• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/workflows/H05-Aug-2020-5554

ci/H05-Aug-2020-7455

contrib/H05-Aug-2020-218134

example/H05-Aug-2020-21

src/H05-Aug-2020-14,27310,324

tests/H03-May-2022-1,8811,471

.gitignoreH A D05-Aug-2020290 3231

AUTHORSH A D05-Aug-202029 21

COPYINGH A D05-Aug-20201.1 KiB2418

ChangeLogH A D05-Aug-20200

Makefile.amH A D05-Aug-2020308 159

NEWSH A D05-Aug-20200

READMEH A D05-Aug-202019.9 KiB561398

README.mdH A D05-Aug-202019.9 KiB561398

configure.acH A D05-Aug-20204.5 KiB134113

version.m4H A D05-Aug-202037 21

README

1mod_auth_gssapi
2===============
3
4Intro
5-----
6
7This module has been built as a replacement for the aging mod_auth_kerb.
8Its aim is to use only GSSAPI calls and be as much as possible agnostic
9of the actual mechanism used.
10
11Dependencies
12------------
13
14A modern version of MIT's Krb5 distribution or any GSSAPI implementation
15that supports the [credential store
16extension](http://k5wiki.kerberos.org/wiki/Projects/Credential_Store_extensions)
17is necessary to achieve full functionality. Reduced functionality is
18provided without these extensions.
19
20    MIT krb5 (>=1.11)
21    Apache httpd (>=2.4.11)
22
23### Tests
24
25To run tests, you also need:
26
27* The Kerberos 5 Key-Distribution-Center (`krb5-kdc` package on Debian,
28  `krb5-server` on Fedora)
29* Packages `mod_session`, `krb5-workstation`, `python-requests-gssapi`,
30  and `python-gssapi` on Fedora
31* Some tests require `krb5-pkinit` package on fedora and krb5 >= 1.15.
32* [nss_wrapper](https://cwrap.org/nss_wrapper.html), packaged in Fedora
33* [socket_wrapper](https://cwrap.org/socket_wrapper.html), packaged in Fedora
34
35Installation
36------------
37
38    autoreconf -fi
39    ./configure
40    make
41    make install
42
43
44Configuration
45-------------
46
47Apache authentication modules are usually configured per location, see the
48[mod_authn_core](https://httpd.apache.org/docs/2.4/mod/mod_authn_core.html)
49documentation for the common directives
50
51### Basic configuration
52
53The simplest configuration scheme specifies just one directive, which is the
54location of the keytab.
55
56#### Example
57    <Location /private>
58        AuthType GSSAPI
59        AuthName "GSSAPI Single Sign On Login"
60        GssapiCredStore keytab:/etc/httpd.keytab
61        Require valid-user
62    </Location>
63
64Your Apache server need read access to the keytab configured.
65If your Kerberos implementation does not support the credential store
66extensions you can also simply set the KRB5_KTNAME environment variable in the
67Apache init script and skip the GssapiCredStore option completely.
68
69
70Environment Variables
71---------------------
72
73(Note: these are not process environment variables, but rather Apache
74environment variables, as described
75[in the apache docs](https://httpd.apache.org/docs/2.4/env.html).)
76
77### gssapi-no-negotiate
78
79This environment variable is used to suppress setting Negotiate headers.  Not
80sending these headers is useful to work around browsers that do not handle
81them properly (and incorrectly show authentication popups to users).
82
83#### Example
84
85For instance, to suppress negotiation on Windows browsers, one could set:
86
87    BrowserMatch Windows gssapi-no-negotiate
88
89
90
91Configuration Directives
92------------------------
93
94### Alphabetic List of Directives
95
96[GssapiAcceptorName](#gssapiacceptorname)<br>
97[GssapiAllowedMech](#gssapiallowedmech)<br>
98[GssapiBasicAuth](#gssapibasicauth)<br>
99[GssapiBasicAuthMech](#gssapibasicauthmech)<br>
100[GssapiBasicTicketTimeout](#gssapibasicticketvalidity)<br>
101[GssapiConnectionBound](#gssapiconnectionbound)<br>
102[GssapiCredStore](#gssapicredstore)<br>
103[GssapiDelegCcacheDir](#gssapidelegccachedir)<br>
104[GssapiDelegCcacheEnvVar](#gssapidelegccacheenvvar)<br>
105[GssapiDelegCcachePerms](#gssapidelegccacheperms)<br>
106[GssapiDelegCcacheUnique](#gssapidelegccacheunique)<br>
107[GssapiImpersonate](#gssapiimpersonate)<br>
108[GssapiLocalName](#gssapilocalname)<br>
109[GssapiNameAttributes](#gssapinameattributes)<br>
110[GssapiNegotiateOnce](#gssapinegotiateonce)<br>
111[GssapiPublishErrors](#gssapipublisherrors)<br>
112[GssapiPublishMech](#gssapipublishmech)<br>
113[GssapiRequiredNameAttributes](#gssapirequirednameattributes)<br>
114[GssapiSessionKey](#gssapisessionkey)<br>
115[GssapiSignalPersistentAuth](#gssapisignalpersistentauth)<br>
116[GssapiSSLonly](#gssapisslonly)<br>
117[GssapiUseS4U2Proxy](#gssapiuses4u2proxy)<br>
118[GssapiUseSessions](#gssapiusesessions)<br>
119
120
121### GssapiSSLonly
122
123Forces the authentication attempt to fail if the connection is not being
124established over TLS. The default is "Off", which could be helpful in a
125local development environment, but we do not recommend for production
126deployments. A passive adversary could listen to the plaintext HTTP connection
127to observe any private information in the client's request or server's
128response (for example: the full HTTP response body, or any web application
129session cookies, etc). You should only use mod_auth_gssapi with HTTPS in
130production, so we recommend that you *enable* this setting in production for
131added protection.
132
133- **Enable with:** GssapiSSLonly On
134- **Default:** GssapiSSLonly Off
135
136
137### GssapiLocalName
138
139Tries to map the client principal to a local name using the gss_localname()
140call. This requires configuration in the /etc/krb5.conf file in order to allow
141proper mapping for principals not in the default realm (for example a user
142coming from a trusted realm).
143See the 'auth_to_local' option in the [realms] section of krb5.conf(5)
144
145When `GssapiLocalName` is set to `on`, mod_auth_gssapi will set the
146`REMOTE_USER` variable to the resolved user name. mod_auth_gssapi will also
147set the `GSS_NAME` variable to the complete client principal name.
148
149- **Enable with:** GssapiLocalName On
150- **Default:** GssapiLocalName Off
151
152
153### GssapiConnectionBound
154
155This option is not needed for krb5 or basic auth in almost all cases.  It
156incurs overhead, so leaving it off is recommended.
157
158For NTLMSSP (and any other GSS mechanisms that require more than one
159round-trip to complete authentication), it is necessary to bind to the
160authentication to the connection in order to keep the state between
161round-trips.  With this option, incomplete context are stored in the
162connection and retrieved on the next request for continuation.
163
164- **Enable with:** GssapiConnectionBound On
165- **Default:** GssapiConnectionBound Off
166
167
168### GssapiSignalPersistentAuth
169
170For clients that make use of Persistent-Auth header, send the header according
171to GssapiConnectionBound setting.
172
173- **Enable with:** GssapiSignalPersistentAuth On
174- **Default:** GssapiSignalPersistentAuth Off
175
176
177### GssapiUseSessions
178
179In order to avoid constant and costly re-authentication attempts for every
180request, mod_auth_gssapi offers a cookie based session method to maintain
181authentication across multiple requests. GSSAPI uses the mod_sessions module
182to handle cookies so that module needs to be activated and configured.
183GSSAPI uses a secured (encrypted + MAC-ed) payload to maintain state in the
184session cookie. The session cookie lifetime depends on the lifetime of the
185GSSAPI session established at authentication.
186**NOTE**: It is important to correctly set the SessionCookieName option.
187See the
188[mod_sessions](http://httpd.apache.org/docs/current/mod/mod_session.html)
189documentation for more information.
190
191- **Enable with:** GssapiUseSessions On
192- **Default:** GssapiUseSessions Off
193
194#### Example
195    GssapiUseSessions On
196    Session On
197    SessionCookieName gssapi_session path=/private;httponly;secure;
198
199
200### GssapiSessionKey
201
202When GssapiUseSessions is enabled a key use to encrypt and MAC the session
203data will be automatically generated at startup, this means session data will
204become unreadable if the server is restarted or multiple servers are used and
205the client is load balanced from one to another. To obviate this problem the
206admin can choose to install a permanent key in the configuration so that
207session data remain accessible after a restart or by multiple servers
208sharing the same key.
209
210Two schemes to read persistent keys are provided, 'key' and 'file'.
211
212- 'key'
213    A key is read from the configuration directive.
214    The key must be a base64 encoded raw key of 32 bytes of length.
215
216- 'file'
217    A file on the file system is used to store the key. If the file does not
218    exists one is created with a randomly generated key during the first
219    execution.
220
221
222#### Examples
223    GssapiSessionKey key:VGhpcyBpcyBhIDMyIGJ5dGUgbG9uZyBzZWNyZXQhISE=
224    GssapiSessionKey file:/var/lib/httpd/secrets/session.key
225
226
227### GssapiCredStore
228
229The GssapiCredStore option allows to specify multiple credential related
230options like keytab location, client_keytab location, ccache location etc.
231
232#### Example
233    GssapiCredStore keytab:/etc/httpd.keytab
234    GssapiCredStore ccache:FILE:/var/run/httpd/krb5ccache
235
236
237### GssapiDelegCcacheDir
238
239If delegation of credentials is desired credentials can be exported in a
240private directory accessible by the Apache process.
241The delegated credentials will be stored in a file named after the client
242principal and a request environment variable (`KRB5CCNAME` by default) will be
243set to point to that file.
244
245#### Example
246    GssapiDelegCcacheDir /var/run/httpd/clientcaches
247
248A user foo@EXAMPLE.COM delegating its credentials would cause the server to
249create a ccache file named /var/run/httpd/clientcaches/foo@EXAMPLE.COM
250
251
252### GssapiDelegCcacheUnique
253
254Enables using unique ccache names for delegation.  ccache files will be placed
255in GssapiDelegCcacheDir and named using the principal and a six-digit unique
256suffix.
257
258**Note:** Consuming application must delete the ccache otherwise it will
259litter the filesystem if sessions are used.  An example sweeper can be found
260in the contrib directory.  If using with gssproxy, see note at the top of that
261file.
262
263- **Enable with:** GssapiDelegCcacheUnique On
264- **Default:** GssapiDelegCcacheUnique Off
265
266
267### GssapiDelegCcacheEnvVar
268
269Set the name of the request environment variable that will receive the
270credential cache name.  If unspecified, defaults to `KRB5CCNAME`.
271
272#### Example
273    GssapiDelegCcacheEnvVar AJP_KRB5CCNAME
274
275
276### GssapiUseS4U2Proxy
277
278Enables the use of the s4u2Proxy Kerberos extension also known as
279[constrained delegation](https://ssimo.org/blog/id_011.html)
280This option allows an application running within Apache to operate on
281behalf of the user against other servers by using the provided ticket
282(subject to KDC authorization).
283This options requires GssapiDelegCcacheDir to be set. The ccache will be
284populated with the user's provided ticket which is later used as evidence
285ticket by the application.
286
287**Note:** This flag has no effect when Basic-Auth is used since user's
288credentials are delegated anyway when GssapiDelegCcacheDir is set.
289
290#### Example
291    GssapiUseS4U2Proxy On
292    GssapiCredStore keytab:/etc/httpd.keytab
293    GssapiCredStore client_keytab:/etc/httpd.keytab
294    GssapiCredStore ccache:FILE:/var/run/httpd/krb5ccache
295    GssapiDelegCcacheDir /var/run/httpd/clientcaches
296
297**NOTE:** The client keytab is necessary to allow GSSAPI to initiate via keytab
298on its own. If not present an external mechanism needs to kinit with the
299keytab and store a ccache in the configured ccache file.
300
301
302### GssapiBasicAuth
303
304Allows the use of Basic Auth in conjunction with Negotiate.
305If the browser fails to use Negotiate it will instead fallback to Basic and
306the username and password will be used to try to acquire credentials in the
307module via GSSAPI. If credentials are acquired successfully then they are
308validated against the server's keytab.
309
310- **Enable with:** GssapiBasicAuth On
311- **Default:** GssapiBasicAuth Off
312
313#### Example
314    <Location /gssapi>
315      AuthType GSSAPI
316      AuthName "Login"
317      GssapiBasicAuth On
318      GssapiCredStore keytab:/etc/httpd/http.keytab
319      Require valid-user
320    </Location>
321
322
323### GssapiAllowedMech
324
325List of allowed mechanisms. This is useful to restrict the mechanism that
326can be used when credentials for multiple mechanisms are available.
327By default no mechanism is set, this means all locally available mechanisms
328are allowed.  The recognized mechanism names are: krb5, iakerb, ntlmssp
329
330#### Example
331    GssapiAllowedMech krb5
332    GssapiAllowedMech ntlmssp
333
334
335### GssapiBasicAuthMech
336
337List of mechanisms against which Basic Auth is attempted. This is useful to
338restrict the mechanisms that can be used to attempt password auth.
339By default no mechanism is set, this means all locally available mechanisms
340are allowed, unless GssapiAllowedMech is set, in which case those are used.
341GssapiBasicAuthMech always takes precedence over GssapiAllowedMech.
342The recognized mechanism names are: krb5, iakerb, ntlmssp
343
344#### Example
345    GssapiBasicAuthMech krb5
346
347
348### GssapiNameAttributes
349
350Enables the module to source Name Attributes from the client name
351(authorization data associated with the established context) and exposes them
352as environment variables.
353
354Value format: ENV_VAR_NAME ATTRIBUTE_NAME
355
356This option can be specified multiple times, once for each attribute to expose.
357The Special value "json" is used to expose all attributes in a json formatted
358string via the special environment variable GSS_NAME_ATTRS_JSON
359The environment variable GSS_NAME_ATTR_ERROR is set with the Gssapi returned
360error string in case the inquire name function fails to retrieve attributes,
361and with the string "0 attributes found", if no attributes are set.
362
363**Note**: These variables are NOT saved in the session data stored in the
364cookie so they are available only on the first authenticated request when
365GssapiUseSessions is used.
366
367**Note:** It is recommended but not required to use only capital letters and
368underscores for environment variable names.
369
370#### Example
371    GssapiNameAttributes json
372    GssapiNameAttributes RADIUS_NAME urn:ietf:params:gss:radius-attribute_1
373
374
375### GssapiRequiredNameAttributes
376
377This option allows specifying one or more Name Attributes that the client must
378possess in order to be authorized to access the location. The required Name
379Attributes are specified by name=value pairs (name being the ATTRIBUTE_NAME as
380mentioned above, and value being a Null-terminated string. Alternately, if a
381Name Attribute produces binary values or is expected to contain a space
382character, the desired value can be specified by a ':=' and a base64-encoded
383string).
384
385A combination of Name Attributes (including multiple values from a single Name
386Attribute type) can be specified with an expression that separates each
387name=value pair with the "and" or "or" logical operators.  Operator precedence
388can be influenced by parenthesized statements.
389
390	foo=bar
391	foo:=YmFy
392	foo=bar or foo=baz
393	foo=bar and foo=baz and bar=baz
394	(foo=bar and foo=baz) or bar:=YmFy
395
396If the Name Attributes associated with the client do not satisfy the given
397expression, or no Name Attributes are present, a 403 response is returned.
398
399#### Example
400    GssapiRequiredNameAttributes "auth-indicators=high"
401    GssapiRequiredNameAttributes "auth-indicators=high or other-attr=foo"
402    GssapiRequiredNameAttributes "((auth-indicators=low and auth-indicators=med) or auth-indicators=high)"
403
404
405### GssapiNegotiateOnce
406
407When this option is enabled the Negotiate header will not be resent if
408Negotiation has already been attempted but failed.
409
410Normally when a client fails to use Negotiate authentication, a HTTP 401
411response is returned with a WWW-Authenticate: Negotiate header, implying that
412the client can retry to use Negotiate with different credentials or a
413different mechanism.
414
415Consider enabling GssapiNegotiateOnce when only one single sign on mechanism
416is allowed, or when GssapiBasicAuth is enabled.
417
418**NOTE:** if the initial Negotiate attempt fails, some browsers will fallback
419to other Negotiate mechanisms, prompting the user for login credentials and
420reattempting negotiation. This situation can mislead users - for example if
421krb5 authentication failed and no other mechanisms are allowed, a user could
422be prompted for login information even though any login information provided
423cannot succeed. When this occurs, some browsers will not fall back to a Basic
424Auth mechanism. Enable GssapiNegotiateOnce to avoid this situation.
425
426- **Enable with:** GssapiNegotiateOnce On
427- **Default:** GssapiNegotiateOnce Off
428
429
430### GssapiImpersonate
431
432This option can be used even if AuthType GSSAPI is not used for given
433Location or LocationMatch, to obtain service ticket for a user that was
434already authenticated by different module.  (This is also known as s4u2self,
435or protocol transition.)
436
437The principal of the user is retrieved from the internal r->user
438identifier which typically holds the username from the authentication
439results.
440
441Optionally, this user principal can later be used for s4u2proxy (constrained
442delegation).  To do this, ensure the server principal is permitted to acquire
443forwardable tickets to itself from arbitrary users (i.e., with the option
444`+ok_to_auth_as_delegate`).
445
446- **Enable with:** GssapiImpersonate On
447- **Default:** GssapiImpersonate Off
448
449
450### GssapiDelegCcachePerms
451
452This option is used to set alternative ownership and permission for delegated
453ccache files stored in the GssapiDelegCcacheDir location. It is a multivalue
454configuration directive that can accept the following three settings:
455- mode
456- uid
457- gid
458If a setting is not present the relative file property will not be modified and
459the default owners and/or mode will be retained.
460
461#### mode
462    This option allows to set the file mode, the format used is a numeric mode
463    with the same semantics of the chmod unix command for mapping numbers to
464    permissions.
465
466#### uid
467    A user id number or name, an attempt to change the user owner of the file
468    to the uid number specified will be made. If a user name has been
469    specified, it will be resolved at startup time and the user's id number
470    stored internally for all subsequent operations.
471
472#### gid
473    A group id number or name, an attempt to change the group owner of the
474    file to the gid number specified will be made. If a group name has been
475    specified, it will be resolved at startup time and the group's id number
476    stored internally for all subsequent operations.
477
478#### Example
479    GssapiDelegCcachePerms mode:0660 gid:webuiworkers
480
481
482### GssapiPublishErrors
483
484This option is used to publish errors as Environment Variables for use by
485httpd processes.
486
487A general error type is provided in the MAG_ERROR variable, and can have the
488following values: "GSS ERROR", "INTERNAL ERROR", "AUTH NOT ALLOWED"
489Additionally, in the variable named MAG_ERROR_TEXT there may be a free form
490error message.
491
492When the error type is "GSS ERROR" the variables GSS_ERROR_MAJ and
493GSS_ERROR_MIN contain the numeric errors returned by GSSAPI, and the
494MAG_ERROR_TEXT will contain a GSS Error message, possibly prepended by
495an additional message that provides more context.
496
497- **Enable with:** GssapiPublishErrors On
498- **Default:** GssapiPublishErrors Off
499
500
501### GssapiAcceptorName
502
503This option is used to force the server to accept only for a specific name.
504
505This allows, for example to select to use a specific credential when multiple
506keys are provided in a keytab.
507
508A special value of {HOSTNAME} will make the code use the name apache sees in
509the httpd request to select the correct name to use. This may be useful to
510allow multiple names and multiple keys to be used on the same apache instance.
511
512Note: By default no name is set and any name in a keytab or mechanism specific
513acceptor credential will be allowed.
514
515Note: Global gssapi options set in krb5.conf like 'ignore_acceptor_hostname'
516may affect the ability to restrict names.
517
518Note: The GSS_C_NT_HOSTBASED_SERVICE format is used for names (see example).
519
520#### Example
521    GssapiAcceptorName HTTP@www.example.com
522
523
524### GssapiBasicTicketTimeout
525
526This option controls the ticket validity time requested for the user TGT by the
527Basic Auth method.
528
529Normally basic auth is repeated by the browser on each request so a short
530validity period is used to reduce the scope of the ticket as it will be
531replaced quickly.
532However in cases where the authentication page is separate and the session
533is used by other pages the validity can be changed to arbitrary duration.
534
535Note: the validity of a ticket is still capped by KDC configuration.
536
537Note: the value is specified in seconds.
538
539- **Default:** GssapiBasicTicketTimeout 300
540
541#### Example
542    GssapiBasicTicketTimeout 36000
543
544Sets ticket/session validity to 10 hours.
545
546
547### GssapiPublishMech
548
549This option is used to publish the mech used for authentication as an
550Environment variable named GSS_MECH.
551
552It will return a string of the form 'Authtype/Mechname'.
553Authtype represents the type of auth performed by the module. Possible values
554are 'Basic', 'Negotiate', 'NTLM', 'Impersonate'.
555Mechname is the name of the mechanism as reported by GSSAPI or the OID of the
556mechanism if a name is not available. In case of errors the 'Unavailable'
557string may also be returned for either Authtype or Mechname.
558
559- **Enable with:** GssapiPublishMech On
560- **Default:** GssapiPublishMech Off
561

README.md

1mod_auth_gssapi
2===============
3
4Intro
5-----
6
7This module has been built as a replacement for the aging mod_auth_kerb.
8Its aim is to use only GSSAPI calls and be as much as possible agnostic
9of the actual mechanism used.
10
11Dependencies
12------------
13
14A modern version of MIT's Krb5 distribution or any GSSAPI implementation
15that supports the [credential store
16extension](http://k5wiki.kerberos.org/wiki/Projects/Credential_Store_extensions)
17is necessary to achieve full functionality. Reduced functionality is
18provided without these extensions.
19
20    MIT krb5 (>=1.11)
21    Apache httpd (>=2.4.11)
22
23### Tests
24
25To run tests, you also need:
26
27* The Kerberos 5 Key-Distribution-Center (`krb5-kdc` package on Debian,
28  `krb5-server` on Fedora)
29* Packages `mod_session`, `krb5-workstation`, `python-requests-gssapi`,
30  and `python-gssapi` on Fedora
31* Some tests require `krb5-pkinit` package on fedora and krb5 >= 1.15.
32* [nss_wrapper](https://cwrap.org/nss_wrapper.html), packaged in Fedora
33* [socket_wrapper](https://cwrap.org/socket_wrapper.html), packaged in Fedora
34
35Installation
36------------
37
38    autoreconf -fi
39    ./configure
40    make
41    make install
42
43
44Configuration
45-------------
46
47Apache authentication modules are usually configured per location, see the
48[mod_authn_core](https://httpd.apache.org/docs/2.4/mod/mod_authn_core.html)
49documentation for the common directives
50
51### Basic configuration
52
53The simplest configuration scheme specifies just one directive, which is the
54location of the keytab.
55
56#### Example
57    <Location /private>
58        AuthType GSSAPI
59        AuthName "GSSAPI Single Sign On Login"
60        GssapiCredStore keytab:/etc/httpd.keytab
61        Require valid-user
62    </Location>
63
64Your Apache server need read access to the keytab configured.
65If your Kerberos implementation does not support the credential store
66extensions you can also simply set the KRB5_KTNAME environment variable in the
67Apache init script and skip the GssapiCredStore option completely.
68
69
70Environment Variables
71---------------------
72
73(Note: these are not process environment variables, but rather Apache
74environment variables, as described
75[in the apache docs](https://httpd.apache.org/docs/2.4/env.html).)
76
77### gssapi-no-negotiate
78
79This environment variable is used to suppress setting Negotiate headers.  Not
80sending these headers is useful to work around browsers that do not handle
81them properly (and incorrectly show authentication popups to users).
82
83#### Example
84
85For instance, to suppress negotiation on Windows browsers, one could set:
86
87    BrowserMatch Windows gssapi-no-negotiate
88
89
90
91Configuration Directives
92------------------------
93
94### Alphabetic List of Directives
95
96[GssapiAcceptorName](#gssapiacceptorname)<br>
97[GssapiAllowedMech](#gssapiallowedmech)<br>
98[GssapiBasicAuth](#gssapibasicauth)<br>
99[GssapiBasicAuthMech](#gssapibasicauthmech)<br>
100[GssapiBasicTicketTimeout](#gssapibasicticketvalidity)<br>
101[GssapiConnectionBound](#gssapiconnectionbound)<br>
102[GssapiCredStore](#gssapicredstore)<br>
103[GssapiDelegCcacheDir](#gssapidelegccachedir)<br>
104[GssapiDelegCcacheEnvVar](#gssapidelegccacheenvvar)<br>
105[GssapiDelegCcachePerms](#gssapidelegccacheperms)<br>
106[GssapiDelegCcacheUnique](#gssapidelegccacheunique)<br>
107[GssapiImpersonate](#gssapiimpersonate)<br>
108[GssapiLocalName](#gssapilocalname)<br>
109[GssapiNameAttributes](#gssapinameattributes)<br>
110[GssapiNegotiateOnce](#gssapinegotiateonce)<br>
111[GssapiPublishErrors](#gssapipublisherrors)<br>
112[GssapiPublishMech](#gssapipublishmech)<br>
113[GssapiRequiredNameAttributes](#gssapirequirednameattributes)<br>
114[GssapiSessionKey](#gssapisessionkey)<br>
115[GssapiSignalPersistentAuth](#gssapisignalpersistentauth)<br>
116[GssapiSSLonly](#gssapisslonly)<br>
117[GssapiUseS4U2Proxy](#gssapiuses4u2proxy)<br>
118[GssapiUseSessions](#gssapiusesessions)<br>
119
120
121### GssapiSSLonly
122
123Forces the authentication attempt to fail if the connection is not being
124established over TLS. The default is "Off", which could be helpful in a
125local development environment, but we do not recommend for production
126deployments. A passive adversary could listen to the plaintext HTTP connection
127to observe any private information in the client's request or server's
128response (for example: the full HTTP response body, or any web application
129session cookies, etc). You should only use mod_auth_gssapi with HTTPS in
130production, so we recommend that you *enable* this setting in production for
131added protection.
132
133- **Enable with:** GssapiSSLonly On
134- **Default:** GssapiSSLonly Off
135
136
137### GssapiLocalName
138
139Tries to map the client principal to a local name using the gss_localname()
140call. This requires configuration in the /etc/krb5.conf file in order to allow
141proper mapping for principals not in the default realm (for example a user
142coming from a trusted realm).
143See the 'auth_to_local' option in the [realms] section of krb5.conf(5)
144
145When `GssapiLocalName` is set to `on`, mod_auth_gssapi will set the
146`REMOTE_USER` variable to the resolved user name. mod_auth_gssapi will also
147set the `GSS_NAME` variable to the complete client principal name.
148
149- **Enable with:** GssapiLocalName On
150- **Default:** GssapiLocalName Off
151
152
153### GssapiConnectionBound
154
155This option is not needed for krb5 or basic auth in almost all cases.  It
156incurs overhead, so leaving it off is recommended.
157
158For NTLMSSP (and any other GSS mechanisms that require more than one
159round-trip to complete authentication), it is necessary to bind to the
160authentication to the connection in order to keep the state between
161round-trips.  With this option, incomplete context are stored in the
162connection and retrieved on the next request for continuation.
163
164- **Enable with:** GssapiConnectionBound On
165- **Default:** GssapiConnectionBound Off
166
167
168### GssapiSignalPersistentAuth
169
170For clients that make use of Persistent-Auth header, send the header according
171to GssapiConnectionBound setting.
172
173- **Enable with:** GssapiSignalPersistentAuth On
174- **Default:** GssapiSignalPersistentAuth Off
175
176
177### GssapiUseSessions
178
179In order to avoid constant and costly re-authentication attempts for every
180request, mod_auth_gssapi offers a cookie based session method to maintain
181authentication across multiple requests. GSSAPI uses the mod_sessions module
182to handle cookies so that module needs to be activated and configured.
183GSSAPI uses a secured (encrypted + MAC-ed) payload to maintain state in the
184session cookie. The session cookie lifetime depends on the lifetime of the
185GSSAPI session established at authentication.
186**NOTE**: It is important to correctly set the SessionCookieName option.
187See the
188[mod_sessions](http://httpd.apache.org/docs/current/mod/mod_session.html)
189documentation for more information.
190
191- **Enable with:** GssapiUseSessions On
192- **Default:** GssapiUseSessions Off
193
194#### Example
195    GssapiUseSessions On
196    Session On
197    SessionCookieName gssapi_session path=/private;httponly;secure;
198
199
200### GssapiSessionKey
201
202When GssapiUseSessions is enabled a key use to encrypt and MAC the session
203data will be automatically generated at startup, this means session data will
204become unreadable if the server is restarted or multiple servers are used and
205the client is load balanced from one to another. To obviate this problem the
206admin can choose to install a permanent key in the configuration so that
207session data remain accessible after a restart or by multiple servers
208sharing the same key.
209
210Two schemes to read persistent keys are provided, 'key' and 'file'.
211
212- 'key'
213    A key is read from the configuration directive.
214    The key must be a base64 encoded raw key of 32 bytes of length.
215
216- 'file'
217    A file on the file system is used to store the key. If the file does not
218    exists one is created with a randomly generated key during the first
219    execution.
220
221
222#### Examples
223    GssapiSessionKey key:VGhpcyBpcyBhIDMyIGJ5dGUgbG9uZyBzZWNyZXQhISE=
224    GssapiSessionKey file:/var/lib/httpd/secrets/session.key
225
226
227### GssapiCredStore
228
229The GssapiCredStore option allows to specify multiple credential related
230options like keytab location, client_keytab location, ccache location etc.
231
232#### Example
233    GssapiCredStore keytab:/etc/httpd.keytab
234    GssapiCredStore ccache:FILE:/var/run/httpd/krb5ccache
235
236
237### GssapiDelegCcacheDir
238
239If delegation of credentials is desired credentials can be exported in a
240private directory accessible by the Apache process.
241The delegated credentials will be stored in a file named after the client
242principal and a request environment variable (`KRB5CCNAME` by default) will be
243set to point to that file.
244
245#### Example
246    GssapiDelegCcacheDir /var/run/httpd/clientcaches
247
248A user foo@EXAMPLE.COM delegating its credentials would cause the server to
249create a ccache file named /var/run/httpd/clientcaches/foo@EXAMPLE.COM
250
251
252### GssapiDelegCcacheUnique
253
254Enables using unique ccache names for delegation.  ccache files will be placed
255in GssapiDelegCcacheDir and named using the principal and a six-digit unique
256suffix.
257
258**Note:** Consuming application must delete the ccache otherwise it will
259litter the filesystem if sessions are used.  An example sweeper can be found
260in the contrib directory.  If using with gssproxy, see note at the top of that
261file.
262
263- **Enable with:** GssapiDelegCcacheUnique On
264- **Default:** GssapiDelegCcacheUnique Off
265
266
267### GssapiDelegCcacheEnvVar
268
269Set the name of the request environment variable that will receive the
270credential cache name.  If unspecified, defaults to `KRB5CCNAME`.
271
272#### Example
273    GssapiDelegCcacheEnvVar AJP_KRB5CCNAME
274
275
276### GssapiUseS4U2Proxy
277
278Enables the use of the s4u2Proxy Kerberos extension also known as
279[constrained delegation](https://ssimo.org/blog/id_011.html)
280This option allows an application running within Apache to operate on
281behalf of the user against other servers by using the provided ticket
282(subject to KDC authorization).
283This options requires GssapiDelegCcacheDir to be set. The ccache will be
284populated with the user's provided ticket which is later used as evidence
285ticket by the application.
286
287**Note:** This flag has no effect when Basic-Auth is used since user's
288credentials are delegated anyway when GssapiDelegCcacheDir is set.
289
290#### Example
291    GssapiUseS4U2Proxy On
292    GssapiCredStore keytab:/etc/httpd.keytab
293    GssapiCredStore client_keytab:/etc/httpd.keytab
294    GssapiCredStore ccache:FILE:/var/run/httpd/krb5ccache
295    GssapiDelegCcacheDir /var/run/httpd/clientcaches
296
297**NOTE:** The client keytab is necessary to allow GSSAPI to initiate via keytab
298on its own. If not present an external mechanism needs to kinit with the
299keytab and store a ccache in the configured ccache file.
300
301
302### GssapiBasicAuth
303
304Allows the use of Basic Auth in conjunction with Negotiate.
305If the browser fails to use Negotiate it will instead fallback to Basic and
306the username and password will be used to try to acquire credentials in the
307module via GSSAPI. If credentials are acquired successfully then they are
308validated against the server's keytab.
309
310- **Enable with:** GssapiBasicAuth On
311- **Default:** GssapiBasicAuth Off
312
313#### Example
314    <Location /gssapi>
315      AuthType GSSAPI
316      AuthName "Login"
317      GssapiBasicAuth On
318      GssapiCredStore keytab:/etc/httpd/http.keytab
319      Require valid-user
320    </Location>
321
322
323### GssapiAllowedMech
324
325List of allowed mechanisms. This is useful to restrict the mechanism that
326can be used when credentials for multiple mechanisms are available.
327By default no mechanism is set, this means all locally available mechanisms
328are allowed.  The recognized mechanism names are: krb5, iakerb, ntlmssp
329
330#### Example
331    GssapiAllowedMech krb5
332    GssapiAllowedMech ntlmssp
333
334
335### GssapiBasicAuthMech
336
337List of mechanisms against which Basic Auth is attempted. This is useful to
338restrict the mechanisms that can be used to attempt password auth.
339By default no mechanism is set, this means all locally available mechanisms
340are allowed, unless GssapiAllowedMech is set, in which case those are used.
341GssapiBasicAuthMech always takes precedence over GssapiAllowedMech.
342The recognized mechanism names are: krb5, iakerb, ntlmssp
343
344#### Example
345    GssapiBasicAuthMech krb5
346
347
348### GssapiNameAttributes
349
350Enables the module to source Name Attributes from the client name
351(authorization data associated with the established context) and exposes them
352as environment variables.
353
354Value format: ENV_VAR_NAME ATTRIBUTE_NAME
355
356This option can be specified multiple times, once for each attribute to expose.
357The Special value "json" is used to expose all attributes in a json formatted
358string via the special environment variable GSS_NAME_ATTRS_JSON
359The environment variable GSS_NAME_ATTR_ERROR is set with the Gssapi returned
360error string in case the inquire name function fails to retrieve attributes,
361and with the string "0 attributes found", if no attributes are set.
362
363**Note**: These variables are NOT saved in the session data stored in the
364cookie so they are available only on the first authenticated request when
365GssapiUseSessions is used.
366
367**Note:** It is recommended but not required to use only capital letters and
368underscores for environment variable names.
369
370#### Example
371    GssapiNameAttributes json
372    GssapiNameAttributes RADIUS_NAME urn:ietf:params:gss:radius-attribute_1
373
374
375### GssapiRequiredNameAttributes
376
377This option allows specifying one or more Name Attributes that the client must
378possess in order to be authorized to access the location. The required Name
379Attributes are specified by name=value pairs (name being the ATTRIBUTE_NAME as
380mentioned above, and value being a Null-terminated string. Alternately, if a
381Name Attribute produces binary values or is expected to contain a space
382character, the desired value can be specified by a ':=' and a base64-encoded
383string).
384
385A combination of Name Attributes (including multiple values from a single Name
386Attribute type) can be specified with an expression that separates each
387name=value pair with the "and" or "or" logical operators.  Operator precedence
388can be influenced by parenthesized statements.
389
390	foo=bar
391	foo:=YmFy
392	foo=bar or foo=baz
393	foo=bar and foo=baz and bar=baz
394	(foo=bar and foo=baz) or bar:=YmFy
395
396If the Name Attributes associated with the client do not satisfy the given
397expression, or no Name Attributes are present, a 403 response is returned.
398
399#### Example
400    GssapiRequiredNameAttributes "auth-indicators=high"
401    GssapiRequiredNameAttributes "auth-indicators=high or other-attr=foo"
402    GssapiRequiredNameAttributes "((auth-indicators=low and auth-indicators=med) or auth-indicators=high)"
403
404
405### GssapiNegotiateOnce
406
407When this option is enabled the Negotiate header will not be resent if
408Negotiation has already been attempted but failed.
409
410Normally when a client fails to use Negotiate authentication, a HTTP 401
411response is returned with a WWW-Authenticate: Negotiate header, implying that
412the client can retry to use Negotiate with different credentials or a
413different mechanism.
414
415Consider enabling GssapiNegotiateOnce when only one single sign on mechanism
416is allowed, or when GssapiBasicAuth is enabled.
417
418**NOTE:** if the initial Negotiate attempt fails, some browsers will fallback
419to other Negotiate mechanisms, prompting the user for login credentials and
420reattempting negotiation. This situation can mislead users - for example if
421krb5 authentication failed and no other mechanisms are allowed, a user could
422be prompted for login information even though any login information provided
423cannot succeed. When this occurs, some browsers will not fall back to a Basic
424Auth mechanism. Enable GssapiNegotiateOnce to avoid this situation.
425
426- **Enable with:** GssapiNegotiateOnce On
427- **Default:** GssapiNegotiateOnce Off
428
429
430### GssapiImpersonate
431
432This option can be used even if AuthType GSSAPI is not used for given
433Location or LocationMatch, to obtain service ticket for a user that was
434already authenticated by different module.  (This is also known as s4u2self,
435or protocol transition.)
436
437The principal of the user is retrieved from the internal r->user
438identifier which typically holds the username from the authentication
439results.
440
441Optionally, this user principal can later be used for s4u2proxy (constrained
442delegation).  To do this, ensure the server principal is permitted to acquire
443forwardable tickets to itself from arbitrary users (i.e., with the option
444`+ok_to_auth_as_delegate`).
445
446- **Enable with:** GssapiImpersonate On
447- **Default:** GssapiImpersonate Off
448
449
450### GssapiDelegCcachePerms
451
452This option is used to set alternative ownership and permission for delegated
453ccache files stored in the GssapiDelegCcacheDir location. It is a multivalue
454configuration directive that can accept the following three settings:
455- mode
456- uid
457- gid
458If a setting is not present the relative file property will not be modified and
459the default owners and/or mode will be retained.
460
461#### mode
462    This option allows to set the file mode, the format used is a numeric mode
463    with the same semantics of the chmod unix command for mapping numbers to
464    permissions.
465
466#### uid
467    A user id number or name, an attempt to change the user owner of the file
468    to the uid number specified will be made. If a user name has been
469    specified, it will be resolved at startup time and the user's id number
470    stored internally for all subsequent operations.
471
472#### gid
473    A group id number or name, an attempt to change the group owner of the
474    file to the gid number specified will be made. If a group name has been
475    specified, it will be resolved at startup time and the group's id number
476    stored internally for all subsequent operations.
477
478#### Example
479    GssapiDelegCcachePerms mode:0660 gid:webuiworkers
480
481
482### GssapiPublishErrors
483
484This option is used to publish errors as Environment Variables for use by
485httpd processes.
486
487A general error type is provided in the MAG_ERROR variable, and can have the
488following values: "GSS ERROR", "INTERNAL ERROR", "AUTH NOT ALLOWED"
489Additionally, in the variable named MAG_ERROR_TEXT there may be a free form
490error message.
491
492When the error type is "GSS ERROR" the variables GSS_ERROR_MAJ and
493GSS_ERROR_MIN contain the numeric errors returned by GSSAPI, and the
494MAG_ERROR_TEXT will contain a GSS Error message, possibly prepended by
495an additional message that provides more context.
496
497- **Enable with:** GssapiPublishErrors On
498- **Default:** GssapiPublishErrors Off
499
500
501### GssapiAcceptorName
502
503This option is used to force the server to accept only for a specific name.
504
505This allows, for example to select to use a specific credential when multiple
506keys are provided in a keytab.
507
508A special value of {HOSTNAME} will make the code use the name apache sees in
509the httpd request to select the correct name to use. This may be useful to
510allow multiple names and multiple keys to be used on the same apache instance.
511
512Note: By default no name is set and any name in a keytab or mechanism specific
513acceptor credential will be allowed.
514
515Note: Global gssapi options set in krb5.conf like 'ignore_acceptor_hostname'
516may affect the ability to restrict names.
517
518Note: The GSS_C_NT_HOSTBASED_SERVICE format is used for names (see example).
519
520#### Example
521    GssapiAcceptorName HTTP@www.example.com
522
523
524### GssapiBasicTicketTimeout
525
526This option controls the ticket validity time requested for the user TGT by the
527Basic Auth method.
528
529Normally basic auth is repeated by the browser on each request so a short
530validity period is used to reduce the scope of the ticket as it will be
531replaced quickly.
532However in cases where the authentication page is separate and the session
533is used by other pages the validity can be changed to arbitrary duration.
534
535Note: the validity of a ticket is still capped by KDC configuration.
536
537Note: the value is specified in seconds.
538
539- **Default:** GssapiBasicTicketTimeout 300
540
541#### Example
542    GssapiBasicTicketTimeout 36000
543
544Sets ticket/session validity to 10 hours.
545
546
547### GssapiPublishMech
548
549This option is used to publish the mech used for authentication as an
550Environment variable named GSS_MECH.
551
552It will return a string of the form 'Authtype/Mechname'.
553Authtype represents the type of auth performed by the module. Possible values
554are 'Basic', 'Negotiate', 'NTLM', 'Impersonate'.
555Mechname is the name of the mechanism as reported by GSSAPI or the OID of the
556mechanism if a name is not available. In case of errors the 'Unavailable'
557string may also be returned for either Authtype or Mechname.
558
559- **Enable with:** GssapiPublishMech On
560- **Default:** GssapiPublishMech Off
561