| 1 |
Welcome to kdcproxy! |
| 2 |
==================== |
| 3 |
|
| 4 |
This package contains a WSGI module for proxying KDC requests over HTTP by |
| 5 |
following the [MS-KKDCP] protocol. It aims to be simple to deploy, with |
| 6 |
minimal configuration. |
| 7 |
|
| 8 |
Deploying kdcproxy |
| 9 |
================== |
| 10 |
|
| 11 |
The kdcproxy module follows the standard WSGI protocol for deploying Python |
| 12 |
web applications. This makes configuration simple. Simply load up your favorite |
| 13 |
WSGI-enabled web server and point it to the module. For example, if you wish |
| 14 |
to use mod_wsgi, try something like this:: |
| 15 |
|
| 16 |
WSGIDaemonProcess kdcproxy processes=2 threads=15 maximum-requests=1000 \ |
| 17 |
display-name=%{GROUP} |
| 18 |
WSGIImportScript /usr/lib/python3.6/site-packages/kdcproxy/__init__.py \ |
| 19 |
process-group=kdcproxy application-group=kdcproxy |
| 20 |
WSGIScriptAlias /KdcProxy /usr/lib/python3.6/site-packages/kdcproxy/__init__.py |
| 21 |
WSGIScriptReloading Off |
| 22 |
|
| 23 |
<Location "/KdcProxy"> |
| 24 |
Satisfy Any |
| 25 |
Order Deny,Allow |
| 26 |
Allow from all |
| 27 |
WSGIProcessGroup kdcproxy |
| 28 |
WSGIApplicationGroup kdcproxy |
| 29 |
</Location> |
| 30 |
|
| 31 |
[MS-KKDCP] suggests /KdcProxy as end point. For more information, see the |
| 32 |
documentation of your WSGI server. |
| 33 |
|
| 34 |
|
| 35 |
Configuring kdcproxy |
| 36 |
==================== |
| 37 |
|
| 38 |
When kdcproxy receives a request, it needs to know where to proxy it to. This |
| 39 |
is the purpose of configuration: discovering where to send kerberos requests. |
| 40 |
|
| 41 |
One important note: where the underlying configuration does not specify TCP or |
| 42 |
UDP, both will be attempted. TCP will be attempted before UDP, hence setting |
| 43 |
`udp_preference_limit = 1` is not required for kdcproxy itself (though krb5 |
| 44 |
may still need it). This permits the use of longer timeouts and prevents |
| 45 |
possible lockouts when the KDC packets contain OTP token codes (which should |
| 46 |
preferably be sent to only one server). |
| 47 |
|
| 48 |
Automatic Configuration |
| 49 |
----------------------- |
| 50 |
By default, no configuration is necessary. In this case, kdcproxy will use |
| 51 |
REALM DNS SRV record lookups to determine remote KDC locations. |
| 52 |
|
| 53 |
Master Configuration File |
| 54 |
------------------------- |
| 55 |
If you wish to have more detailed configuration, the first place you can |
| 56 |
configure kdcproxy is the master configuration file. This file exists at the |
| 57 |
location specified in the environment variable KDCPROXY_CONFIG. If this |
| 58 |
variable is unspecified, the default locations are |
| 59 |
`/usr/local/etc/kdcproxy.conf` or `/etc/kdcproxy.conf`. This configuration |
| 60 |
file takes precedence over all other configuration modules. This file is an |
| 61 |
ini-style configuration with a special section **[global]**. Two parameters |
| 62 |
are available in this section: **configs** and **use_dns**. |
| 63 |
|
| 64 |
The **use_dns** allows you to enable or disable use of DNS SRV record lookups. |
| 65 |
|
| 66 |
The **configs** parameter allows you to load other configuration modules for |
| 67 |
finding configuration in other places. The configuration modules specified in |
| 68 |
here will have priority in the order listed. For instance, if you wished to |
| 69 |
read configuration from MIT libkrb5, you would set the following: |
| 70 |
|
| 71 |
[global] |
| 72 |
configs = mit |
| 73 |
|
| 74 |
Aside from the **[global]** section, you may also specify manual configuration |
| 75 |
for realms. In this case, each section is the name of the realm and the |
| 76 |
parameters are **kerberos** or **kpasswd**. These specify the locations of the |
| 77 |
remote servers for krb5 AS requests and kpasswd requests, respectively. For |
| 78 |
example: |
| 79 |
|
| 80 |
[EXAMPLE.COM] |
| 81 |
kerberos = kerberos+tcp://kdc.example.com:88 |
| 82 |
kpasswd = kpasswd+tcp://kpasswd.example.com:464 |
| 83 |
|
| 84 |
The realm configuration parameters may list multiple servers separated by a |
| 85 |
space. The order the realms are specified in will be respected by kdcproxy when |
| 86 |
forwarding requests. The port number is optional. Possible schemes are: |
| 87 |
|
| 88 |
* kerberos:// |
| 89 |
* kerberos+tcp:// |
| 90 |
* kerberos+udp:// |
| 91 |
* kpasswd:// |
| 92 |
* kpasswd+tcp:// |
| 93 |
* kpasswd+udp:// |
| 94 |
|
| 95 |
MIT libkrb5 |
| 96 |
----------- |
| 97 |
|
| 98 |
If you load the **mit** config module in the master configuration file, |
| 99 |
kdcproxy will also read the config using libkrb5 (usually /etc/krb5.conf). If |
| 100 |
this module is used, kdcproxy will respect the DNS settings from the |
| 101 |
**[libdefaults]** section and the realm configuration from the **[realms]** |
| 102 |
section. |
| 103 |
|
| 104 |
For more information, see the documentation for MIT's krb5.conf. |
| 105 |
|
| 106 |
Configuration reloading |
| 107 |
----------------------- |
| 108 |
|
| 109 |
kdcproxy reads its configurtion files when package is imported and a global |
| 110 |
WSGI application object is instantiated. For now kdcproxy does neither |
| 111 |
monitor its configuration files for changes nor supports runtime updates. You |
| 112 |
have to restart the WSGI process to make modification available. With Apache |
| 113 |
HTTP and mod_wsgi, a reload of the server also restarts all WSGI daemons. |
| 114 |
|
| 115 |
|
| 116 |
Configuring a client for kdcproxy |
| 117 |
================================= |
| 118 |
|
| 119 |
HTTPS proxy support is available since Kerberos 5 release 1.13. Some |
| 120 |
vendors have backported the feature to older versions of krb5, too. In order |
| 121 |
to use a HTTPS proxy, simply point the kdc and kpasswd options to the proxy URL like |
| 122 |
explained in [HTTPS proxy] configuration guide. Your ``/etc/krb5.conf`` may |
| 123 |
look like this:: |
| 124 |
|
| 125 |
[libdefaults] |
| 126 |
default_realm = EXAMPLE.COM |
| 127 |
|
| 128 |
[realms] |
| 129 |
EXAMPLE.COM = { |
| 130 |
http_anchors = FILE:/etc/krb5/cacert.pem |
| 131 |
kdc = https://kerberos.example.com/KdcProxy |
| 132 |
kpasswd_server = https://kerberos.example.com/KdcProxy |
| 133 |
} |
| 134 |
|
| 135 |
|
| 136 |
To debug the feature, set the environment variable ``KRB5_TRACE`` to |
| 137 |
``/dev/stdout``. When the feature is correctly configured, you should see |
| 138 |
two POST requests in the access log of the WSGI server and a line containing |
| 139 |
``Sending HTTPS request`` in the debug output of kinit:: |
| 140 |
|
| 141 |
$ env KRB5_TRACE=/dev/stdout kinit user |
| 142 |
[1037] 1431509096.26305: Getting initial credentials for [email protected] |
| 143 |
[1037] 1431509096.26669: Sending request (169 bytes) to EXAMPLE.COM |
| 144 |
[1037] 1431509096.26939: Resolving hostname kerberos.example.com |
| 145 |
[1037] 1431509096.34377: TLS certificate name matched "kerberos.example.com" |
| 146 |
[1037] 1431509096.38791: Sending HTTPS request to https 128.66.0.1:443 |
| 147 |
[1037] 1431509096.46387: Received answer (344 bytes) from https 128.66.0.1:443 |
| 148 |
[1037] 1431509096.46411: Terminating TCP connection to https 128.66.0.1:443 |
| 149 |
... |
| 150 |
|
| 151 |
If kinit still connects to port 88/TCP or port 88/UDP, then System Security |
| 152 |
Services Daemon's Kerberos locator plugin might override the settings in |
| 153 |
/etc/krb5.conf. With the environment variable ``SSSD_KRB5_LOCATOR_DEBUG=1``, |
| 154 |
kinit and sssd_krb5_locator_plugin print out additional debug information. To |
| 155 |
disable the KDC locator feature, edit ``/etc/sssd/sssd.conf`` and set |
| 156 |
``krb5_use_kdcinfo`` to False: |
| 157 |
|
| 158 |
[domain/example.com] |
| 159 |
krb5_use_kdcinfo = False |
| 160 |
|
| 161 |
Don't forget to restart SSSD! |
| 162 |
|
| 163 |
[MS-KKDCP]: http://msdn.microsoft.com/en-us/library/hh553774.aspx |
| 164 |
|
| 165 |
[HTTPS Proxy]: http://web.mit.edu/kerberos/krb5-current/doc/admin/https.html |