NIS Hosts
Goal
We want to map the following entry in /etc/hosts:
192.168.1.10 www.example.com www
into the following LDAP entry in Penrose:
dn: cn=www.example.com,ou=Hosts,dc=NIS,dc=Example,dc=com objectClass: device objectClass: ipHost ipHostNumber: 192.168.1.10 cn: www.example.com cn: www
Solution
First we create the source:
<source name="hosts"> <connection-name>NIS</connection-name> <field name="cn" primaryKey="true"/> <field name="ipHostNumber"/> <parameter> <param-name>objectClasses</param-name> <param-value>ipHost</param-value> </parameter> <parameter> <param-name>base</param-name> <param-value>system/hosts.byname</param-value> </parameter> <parameter> <param-name>scope</param-name> <param-value>ONELEVEL</param-value> </parameter> </source>
Then we create the mapping:
<entry dn="cn=...,ou=Hosts,dc=NIS,dc=Example,dc=com"> <oc>device</oc> <oc>ipHost</oc> <at name="cn" rdn="true"> <variable>h.primaryKey.cn</variable> </at> <at name="cn"> <variable>h.cn</variable> </at> <at name="ipHostNumber"> <variable>h.ipHostNumber</variable> </at> <source name="h"> <source-name>hosts</source-name> <field name="cn" primaryKey="true"> <variable>rdn.cn</variable> </field> <field name="cn"> <variable>cn</variable> </field> <field name="ipHostNumber"> <variable>ipHostNumber</variable> </field> </source> </entry>