Include RPM spec file in dist package.
[mod_auth_gssapi.git] / README
1 mod_auth_gssapi
2 ===============
3
4 Intro
5 -----
6
7 This module has been built as a replacement for the aging mod_auth_kerb.
8 Its aim is to use only GSSAPI calls and be as much as possible agnostic
9 of the actual mechanism used.
10
11 Dependencies
12 ------------
13
14 A modern version of MIT's Krb5 distribution or any GSSAPI implementation
15 that supports the [credential store
16 extension](http://k5wiki.kerberos.org/wiki/Projects/Credential_Store_extensions)
17 is necessary to achieve full functionality. Reduced functionality is
18 provided without these extensions.
19
20     krb5 (>=1.11)
21     Apache (>=2.4)
22
23 ### Tests
24
25 To run tests, you also need:
26
27 * The Kerberos 5 Key-Distribution-Center (`krb5-kdc` package on Debian)
28 * [nss_wrapper](https://cwrap.org/nss_wrapper.html)
29 * [socket_wrapper](https://cwrap.org/socket_wrapper.html)
30
31 Installation
32 ------------
33
34     ./configure
35     make
36     make install
37
38
39 Configuration
40 -------------
41
42 Apache authentication modules are usually configured per location, see the
43 [mod_authn_core](https://httpd.apache.org/docs/2.4/mod/mod_authn_core.html)
44 documentation for the common directives
45
46 ### Basic configuration
47
48 The simplest configuration scheme specifies just one directive, which is the
49 location of the keytab.
50
51 #### Example
52     <Location /private>
53         AuthType GSSAPI
54         AuthName "GSSAPI Single Sign On Login"
55         GssapiCredStore keytab:/etc/httpd.keytab
56         Require valid-user
57     </Location>
58
59 Your Apache server need read access to the keytab configured.
60 If your Kerberos implementation does not support the credential store
61 extensions you can also simply set the KRB5_KTNAME environment variable in the
62 Apache init script and skip the GssapiCredStore option completely.
63
64
65 Configuration Directives
66 ------------------------
67
68 ### GssapiSSLonly
69
70 Forces the authentication attempt to fail if the connection is not being
71 established over TLS
72
73 #### Example
74     GssapiSSLonly On
75
76
77 ### GssapiLocalName
78
79 Tries to map the client principal to a local name using the gss_localname()
80 call. This requires configuration in the /etc/krb5.conf file in order to allow
81 proper mapping for principals not in the default realm (for example a user
82 coming from a trusted realm).
83 See the 'auth_to_local' option in the [realms] section of krb5.conf(5)
84
85 When this options is used the resolved name is set in the REMOTE_USER variable
86 however the complete client principal name is also made available in the
87 GSS_NAME variable.
88
89 #### Example
90     GssapiLocalName on
91
92
93 ### GssapiConnectionBound
94
95 When using GSS mechanisms that require more than one round-trip to complete
96 authentication (like NTLMSSP) it is necessary to bind to the authentication to
97 the connection in order to keep the state between round-trips. With this option
98 enable incomplete context are store in the connection and retrieved on the next
99 request for continuation.
100
101 #### Example
102     GssapiConnectionBound On
103
104
105 ### GssapiSignalPersistentAuth
106 For clients that make use of Persistent-Auth header, send the header according
107 to GssapiConnectionBound setting.
108
109 #### Example
110     GssapiSignalPersistentAuth On
111
112
113 ### GssapiUseSessions
114
115 In order to avoid constant and costly re-authentication attempts for every
116 request, mod_auth_gssapi offers a cookie based session method to maintain
117 authentication across multiple requests. GSSAPI uses the mod_sessions module
118 to handle cookies so that module needs to be activated and configured.
119 GSSAPI uses a secured (encrypted + MAC-ed) payload to maintain state in the
120 session cookie. The session cookie lifetime depends on the lifetime of the
121 GSSAPI session established at authentication.
122 **NOTE**: It is important to correctly set the SessionCookieName option.
123 See the
124 [mod_sessions](http://httpd.apache.org/docs/current/mod/mod_session.html)
125 documentation for more information.
126
127 #### Example
128     GssapiUseSessions On
129     Session On
130     SessionCookieName gssapi_session path=/private;httponly;secure;
131
132
133 ### GssapiSessionKey
134
135 When GssapiUseSessions is enabled a key use to encrypt and MAC the session
136 data will be automatically generated at startup, this means session data will
137 become unreadable if the server is restarted or multiple servers are used and
138 the client is load balanced from one to another. To obviate this problem the
139 admin can choose to install a permanent key in the configuration so that
140 session data remain accessible after a restart or by multiple servers
141 sharing the same key.
142
143 The key must be a base64 encoded raw key of 32 bytes of length.
144
145 #### Example
146     GssapiSessionKey key:VGhpcyBpcyBhIDMyIGJ5dGUgbG9uZyBzZWNyZXQhISE=
147
148
149 ### GssapiCredStore
150
151 The GssapiCredStore option allows to specify multiple credential related
152 options like keytab location, client_keytab location, ccache location etc.
153
154 #### Example
155     GssapiCredStore keytab:/etc/httpd.keytab
156     GssapiCredStore ccache:FILE:/var/run/httpd/krb5ccache
157
158
159 ### GssapiDelegCcacheDir
160
161 If delegation of credentials is desired credentials can be exported in a
162 private directory accessible by the Apache process.
163 The delegated credentials will be stored in a file named after the client
164 principal and the subprocess environment variable KRB5CCNAME will be set
165 to point to that file.
166
167 #### Example
168     GssapiDelegCcacheDir /var/run/httpd/clientcaches
169
170 A user foo@EXAMPLE.COM delegating its credentials would cause the server to
171 create a ccache file named /var/run/httpd/clientcaches/foo@EXAMPLE.COM
172
173
174 ### GssapiUseS4U2Proxy
175
176 Enables the use of the s4u2Proxy Kerberos extension also known as
177 [constrained delegation](https://ssimo.org/blog/id_011.html)
178 This option allows an application running within Apache to operate on
179 behalf of the user against other servers by using the provided ticket
180 (subject to KDC authorization).
181 This options requires GssapiDelegCcacheDir to be set. The ccache will be
182 populated with the user's provided ticket which is later used as evidence
183 ticket by the application.
184
185 **Note:** This flag has no effect when Basic-Auth is used since user's
186 credentials are delegated anyway when GssapiDelegCcacheDir is set.
187
188 #### Example
189     GssapiUseS4U2Proxy On
190     GssapiCredStore keytab:/etc/httpd.keytab
191     GssapiCredStore client_keytab:/etc/httpd.keytab
192     GssapiCredStore ccache:FILE:/var/run/httpd/krb5ccache
193     GssapiDelegCcacheDir /var/run/httpd/clientcaches
194
195 **NOTE:** The client keytab is necessary to allow GSSAPI to initiate via keytab
196 on its own. If not present an external mechanism needs to kinit with the
197 keytab and store a ccache in the configured ccache file.
198
199
200 ### GssapiBasicAuth
201 Allows the use of Basic Auth in conjunction with Negotiate.
202 If the browser fails to use Negotiate it will instead fallback to Basic and
203 the username and password will be used to try to acquire credentials in the
204 module via GSSAPI. If credentials are acquired successfully then they are
205 validated against the server's keytab.
206
207 - **Enable with:** GssapiBasicAuth On
208 - **Default:** GssapiBasicAuth Off
209
210 #### Example
211     <Location /gssapi>
212       AuthType GSSAPI
213       AuthName "Login"
214       GssapiBasicAuth On
215       GssapiCredStore keytab:/etc/httpd/http.keytab
216       Require valid-user
217     </Location>
218
219
220 ### GssapiAllowedMech
221
222 List of allowed mechanisms. This is useful to restrict the mechanism that
223 can be used when credentials for multiple mechanisms are available.
224 By default no mechanism is set, this means all locally available mechanisms
225 are allowed.  The recognized mechanism names are: krb5, iakerb, ntlmssp
226
227 #### Example
228     GssapiAllowedMech krb5
229     GssapiAllowedMech ntlmssp
230
231
232 ### GssapiBasicAuthMech
233
234 List of mechanisms against which Basic Auth is attempted. This is useful to
235 restrict the mechanisms that can be used to attempt password auth.
236 By default no mechanism is set, this means all locally available mechanisms
237 are allowed, unless GssapiAllowedMech is set, in which case those are used.
238 GssapiBasicAuthMech always takes precedence over GssapiAllowedMech.
239 The recognized mechanism names are: krb5, iakerb, ntlmssp
240
241 #### Example
242     GssapiBasicAuthMech krb5
243
244
245 ### GssapiNameAttributes
246
247 Enables the module to source Name Attributes from the client name
248 (authorization data associated with the established context) and exposes them
249 as environment variables.
250
251 Value format: ENV_VAR_NAME ATTRIBUTE_NAME
252
253 This option can be specified multiple times, once for each attribute to expose.
254 The Special value "json" is used to expose all attributes in a json formatted
255 string via the special environment variable GSS_NAME_ATTRS_JSON
256 The environment variable GSS_NAME_ATTR_ERROR is set with the Gssapi returned
257 error string in case the inquire name function fails to retrieve attributes,
258 and with the string "0 attributes found", if no attributes are set.
259
260 **Note**: These variables are NOT saved in the session data stored in the
261 cookie so they are available only on the first authenticated request when
262 GssapiUseSessions is used.
263
264 **Note:** It is recommended but not required to use only capital letters and
265 underscores for environment variable names.
266
267 #### Example
268     GssapiNameAttributes json
269     GssapiNameAttributes RADIUS_NAME urn:ietf:params:gss:radius-attribute_1
270
271
272 ### GssapiNegotiateOnce
273
274 When this option is enabled the Negotiate header will not be resent if
275 Negotiation has already been attempted but failed.
276
277 Normally when a client fails to use Negotiate authentication, a HTTP 401
278 response is returned with a WWW-Authenticate: Negotiate header, implying that
279 the client can retry to use Negotiate with different credentials or a
280 different mechanism.
281
282 Consider enabling GssapiNegotiateOnce when only one single sign on mechanism
283 is allowed, or when GssapiBasicAuth is enabled.
284
285 **NOTE:** if the initial Negotiate attempt fails, some browsers will fallback
286 to other Negotiate mechanisms, prompting the user for login credentials and
287 reattempting negotiation. This situation can mislead users - for example if
288 krb5 authentication failed and no other mechanisms are allowed, a user could
289 be prompted for login information even though any login information provided
290 cannot succeed. When this occurs, some browsers will not fall back to a Basic
291 Auth mechanism. Enable GssapiNegotiateOnce to avoid this situation.
292
293 - **Enable with:** GssapiNegotiateOnce On
294 - **Default:** GssapiNegotiateOnce Off
295