Jump to content

Fundraising/techops/procedures/services-kerberos new replica setup

From Wikitech

Services: Kerberos New KDC Replica Setup=

Here are the steps to add a new Kerberos host into the replication chain. Host auth1 and auth2 refer to the primary and secondary auth servers, respectively. This document assumes puppet has already run and configured krb5-kdc.

First, create a host key and export a keytab for new Kerberos replica host

  • On Origin:
root@auth1:~# kadmin.local -q "addprinc -randkey host/auth2.frack.codfw.wmnet@WMF-FUNDRAISING"
root@auth1:~# kadmin.local -q "ktadd -k /root/puppet.keytab host/auth2.frack.codfw.wmnet@WMF-FUNDRAISING"

Next we need to copy the keytab and stash to the new host that is being set up.

The keytab file:

  • On Replica:
root@auth2:~# cd /etc
root@auth2:# nc -l -p 88 | tar xvBpf -
root@auth2:/etc# sha256sum krb5.keytab
  • On Origin:
root@auth1:~# cd /etc
root@auth1:/etc# tar cvBpf - krb5.keytab | nc -q 100 auth1 88
root@auth1:/etc# sha256sum krb5.keytab

The stash file:

  • On Replica:
root@auth2:~# cd /etc/krb5kdc
root@auth2:/etc/krb5kdc# nc -l -p 88 | tar xvBpf -
root@auth2:/etc/krb5kdc# sha256sum stash
  • On Origin:
root@auth1:~# cd /etc/krb5kdc
root@auth1:/etc/krb5kdc# tar cvBpf - stash | nc -q 100 auth1 88
root@auth1:/etc/krb5kdc# sha256sum stash

Then we can run the krb5_propagate script to do the regular propagation.

  • On Origin:
root@auth2:~# /usr/local/bin/krb5_propagate

You should now be able to start the kdc admin processes on the replica.

  • On Replica:
root@auth2:~# sudo systemctl restart krb5-kdc.service
root@auth2:~# kadmin.local -q "list_principals"