16.4. Retrieve Existing Keytabs for Multiple Servers
In some scenarios, like in a cluster environment, the same keytab file is required for a service represented on one common host name by different machines. IdM commands can be used to retrieve the same keytab on each of the hosts.
To prepare the common host name and the service principal, run the following commands on an IdM server:
- Authenticate as
adminuser:kinit admin
[root@ipaserver ~]# kinit adminCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Add a common forward DNS record for all IP addresses that share this host name:
ipa dnsrecord-add idm.example.com cluster --a-rec={192.0.2.40,192.0.2.41}[root@ipaserver ~]# ipa dnsrecord-add idm.example.com cluster --a-rec={192.0.2.40,192.0.2.41} Record name: cluster A record: 192.0.2.40, 192.0.2.41Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a new host entry object for the common DNS name:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the service principal for the host:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the hosts to the service, that should be able to retrieve the keytab from IdM:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Grant permission to create a new keytab to one host:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
On the clients, follow these steps:
- Authenticate with the hosts Kerberos keytab:
kinit -kt /etc/krb5.keytab
# kinit -kt /etc/krb5.keytabCopy to Clipboard Copied! Toggle word wrap Toggle overflow - On the client you granted the respective permission to, generate a new keytab and store it in a file:
ipa-getkeytab -s ipaserver.idm.example.com -p HTTP/cluster.idm.example.com -k /tmp/client.keytab
[root@node01 ~]# ipa-getkeytab -s ipaserver.idm.example.com -p HTTP/cluster.idm.example.com -k /tmp/client.keytabCopy to Clipboard Copied! Toggle word wrap Toggle overflow - On all other clients, retrieve the existing keytab from the IdM server by adding the
-roption to the command:ipa-getkeytab -r -s ipaserver.idm.example.com -p HTTP/cluster.idm.example.com -k /tmp/client.keytab
[root@node02 ~]# ipa-getkeytab -r -s ipaserver.idm.example.com -p HTTP/cluster.idm.example.com -k /tmp/client.keytabCopy to Clipboard Copied! Toggle word wrap Toggle overflow WarningBe aware that if you omit the-roption, a new keytab will be generated. This invalidates all previously retrieved keytabs for this service principal.