Installing mod_auth_kerb (v. 4.x)Contents
Retrieving the module sourceThe source can be downloaded off of the Project Site link to the left. If you grab the .zip or .tar.gz distributions, then they are expecting to be extracted at the root of the Apache source tree. It sets up the appropriate paths to have it compiled from within the source tree as indicated in all of the non-dso compile instructions on this page. The .c distribution is normally downloaded by those wishing to compile mod_auth_kerb as a dso. Here is a direct link to the file download listing off the project page just in case you want to skip the middleman. Building mod_auth_kerb as a dso
The easiest way to compile mod_auth_kerb is as a dso using apxs. It you
compile it using apxs, all you have to do is (we'll assume apxs is in your path
for this example): apxs -c -DKRB5 -DKRB_DEF_REALM=\\\"EOS.NCSU.EDU\\\" \ -I/usr/kerberos/include -L/usr/kerberos/lib -lkrb5 \ -ldl -lcom_err -lk5crypto mod_auth_kerb.cOr something along those lines. I'll have better documentation whenever I get the configure script stuff going. Building Apache with mod_auth_kerb
The first example is a simple example providing only KerberosV5 support and
settings a default realm. I normally create two scripts to set up the
environment appropriately, as follows: env 'LIBS=-L/usr/kerberos/lib -lkrb5 -lcrypto -lcom_err' \ 'CFLAGS=-DKRB5 -DKRB_DEF_REALM=\\\"EOS.NCSU.EDU\\\"' \ 'INCLUDES=-I/usr/kerberos/include' \ ./configure --enable-module=cern_meta --enable-module=expires \ --enable-module=headers --enable-module=info \ --enable-module=rewrite --enable-module=status \ --prefix=/local/httpd \ --add-module=src/modules/kerberos/mod_auth_kerb.c docompile env 'LIBS=-L/usr/kerberos/lib -lkrb5 -lcrypto -lcom_err' \ 'CFLAGS=-DKRB5 -DKRB_DEF_REALM=\\\"EOS.NCSU.EDU\\\"' \ 'INCLUDES=-I/usr/kerberos/include' \ make As you can see, the environment variable LIBS contains all the options necessary to link in the Kerberos V5 libraries, while INCLUDES contains the include options needed to find the Kerberos V5 header files. CFLAGS contains -DKRB5 for Kerberos V5 support and/or -DKRB4 for Kerberos V4 support. You can specify both if you wish to compile in support both both. CFLAGS is also used for various other compile time options, such as the KRB_DEF_REALM define. All of these defines are explained below. The configure command is passed the option --add-module=src/modules/kerberos/mod_auth_kerb.c so configure knows to link in that module.
Before we go into the explanation of the defines, I'd like to display
my doconfig and docompile scripts, which include almost all of the supported
functionality: env 'LIBS=-L/usr/kerberos/lib -lkrb524 -lkrb4 -lkrb5 \ /usr/kerberos/lib/libcrypto.a -lcom_err -L/local/ssl/lib \ -L/local/mm/lib -lrsaref /usr/athena/lib/libhesiod.a \ -lsocket -lresolv -lnsl' \ 'INCLUDES=-I/usr/kerberos/include \ -I/usr/kerberos/include/kerberosIV -I/local/ssl/include \ -I/local/mm/include -I/usr/athena/include \ -I/local/src/rsaref/source' \ 'CFLAGS=-DKRB5 -DKRB5_VERIFY_TICKET \ -DKRB_DEF_REALM=\\\"EOS.NCSU.EDU\\\" -DKRB5_SAVE_CREDENTIALS \ -DKRB4 -DKRB4_SAVE_TICKETS -DHESIOD' \ 'SSL_BASE=/local/src/openssl-0.9.4' \ 'RSA_BASE=/local/src/rsaref/comp' \ 'EAPI_MM=/local/src/mm-1.0.9' \ ./configure --enable-module=headers --enable-module=info \ --enable-module=rewrite --prefix=/local/ap_krbtest \ --enable-module=mime_magic --enable-module=ssl \ --add-module=src/modules/kerberos/mod_auth_kerb.c \ --add-module=src/modules/wrap/mod_auth_wrap.c docompile env 'LIBS=-L/usr/kerberos/lib -lkrb524 -lkrb4 -lkrb5 \ /usr/kerberos/lib/libcrypto.a -lcom_err -L/local/ssl/lib \ -L/local/mm/lib -lrsaref /usr/athena/lib/libhesiod.a \ -lsocket -lresolv -lnsl' \ 'INCLUDES=-I/usr/kerberos/include \ -I/usr/kerberos/include/kerberosIV -I/local/ssl/include \ -I/local/mm/include -I/usr/athena/include \ -I/local/src/rsaref/source -I/local/src/rsaref/source' \ 'CFLAGS=-DKRB5 -DKRB5_VERIFY_TICKET \ -DKRB_DEF_REALM=\\\"EOS.NCSU.EDU\\\" -DKRB5_SAVE_CREDENTIALS \ -DKRB4 -DKRB4_SAVE_TICKETS -DHESIOD' \ 'SSL_BASE=/local/src/openssl-0.9.4' \ 'RSA_BASE=/local/src/rsaref/comp' \ 'EAPI_MM=/local/src/mm-1.0.9' \ makeNasty, isn't it? As you can see, I had to do some 'fighting' to get everything to compile together happily. You'll also notice that I'm compiling a second module into it as well, so not all of those options are necessary for mod_auth_kerb. However, I just wanted to show a more complex form of the config and compile. DefinesThe following defines can be added to the CFLAGS line to add/alter functionality of the compiled module:
Other Compiling NotesLinking with SSL
Building StrongholdThanks to David MacKenzie for the patches to allow mod_auth_kerb to be used with Stronghold. His instructions are as follows: To compile this module under Stronghold 2.4.1, you need to prevent it from including Stronghold's SSL include files. To link it, you need to avoid a few library symbol conflicts. Configure Stronghold as usual, with AddModule modules/extra/mod_auth_kerb.o Don't add the Kerberos include or link directives to the Stronghold Configuration file or configure arguments. In include/httpd.h, add #ifdef STRONGHOLD around the last three elements of struct conn_rec. In include/ap_config_auto.h, comment out the #define STRONGHOLD. Compile this module by hand omitting many of the standard command line arguments; I used, on BSDI BSD/OS 3.1 with krb5: cd stronghold/src perl -p -i.dist -e 's/_des_ecb_encrypt/_Des_ecb_encrypt/g; \ s/_des_is_weak_key/_Des_is_weak_key/g; \ s/_des_key_sched/_Des_key_sched/g' ../ssl/lib/libcrypto.a cd modules/extra gcc -c -I/usr/local/krb5/include -I../../os/unix \ -I../../include -O2 -DKRB5 mod_auth_kerb.c ld -r -o kerb.o mod_auth_kerb.o -L/usr/local/krb5/lib \ -lkrb5 -lcrypto -lcom_err mv kerb.o mod_auth_kerb.o cd ../.. make For Kerberos V4: gcc -c -I/usr/include/kerberosIV -I../../os/unix \ -I../../include -O2 -DKRB4 mod_auth_kerb.c ld -r -o kerb.o mod_auth_kerb.o -lkrb -ldes |