kerberos-and-apache2-single-sign-on
| rev 4 | rev 5 | ||||
|---|---|---|---|---|---|
| 98 | ==================================================== | 98 | ==================================================== | ||
| 99 | 99 | ||||
| n | 100 | Copy keytab and adjust perms:: | n | 100 | Copy keytab and adjust perms |
| 101 | |||||
| 102 | .. code-block:: bash | ||||
| 101 | 103 | ||||
| 102 | cd /etc/httpd | 104 | cd /etc/httpd | ||
| 105 | chmod 640 testweb.foxhop.net.keytab | 107 | chmod 640 testweb.foxhop.net.keytab | ||
| 106 | 108 | ||||
| n | 107 | Test keytab:: | n | 109 | Test keytab |
| 110 | |||||
| 111 | .. code-block:: bash | ||||
| 108 | 112 | ||||
| 109 | # you should see a ticket | 113 | # you should see a ticket | ||
| 111 | klist | 115 | klist | ||
| 112 | 116 | ||||
| n | 113 | Install custom mod_auth_kerb RPM:: | n | 117 | Install custom mod_auth_kerb RPM |
| 118 | |||||
| 119 | .. code-block:: bash | ||||
| 114 | 120 | ||||
| 115 | rpm -Uvh /usr/local/src/mod_auth_kerb-5.4-0.x86_64.rpm | 121 | rpm -Uvh /usr/local/src/mod_auth_kerb-5.4-0.x86_64.rpm | ||
| 116 | 122 | ||||
| n | 117 | Configure Apache2 VirtualHost:: | n | 123 | Configure Apache2 VirtualHost |
| 118 | 124 | ||||
| n | n | 125 | |||
| 119 | vi /etc/httpd/conf.d/000-testweb.foxhop.net.conf:: | 126 | vi /etc/httpd/conf.d/000-testweb.foxhop.net.conf | ||
| 120 | 127 | ||||
| 128 | .. code-block:: apache | ||||
| 129 | #... | ||||
| 130 | |||||
| 121 | ################## | 131 | ################## | ||
| 122 | # Kerberos # | 132 | # Kerberos # | ||
| 132 | # Compiled custom RPM: /usr/local/src/mod_auth_kerb-5.4-0.x86_64.rpm | 142 | # Compiled custom RPM: /usr/local/src/mod_auth_kerb-5.4-0.x86_64.rpm | ||
| 133 | KrbLocalUserMapping on | 143 | KrbLocalUserMapping on | ||
| t | t | 144 | |||
| 145 | #... | ||||
| 146 | |||||
| rev 3 | rev 4 | ||||
|---|---|---|---|---|---|
| 68 | ==================================== | 68 | ==================================== | ||
| 69 | 69 | ||||
| n | 70 | Get a ticket and authenticate your user:: | n | 70 | Get a ticket and authenticate your user |
| 71 | |||||
| 72 | .. code-block:: cli | ||||
| 71 | 73 | ||||
| 72 | kinit foxhop-test@AD.FOXHOP.NET | 74 | kinit foxhop-test@AD.FOXHOP.NET | ||
| 74 | Password for foxhop@AD.FOXHOP.NET: | 76 | Password for foxhop@AD.FOXHOP.NET: | ||
| 75 | 77 | ||||
| n | 76 | View the ticket:: | n | 78 | View the ticket |
| 79 | |||||
| 80 | .. code-block:: cli | ||||
| 77 | 81 | ||||
| 78 | klist | 82 | klist | ||
| 82 | renew until 08/02/12 11:07:22 | 86 | renew until 08/02/12 11:07:22 | ||
| 83 | 87 | ||||
| t | 84 | Delete or destroy all tickets:: | t | 88 | Delete or destroy all tickets |
| 89 | |||||
| 90 | .. code-block:: cli | ||||
| 85 | 91 | ||||
| 86 | kdestroy | 92 | kdestroy | ||
| rev 2 | rev 3 | ||||
|---|---|---|---|---|---|
| 28 | =================================================== | 28 | =================================================== | ||
| 29 | 29 | ||||
| t | 30 | vim /etc/krb5.conf:: | t | 30 | vim /etc/krb5.conf |
| 31 | |||||
| 32 | .. code-block:: ini | ||||
| 31 | 33 | ||||
| 32 | [logging] | 34 | [logging] | ||
| rev 1 | rev 2 | ||||
|---|---|---|---|---|---|
| 15 | #. generate a keytab file | 15 | #. generate a keytab file | ||
| 16 | 16 | ||||
| t | 17 | :: | t | 17 | .. code-block:: txt |
| 18 | 18 | ||||
| 19 | # run on srv0103 | 19 | # run on srv0103 | ||
| empty | rev 1 | ||||
|---|---|---|---|---|---|
| t | t | 1 | Kerberos and Apache2 Single-Sign-on | ||
| 2 | ########################################### | ||||
| 3 | |||||
| 4 | **Record of steps taken when building testweb.foxhop.net** | ||||
| 5 | |||||
| 6 | .. contents:: | ||||
| 7 | |||||
| 8 | Prepare Service AD account and keytab | ||||
| 9 | =================================================== | ||||
| 10 | |||||
| 11 | Windows Domain admin required. | ||||
| 12 | |||||
| 13 | #. configure the testservice AD user account | ||||
| 14 | #. configure the testservice AD user password to sup3rs3cur3 | ||||
| 15 | #. generate a keytab file | ||||
| 16 | |||||
| 17 | :: | ||||
| 18 | |||||
| 19 | # run on srv0103 | ||||
| 20 | ktpass -out c:\temp\testweb.foxhop.net.keytab ^ | ||||
| 21 | -princ HTTP/testweb.foxhop.net@AD.FOXHOP.NET ^ | ||||
| 22 | -mapUser testservice@AD.FOXHOP.NET -mapOp set -pass sup3rs3cur3 ^ | ||||
| 23 | -crypto RC4-HMAC-NT -pType KRB5_NT_PRINCIPAL | ||||
| 24 | |||||
| 25 | Copy keytab to /tmp on linux webserver. | ||||
| 26 | |||||
| 27 | Configure Kerberos | ||||
| 28 | =================================================== | ||||
| 29 | |||||
| 30 | vim /etc/krb5.conf:: | ||||
| 31 | |||||
| 32 | [logging] | ||||
| 33 | default = FILE:/var/log/krb5libs.log | ||||
| 34 | kdc = FILE:/var/log/krb5kdc.log | ||||
| 35 | admin_server = FILE:/var/log/kadmind.log | ||||
| 36 | |||||
| 37 | [libdefaults] | ||||
| 38 | default_realm = AD.FOXHOP.NET | ||||
| 39 | dns_lookup_realm = true | ||||
| 40 | dns_lookup_kdc = true | ||||
| 41 | ticket_lifetime = 24h | ||||
| 42 | forwardable = yes | ||||
| 43 | |||||
| 44 | [realms] | ||||
| 45 | AD.FOXHOP.NET = { | ||||
| 46 | kdc = DS1.AD.FOXHOP.NET | ||||
| 47 | kdc = DS2.AD.FOXHOP.NET | ||||
| 48 | admin_server = DS1.AD.FOXHOP.NET | ||||
| 49 | default_domain = AD.FOXHOP.NET | ||||
| 50 | } | ||||
| 51 | |||||
| 52 | [domain_realm] | ||||
| 53 | .ad.foxhop.net = AD.FOXHOP.NET | ||||
| 54 | ad.foxhop.net = AD.FOXHOP.NET | ||||
| 55 | |||||
| 56 | [appdefaults] | ||||
| 57 | pam = { | ||||
| 58 | debug = false | ||||
| 59 | ticket_lifetime = 36000 | ||||
| 60 | renew_lifetime = 36000 | ||||
| 61 | forwardable = true | ||||
| 62 | krb4_convert = false | ||||
| 63 | } | ||||
| 64 | |||||
| 65 | Test Kerberos | ||||
| 66 | ==================================== | ||||
| 67 | |||||
| 68 | Get a ticket and authenticate your user:: | ||||
| 69 | |||||
| 70 | kinit foxhop-test@AD.FOXHOP.NET | ||||
| 71 | |||||
| 72 | Password for foxhop@AD.FOXHOP.NET: | ||||
| 73 | |||||
| 74 | View the ticket:: | ||||
| 75 | |||||
| 76 | klist | ||||
| 77 | |||||
| 78 | Valid starting Expires Service principal | ||||
| 79 | 08/01/12 11:07:22 08/01/12 21:07:27 krbtgt/AD.FOXHOP.NET@AD.FOXHOP.NET | ||||
| 80 | renew until 08/02/12 11:07:22 | ||||
| 81 | |||||
| 82 | Delete or destroy all tickets:: | ||||
| 83 | |||||
| 84 | kdestroy | ||||
| 85 | klist | ||||
| 86 | |||||
| 87 | Successfully configured kerberos | ||||
| 88 | |||||
| 89 | Configure Apache | ||||
| 90 | ==================================================== | ||||
| 91 | |||||
| 92 | Copy keytab and adjust perms:: | ||||
| 93 | |||||
| 94 | cd /etc/httpd | ||||
| 95 | cp /tmp/testweb.foxhop.net.keytab . | ||||
| 96 | chown root:apache testweb.foxhop.net.keytab | ||||
| 97 | chmod 640 testweb.foxhop.net.keytab | ||||
| 98 | |||||
| 99 | Test keytab:: | ||||
| 100 | |||||
| 101 | # you should see a ticket | ||||
| 102 | kinit -k -t /etc/httpd/testweb.foxhop.net.keytab HTTP/testweb.foxhop.net | ||||
| 103 | klist | ||||
| 104 | |||||
| 105 | Install custom mod_auth_kerb RPM:: | ||||
| 106 | |||||
| 107 | rpm -Uvh /usr/local/src/mod_auth_kerb-5.4-0.x86_64.rpm | ||||
| 108 | |||||
| 109 | Configure Apache2 VirtualHost:: | ||||
| 110 | |||||
| 111 | vi /etc/httpd/conf.d/000-testweb.foxhop.net.conf:: | ||||
| 112 | |||||
| 113 | ################## | ||||
| 114 | # Kerberos # | ||||
| 115 | ################## | ||||
| 116 | |||||
| 117 | KrbServiceName HTTP | ||||
| 118 | KrbAuthRealms AD.FOXHOP.NET | ||||
| 119 | Krb5Keytab /etc/httpd/testweb.foxhop.net.keytab | ||||
| 120 | KrbMethodNegotiate on | ||||
| 121 | KrbMethodK5Passwd on | ||||
| 122 | KrbSaveCredentials on | ||||
| 123 | # KrbLocalUserMapping removes @REALM | NA in RHEL5 | ||||
| 124 | # Compiled custom RPM: /usr/local/src/mod_auth_kerb-5.4-0.x86_64.rpm | ||||
| 125 | KrbLocalUserMapping on | ||||
Remarkbox