xcat-core/xCAT/postscripts/joindomain
2010-08-23 19:41:51 +00:00

19 lines
842 B
Plaintext

#First, set up kerberos, simple enough
DNSDOMAIN=`dnsdomainname`
UPDNSDOMAIN=`echo $DNSDOMAIN|tr a-z A-Z`
LDAPBASEDN=dc=`echo $DNSDOMAIN|sed -e 's/\./,dc=/'`
HOSTPRINC=`hostname`
MYPASS=`dd if=/dev/urandom bs=1024 count=1|md5sum`
authconfig --update --krb5realm=$UPDNSDOMAIN --enablekrb5kdcdns --enablekrb5
(echo $TEMPHOSTPASS;echo $MYPASS;echo $MYPASS)|kpasswd $HOSTPRINC
(echo $MYPASS)|kinit $HOSTPRINC
KVNO=`kvno $HOSTPRINC|awk '{print $NF}'`
(echo add_entry -password -p $HOSTPRINC -k $KVNO -e des;echo $MYPASS;wkt /etc/host.keytab)|ktutil
#ok, time for ldap
LDAPSRV=`host -t SRV _ldap._tcp.$DNSDOMAIN|awk '{print $NF}'`
sed -ie 's/#uri ldap:\/\/127.0.0.1/uri ldap:\/\/$LDAPSRV\//' /etc/nslcd.conf
sed -ie 's/# base dc.*/base $LDAPBASEDN/' /etc/nslcd.conf
authconfig --update --enableldap --ldapserver=$LDAPSRV --ldapbasedn=$LDAPBASEDN