NIS Ethers

Goal

We want to map the following entry from /etc/ethers:

5A:CA:FE:BA:BE:23 www.example.com

into the following LDAP entry in Penrose:

dn: cn=www.example.com,ou=Ethers,dc=NIS,dc=Example,dc=com
objectClass: device
objectClass: ieee802Device
macAddress: 5A:CA:FE:BA:BE:23
cn: www.example.com

Solution

First we create the source:

<source name="ethers">

    <connection-name>NIS</connection-name>

    <field name="cn" primaryKey="true"/>
    <field name="macAddress"/>

    <parameter>
      <param-name>objectClasses</param-name>
      <param-value>ieee802Device</param-value>
    </parameter>
    <parameter>
      <param-name>base</param-name>
      <param-value>system/ethers</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=Ethers,dc=NIS,dc=Example,dc=com">

    <oc>device</oc>
    <oc>ieee802Device</oc>

    <at name="cn" rdn="true">
      <variable>e.cn</variable>
    </at>
    <at name="macAddress">
      <variable>e.macAddress</variable>
    </at>

    <source name="e">
      <source-name>ethers</source-name>
      <field name="cn">
        <variable>cn</variable>
      </field>
      <field name="macAddress">
        <variable>macAddress</variable>
      </field>
    </source>

</entry>