Apache HTTP Server Version 2.2

Available Languages: en
| Description: | WebAuth V3 WebKDC module |
|---|---|
| Status: | |
| Module Identifier: | webkdc_module |
| Source File: | mod_webkdc.c |
This module implements the central authentication server for the WebAuth V3 protocol, also known as the WebKDC.
The WebKDC authenticates the user based on information passed by the weblogin service (which should generally run on the same system) and generates authentication tokens both for the user's cookie cache to support single sign-on and to send to application servers to authenticate the user. It is designed to store as little state as possible, using the browser cookie cache as the repository for (encrypted) authentication tokens and ticket caches.
Further details are provided in the WebAuth documentation.
WebKdcDebug
WebKdcKeyring
WebKdcKeyringAutoUpdate
WebKdcKeyringKeyLifetime
WebKdcKeytab
WebKdcLocalRealms
WebKdcPermittedRealms
WebKdcProxyTokenLifetime
WebKdcServiceTokenLifetime
WebKdcTokenAcl
WebkdcTokenMaxTTL
Setting up the WebKDC
Minimal Config File
WebKDC Logging
Setting up Multiple WebKDCsThe minimal configuration for the WebKDC requires two things: a keytab
for the Kerberos principal used by the WebKDC to authenticate requests
from application servers, and the token.acl file that
specifies what tokens application servers are permitted to request.
The keytab must be a Kerberos V5 keytab for the principal referenced in
the WebAuthWebKdcPrincipal configuration directive
on the application servers. How to obtain a keytab will depend on one's
local Kerberos infrastructure; it may be via kadmin or via
some other local interface.
For information about the token.acl file, see the
WebKdcTokenAcl
documentation below.
Finally, the one piece of state that the WebKDC must maintain is its
local keyring, which holds the AES keys that it uses to encrypt and
decrypt tokens. This keyring can either be generated and updated
automatically (the default) or managed externally using
wa_keyring. See
WebKdcKeyringAutoUpdate
for more information.
The WebKDC must get a URL to itself on the host where it is running.
By convention, /webkdc-service is used. This URL must be
only accessible via SSL, for security reasons.
The following example shows the minimum config file required to
configure and use mod_webkdc.
LoadModule webkdc_module modules/mod_webkdc.so
WebKdcServiceTokenLifetime 30d
WebKdcKeyring conf/webkdc/keyring
WebKdcKeytab conf/webkdc/keytab
WebKdcTokenAcl conf/webkdc/token.acl
<VirtualHost _default_:443>
<Location /webkdc-service>
SetHandler webkdc
</Location>
</VirtualHost>
All commands received by the WebKDC and their results are logged to the Apache error log with a log level of "notice". These log messages always begin with the string "mod_webkdc: event=" followed by the event, which is one of the following:
A request for a service, id, proxy, or cred token. You will see
this action most frequently from WebAuth web servers acquiring new
service tokens for use later when redirecting users to the WebLogin
server and decoding the response. When delegating user credentials to
WebAuth application servers, those servers will send a
getTokens request to the WebKDC to obtain those delegated
credentials.
A request for an id or proxy token for a user. A proxy token for the WebKDC itself will also be returned for use with future requests by the same user. This call will normally only be done by the WebLogin component of the WebKDC service; while the call is available to any client, clients wishing to bootstrap WebAuth cookies on their own should use the much simpler webkdcProxyToken call instead.
A request for a WebKDC proxy token (the token contained in the WebAuth single sign-on cookie) given a Kerberos authenticator. This can be used by clients to bootstrap a WebAuth single sign-on cookie without having to visit the WebLogin server in a browser.
Given a WebKDC proxy token, returns various metadata about it, such as its expiration time.
Those who are familiar with the WebAuth protocol will recognize that the four events logged are the four XML elements that the WebKDC protocol permits. (Other errors, such as unknown commands, are of course also logged.)
Following the event will be additional key/value pairs in the form key=value. The possible keys are:
Only for requestToken requests, this contains the
client IP address as indicated by the WebLogin server. If the
WebLogin server didn't include the client IP address in the request,
the value will be empty. Please note that the WebKDC does not
authenticate this information, only records whatever was passed in by
the WebLogin server, which means that if from is not
127.0.0.1 (meaning that the requestToken request didn't
come from the WebLogin server), the value of this key should not be
trusted.
The error code for a protocol-level error. The presence of this key means that some failure occurred in the course of parsing the XML document and therefore no action was taken in the WebKDC.
The error message corresponding to the error code from a
errorCode key.
The IP address from which the request came. For
requestToken in the recommended configuration of running
WebLogin servers on the same host as the WebKDC, this will normally
always be 127.0.0.1, but will be more interesting for the other
events.
The login error code, only included for requestToken.
If this is 0, the call was successful. Otherwise, it contains the
error code.
If lec is non-zero in requestToken, this
contains the error message corresponding to that error code.
Any request options set by the WebAuth server. The most common value here is "fa", indicating that the WebAuth server requested forced password authentication even if the user already had single sign-on credentials. For more details on the possible values, see the WebAuth protocol specification.
The returned token type from a requestToken request.
Normally this will be "id" for an id token, but may be another token
type depending on what the WebAuth server asked for.
For getTokens and requestToken, this will
contain the identifier of the requesting server (in the case of
requestToken, this is the server that sent the user to
WebLogin).
The type of token acquired by a getTokens call.
The user being authenticated. This will normally be the username
portion of a Kerberos identity, if it is known, for
requestToken. For protocol-level errors, it often will
be unknown (because the protocol failed before the username was
established) and will instead be the string "<unknown>". For
getTokens, it will be the user the tokens are for (the
same as server in the most common case of acquiring
service tokens).
WebAuth V3 was designed so that it would be fairly easy to setup multiple WebKDCs for load balancing and redundancy. There are three pieces of information that need to be shared between WebKDC servers in order to achieve this:
All the files should be securely transferred from the master to the
slave or slaves using a program like scp that encrypts the
file contents during the transfer.
By convention, one of the WebKDC's should be designated as the "master" and other WebKDC's should be designated as "slaves." These files should only be updated on the master and pushed manually or automatically to the slaves.
The token ACL file is specified using the
WebKdcTokenAcl
directive. This file should be maintained on the "master" WebKDC, and
copied to other WebKDCs.
The Kerberos keytab file is specified using the
WebKdcKeytab
directive. This is a standard Kerberos V5 keytab file containing the
principal used by WebAuth servers to initially communicate with the
WebKDC. This is a binary file that should be kept consistent across all
the WebKDC servers. Normally this means that you will need to download it
once and then copy it between systems, since Kerberos V5 generally changes
the key of a principal when downloading a new keytab for it.
The WebKDC keyring file is specified using the
WebKdcKeyring
directive. This file contains the WebKDCs private AES keys. If you are
running multiple WebKDCs, you must turn off automatic updating of the
WebKDCs keyring file on restarts. This is done using the
WebKdcKeyringAutoUpdate
directive:
WebKdcKeyringAutoUpdate off
Once auto update is turned off, the keyring file will not be
automatically updated, and can be manually updated and then copied between
the servers. The keys in the keyring file still need to be changed
periodically using the wa_keyring command. This command
would be run on the keyring file on the master, and then the new keyring
should be copied to the slaves. For example, to generate a new post-dated
key in the file called "keyring" you should do the following:
wa_keyring -f ./keyring add 2d
That example generates a new key that will be valid in seven days. Any existing keys in the keyring file are left as-is so outstanding tokens continue to work. The new keyring file can then safely be distributed to the slave WebKDCs. Then, the WebKDC must be restarted to pick up the new key.
Old keys in the keyring file should also periodically be removed. This
should be done using wa_keyring and the gc
command:
wa_keyring -f ./keyring gc -60d
This command would remove any key older than 90 days. The time
interval that you pass to the gc command must be older than
the service token lifetime as specified with
WebKdcServiceTokenLifetime.
The recommendation is to make it about twice as long.
To summarize, for each WebKDC (master and slaves), you'd want the following directives:
LoadModule webkdc_module modules/mod_webkdc.so
WebKdcServiceTokenLifetime 30d
WebKdcKeyring conf/webkdc/keyring
WebKdcKeytab conf/webkdc/keytab
WebKdcTokenAcl conf/webkdc/token.acl
WebKdcKeyringAutoUpdate off
<VirtualHost _default_:443>
<Location /webkdc-service>
SetHandler webkdc
</Location>
</VirtualHost>
Periodically (once a month should be reasonable), you'd want to generate a new key, remove old keys, and then update the keyring file on the slaves using a script like this:
wa_keyring -f conf/webkdc/keyring add 2d
wa_keyring -f conf/webkdc/keyring gc -60d
apache2ctl graceful
for host in slave1 slave2 ; do
scp conf/webkdc/keyring $host:/path/to/conf/webkdc/keyring
ssh $host apache2ctl graceful
done
If the servers are restarted regularly (such as for nightly log
rotation), you can omit the apache2ctl graceful restart and
just let that restart pick up the new keys. The reason for post-dating
the key is to make sure that all of the servers pick it up before it
becomes valid and is used in service tokens.
| Description: | Turn on extra debugging in the Apache error log |
|---|---|
| Syntax: | WebKdcDebug on|off |
| Default: | WebKdcDebug off |
| Context: | server config, virtual host |
| Status: | |
| Module: | mod_webkdc |
Whether or not to log additional debugging messages to the Apache server log.
WebKdcDebug on
| Description: | Name of the file containing the WebKDC's keyring |
|---|---|
| Syntax: | WebKdcKeyring path |
| Default: | (none) |
| Context: | server config, virtual host |
| Status: | |
| Module: | mod_webkdc |
This is the name of the file containing the WebKDC's keyring, which
stores the server's private AES keys. The keyring file is read on startup
and cached for the duration of an Apache child process, so if it is
changed by an external process (wa_keyring, for instance),
Apache must be told to reload configuration files in order to pick up the
change.
If the path is not absolute, it will considered relative to
ServerRoot.
This directive must be set.
WebKdcKeyring conf/webkdc/keyring
| Description: | Whether or not to auto-update the keyring file |
|---|---|
| Syntax: | WebKdcKeyringAutoUpdate on|off |
| Default: | WebKdcKeyringAutoUpdate on |
| Context: | server config, virtual host |
| Status: | |
| Module: | mod_webkdc |
This directive controls whether or not we auto-update the keyring file. This includes creating it if it doesn't exist, generating a new key before the old key expires, and periodically garbage collecting old keys. Note that auto updating only occurs on server startup and restarts.
This directive should be turned off if multiple servers are sharing the same keyring file, so that the keyring file can be manually updated. That too may eventually be automated.
WebKdcKeyringAutoUpdate off
| Description: | Lifetime of keys in the keyring if we auto-update |
|---|---|
| Syntax: | WebKdcKeyringKeyLifetime nnnn[s|m|h|d|w] |
| Default: | WebKdcKeyringKeyLifetime 30d |
| Context: | server config, virtual host |
| Status: | |
| Module: | mod_webkdc |
This directive controls how long keys we automatically create for the
keyring are valid. Keys will be valid from the time they are created
until the lifetime is reached. It is equivalent to the time specified to
wa_keyring gc, except that the latter expects a negative
time. Note that key lifetime is only checked on server startup and
restarts.
This directive is only consulted if
WebKdcKeyringAutoUpdate
is enabled.
The units for the time are specified by appending a single letter.
This letter may be one of s, m, h,
d, or w, which correspond to seconds, minutes,
hours, days, and weeks, respectively.
WebKdcKeyringKeyLifetime 60d
| Description: | Name of the Kerberos V5 keytab file |
|---|---|
| Syntax: | WebKdcKeytab path [principal] |
| Default: | (none) |
| Context: | server config, virtual host |
| Status: | |
| Module: | mod_webkdc |
This is the name of the Kerberos V5 keytab file, used by the WebKDC to authenticate initial requests from application servers. The principal is optional and can be used to specify a particular principal in a keytab file that contains several. If it is not specified, then the first principal in the keytab file be used.
If the path is not absolute, it will considered relative to
ServerRoot.
This directive must be set.
WebKdcKeytab conf/webkdc/keytab service/webkdc
| Description: | Realms to be stripped from authenticated identities |
|---|---|
| Syntax: | WebKdcLocalRealms none|local|realm ... |
| Default: | WebKdcLocalRealms local |
| Context: | server config, virtual host |
| Status: | |
| Module: | mod_webkdc |
This directive controls stripping realm qualifications from the
authenticated identity of a WebAuth user. The realm is defined as the
portion of the authenticated identity following the first unescaped
@ in the identity.
If set to none, no transformations are done and the
authenticated identity is always passed in its fully-qualified form. This
is probably the best option for sites that use multiple local Kerberos
realms where none is the logical default realm.
If set to local (the default), the authenticated identity
will be passed to the krb5_aname_to_localname function on the WebKDC.
Normally, this will strip off the realm if it matches the default Kerberos
realm of the WebKDC (not the requesting WebAuth Application Server) and
otherwise leave it; however, more complex canonicalization rules may be
specified in the /etc/krb5.conf file on the WebKDC.
Otherwise, the space-separated arguments to this directive are taken to
be realms that should be stripped from the authenticated identity. The
realms must be given in escaped form in the WebKDC configuration (for
example, any @ in a realm must be given as
\@).
The canonicalization done is that specified on the WebKDC, not in the WebAuth Application Server. There is no way to perform different authenticated identity canonicalization on different WebAuth Application Servers using the same WebKDC.
# Strip stanford.edu and WIN.STANFORD.EDU but leave other realms
WebKdcLocalRealms stanford.edu WIN.STANFORD.EDU
| Description: | List of permitted authentication realms |
|---|---|
| Syntax: | WebKdcPermittedRealms realm ... |
| Default: | (none) |
| Context: | server config, virtual host |
| Status: | |
| Module: | mod_webkdc |
By default, the WebKDC allows authentication via any realm with which
there is cross-realm trust. If this directive is given, it restricts
authentication to principals in one of the realms listed in this
directive. The realms must be given in escaped form in the WebKDC
configuration (for example, any @ in a realm must be given as
\@).
WebKdcPermittedRealms stanford.edu WIN.STANFORD.EDU
| Description: | Lifetime of webkdc-proxy tokens we create |
|---|---|
| Syntax: | WebKdcProxyTokenLifetime nnnn[s|m|h|d|w] |
| Default: | (lifetime of underlying proxied-credential) |
| Context: | server config, virtual host |
| Status: | |
| Module: | mod_webkdc |
This directive controls the lifetime of the webkdc-proxy token (the main single-sign-on cookie containing the user's proxied credentials). If not specified, the lifetime time used is the expiration time of the underlying credential (i.e., the lifetime of the Kerberos TGT for example).
Tokens created with a webkdc-proxy token (id, proxy, cred) will have the same expiration time as the webkdc-proxy token, so this directive also controls the lifetime of those tokens as well.
The units for the time are specified by appending a single letter.
This letter may be one of s, m, h,
d, or w, which correspond to seconds, minutes,
hours, days, and weeks, respectively.
The upper bound of the webkdc-proxy token is always bounded by the expiration time of the underlying proxied credential. For example, if the Kerberos V5 TGT expires in 25 hours, then the WebKDC will not create a webkdc-proxy token with a lifetime greater then 25 hours, even if this directive is set higher then 25 hours.
# create a webkdc-proxy token valid for 2 hours
WebKdcProxyTokenLifetime 2h
| Description: | Lifetime of webkdc-service tokens we create |
|---|---|
| Syntax: | WebKdcServiceTokenLifetime nnnn[s|m|h|d|w] |
| Default: | (none) |
| Context: | server config, virtual host |
| Status: | |
| Module: | mod_webkdc |
This directive controls the lifetime of the webkdc-service token we create. This controls how often a WebAuth application server needs to re-authenticate with the WebKDC to get a new service token. The lifetime of the service token (and the webkdc-proxy-token) control how often the WebKDC can change its private key, and how long it should retain the previous key for.
A reasonable setting for this directive is 30 days, with the private key of the WebKDC being changed every 60 days or so, keeping the previous WebKDC private key around for 30 days after it expires.
The units for the time are specified by appending a single letter.
This letter may be one of s, m, h,
d, or w, which correspond to seconds, minutes,
hours, days, and weeks, respectively.
This directive must be set.
# create a webkdc-service token valid for 30 days
WebKdcServiceTokenLifetime 30d
| Description: | Name of the file containing the token ACL |
|---|---|
| Syntax: | WebKdcTokenAcl path |
| Default: | (none) |
| Context: | server config, virtual host |
| Status: | |
| Module: | mod_webkdc |
This is the name of the file containing the ACL that controls access to
who can request tokens. Each line that isn't blank or starting with
# specifies a type of token that the given Kerberos principal
may request.
The first space-separated field of each line is an identifier (at
present, always a Kerberos principal) which may contain * as
a wildcard. The second field is either id, saying that this
Kerberos principal may request id tokens (giving the authenticated
identity of the user), or cred, saying that this principal
may request credentials allowing it to act as the user. For type
cred, there are two more fields, one giving the type (always
krb5 for now) and the other giving the Kerberos service
ticket that may be requested.
# allow anyone with a webauth keytab to request id tokens krb5:webauth/*@stanford.edu id # allow shred to request a service/foobar credential krb5:webauth/shred.stanford.edu@stanford.edu cred krb5 service/foobar@stanford.edu
The krb5: prefix on the subject is used to signify that
the named principal was authenticated using Kerberos. Currently, krb5 is
the only supported mechanism for WebAuth servers to initially authenticate
with the WebKDC. Other types of authentication maybe supported in the
future.
If the path is not absolute, it will be considered relative to
ServerRoot.
This directive must be set.
The ACL file is cached in memory, but will be re-read automatically if the modification timestamp on the file changes.
WebKdcTokenAcl conf/webkdc/token.acl
| Description: | How old tokens may be before they're considered stale |
|---|---|
| Syntax: | WebKdcTokenMaxTTL nnnn[s|m|h|d|w] |
| Default: | WebKdcTokenMaxTTL 300s |
| Context: | server config, virtual host |
| Status: | |
| Module: | mod_webkdc |
This directive sets how old tokens may be before they're considered stale. It is used to help prevent tokens from being replayed and to ignore old tokens in cookies, URLs, etc. It is important to keep the clocks of the web application servers and the WebKDC synchronized; if they aren't, all tokens from that application server may be considered stale.
In practice, this setting will also double as a limit on how long a user may take while logging in via weblogin. If they take longer than this TTL, the request token will have timed out by the time they authenticate.
The units for the TTL are specified by appending a single letter. This
letter may be one of s, m, h,
d, or w, which correspond to seconds, minutes,
hours, days, and weeks, respectively.
# ten minute TTL
WebKdcTokenMaxTTL 10m
Available Languages: en