NIS RPCs

Goal

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

portmapper      100000  portmap sunrpc rpcbind

into the following LDAP entry in Penrose:

dn: cn=portmapper,ou=RPCs,dc=NIS,dc=Example,dc=com
oncRpcNumber: 100000
objectClass: oncRpc
cn: portmapper
cn: portmap
cn: sunrpc
cn: rpcbind

Solution

First we create the source:

<source name="rpcs">

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

    <field name="cn" primaryKey="true"/>
    <field name="oncRpcNumber"/>
    <field name="description"/>

    <parameter>
      <param-name>objectClasses</param-name>
      <param-value>oncRpc</param-value>
    </parameter>
    <parameter>
      <param-name>base</param-name>
      <param-value>system/rpc.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=RPCs,dc=NIS,dc=Example,dc=com">

    <oc>oncRpc</oc>

    <at name="cn" rdn="true">
      <variable>r.primaryKey.cn</variable>
    </at>
    <at name="cn">
      <variable>r.cn</variable>
    </at>
    <at name="oncRpcNumber">
      <variable>r.oncRpcNumber</variable>
    </at>
    <at name="description">
      <variable>r.description</variable>
    </at>

    <source name="r">
      <source-name>rpcs</source-name>
      <field name="cn">
        <variable>cn</variable>
      </field>
      <field name="oncRpcNumber">
        <variable>oncRpcNumber</variable>
      </field>
      <field name="description">
        <variable>description</variable>
      </field>
    </source>

</entry>