Salt forumula to provision Kerberos principals and keytab files securely.
Configure these on your Salt master:
- Add the following reactor:
reactor:
- 'princ/add':
- /srv/PATH/TO/YOUR/keytab/files/react/princ_add.sls
- Add a PillarStack ext_pillar to hold the keytabs (do NOT make this available via the Salt fileserver):
ext_pillar:
- stack: /srv/pillar/keytabs/core.cfg
- Create the PillarStack keytab directory and drop the cfg file in:
mkdir -p /srv/pillar/keytabs/id
/srv/pillar/keytabs/core.cfg:
id/{{ __grains__['id'] }}.yml
-
Add the contents of the keytab/files/_{runners,states,modules} directories to corresponding _runners, _states, or _modules directory within the root of one of your configured file_roots. (There are a few ways to tell Salt how to find custom extensions, check your master config).
-
Configure the "CONFIGURE THESE!" items in _runners/princ.py.
-
Create a keytab file on the salt master with the credentials of the user that will be used to provision principals:
ktutil
addent -password -p YOURUSER@EXAMPLE.COM -k 4 -e arcfour-hmac-md5
addent -password -p YOURUSER@EXAMPLE.COM -k 4 -e aes128-cts-hmac-sha1-96
addent -password -p YOURUSER@EXAMPLE.COM -k 4 -e aes256-cts-hmac-sha1-96
wkt /root/ktprov.keytab
- On your master, make sure kadmin (or msktutil / k5start for AD) is installed and /etc/krb5.conf is configured.
keytab:
lookup:
princs:
- princ: host/SOME.HOST.HERE@EXAMPLE.COM
keytab: /etc/krb5.keytab
- The custom state checks if the specified principal exists in the specified keytab. If not, fire an event to the master and sleep for 5 seconds.
- Master catches the event in a reactor which fires a runner.
- Runner executes the mskutil / kadmin commands to provision a new principal. Then it base64 encodes the keytab and puts it into pillar
- Minion wakes up, refreshes its pillar, base64 decodes the keytab, and merges it with the final keytab.
- Write code for service principals that might exist on multiple hosts:
- Write code to verify if a specific minion is configured to have the principal it claims to have in the state.event.
- Figure out a way to see if principals are in sync with KDC. Right now we just see if they exist.