6.2. mod_auth_kerb Example
6.2.1. mod_auth_kerb Example Prerequisites Copy linkLink copied to clipboard!
- Install mod_auth_kerb on Red Hat Enterprise Linux.
- Install curl with GSS-negotiated support.
- Configure and run a Kerberos or LDAP server (for example ApacheDS) on the same host as your Red Hat JBoss Web Server.
- Create the following LDAP users:
- Create the user
krbtgt:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create the user
ldap:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create the user
HTTP:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create user
hnelson(test user):Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.2.2. Configure the Kerberos Client Copy linkLink copied to clipboard!
Procedure 6.1. Configure the Kerberos Client
Create the Kerberos Configuration File
Create thekrb5.confconfiguration file in the/etcdirectory and add the following to the file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a Key Tab
Create a key tab in the/etc/httpdfolder with the following contents:Copy to Clipboard Copied! Toggle word wrap Toggle overflow As the root user, run the following commands to apply the correct group and permissions to the key tab:chgrp apache /etc/httpd/krb5.keytab chmod 640 /etc/httpd/krb5.keytab
# chgrp apache /etc/httpd/krb5.keytab # chmod 640 /etc/httpd/krb5.keytabCopy to Clipboard Copied! Toggle word wrap Toggle overflow Check the Hosts File
Ensure that the following host configuration is included in the/etc/hostsfile:127.0.0.1 localhost
127.0.0.1 localhostCopy to Clipboard Copied! Toggle word wrap Toggle overflow
6.2.3. Configure mod_auth_kerb Copy linkLink copied to clipboard!
Procedure 6.2. Configure mod_auth_kerb
- Create the
auth_kerb.confconfiguration file in theJWS_HOME/httpd/conf.d/folder and add the following information to the file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.2.4. Test the Kerberos Authentication Copy linkLink copied to clipboard!
Procedure 6.3. Test the Kerberos Authentication
Create a Test Page
Create a test page namedauth_kerb_page.htmlinJWS_HOME/httpd/www/html/kerberostest/.Add the Contents of the Test Page
Add the following contents to the test page (auth_kerb_page.html):<html> <body> <h1>mod_auth_kerb successfully authenticated!</h1> </body> </html><html> <body> <h1>mod_auth_kerb successfully authenticated!</h1> </body> </html>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Set Log Level
Optionally, set the log level for debugging inJWS_HOME/httpd/conf/httpd.conf.Start httpd
The the Installation Guide for details.Test Authentication
Test the authentication as follows:- Initiate Kerberos authentication for the test user
hnelson:kinit hnelson
$ kinit hnelsonCopy to Clipboard Copied! Toggle word wrap Toggle overflow - View the details for the test user
hnelson:klist
$ klistCopy to Clipboard Copied! Toggle word wrap Toggle overflow A result similar to the following appears:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Testing Apache HTTP Server Kerberos Authentication
Test Apache HTTP Server Kerberos authentication as follows:curl --negotiate -u : http://localhost/kerberostest/auth_kerb_page.html
$ curl --negotiate -u : http://localhost/kerberostest/auth_kerb_page.htmlCopy to Clipboard Copied! Toggle word wrap Toggle overflow If working correctly, the following result appears:<html> <body> <h1>mod_auth_kerb successfully authenticated!</h1> </body> </html><html> <body> <h1>mod_auth_kerb successfully authenticated!</h1> </body> </html>Copy to Clipboard Copied! Toggle word wrap Toggle overflow