11.2. Configuring the Kerberos KDC
Install the master KDC first and then install any necessary secondary servers after the master is set up.
Important
Setting up Kerberos KDC manually is not recommended. The recommended way to introduce Kerberos into Red Hat Enterprise Linux environments is to use the Identity Management feature.
11.2.1. Configuring the Master KDC Server Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Important
The KDC system should be a dedicated machine. This machine needs to be very secure — if possible, it should not run any services other than the KDC.
- Install the required packages for the KDC:
yum install krb5-server krb5-libs krb5-workstation
[root@server ~]# yum install krb5-server krb5-libs krb5-workstationCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Edit the
/etc/krb5.confand/var/kerberos/krb5kdc/kdc.confconfiguration files to reflect the realm name and domain-to-realm mappings. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow A simple realm can be constructed by replacing instances of EXAMPLE.COM and example.com with the correct domain name — being certain to keep uppercase and lowercase names in the correct format — and by changing the KDC from kerberos.example.com to the name of the Kerberos server. By convention, all realm names are uppercase and all DNS host names and domain names are lowercase. The man pages of these configuration files have full details about the file formats. - Create the database using the
kdb5_utilutility.kdb5_util create -s
[root@server ~]# kdb5_util create -sCopy to Clipboard Copied! Toggle word wrap Toggle overflow Thecreatecommand creates the database that stores keys for the Kerberos realm. The-sargument creates a stash file in which the master server key is stored. If no stash file is present from which to read the key, the Kerberos server (krb5kdc) prompts the user for the master server password (which can be used to regenerate the key) every time it starts. - Edit the
/var/kerberos/krb5kdc/kadm5.aclfile. This file is used bykadmindto determine which principals have administrative access to the Kerberos database and their level of access. For example:*/admin@EXAMPLE.COM *
*/admin@EXAMPLE.COM *Copy to Clipboard Copied! Toggle word wrap Toggle overflow Most users are represented in the database by a single principal (with a NULL, or empty, instance, such as joe@EXAMPLE.COM). In this configuration, users with a second principal with an instance of admin (for example, joe/admin@EXAMPLE.COM) are able to exert full administrative control over the realm's Kerberos database.Afterkadmindhas been started on the server, any user can access its services by runningkadminon any of the clients or servers in the realm. However, only users listed in thekadm5.aclfile can modify the database in any way, except for changing their own passwords.Note
Thekadminutility communicates with thekadmindserver over the network, and uses Kerberos to handle authentication. Consequently, the first principal must already exist before connecting to the server over the network to administer it. Create the first principal with thekadmin.localcommand, which is specifically designed to be used on the same host as the KDC and does not use Kerberos for authentication. - Create the first principal using
kadmin.localat the KDC terminal:kadmin.local -q "addprinc username/admin"
[root@server ~]# kadmin.local -q "addprinc username/admin"Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Start Kerberos using the following commands:
systemctl start krb5kdc.service systemctl start kadmin.service
[root@server ~]# systemctl start krb5kdc.service [root@server ~]# systemctl start kadmin.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Add principals for the users using the
addprinccommand withinkadmin.kadminandkadmin.localare command line interfaces to the KDC. As such, many commands — such asaddprinc— are available after launching thekadminprogram. Refer to thekadminman page for more information. - Verify that the KDC is issuing tickets. First, run
kinitto obtain a ticket and store it in a credential cache file. Next, useklistto view the list of credentials in the cache and usekdestroyto destroy the cache and the credentials it contains.Note
By default,kinitattempts to authenticate using the same system login user name (not the Kerberos server). If that user name does not correspond to a principal in the Kerberos database,kinitissues an error message. If that happens, supplykinitwith the name of the correct principal as an argument on the command line:kinit principal
kinit principalCopy to Clipboard Copied! Toggle word wrap Toggle overflow
11.2.2. Setting up Secondary KDCs Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
When there are multiple KDCs for a given realm, one KDC (the master KDC) keeps a writable copy of the realm database and runs
kadmind. The master KDC is also the realm's admin server. Additional secondary KDCs keep read-only copies of the database and run kpropd.
The master and slave propagation procedure entails the master KDC dumping its database to a temporary dump file and then transmitting that file to each of its slaves, which then overwrite their previously received read-only copies of the database with the contents of the dump file.
To set up a secondary KDC:
- Install the required packages for the KDC:
yum install krb5-server krb5-libs krb5-workstation
[root@slavekdc ~]# yum install krb5-server krb5-libs krb5-workstationCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Copy the master KDC's
krb5.confandkdc.conffiles to the secondary KDC. - Start
kadmin.localfrom a root shell on the master KDC.- Use the
kadmin.local add_principalcommand to create a new entry for the master KDC's host service.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the
kadmin.local ktaddcommand to set a random key for the service and store the random key in the master's default keytab file.Note
This key is used by thekpropcommand to authenticate to the secondary servers. You will only need to do this once, regardless of how many secondary KDC servers you install.
- Start
kadminfrom a root shell on the secondary KDC.- Use the
kadmin.local add_principalcommand to create a new entry for the secondary KDC's host service.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the
kadmin.local ktaddcommand to set a random key for the service and store the random key in the secondary KDC server's default keytab file. This key is used by thekpropdservice when authenticating clients.
- With its service key, the secondary KDC could authenticate any client which would connect to it. Obviously, not all potential clients should be allowed to provide the
kpropservice with a new realm database. To restrict access, thekpropservice on the secondary KDC will only accept updates from clients whose principal names are listed in/var/kerberos/krb5kdc/kpropd.acl.Add the master KDC's host service's name to that file.echo host/masterkdc.example.com@EXAMPLE.COM > /var/kerberos/krb5kdc/kpropd.acl
[root@slavekdc ~]# echo host/masterkdc.example.com@EXAMPLE.COM > /var/kerberos/krb5kdc/kpropd.aclCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Once the secondary KDC has obtained a copy of the database, it will also need the master key which was used to encrypt it. If the KDC database's master key is stored in a stash file on the master KDC (typically named
/var/kerberos/krb5kdc/.k5.REALM), either copy it to the secondary KDC using any available secure method, or create a dummy database and identical stash file on the secondary KDC by runningkdb5_util create -sand supplying the same password. The dummy database will be overwritten by the first successful database propagation. - Ensure that the secondary KDC's firewall allows the master KDC to contact it using TCP on port 754 (krb5_prop), and start the
kpropservice. - Verify that the
kadminservice is disabled. - Perform a manual database propagation test by dumping the realm database on the master KDC to the default data file which the
kpropcommand will read (/var/kerberos/krb5kdc/slave_datatrans).kdb5_util dump /var/kerberos/krb5kdc/slave_datatrans
[root@masterkdc ~]# kdb5_util dump /var/kerberos/krb5kdc/slave_datatransCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the
kpropcommand to transmit its contents to the secondary KDC.kprop slavekdc.example.com
[root@masterkdc ~]# kprop slavekdc.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Using
kinit, verify that the client system is able to correctly obtain the initial credentials from the KDC.The/etc/krb5.conffor the client should list only the secondary KDC in its list of KDCs.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a script which dumps the realm database and runs the
kpropcommand to transmit the database to each secondary KDC in turn, and configure thecronservice to run the script periodically.
11.2.3. Kerberos Key Distribution Center Proxy Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Some administrators might choose to make the default Kerberos ports inaccessible in their deployment. To allow users, hosts, and services to obtain Kerberos credentials, you can use the
HTTPS service as a proxy that communicates with Kerberos via the HTTPS port 443.
In Identity Management (IdM), the Kerberos Key Distribution Center Proxy (KKDCP) provides this functionality.
KKDCP Server
On an IdM server, KKDCP is enabled by default. The KKDCP is automatically enabled each time the Apache web server starts, if the attribute and value pair
ipaConfigString=kdcProxyEnabled exists in the directory. In this situation, the symbolic link /etc/httpd/conf.d/ipa-kdc-proxy.conf is created. Thus, you can verify that KKDCP is enabled on an IdM Server by checking that the symbolic link exists.
ls -l /etc/httpd/conf.d/ipa-kdc-proxy.conf
$ ls -l /etc/httpd/conf.d/ipa-kdc-proxy.conf
lrwxrwxrwx. 1 root root 36 Aug 15 09:37 /etc/httpd/conf.d/ipa-kdc-proxy.conf -> /etc/ipa/kdcproxy/ipa-kdc-proxy.conf
See the example server configurations below for more details.
Example 11.1. Configuring the KKDCP server I
Using the following example configuration, you can enable TCP to be used as the transport protocol between the IdM KKDCP and the Active Directory realm, where multiple Kerberos servers are used:
- In the
/etc/ipa/kdcproxy/kdcproxy.conffile, set theuse_dnsparameter in the [global] section to false :[global] use_dns = false
[global] use_dns = falseCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Put the proxied realm information into the
/etc/ipa/kdcproxy/kdcproxy.conffile. For the [AD.EXAMPLE.COM] realm with proxy, for example, list the realm configuration parameters as follows:[AD.EXAMPLE.COM] kerberos = kerberos+tcp://1.2.3.4:88 kerberos+tcp://5.6.7.8:88 kpasswd = kpasswd+tcp://1.2.3.4:464 kpasswd+tcp://5.6.7.8:464
[AD.EXAMPLE.COM] kerberos = kerberos+tcp://1.2.3.4:88 kerberos+tcp://5.6.7.8:88 kpasswd = kpasswd+tcp://1.2.3.4:464 kpasswd+tcp://5.6.7.8:464Copy to Clipboard Copied! Toggle word wrap Toggle overflow Important
The realm configuration parameters must list multiple servers separated by a space, as opposed to/etc/krb5.confandkdc.conf, in which certain options may be specified multiple times. - Restart IdM services:
ipactl restart
# ipactl restartCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Example 11.2. Configuring the KKDCP server II
This example server configuration relies on the DNS service records to find AD servers to communicate with.
- In the
/etc/ipa/kdcproxy/kdcproxy.conffile, the [global] section, set theuse_dnsparameter to true:[global] configs = mit use_dns = true
[global] configs = mit use_dns = trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow Theconfigsparameter allows you to load other configuration modules. In this case, the configuration is read from the MITlibkrb5library. - Optional: In case you do not want to use DNS service records, add explicit AD servers to the [realms] section of the
/etc/krb5.conffile. If the realm with proxy is, for example, AD.EXAMPLE.COM, you add:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart IdM services:
ipactl restart
# ipactl restartCopy to Clipboard Copied! Toggle word wrap Toggle overflow
KKDCP Client
Client systems point to the KDC proxies through their
/etc/krb5.conf files. Follow this procedure to reach the AD server.
- On the client, open the
/etc/krb5.conffile, and add the name of the AD realm to the [realms] section:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Open the
/etc/sssd/sssd.conffile, and add the krb5_use_kdcinfo = False line to your IdM domain section:[domain/example.com] krb5_use_kdcinfo = False
[domain/example.com] krb5_use_kdcinfo = FalseCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the
SSSDservice:systemctl restart sssd.service
# systemctl restart sssd.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Additional Resources
- For details on configuring KKDCP for an Active Directory realm, see Configure IPA server as a KDC Proxy for AD Kerberos communication in Red Hat Knowledgebase.