Overview

Part 7 of the Identity series covers Kerberos service principals and keytabs with FreeIPA on Fedora 44. The article does not only show how to create a keytab, but also how to verify that a service can actually accept Kerberos authentication with it.

A keytab is a secret key container for a principal. It does not belong in screenshots, tickets or Git repositories. The article therefore shows metadata, principal names, ticket lists and test results, but no key material.

https://ipa01.example.test/ipa/ui/

FreeIPA Web UI in the Fedora 44 keytab lab. Screenshot from the isolated FreeIPA C5 keytab lab on Fedora 44.

Lab Setup

bash
Server: ipa01.example.test
Client: client01.example.test
Service host: app01.example.test
Service: HTTP/app01.example.test
Domain: example.test
Realm: EXAMPLE.TEST
Distribution: Fedora Linux 44
SELinux: Enforcing

Create the Service Principal

The service principal describes the service identity. The lab uses `HTTP/app01.example.test@EXAMPLE.TEST`. The name follows the common service/FQDN@REALM pattern.

bash
ipa host-add app01.example.test --force
ipa service-add HTTP/app01.example.test --force
ipa service-show HTTP/app01.example.test --all
https://ipa01.example.test/ipa/ui/

FreeIPA service principal HTTP/app01.example.test with Kerberos key present. Screenshot from the isolated FreeIPA C5 keytab lab on Fedora 44.

https://ipa01.example.test/ipa/ui/

FreeIPA host app01.example.test as managed-by target of the service principal. Screenshot from the isolated FreeIPA C5 keytab lab on Fedora 44.

Generate and Inspect the Keytab

`ipa-getkeytab` writes keys for the service principal into a local keytab file. Immediately afterwards, `klist -k -e` verifies which principal and encryption-type entries are present. The key value itself is not printed.

bash
ipa-getkeytab \
-s ipa01.example.test \
-p HTTP/app01.example.test \
-k /tmp/http-app01.keytab
klist -k -e /tmp/http-app01.keytab
Keytab successfully retrieved and stored in: /tmp/http-app01.keytab
KVNO Principal
---- --------------------------------------------------------------------------
1 HTTP/app01.example.test@EXAMPLE.TEST (aes256-cts-hmac-sha384-192)
1 HTTP/app01.example.test@EXAMPLE.TEST (aes128-cts-hmac-sha256-128)
1 HTTP/app01.example.test@EXAMPLE.TEST (aes256-cts-hmac-sha1-96)
1 HTTP/app01.example.test@EXAMPLE.TEST (aes128-cts-hmac-sha1-96)

Protect the Keytab on the Service System

In the lab, the keytab is installed as root-owned with mode 0600. The later positive GSSAPI test therefore had to run the acceptor process with root privileges. That is intentional: a readable keytab is effectively a service password.

bash
install -o root -g root -m 0600 \
/tmp/http-app01.keytab \
/etc/krb5.keytabs-http-app01.keytab

Service TGT with kinit -k

The first technical proof is `kinit -k`: the service can obtain a ticket from the keytab without interactive password entry.

bash
kinit -k \
-t /etc/krb5.keytabs-http-app01.keytab \
HTTP/app01.example.test
klist -e
Ticket cache: KCM:0
Default principal: HTTP/app01.example.test@EXAMPLE.TEST
Valid starting Expires Service principal
10/08/2026 21:10:20 10/09/2026 21:04:06 krbtgt/EXAMPLE.TEST@EXAMPLE.TEST

Real Service Authentication

A successful `kinit -k` proves that the keytab is usable. For stronger acceptance, the lab also performed a GSSAPI client/server test: user `krbuser` obtains a service ticket for `HTTP/app01.example.test`, and the service accepts the context with the keytab.

https://ipa01.example.test/ipa/ui/

FreeIPA user krbuser for the GSSAPI client test. Screenshot from the isolated FreeIPA C5 keytab lab on Fedora 44.

kvno HTTP/app01.example.test
HTTP/app01.example.test@EXAMPLE.TEST: kvno = 1
client_complete= True
server_initiator= krbuser@EXAMPLE.TEST

Negative Test

An empty or wrong keytab must not obtain credentials. This negative test prevents an existing ticket cache from being mistaken for success.

bash
KRB5_KTNAME=/tmp/empty-http-app01.keytab \
kinit -k HTTP/app01.example.test
kinit: Pre-authentication failed: Invalid argument while getting initial credentials
empty_keytab_rc=1

Result Check

Platform

Check
Server and client on Fedora Linux 44
Result
PASS

FreeIPA

Check
host app01.example.test exists
Result
PASS

FreeIPA

Check
service HTTP/app01.example.test exists
Result
PASS

Keytab

Check
ipa-getkeytab creates keytab
Result
PASS

Keytab

Check
klist -k -e shows principal and enctypes
Result
PASS

Permission

Check
keytab root-owned 0600
Result
PASS

Kerberos

Check
kinit -k with service principal
Result
PASS

Kerberos

Check
kvno obtains service ticket
Result
PASS

GSSAPI

Check
service accepts client context
Result
PASS

Negative test

Check
empty keytab fails
Result
PASS

Practice Notes

  • Treat keytabs like passwords: restrictive permissions, controlled rollout and no storage in repositories.

  • When a keytab is regenerated, the key version context typically changes. Old keytabs must be replaced deliberately.

  • For production services, also document ticket lifetime, clock skew, DNS/FQDN consistency, service names and rotation.

Do Not Skip This

  • Treat keytabs like passwords and never store them in tickets or repositories.

  • In addition to kinit -k, validate real service authentication.

  • Document keytab rotation and KVNO changes.

  • Check file permissions and service user as part of acceptance.