So this is another one of those "oops" posts... it turns out I wasn't quite ready yet to implement a backup LDAP/Kerberos jail. While putting together my plan for implementing the secondary jail I stumbled across a couple of things that had slipped through the cracks that needed tending to.
First up, I forgot to create a group to go along with my firstuser LDAP account. When running any version of
# ls with flags that show ownership, I never looked hard enough to notice that the results were returning without any GID to name translation, e.g.
-rw-r--r-- 1 firstuser 10002 208 Mar 16 20:10 somefile.
- The fix for this was obvious enough - I already created a domainGroup type when setting up the LDAP schema, and I also created ou=groups,dc=mydomain,dc=com to hold all my group info... the stage was set, I just failed to execute.
- I used my handy dandy phpLDAPAdmin instance to create a new firstuser group with GID 10002 using the domainGroup template, and voila! GID to name translation works, and my previous example now returns e.g.
-rw-r--r-- 1 firstuser firstuser 208 Mar 16 20:10 somefile.
- For good measure, I added dn=uid=firstuser,ou=accounts,dc=mydomain,dc=com as a member of the new firstuser group. I'm not sure if I'll ever have any software that reads membership from my directory, but if I do... best to be prepared.
The other item I forgot was to set up entries for my hosts and devices. ou=hosts,dc=mydomain,dc=com was created during LDAP install, but never populated. The core schema has a "device" objectClass that looks pretty good for things like printers and scanners, but for hosts it's not exactly what I want. So, I took a page out of surfrock66's book and rolled my own domainHost objectClass. Some attributes I want simply don't exist at all in the standard public schema, so I created those, too. I've attached the .ldif that extends the schema with my new domainHost type - this is very much personal preference and if you're following along I'd suggest you look carefully at it and make appropriate modifications for your needs. In the attached file, I replaced my OID with XXXXX to anonymize it. Replace with your own OID before attempting to use this... I'm not sure what happens if you have letters instead of numbers, but I'm guessing it'll fail.
- As before, schema additions are made using ldapadd, but I ran into an issue.
- Once LDAP/Kerberos/SASL was set up and working, we had:
mech_list: GSSAPI PLAINas the first line of /usr/local/lib/sasl2/slapd.conf. This was too restrictive, in that it disallows the system root user to LDAP admin translation we took advantage of during setup.
- The fix is to append EXTERNAL to the end of this line... once done, ldapadd worked as expected
# ldapadd -y EXTERNAL -H ldapi:/// -f domainHost.ldif
With the domainHost template installed, I used phpLDAPAdmin to add a host entry for my laptop: cn=laptop1,ou=hosts,dc=mydomain,dc=com. I then deleted the existing host/laptop1 Kerberos pricipal and created a new one:
# kadmin.local
> addprinc -x dn=cn=laptop1,ou=hosts,dc=mydomain,dc=com -randkey host/laptop1.mydomain.com (the -x flag tells kadmin to attach the new principal to the specified LDAP entry, instead of just placing it in the default kerberos subtree of dc=mydomain,dc=com)
> ktadd -k /root/laptop1.keytab host/laptop1.mydomain.com
> exit
This is nit-picking, but I wanted to have Kerberos data stored alongside the LDAP host entries, because OCD. There's nothing I can do about the primary LDAP/Kerberos jail - that key is already in place and I don't know enough to risk breaking everything and having to start from scratch. It'll just stay where it is, untethered to an LDAP domainHost entry. So, now I just copy
/root/laptop1.keytab over to my laptop, renaming it
/etc/krb5.keytab. Lastly, I make sure Kerberos is up to speed on the laptop by running (as root)
# kinit -k -t /etc/krb5.keytab host/laptop1.mydomain.com.
My last little test was to create an LDAP account for my wife, Kerberize it by adding the matching principal, and then log into my laptop with the new network username and password. For a change, it actually worked on the first try! So I have hosts and groups working, I have fully half of the user accounts I'll ever create in place, and I think I'm good...
NOW I'll move on and implement my plan for a backup LDAP/KDC jail.