xcat-core/xCAT/postscripts/joindomain

19 lines
836 B
Plaintext
Raw Normal View History

#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 vs99 -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