| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | <H1 align=center>LDAP to DNS gateway</H1> | 
					
						
							|  |  |  | <P> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <B>ldap2dns</B> is a program to create DNS (Domain Name Service) records directly | 
					
						
							|  |  |  | from a LDAP directory.  It can and should be be used to replace the secondary | 
					
						
							|  |  |  | name-server by a second primary one.<BR> | 
					
						
							|  |  |  | <B>ldap2dns</B> reduces all kind of administration overhead: | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | No more flat file editing, no more zone file editing. After having installed | 
					
						
							|  |  |  | <B>ldap2dns</B>, the administrator only has to access the LDAP directory.<BR> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | Optionally she can add access control for each zone, create a GUI | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | and add all other kind of zone and resource record information without | 
					
						
							|  |  |  | interfering with the DNS server.<BR> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <B>ldap2dns</B> is designed to write ASCII data files used by <I>tinydns</I> | 
					
						
							|  |  |  | from the <I>djbdns</I> package, but also may be used to write .db-files used | 
					
						
							|  |  |  | by <I>named</I> as found in the <I>BIND</I> package.<BR> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | <P> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <H3>1. Introduction</H3> | 
					
						
							|  |  |  | Often it is desirable to store DNS information in a database rather than | 
					
						
							|  |  |  | in flat text files. This can greatly help to reduce administration overhead | 
					
						
							|  |  |  | since associate information such as billing contact, account management, etc. | 
					
						
							|  |  |  | can be stored and processed inside the same database. Also due to the nature of | 
					
						
							|  |  |  | DNS, information must be stored redundantly on two or more hosts.  | 
					
						
							|  |  |  | The classical data replication through zone transfer is unreliable, insecure | 
					
						
							|  |  |  | and difficult to administer.<BR> | 
					
						
							|  |  |  | To solve this problem some proprietary attempts have been proposed to | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | store DNS information in relational databases. The nature of DNS, however, | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | is hierarchical and such should the database be. Using a relational database | 
					
						
							|  |  |  | to store DNS information is undesirable, because it becomes difficult | 
					
						
							|  |  |  | to store free form information. Within a hierachical data scheme, the | 
					
						
							|  |  |  | administrator might define more than one IP-address for each canonical name. | 
					
						
							|  |  |  | To implement such a feature in a relational database without breaking the  | 
					
						
							|  |  |  | normalization rules, one would have to add another table.<BR> | 
					
						
							|  |  |  | One of the most widely spread hierarchical database protocols is LDAP. | 
					
						
							|  |  |  | <B>ldap2dns</B> retrieves DNS information stored in an LDAP directory service | 
					
						
							|  |  |  | and generates a file suitable for name-servers.<BR> | 
					
						
							|  |  |  | Actually the most widely spread name-servers | 
					
						
							|  |  |  | <A HREF="http://www.isc.org/products/BIND/">named</A> and | 
					
						
							|  |  |  | <A HREF="http://cr.yp.to/djbdns/tinydns.html">tinydns</A> are | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | supported. <B>ldap2dns</B> specially has been designed to work with  | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | tinydns and is the favored name server daemon for the author of this program.  | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <B>ldap2dns</B> can also generate files suitable for <I>named</I> version 8, | 
					
						
							|  |  |  | but this feature is not well supported. | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | There is a  | 
					
						
							|  |  |  | <A HREF="http://www.alternic.org/drafts/drafts-m-n/draft-miller-dns-ldap-schema-00.txt"> | 
					
						
							|  |  |  | RFC</A> for a format description how to store DNS information in LDAP.  | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | This paper a draft RFC which expired in February 1999, looks as if it has been  | 
					
						
							|  |  |  | specially designed to be used by <I>named</I>. This scheme | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | does not have strict attribute-value-pair mapping, making it difficult to be used by | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | user interfaces. It also lacks of an implementation (or I have never heard of any).<BR> | 
					
						
							|  |  |  | Since <I>tinydns</I> is going another descriptive way. Therefore I implemented a similar | 
					
						
							|  |  |  | object-scheme more suitable for <I>tinydns</I>. Two object-classes have been defined.  | 
					
						
							|  |  |  | <B>DNSzone</B> stores all the information to define a DNS zone, such as the SOA  | 
					
						
							|  |  |  | (Start Of Authority), serial numbers etc. <B>DNSrrset</B> is used to store the information  | 
					
						
							|  |  |  | for a single resource record, such as the domain name, IP-addresses, class and type.<BR> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | Here are the tables: | 
					
						
							|  |  |  | <P> | 
					
						
							|  |  |  | <H4>DNSzone</H4> | 
					
						
							|  |  |  | This object-class represents a DNS zone. It is the container for all the resource records | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | within a zone. Zones can be primary or secondary. If used in conjunction with | 
					
						
							|  |  |  | <I>tinydns</I> zones are always primary. Secondary zones don't make sense anyway! | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | In addition to being a container, the zone object has attributes related to | 
					
						
							|  |  |  | the management of the zone. These include the zone's SOA information. Each zone-object | 
					
						
							|  |  |  | can have none to many children of class <B>DNSrrset</B>.<BR> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <TABLE bgcolor=#EEEEEE> | 
					
						
							|  |  |  | <TR><TH>ATTRIBUTE</TH><TH>VALUE</TH><TH>Comment</TH></TR> | 
					
						
							|  |  |  | <TR><TD>objectclass</TD><TD>DNSzone</TD><TD>required</TD></TR> | 
					
						
							|  |  |  | <TR><TD>cn</TD><TD><I>common name</I></TD><TD>required</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSzonename</TD><TD><I>Name of the zone</I></TD><TD>required, multivalued</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSserial</TD><TD><I>Serial number of SOA</I></TD><TD>optional</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSrefresh</TD><TD><I>Refresh time of SOA</I></TD><TD>optional, only used for zone transfers</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSretry</TD><TD><I>Retry time of SOA</I></TD><TD>optional, only used for zone transfers</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSexpire</TD><TD><I>Expire time of SOA</I></TD><TD>optional, only used for zone transfers</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSminimum</TD><TD><I>Minimum time to live</I></TD><TD>optional, only used for zone transfers</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSadminmailbox</TD><TD><I>Hostmaster's contact address</I></TD><TD>optional</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSzonemaster</TD><TD><I>Primary nameserver for this zone</I></TD><TD>optional</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNStype</TD><TD>SOA</TD><TD>must be SOA</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSclass</TD><TD>IN</TD><TD>must be IN</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSttl</TD><TD><I>time to live</I></TD><TD>optional, only used with tinydns</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNStimestamp</TD><TD><I>timestamp</I></TD><TD>optional, only used with tinydns</TD></TR> | 
					
						
							|  |  |  | </TABLE> | 
					
						
							|  |  |  | <UL> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <LI><B>DNSzonename:</B> This field is required to describe the zone's domain name, for instance | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | myorg.com. More than one <B>DNSzonename</B> my be specified for a <B>DNSzone</B> so that the | 
					
						
							|  |  |  | same host is accessable with different zonenames.</LI> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <LI><B>DNSserial:</B> This is the serial number as used for BIND's zone transfers. Here it is | 
					
						
							|  |  |  | used to inform <B>ldap2dns</B> that it has to rebuild its data-file. Without increasing the serial | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | number <B>ldap2dns</B> will ignore all modifications until it is restarted.</LI> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | <LI><B>DNSrefresh, DNSretry, DNSexpire, DNSminimum:</B> You may safly ignore these numbers | 
					
						
							|  |  |  | if You don't do zone-transfers. Since Your secondary nameserver will connect to the LDAP | 
					
						
							|  |  |  | server the same way Your primary does, You don't need zone-transfers anyway.</LI> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <LI><B>DNSzonemaster:</B> Here you specify the canonical name of your primary nameserver.</LI> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | <LI><B>DNSadminmailbox:</B> This is the contact address of Your DNS-administrator. The first dot | 
					
						
							|  |  |  | is converted to a <I>@</I>.</LI> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <LI><B>DNStype:</B> Must be <B>SOA</B> (Start Of Authority)</LI> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <LI><B>DNSclass:</B> Must be <B>IN</B> (Internet, or do still use Chaosnet?)</LI> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | <LI><B>DNSttl:</B> This is the time-to-live value as used by <B>tinydns</B>. | 
					
						
							|  |  |  | If TTL is nonzero (or omitted), the timestamp is a starting time from whereon this zone's | 
					
						
							|  |  |  | information is valid. If TTL is zero, the timestamp is an ending time (``time to die'').</LI>  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <LI><B>DNStimestamp:</B> This is the timestamp as used by <B>tinydns</B>. It represents a | 
					
						
							|  |  |  | string as external TAI64 timestamp, printed as 16 lowercase hexadecimal characters</LI> | 
					
						
							|  |  |  | </UL> | 
					
						
							|  |  |  | <P> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <H4>DNSrrset</H4> | 
					
						
							|  |  |  | The Resource Record Set represents all of the resource records for | 
					
						
							|  |  |  | a given host name within a zone. It must be a child of a DNSzone object.<BR> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <TABLE bgcolor=#EEEEEE> | 
					
						
							|  |  |  | <TR><TH>ATTRIBUTE</TH><TH>VALUE</TH><TH>Comment</TH></TR> | 
					
						
							|  |  |  | <TR><TD>objectclass</TD><TD>DNSrrset</TD><TD>required</TD></TR> | 
					
						
							|  |  |  | <TR><TD>cn</TD><TD><I>common name</I></TD><TD>required</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSdomainname</TD><TD><I>Name of this record</I></TD><TD>optional, relative to zonename</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSipaddr</TD><TD><I>IP address</I></TD><TD>optional, mutivalued</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNScname</TD><TD><I>Canonical name</I></TD><TD>optional, without ending dot relative to zonename</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSpreference</TD><TD><I>integer</I></TD><TD>optional, only used for MX records</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNStype</TD><TD>A, CNAME, NS, MX, PTR or TXT</TD><TD>must be any valid record type</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSclass</TD><TD>IN</TD><TD>must be IN</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNSttl</TD><TD><I>time to live</I></TD><TD>optional, only used with tinydns</TD></TR> | 
					
						
							|  |  |  | <TR><TD>DNStimestamp</TD><TD><I>timestamp</I></TD><TD>optional, only used with tinydns</TD></TR> | 
					
						
							|  |  |  | </TABLE> | 
					
						
							|  |  |  | <P> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <UL> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <LI><B>DNSrrset:</B> This object-class must be a direct child of DNSzone. Its <B>dn</B> should be  | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | specified as <PRE>cn=<I>domainname</I>,cn=<I>zonename</I>,...</PRE></LI> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <LI><B>DNSdomainname</B> This is the partial domain-name, ie. the part in front of the | 
					
						
							|  |  |  | zone-name.</LI> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | <LI><B>DNSipaddr:</B> This specifies the IP-address in dotted format. It can be used for <B>DNSrrset</B>'s | 
					
						
							|  |  |  | of type <B>A, NS, MX</B> or <B>PTR</B>. <B>DNSipaddr</B> is multivalued to specifiy more than one | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | IP-address for a service. If used in <B>DNSrrset</B>'s with <B>DNStype</B> = <B>PTR</B> it | 
					
						
							|  |  |  | overrides the old-fashioned form used in <B>DNSdomainname</B> such as 13.178.23.in-addr.arpa | 
					
						
							|  |  |  | for reverse lookups.</LI> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <LI><B>DNScname:</B> Whenever there is a mapping of a domain-name to a canonical name, use | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | this attribute. <B>DNScname</B> may be used for <B>DNSrrset</B>'s with <B>DNStype CNAME, | 
					
						
							|  |  |  | NS, MX, PTR or TXT</B>. If the last character of a CNAME is a dot its name is considered | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | absolute. If it does not contain a dot, its name is prepended to the zone-name.</LI> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | <LI><B>DNSpreference:</B> This number is the mail-exchange preference as used by BIND.</LI> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <LI><B>DNStype:</B> This must be <B>A, CNAME, NS, MX, PTR</B> or <B>TXT</B>. It specifies | 
					
						
							|  |  |  | the DNSrrset type.</LI> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <LI><B>DNSclass:</B> Must be <B>IN</B></LI> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | <LI><B>DNSttl:</B> This is the time-to-live value as used by <B>tinydns</B>. | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | If TTL is non-zero (or omitted), the time-stamp is a starting time from where-on this zone's | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | information is valid. If TTL is zero, the timestamp is an ending time (``time to die'').</LI>  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <LI><B>DNStimestamp:</B> This is the timestamp as used by <B>tinydns</B>. It represents a | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | string as external TAI64 time-stamp, printed as 16 lowercase hexadecimal characters</LI> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | </UL> | 
					
						
							|  |  |  | <P> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <H3>2. Installation</H3> | 
					
						
							|  |  |  | <UL> | 
					
						
							|  |  |  | <LI>Install an LDAP server such as <A HREF="www.openldap.org">openldap</A>. Other | 
					
						
							|  |  |  | LDAP implementations may work but have not been tested. Also install the | 
					
						
							|  |  |  | development libraries and include files.</LI> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <LI>Install <A HREF="http://cr.yp.to/djbdns.html">djbdns</A> or if you really | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | have to, go with BIND.<BR> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | I suggest to install <I>tinydns</I> included in the <B>djbdns</B> package, because it is | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | safer, but You may have reasons why You want to use BIND.</LI> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <LI>Install <B>ldap2dns</B><BR> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | Unpack the package and build it: | 
					
						
							|  |  |  | <PRE> | 
					
						
							|  |  |  | gzcat ldap2dns.tar.gz | tar x | 
					
						
							|  |  |  | cd ldap2dns-version | 
					
						
							|  |  |  | make | 
					
						
							|  |  |  | make install | 
					
						
							|  |  |  | </PRE> | 
					
						
							|  |  |  | If you run <B>ldap2dns</B> togther with tinydns, go into | 
					
						
							|  |  |  | /var/tinydns and run ldap2tinydns-conf. | 
					
						
							|  |  |  | </LI> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <LI>Add the extra object-classes to the slapd.conf file. | 
					
						
							|  |  |  | If You are using openldap-1.2.x:<BR> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | copy the files dns.oc.conf and dns.ac.conf into the directory /etc/openldap or | 
					
						
							|  |  |  | appropriate and add the following two lines to Your slapd.conf file:<BR> | 
					
						
							|  |  |  | <PRE> | 
					
						
							|  |  |  | include         /etc/openldap/dns.at.conf | 
					
						
							|  |  |  | include         /etc/openldap/dns.oc.conf | 
					
						
							|  |  |  | </PRE> | 
					
						
							|  |  |  | or, if You are using openldap-2.0.x:<BR> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:26:14 +00:00
										 |  |  | copy the file dns.schema-2.0 into the directory /etc/openldap/schema | 
					
						
							|  |  |  | and rename it to dns.schema. | 
					
						
							|  |  |  | If You are using openldap-2.2.x:<BR> | 
					
						
							|  |  |  | copy the file dns.schema-2.2 into the directory /etc/openldap/schema | 
					
						
							|  |  |  | and rename it to dns.schema. | 
					
						
							|  |  |  | Add the following line to Your slapd.conf file:<BR> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | <PRE> | 
					
						
							|  |  |  | include         /etc/openldap/schema/dns.schema | 
					
						
							|  |  |  | </PRE> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | Now restart your LDAP server.</LI> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | <P> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <LI>Start to populate your LDAP server with DNS information. As a first test do | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | <PRE> | 
					
						
							|  |  |  | $ ldapadd -D "<I>binddn</I>" -w <I>password</I> < example.ldif | 
					
						
							|  |  |  | </PRE> | 
					
						
							|  |  |  | Replace 'myorg' and 'binddn' with whatever is appropriate on Your system. | 
					
						
							|  |  |  | Start a search and see if something was added | 
					
						
							|  |  |  | <PRE> | 
					
						
							|  |  |  | $ ldapsearch -D "<I>binddn</I>" "objectclass=dnsrrset" </LI> | 
					
						
							|  |  |  | </PRE> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <LI>Test <B>ldap2dns</B> | 
					
						
							|  |  |  | <PRE> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | $ ./ldap2dns -D "<I>binddn</I>" [ -b "<I>searchbase</I>" ] [ -w <I>passwd</I> ] -o data -o db -L | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | </PRE> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | This should create a 'data' file, a 'corp.local.db' file and should print the | 
					
						
							|  |  |  | DNS content.<BR> | 
					
						
							|  |  |  | Note: The <I>data</I> file is text data which can be processed with <B>tinydns-data</B>. | 
					
						
							|  |  |  | <I>corp.local.db</I> is the file as used by <B>named</B>. If You are using bind, You also | 
					
						
							|  |  |  | have to adopt the file <I>/etc/named.conf</I> and You have to restart named.</LI> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | </UL> | 
					
						
							|  |  |  | <P> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <H3>3. Running ldap2dns</H3> | 
					
						
							|  |  |  | If You are a tinydns user, run <B>ldap2dns</B> in /services/tinydns/root.<BR> | 
					
						
							|  |  |  | If You are an openldap user, the command line switches are the same as for ldapsearch | 
					
						
							|  |  |  | or ldapadd. | 
					
						
							|  |  |  | <PRE> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | $ ldap2dns -D "<I>binddn</I>" [ -w <I>passwd</I> ] -b "<I>searchbase</I>" -o data -e "cd /var/tinydns/root && /usr/bin/tinydns-data" | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | </PRE> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | This generates a data file which is converted into a data.cdb by tinydns-data as | 
					
						
							|  |  |  | soon as ldap2dns detects a modification in the LDAP directory.  | 
					
						
							|  |  |  | The password is required if You restrict read queries to authenticated users only.  | 
					
						
							|  |  |  | Test with  | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | <PRE> | 
					
						
							|  |  |  | $ dnsq any corp.local <I>ipaddr</I> | 
					
						
							|  |  |  | </PRE> | 
					
						
							|  |  |  | Replace <I>ipaddr</I> with whatever You configured tinydns to listen to. | 
					
						
							|  |  |  | <P> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | If You are a BIND user, run <B>ldap2dns</B> in /var/named with | 
					
						
							|  |  |  | <PRE> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | $ ldap2dns -D "<I>binddn</I>" -w <I>passwd</I> -b "<I>searchbase</I>" -o db -e "kill -HUP `cat /var/run/named-pid`" | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | </PRE> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | Do not forget to add You primary definition to Your named.boot file. | 
					
						
							|  |  |  | Your named should be restarted automatically as soon as ldap2dns detects a modification | 
					
						
							|  |  |  | in the LDAP directory. If bind is not restarted, do so with | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | <PRE> | 
					
						
							|  |  |  | # kill -HUP <I>PID</I> | 
					
						
							|  |  |  | </PRE> | 
					
						
							|  |  |  | Now run  | 
					
						
							|  |  |  | <PRE> | 
					
						
							|  |  |  | $ nslookup - localhost | 
					
						
							|  |  |  | > ns1.corp.local | 
					
						
							|  |  |  | </PRE> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | Note that <B>nslookup</B> only works with <B>tinydns</B> if Your nameserver resolves its IP-address | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | backwards. | 
					
						
							|  |  |  | <P> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <H3>4. Running ldap2dnsd</H3> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <B>ldap2dnsd</B> is a hard link onto <B>ldap2dns</B>. If invoked, the program | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | starts as backgound-daemon and contineously checks for modifications in the LDAP directory. | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | If the the daemon sees a modification in the <B>DNSserial</B> numbers it updates the data | 
					
						
							|  |  |  | or .db files, depending what kind of output was configured. This check is done about once | 
					
						
							|  |  |  | a minute.<BR> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | The command-line options for <B>ldap2dnsd</B> are the same as for <B>ldap2dns</B>. | 
					
						
							|  |  |  | Use the -u option to modify the update intervall. You may also use -u on <B>ldap2dns</B> | 
					
						
							|  |  |  | to start as a foreground daemon. This is useful if You want to run <B>ldap2dns</B> from | 
					
						
							|  |  |  | <A HREF="http://cr.yp.to/daemontools.html">daemontools</A>. To do this run <B>ldap2tinydns-conf</B> | 
					
						
							|  |  |  | in /service/tinydns and link /service/ldap2dns onto /service/tinydns/ldap2dns. | 
					
						
							|  |  |  | <PRE> | 
					
						
							|  |  |  | # ln -s /service/tinydns/ldap2dns /service/ldap2dns | 
					
						
							|  |  |  | </PRE> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | After a few seconds <B>daemontools</B> starts <B>ldap2dns</B> which itself generates data | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | files whenever a modification is commited into the LDAP directory.  | 
					
						
							|  |  |  | <P> | 
					
						
							|  |  |  | <B>ldap2dns</B> and <B>ldap2dnsd</B> recognize the following options: | 
					
						
							|  |  |  | <PRE> | 
					
						
							|  |  |  | -D <I>binddn</I> specify the distinguished name to bind to the LDAP directory | 
					
						
							|  |  |  | -w <I>bindpasswd</I> use bindpasswd as the password for simple authentication | 
					
						
							|  |  |  | -b <I>searchbase</I> use searchbase as the starting point for the search instead of the default | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | -o Generate a "data" file to be processed by tinydns-data.  | 
					
						
							|  |  |  | -o db	For each zone generate a "<zonename>.db" file to be used by named. | 
					
						
							|  |  |  | -L[<I>filename</I>] print output in LDIF format for reimport. If no filename is specified output goes to stdout.  | 
					
						
							|  |  |  | -h <I>host</I> specify the hostname of LDAP directory. Default is localhost. | 
					
						
							|  |  |  | -p <I>port</I> portnumber to connect to LDAP directory. Defaults is 389 | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | -v run in verbose mode | 
					
						
							|  |  |  | -vv even more verbose | 
					
						
							|  |  |  | -V print version and exit | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | -u <I>numsecs</I> update DNS data every numsecs. | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | </PRE> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | <B>ldap2dns</B> and <B>ldap2dnsd</B> recognizes the following environement variables:<BR> | 
					
						
							|  |  |  | <B>TINYDNSDIR</B>: Specifies the directory where ldap2dns writes its data file.<BR> | 
					
						
							|  |  |  | <B>LDAP2DNS_UPDATE</B>: Specifies the update intervall as the -u command line option would.<BR> | 
					
						
							|  |  |  | <B>LDAP2DNS_OUTPUT</B>: Specifies the default output, as the -o command line option would. | 
					
						
							|  |  |  | <P> | 
					
						
							|  |  |  | <B>ldap2dns</B> and <B>ldap2dnsd</B> use the following parameters from /etc/ldap.conf if not | 
					
						
							|  |  |  | specified on the command line: | 
					
						
							|  |  |  | <B>BASE</B>: The LDAP search base.<BR> | 
					
						
							|  |  |  | <B>HOST</B>: The LDAP server.<BR> | 
					
						
							|  |  |  | <B>PORT</B>: The LDAP port. | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | <P> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <H3>5. Importing DNS data from Your named</H3> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | A perl-script <I>import.pl</I> is contained in this package. Edit the first | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | lines of the script to conform to Your configuration. | 
					
						
							|  |  |  | If You have installed the Perl packages Net::LDAP and Net::DNS | 
					
						
							|  |  |  | skip the following lines, otherwise do | 
					
						
							|  |  |  | <PRE> | 
					
						
							|  |  |  | # perl -MCPAN -e 'shell' | 
					
						
							|  |  |  | (...snip...) | 
					
						
							|  |  |  | > install Net::DNS | 
					
						
							|  |  |  | > install Net::LDAP | 
					
						
							|  |  |  | </PRE> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | Now check that Your nameserver allows zone transfers to your host and run the import script: | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | <PRE> | 
					
						
							|  |  |  | $ echo 'primary mydomain.org ' | ./import.pl | 
					
						
							|  |  |  | </PRE> | 
					
						
							|  |  |  | for a single domain or | 
					
						
							|  |  |  | <PRE> | 
					
						
							|  |  |  | # cat named.boot | ./import.pl | 
					
						
							|  |  |  | </PRE> | 
					
						
							|  |  |  | to populate Your LDAP directory. | 
					
						
							|  |  |  | <P> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-02 04:19:49 +00:00
										 |  |  | <H3>6. Coming soon</H3> | 
					
						
							|  |  |  | A browser-based administration toolkit, which connects directly | 
					
						
							| 
									
										
										
										
											2005-12-02 04:21:08 +00:00
										 |  |  | to the LDAP-directory service. <A HREF="ldap2dns/example.html"> | 
					
						
							|  |  |  | Here is a screenshot</A> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:19:49 +00:00
										 |  |  | <P> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <H3>7. To Do</H3> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | <UL> | 
					
						
							|  |  |  | <LI>Write a man page.</LI> | 
					
						
							|  |  |  | <LI>named.conf should be created automatically.</LI> | 
					
						
							|  |  |  | </UL> | 
					
						
							|  |  |  | <P> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-02 04:19:49 +00:00
										 |  |  | <H3>8. Copyright and disclaimer</H3> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | This program is licensed under the GPL version 2 or at Your choice any later | 
					
						
							|  |  |  | version.<BR> | 
					
						
							| 
									
										
										
										
											2005-12-02 04:17:15 +00:00
										 |  |  | It is maintained by <A HREF="mailto:jacob.rief@tiscover.com?subject=ldap2dns">Jacob Rief</A>. | 
					
						
							|  |  |  | If you run <B>ldap2dns</B> on a productive nameserver, please mail me | 
					
						
							|  |  |  | and tell me on what OS and with which nameserver you do so.  | 
					
						
							| 
									
										
										
										
											2005-12-02 04:09:15 +00:00
										 |  |  | 
 |