NIS Automount

Goal

Suppose we have the following entries in /etc/auto.master:

/misc /etc/auto.misc --timeout=60
/home /etc/auto.home --timeout=60

following entry in /etc/auto.misc:

cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom

and the following entry in /etc/auto.home:

* server:/export/home/&

We want to convert them into the following LDAP entries in Penrose:

dn: ou=auto.master,dc=NIS,dc=Example,dc=com
objectClass: automountMap
ou: auto.master

dn: cn=/misc,ou=auto.master,dc=NIS,dc=Example,dc=com
objectClass: automount
automountInformation: ldap:ou=auto.misc,dc=NIS,dc=Example,dc=com
cn: /misc

dn: cn=/home,ou=auto.master,dc=NIS,dc=Example,dc=com
objectClass: automount
automountInformation: ldap:ou=auto.home,dc=NIS,dc=Example,dc=com
cn: /home

dn: ou=auto.misc,dc=NIS,dc=Example,dc=com
objectClass: automountMap
ou: auto.misc

dn: cn=cd,ou=auto.misc,dc=NIS,dc=Example,dc=com
objectClass: automount
automountInformation: -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
cn: cd

dn: ou=auto.home,dc=NIS,dc=Example,dc=com
objectClass: automountMap
ou: auto.home

dn: cn=*,ou=auto.home,dc=NIS,dc=Example,dc=com
objectClass: automount
automountInformation: server:/export/home/&
cn: *

Solution

First we create the source for auto.master:

<source name="auto_master">
    <connection-name>NIS</connection-name>
    <field name="cn" primaryKey="true"/>
    <field name="automountInformation"/>
    <field name="description"/>
    <parameter>
      <param-name>objectClasses</param-name>
      <param-value>automount</param-value>
    </parameter>
    <parameter>
      <param-name>base</param-name>
      <param-value>system/auto.master</param-value>
    </parameter>
    <parameter>
      <param-name>scope</param-name>
      <param-value>ONELEVEL</param-value>
    </parameter>
</source>

Create the same sources for auto.misc and auto.home.

Then create the mapping:

<entry dn="ou=auto.master,dc=NIS,dc=Example,dc=com">
    <oc>automountMap</oc>
    <at name="ou" rdn="true">
      <constant>auto.master</constant>
    </at>
    <at name="automountMapName">
      <constant>auto.master</constant>
    </at>
</entry>

<entry dn="cn=...,ou=auto.master,dc=NIS,dc=Example,dc=com">
    <oc>automount</oc>
    <at name="cn" rdn="true">
      <variable>a.cn</variable>
    </at>
    <at name="automountKey">
      <variable>a.cn</variable>
    </at>
    <at name="automountInformation">
      <variable>a.automountInformation</variable>
    </at>
    <at name="description">
      <variable>a.description</variable>
    </at>
    <source name="a">
      <source-name>auto_master</source-name>
      <field name="cn">
        <variable>cn</variable>
      </field>
      <field name="automountInformation">
        <variable>automountInformation</variable>
      </field>
      <field name="description">
        <variable>description</variable>
      </field>
    </source>
</entry>

Create the same mappings for auto.misc and auto.home.

References