Required Infrastructure
Kerberos requires NTP and DNS.
NTP
Kerberos authentication is time sensitive. The system times between the client and the server hosts must be synchronized, or at least nearly so. Clock time discrepancies of more than 5 minutes (in the default configuration) will result in authenticaion failure. No two machines keep time at the same rate, and so the clocks WILL drift apart without active intervention. The easiest way to keep the clocks in sync is to use NTP on every host, either running as a daemon (preferred), or periodically as a cron job to make step adjustments to the system clock.
DNS
Kerberos makes heavy use of name services. Almost every operation involves a lookup of some sort, so it is vital to have a healthy DNS in place. Any misconfiguration or problem will result in a broken or partially functional Kerberos system. Your DNS must be capable of forward and reverse lookups. On each host, a name lookup must return the fully qualified domain name (FQDN). THIS IS VITALLY IMPORTANT. To check this, run this command on each host:
The output should be the FQDN of the host. For example, if your host's name is "testbox", and your network's domain is "tiny.net", that command should return "testbox.tiny.net" and not just "testbox". If you didn't get the FQDN, you need to fix the /etc/resolv.conf files, the /etc/hosts files, or maybe the /etc/nsswitch.conf files before proceeding.
One more thing about name resolution: Under no circumstances should a name lookup return 127.0.0.1, with the exception of localhost.
Most of the problems I encountered in implementing Kerberos were related to badly configured /etc/hosts files. The easiest way to avoid name resolution problems is to prioritize DNS over hosts file lookups in /etc/nsswitch.conf.
Pre-Configuration
Add "kerberos" to your USE flags in /etc/make.conf, then do an emerge with --newuse to recompile the packages that can use Kerberos.
Before diving into a Kerberos configuration file, you must do a little planning. First, figure out the name of your Kerberos realm. Your realm name is the same as your network's domain name, in all uppercase letters. For example, the realm name for the DNS domain "tiny.net" is "TINY.NET". Kerberos is case sensitive, a fact that apparently escaped the Windows developers.
The second thing you must figure out is what crypto algorithms will be used by your Kerberos installation. The default crypto types are Triple-DES and DES. There are many alternative crypto choices. Which one(s) you choose depend on what sort of Kerberos clients are on your network. According the the documentation, Kerberos understands the following encryption types:
- des-cbc-crc
- des-cbc-md4
- des-cbc-md5
- des3-cbc-sha1
- des3-hmac-sha1
- des3-cbc-sha1-kd
- des-hmac-sha1
- aes256-cts-hmac-sha1-96
- aes128-cts-hmac-sha1-96
- rc4-hmac
- rc4-hmac-exp
If your network has no Microsoft Windows clients, you may choose whichever crypto algorithms you wish. By adding even one Windows client into your Kerberos realm, however, you are forced into using DES and/or Arcfour as one of your crypto methods.
The configuration files in this guide choose the strongest crypto algorithms available to Kerberos, while still retaining compatibility with Windows clients. Linux clients will be configured to prefer 256-bit AES encryption, while Windows clients will use 128-bit Arcfour.
Configuration
For purposes of illustration, the configs in this guide are for a small, imaginary network with a DNS domain of "tiny.net", and a Kerberos realm of "TINY.NET". Our Key Distribution Center (KDC) host will have a FQDN of kdcbox.tiny.net. Your network will likely be different, so substitute names and such accordingly.
There are two parts to Kerberos configuration: one part is for the Kerberos server (KDC), the other is for Kerberised applications (clients). The Kerberos server machine (kdcbox.tiny.net) should have both the server and client portions configured on it. The other hosts on the network should only have the client portion configured.
This guide assumes that the Kerberos daemons are run as the root user on the KDC server, which how the Gentoo init scripts set it up.
Server Configuration
Kerberos uses two server daemons: one for the KDC, and one for administration of the Kerberos database (/usr/sbin/krb5kdc and /usr/sbin/kadmind, respectively). They are both configured with one file, kdc.conf. The files needed by the daemons, including kdc.conf, are kept in /var/lib/krb5kdc by default on a Gentoo system. File locations are changeable from the default in kdc.conf, but there is a catch-22; the service daemons need to read kdc.conf first, which is looked for at /var/lib/krb5kdc/kdc.conf. An alternate location for kdc.conf can be specified prior to executing the daemons like this:
Code: Select all
export KRB5_KDC_PROFILE=/path/to/kdc.conf
Naturally, it is easiest to use the default locations.
*** WARNING: The 1.5.2-r1 ebuild for MIT Kerberos places a sample configuration file at /etc/kdc.conf.example. The Kerberos daemons WILL NOT find a config file at /etc/kdc.conf without an exported KRB5_KDC_PROFILE variable. THE INIT SCRIPTS DO NOT SET THIS VARIABLE. A misplaced kdc.conf will result in puzzling behavior from your KDC, and may not produce any error messages to alert you. The best way forward is to use the default /var/lib/krb5kdc/kdc.conf location. YOU HAVE BEEN WARNED. ***
The KDC daemon, krb5kdc, starts with sensible defaults for most options. As a result, the kdc.conf for our TINY.NET realm is short:
Code: Select all
[realms]
TINY.NET = {
max_life = 16h 0m 0s
max_renewable_life = 7d 0h 0m 0s
master_key_type = aes256-cts-hmac-sha1-96
supported_enctypes = aes256-cts-hmac-sha1-96:normal rc4-hmac:normal
kdc_supported_enctypes = aes256-cts-hmac-sha1-96:normal rc4-hmac:normal
}
If your network has no Windows clients, the rc4-hmac types may be deleted from the *_enctypes lines.
Next, create an administration ACL file at /var/lib/krb5kdc/kadm5.acl with the following contents:
This file determines Kerberos database permissions when a user logs into the administration daemon, kadmind. For the TINY.NET realm, any principal with a name like "user/
admin@TINY.NET" gets full access to the database. Check the permissions on this file, it should not be writable except by root.
Client Configuration
Every host in the TINY.NET realm has an identical /etc/krb5.conf:
Code: Select all
[libdefaults]
default_realm = TINY.NET
default_tkt_enctypes = aes256-cts-hmac-sha1-96
default_tgs_enctypes = aes256-cts-hmac-sha1-96
permitted_enctypes = aes256-cts-hmac-sha1-96 rc4-hmac
forwardable = true
[realms]
TINY.NET = {
admin_server = kdcbox.tiny.net
kdc = kdcbox.tiny.net
}
[domain_realm]
.tiny.net = TINY.NET
tiny.net = TINY.NET
[logging]
kdc = SYSLOG
admin_server = SYSLOG
default = SYSLOG
In [libdefaults], the realm name and encryption types are set. Again, if you have no Windows hosts, feel free to omit the rc4-hmac type. In [realms], the FQDN of the master KDC server and the admin server is specified for TINY.NET. Both daemons will be running on kdcbox. It is possible to use the IP address insead of the hostname here; functionally, it makes no difference. The [domain_realm] section provides mappings between domain names and Kerberos realms. The [logging] section only affects the KDC server. Here, the krb5kdc daemon is told to send everything to the system logs.
I have a computer.