is a subproject of the Apache Directory
project, and is a complete open-source KDC written entirely in Java. Apache Kerby 1.1.0 has just been released
. This release contains two major new features: a GSSAPI module (covered previously here
) and cross-realm support (the subject of a forthcoming blog post).
I have previously used Apache Kerby in this blog as a KDC to illustrate some security-based test-cases for big data components such as Apache Hadoop, Hive, Storm, etc, by pointing to some code on github that shows how to launch a Kerby KDC using Apache maven
. This is convenient as a KDC can be launched with the principals already created via a single maven command. However, it is not suitable if the KDC is to be used in a standalone setting.
In this post, we will show how to create a Kerby KDC distribution without writing any code.
1) Install and configure the Apache Kerby KDC
The first step is to download
the Apache Kerby source code. Unzip the source and build the distribution via:
- mvn clean install -DskipTests
- cd kerby-dist
- mvn package -Pdist
The "kerby-dist" directory contains the KDC distribution in "kdc-dist", as well as the client tools in "tool-dist". Copy both "kdc-dist" and "tool-dist" directories to another location instead of working directly in the Kerby source. In "kdc-dist" create a directory called "keytabs" and "runtime". Then create some keytabs via:
- sh bin/kdcinit.sh conf keytabs
This will create keytabs for the "kadmin" and "protocol" principals, and store them in the "keytabs" directory. For testing purposes, we will change the port of the KDC from the default "88" to "12345" to avoid having to run the KDC with administrator privileges. Edit "conf/krb5.conf" and "conf/kdc.conf" and change "88" to "12345".
The Kerby principals are stored in a backend that is configured in "conf/backend.conf". By default this is a JSON file that is stored in "/tmp/kerby/jsonbackend". However, Kerby also supports other more robust backends, such as LDAP, Mavibot, Zookeeper, etc.
We can start the KDC via:
- sh bin/start-kdc.sh conf runtime
Let's create a new user called "alice":
2) Install and configure the Apache Kerby tool dist
- sh bin/kadmin.sh conf/ -k keytabs/admin.keytab
- addprinc -pw password alice@EXAMPLE.COM
We can check that the KDC has started properly using the MIT kinit tool, if it is installed locally:
- export KRB5_CONFIG=/path.to.kdc.dist/conf/krb5.conf
- kinit alice (use "password" for the password when prompted)
Now you can see the ticket for alice using "klist". Apache Kerby also ships a "tool-dist" distribution that contains implementations of "kinit", "klist", etc. First call "kdestroy" to remove the ticket previously obtained for "alice". Then go into the directory where "tool-dist" was installed to in the previous section. Edit "conf/krb5.conf" and replace "88" with "12345". We can now obtain a ticket for "alice" via:
- sh bin/kinit.sh -conf conf alice
- sh bin/klist.sh
Post a Comment