In order to get off NIS, I did an upgradeable ldap->master.passwd build script system. It's not instantly obvious what is happening when you look at it, but:

One worked example might be in order.

admin# crontab -l -u root
MAILTO=clusteradm@freebsd.org
*/10 * * * *    /usr/sbin/daemon -cf /usr/bin/lockf -s -t 0 /var/run/ldap-client.lock /etc/ldap-client/update-admin-cron.sh

admin# cat /etc/ldap-client/update-admin-cron.sh 
#! /bin/sh
# */10 * * * *    /usr/sbin/daemon -cf /usr/bin/lockf -s -t 0 /var/run/ldap-client.lock /etc/ldap-client/update-admin-cron.sh
/etc/ldap-client/randwait.pl 180
/etc/ldap-client/update-admin.sh 2>&1 | /etc/ldap-client/maybemail.pl -d freebsd.org -s "`/bin/hostname` - $0" peter@freebsd.org

admin# cat /etc/ldap-client/update-admin.sh 
#! /bin/sh
cd /etc/ldap-client && /usr/bin/cvs -Rq up -d -P -C
/etc/ldap-client/make_masterpasswd.pl -o adminAccount -s adminShell -q
/etc/ldap-client/make_sshkeys.pl -o adminAccount -k adminPublicKey -q
/etc/ldap-client/make_group.pl -q
/etc/ldap-client/make_k5login.pl -o adminAccount -q

The general flow:

The scripts do their best to merge with local changes. Except for things that are in ldap. eg: if there is a local user called "peter", and one in ldap, it will remove the local user and install the ldap one instead. This means you CAN just build/install ports that install local ports users.

The scripts DO interact correctly with useradd/vipw/etc. All locking conventions are maintained. You can still vipw.

So far, this should be easy enough. Where it gets complex is deciding what accounts to put on a machine, and which ssh keys to use.

There are three filtering / access control systems.

ldap accounts are tagged with "objectClass".

ldap accounts have a "loginShell".

The third access filter is ssh shell selection.

With these basic rules I was able to implement all the one-off hacks we had done with NIS. Its not pretty, but it works so far.

Some examples:

I expect this will need refining. I want to add signature checking for updates, etc. Lots todo, but we are off NIS.

Teams/clusteradm/ldap_access_control (last edited 2012-10-15 17:12:05 by PeterWemm)