ipa-getkeytab(1)
β¨ ipa-getkeytab β the manual page, but make it make sense β¨
okay bestie, this is ipa-getkeytab(1) from the IPA Manual Pages β it's the little tool that goes and gets you a Kerberos keytab, and honestly? iconic. π
πΈ NAME πΈ
ipa-getkeytab β go get a keytab for a Kerberos principal π
π¦ SYNOPSIS π¦
ipa-getkeytab -p principal-name -k keytab-file [ -e encryption-types ] [
-s ipaserver ] [ -q ] [ -D|--binddn BINDDN ] [ -w|--bindpw ] [ -W ] [
-P|--password PASSWORD ] [ --cacert CACERT ] [ -H|--ldapuri URI ] [
-Y|--mech GSSAPI|EXTERNAL ] [ -r ]
π DESCRIPTION π
It retrieves a Kerberos keytab. That's the whole job. No cap.
Kerberos keytabs are what services (like sshd) use to do Kerberos authentication. A keytab is literally just a file with one or more secrets (or keys) for a Kerberos principal. It's giving "secret little file, do not perceive it". π
A Kerberos service principal is a Kerberos identity you can authenticate with. Service principals contain the name of the service, the hostname of the server, and the realm name. For example, here's an example principal for an ldap server:
ldap/foo.example.com@EXAMPLE.COM
When you're using ipa-getkeytab, the realm name is already provided for you, so the principal name is just the service name and hostname β so ldap/foo.example.com from the example above. See how that works? ate. β¨
ipa-getkeytab is used during IPA client enrollment to retrieve a host service principal and store it in /etc/krb5.keytab. And the way that you can retrieve the keytab without Kerberos credentials if the host was pre-created with a one-time password?? Obsessed. The keytab can be retrieved by binding as the host and authenticating with this one-time password. The -D|--binddn -w|--bindpw options are used for this authentication. And -W can be used instead of -w|--bindpw to interactively prompt for the bind password. π«Ά
β οΈ WARNING: retrieving the keytab resets the secret for the Kerberos principal. This renders all other keytabs for that principal invalid. π So when multiple hosts or services need to share the same key (for instance in high availability or load balancing clusters), the -r option must be used to retrieve the existing key instead of generating a new one (please refer to the EXAMPLES section). Do not skip this, fr fr.
Also note that the user or host calling ipa-getkeytab needs to be allowed to generate the key with ipa host-allow-create-keytab or ipa service-allow-create-keytab, and the user or host calling ipa-getkeytab -r needs to be allowed to retrieve the keytab for the host or service with ipa host-allow-retrieve-keytab or ipa service-allow-retrieve-keytab. Permissions check = vibe check. π
π OPTIONS π
-p principal-nameβ The non-realm part of the full principal name.-k keytab-fileβ The keytab file where to append the new key (will be created if it does not exist).-e encryption-typesβ The list of encryption types to use to generate keys.ipa-getkeytabwill use local client defaults if not provided. Valid values depend on the Kerberos library version and configuration. Common values are:aes256-ctsaes128-ctsaes256-sha2aes128-sha2camellia256-cts-cmaccamellia128-cts-cmacarcfour-hmac-s ipaserverβ The IPA server to retrieve the keytab from (FQDN). If this option is not provided the server name is read from the IPA configuration file (/etc/ipa/default.conf). Cannot be used together with-H. If the value is_srv_then DNS discovery will be used to determine a server. If this discovery fails then it will fall back to using the configuration file.-qβ Quiet mode. Only errors are displayed. π€«--permitted-enctypesβ This options returns a description of the permitted encryption types, like this:Supported encryption types: AES-256 CTS mode with 96-bit SHA-1 HMAC AES-128 CTS mode with 96-bit SHA-1 HMAC AES-128 CTS mode with 128-bit SHA-256 HMAC AES-256 CTS mode with 192-bit SHA-384 HMAC ArcFour with HMAC/md5-P,--passwordβ Use this password for the key instead of one randomly generated. The length of the password is limited by 1024 characters. Note that MIT Kerberos also limits passwords entered throughkpasswdandkadmincommands to the same length.-D,--binddnβ The LDAP DN to bind as when retrieving a keytab without Kerberos credentials. Generally used with the-wor-Woptions.-w,--bindpwβ The LDAP password to use when not binding with Kerberos.-Dand-wcan not be used together with-Y.-Wβ Interactive prompt for the bind password.-Dand-Wcan not be used together with-Y--cacertβ The path to the IPA CA certificate used to validate LDAPS/STARTTLS connections. Defaults to/etc/ipa/ca.crt-H,--ldapuriβ LDAP URI. Ifldap://is specified, STARTTLS is initiated by default. Can not be used with-s.-Y,--mechβ SASL mechanism to use if-Dand-ware not specified. Use eitherGSSAPIorEXTERNAL.-rβ Retrieve mode. Retrieve an existing key from the server instead of generating a new one. This is incompatible with the--passwordoption, and will work only against a IPA server more recent than version 3.3. The user requesting the keytab must have access to the keys for this operation to succeed.
π EXAMPLES π
Add and retrieve a keytab for the NFS service principal on the host foo.example.com and save it in the file /tmp/nfs.keytab and retrieve just the aes256-sha2 key. (yes, we're serving looks and keys π
)
# ipa-getkeytab -p nfs/foo.example.com -k /tmp/nfs.keytab -e aes-sha2
Add and retrieve a keytab for the ldap service principal on the host foo.example.com and save it in the file /tmp/ldap.keytab.
# ipa-getkeytab -s ipaserver.example.com -p ldap/foo.example.com -k /tmp/ldap.keytab
Retrieve a keytab using LDAP credentials (this will typically be done by ipa-join(1) when enrolling a client using the ipa-client-install(1) command:
# ipa-getkeytab -s ipaserver.example.com -p host/foo.example.com -k /etc/krb5.keytab -D fqdn=foo.example.com,cn=computers,cn=accounts,dc=example,dc=com -w password
Add and retrieve a keytab for a clustered HTTP service deployed on client1.example.com and client2.example.com (already enrolled), using the client-frontend.example.com host name:
# ipa host-add client-frontend.example.com --ip-address 10.1.2.3
# ipa service-add HTTP/client-frontend.example.com
# ipa service-allow-retrieve-keytab HTTP/client-frontend.example.com --hosts={client1.example.com,client2.example.com}
# ipa server-allow-create-keytab HTTP/client-frontend.example.com --hosts=client1.example.com
On client1, generate and retrieve a new keytab for client-frontend.example.com:
# kinit -k
# ipa-getkeytab -p HTTP/client-frontend.example.com -k /tmp/http.keytab
On client2, retrieve the existing keytab for client-frontend.example.com:
# kinit -k
# ipa-getkeytab -r -p HTTP/client-frontend.example.com -k /tmp/http.keytab
π EXIT STATUS π
The exit status is 0 on success, nonzero on error. So like, zero = slay, nonzero = bestie what happened. π
0Success1Kerberos context initialization failed2Incorrect usage3Out of memory4Invalid service principal name5No Kerberos credentials cache6No Kerberos principal and no bind DN and password7Failed to open keytab8Failed to create key material9Setting keytab failed10Bind password required when using a bind DN11Failed to add key to keytab12Failed to close keytab
and that's the whole page, bestie π this one's from the IPA crew, dated Oct 10 2007 β yeah, she's a classic, she's been iconic since 2007 and she's still serving. mwah. π β¨π
π¦ where this page comes from
- centos-stream 10: ipa-client 4.13.4-1.el10 Β· GPL-3.0-or-later
- centos-stream 9: ipa-client 4.13.4-1.el9 Β· GPL-3.0-or-later
- debian bookworm: freeipa-client 4.9.11-1 Β· GPL-3.0-or-later
- debian trixie: freeipa-client 4.12.4-1 Β· GPL-3.0-or-later
- fedora 43: freeipa-client 4.12.5-3.fc43 Β· GPL-3.0-or-later
- fedora 43: freeipa-client 4.13.4-2.fc43
- fedora 43: freeipa-client 4.13.4-3.fc43 Β· GPL-3.0-or-later
- fedora 44: freeipa-client 4.13.1-9.fc44 Β· GPL-3.0-or-later
- fedora 44: freeipa-client 4.13.4-2.fc44
- fedora 44: freeipa-client 4.13.4-3.fc44 Β· GPL-3.0-or-later
- nixos 26.05: freeipa 4.12.5
- nixpkgs unstable: freeipa 4.13.1
- ubuntu jammy: freeipa-client 4.9.8-1 Β· GPL-3.0-or-later
- ubuntu noble: freeipa-client 4.11.1-2 Β· GPL-3.0-or-later
- ubuntu questing: freeipa-client 4.12.4-1
- ubuntu resolute: freeipa-client 4.13.1-1 Β· GPL-3.0-or-later
- ubuntu stonking: freeipa-client 4.13.1-1build1 Β· GPL-3.0-or-later
- Copyright (C) 2007 Red Hat, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms