This goes through setting up Kerberos and LDAP for account management. Kerberos stores the passwords, LDAP stores the account information.
This was done on CentOS 5.6, but probably is portable elsewhere.
See kerberos kdc for more detailed instructions.
yum install krb5-libs krb5-workstation pam_krb5 cyrus-sasl-gssapi.x86_64 openldap-clients krb5-server
/etc/krb5.conf
/var/kerberos/krb5kdc/kdc.conf
/var/kerberos/krb5kdc/kadm5.acl
# kdb5_util create -s
# kadmin.local -q "addprinc root/admin"
# chkconfig kadmin on # service kadmin start # chkconfig krb5kdc on # service krb5kdc start
# chkconfig iptables off # chkconfig ip6tables off # service iptables stop # service ip6tables stop
# kadmin Authenticating as principal root/admin@THOUGHTBIT.COM with password. Password for root/admin@THOUGHTBIT.COM: kadmin: listprincs K/M@THOUGHTBIT.COM kadmin/admin@THOUGHTBIT.COM kadmin/changepw@THOUGHTBIT.COM kadmin/history@THOUGHTBIT.COM kadmin/kdc.thoughtbit.com@THOUGHTBIT.COM krbtgt/THOUGHTBIT.COM@THOUGHTBIT.COM root/admin@THOUGHTBIT.COM
kadmin: addprinc -randkey host/kdc.thoughtbit.com NOTICE: no policy specified for host/kdc.thoughtbit.com@THOUGHTBIT.COM; assigning "default" Principal "host/kdc.thoughtbit.com@THOUGHTBIT.COM" created. kadmin: ktadd host/kdc.thoughtbit.com
# kadmin kadmin: addprinc john
yum install krb5-libs krb5-workstation pam_krb5 cyrus-sasl-gssapi.x86_64 openldap-clients openldap-servers
/etc/krb5.conf
from the KDC# kadmin Authenticating as principal root/admin@THOUGHTBIT.COM with password. Password for root/admin@THOUGHTBIT.COM: kadmin: addprinc -randkey host/ldap-master.thoughtbit.com NOTICE: no policy specified for host/ldap-master.thoughtbit.com@THOUGHTBIT.COM; assigning "default" Principal "host/ldap-master.thoughtbit.com@THOUGHTBIT.COM" created kadmin: ktadd host/ldap-master.thoughtbit.com ... kadmin: addprinc -randkey ldap/ldap-master.thoughtbit.com NOTICE: no policy specified for ldap/ldap-master.thoughtbit.com@THOUGHTBIT.COM; assigning "default" Principal "ldap/ldap-master.thoughtbit.com@THOUGHTBIT.COM" created kadmin: ktadd -k /etc/openldap/ldap.keytab ldap/ldap-master.thoughtbit.com ...
ldap
user own the ldap.keytab
slapd
aware of the ldap key: # echo "export KRB5_KTNAME=/etc/openldap/ldap.keytab" >> /etc/sysconfig/ldap
/etc/openldap/slapd.conf
rootpw
which can be generated by the slappasswd
command/etc/ldap.conf
and /etc/openldap/ldap.conf
/var/lib/ldap/DB_CONFIG
(example can be found at /etc/openldap/DB_CONFIG.example
)# chkconfig ldap on # service start ldap
ldapadd -x -D "cn=Manager,dc=thoughtbit,dc=com" -W -f example.ldif
ldapsearch -x -b 'dc=thoughtbit,dc=com' '(uid=john)'
# cat /usr/lib64/sasl2/slapd.conf auxprop_plugin: slapd mech_list: gssapi external
testsaslauthd
: <code># kinit -k (to get a host princ)
# testsaslauthd -u USER -p PASSWORD</code>slurpd needs a ticket cache setup with the principal that slurpd will use to authenticate to the replica with (defined in the updatedn)
# kadmin ... kadmin: addprinc -randkey slurpd/ldap-master.thoughtbit.com ... kadmin: ktadd -k /etc/openldap/slurpd.keytab slurpd/ldap-master.thoughtbit.com ... kadmin: q # chown ldap:ldap /etc/openldap/slurpd.keytab
# cat /etc/cron.d/ldap # ldap kinit crontab # 24 1,13 * * * ldap /usr/kerberos/bin/kinit -fpk -t /etc/openldap/slurpd.keytab -c /tmp/slurpd.krb5cache slurpd/ldap-master.thoughtbit.com
slurpd
daemon aware of the ticket cache. Add the following to /etc/sysconfig/ldap
: SLURPD_KRB5CCNAME=/tmp/slurpd.krb5cache
slapd.conf
on master contains replica connection info: # Replicas of this database replogfile /var/lib/ldap/openldap-master-replog replica uri=ldap://ldap-replica.thoughtbit.com bindmethod=sasl saslmech=GSSAPI authcId=slurpd/ldap-master.thoughtbit.com
slapd.conf
on replica has updatedn and acls: # add something similar to the following for your ACLs access to * by dn.regex="uid=slurpd/.*,cn=GSSAPI,cn=auth" write # replication info updatedn uid=slurpd/ldap-master.thoughtbit.com,cn=gssapi,cn=auth updateref ldap://ldap-master.thoughtbit.com
slapcat -l /tmp/replication-log.ldif
slapadd -l /tmp/replication-log.ldif
SLAPD_OPTIONS=“-d 1”
to /etc/sysconfig/ldap
for debugging on the replica)Client configurations.
yum install krb5-libs krb5-workstation pam_krb5 cyrus-sasl-gssapi.x86_64 openldap-clients
/etc/krb5.conf
/etc/ldap.conf
/etc/openldap/ldap.conf
/etc/pam.d/system-auth
(adding in kerb stuff)/etc/nsswitch.conf
/etc/security/access.conf
# id john uid=501(john) gid=501(media) groups=501(media)
klist
and ldapwhoami