mod_auth_gssapi.git
8 years agoNegate established flag if session is expired.
davisd123 [Thu, 1 Oct 2015 04:50:06 +0000 (14:20 +0930)]
Negate established flag if session is expired.

If the session is expired, then set established to false to
force re-authentication.

Reviewed-by: Simo Sorce <simo@redhat.com>
Close #57

8 years agoRelease 1.3.1 - Viking 2 landing v1.3.1
Simo Sorce [Thu, 3 Sep 2015 17:22:17 +0000 (13:22 -0400)]
Release 1.3.1 - Viking 2 landing

On September 3rd, 1976 the Viking 2 lander separates from the orbiter and
lands at Utopia Planitia on Mars...

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoMention test dependencies in README
Dennis Schridde [Thu, 3 Sep 2015 15:59:38 +0000 (17:59 +0200)]
Mention test dependencies in README

Reviewed-by: Simo Sorce <simo@redhat.com>
Closes #56

8 years agoFix include path to asn1c for out-of-source builds
Dennis Schridde [Thu, 3 Sep 2015 15:38:24 +0000 (17:38 +0200)]
Fix include path to asn1c for out-of-source builds

Reviewed-by: Simo Sorce <simo@redhat.com>
Closes #55

8 years agoFix bug in handling Session Keys
Simo Sorce [Thu, 3 Sep 2015 16:58:51 +0000 (12:58 -0400)]
Fix bug in handling Session Keys

A check inversion in 86661d07812b010b8cf664c2dab596be15ff1e31 caused
the specified session key to be ignored and a crash when none was
specified.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoAllow building without NTLMSSP support
Simo Sorce [Thu, 3 Sep 2015 14:19:07 +0000 (10:19 -0400)]
Allow building without NTLMSSP support

If gssapi/gssapi_ntlmssp.h is not available simply disable NTLMSSP.

Coauthored

Signed-off-by: Dennis Schridde <dennis.schridde@uni-heidelberg.de>
Signed-off-by: Simo Sorce <simo@redhat.com>
Closes #52
Closes #53
Closes #54

8 years agoUpdate and rename README to README.md
James Groffen [Wed, 19 Aug 2015 01:59:29 +0000 (11:29 +0930)]
Update and rename README to README.md

Add symlink to .md so the markdown is picked up.
Updated styling and fixed a couple of typos.

Simo: Changed rename into a symlink. Reworded commit message
Reviewed-by: Simo Sorce <simo@redhat.com>
Closes #51

8 years agoAdd test for Proxy SPNEGO auth
Isaac Boukris [Sun, 9 Aug 2015 15:14:57 +0000 (18:14 +0300)]
Add test for Proxy SPNEGO auth

Add appropairate authorization headers to test with SPNEGO too as
discussed in #48

Requires recent version of python-gssapi module, see:
https://github.com/pythongssapi/python-gssapi/pull/74

Simo: Squashed original patches in one, removed trailing whitespaces
and reworded the commit message.

Reviewed-by: Simo Sorce <simo@redhat.com>
Closes #49

8 years agoDo not use /tmp as default for s4u2proxy
Simo Sorce [Mon, 31 Aug 2015 12:41:24 +0000 (08:41 -0400)]
Do not use /tmp as default for s4u2proxy

The /tmp directory can lead to bugs and DoS of the apache process
because any user on the system can block the creation of predictable
file names.

Simply error out if GssapiDelegCcacheDir is not explicitly set.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoAllocate new keys at server startup.
Simo Sorce [Sun, 30 Aug 2015 18:31:44 +0000 (14:31 -0400)]
Allocate new keys at server startup.

This avoids a potential race condition if the first 2 request come in at the
same time. It also avoids issues with forked apapche processes which may end
up with different keys per fork.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoFix incorrect free() usage
Simo Sorce [Sun, 30 Aug 2015 18:28:32 +0000 (14:28 -0400)]
Fix incorrect free() usage

This code has been changed to use apr pools for memory allocation, so the
error path is wrong as free() is not called on malloc()ed memory anymore.
Remove the calls to free(), the mempool is clean up by callers.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoMore basic-auth tests
Isaac Boukris [Sun, 2 Aug 2015 03:02:19 +0000 (06:02 +0300)]
More basic-auth tests

Add test for second user on the same connection with the password
of the first user and without auth at all.

Reviewed-by: Simo Sorce <simo@redhat.com>
Closes #48

8 years agoAdd test for Basic Proxy authentication
Isaac Boukris [Mon, 27 Jul 2015 02:49:44 +0000 (05:49 +0300)]
Add test for Basic Proxy authentication

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoSupport forward proxy authentication
Isaac Boukris [Mon, 27 Jul 2015 01:32:49 +0000 (04:32 +0300)]
Support forward proxy authentication

Proxy auth headers are a little different.

Sessions cannot be used as we cannot set a cookie.

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoAdd test for basic auth with two different users over the same connection
Isaac Boukris [Sun, 26 Jul 2015 22:26:41 +0000 (01:26 +0300)]
Add test for basic auth with two different users over the same connection

Make sure each request is authenticated according to given credentials
even when GssapiConnectionBound is set.

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoAvoid advertising NTLM if it isn't technically supported
Isaac Boukris [Sun, 26 Jul 2015 21:24:42 +0000 (00:24 +0300)]
Avoid advertising NTLM if it isn't technically supported

This lets browsers to fall back to basic auth if supported
(similar to 4e7967e797e5c8912a67c0de8f172bb95b5172ff).

Add boolean param to is_mech_allowed which denotes whether
the caller supports multiple step.

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoFix checks on allowed mechs
Simo Sorce [Tue, 7 Jul 2015 17:23:57 +0000 (13:23 -0400)]
Fix checks on allowed mechs

We need to check if a mech is allowed against the desired_mechs set.
Otherwise in case the admin does not explicitly specify an allowed set
then all mechs are allowed, including NTLM. This causes annoying issues
with browsers like Firefox and Chrome/ium which end up popping up an
authentication dialog if they see NTLM is supported and they have no
Kerberos tickets around.
Authentication will then simply fail because NTLM is not actually supported.
By using desired_mechs we use a list of mechanism the machine actually
has a chance to support in the default case.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoAdd basic auth test
Simo Sorce [Sat, 4 Jul 2015 15:11:16 +0000 (11:11 -0400)]
Add basic auth test

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoAdd test target in Makefile
Simo Sorce [Sat, 4 Jul 2015 15:10:34 +0000 (11:10 -0400)]
Add test target in Makefile

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoUS Independence day release - 1.3.0 v1.3.0
Simo Sorce [Sat, 4 Jul 2015 14:41:54 +0000 (10:41 -0400)]
US Independence day release - 1.3.0

Let's celebrate with a new releae which is long overdue.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoRetrieve default mechs at server init
Isaac Boukris [Tue, 23 Jun 2015 01:13:20 +0000 (04:13 +0300)]
Retrieve default mechs at server init

This avoids the need to retrieve the list on every auth attempt,
and then free it every time.

Implemented by adding a server config struct and populating
it at server init with gss_indicate_mechs().

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoProperly check return error when filtering mechs
Simo Sorce [Wed, 24 Jun 2015 20:10:58 +0000 (16:10 -0400)]
Properly check return error when filtering mechs

We need to fail only if the input was an actual set and instead we
get back GSS_C_NO_OID_SET. In all other cases we are fine.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoFail server startup on bad mechanisms
Isaac Boukris [Wed, 24 Jun 2015 00:42:06 +0000 (03:42 +0300)]
Fail server startup on bad mechanisms

This helps to detect mis-configurations early.
Configuration errors are considered fatal in apache anyway.

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoSkip spnego filtering since we already filter it
Isaac Boukris [Tue, 23 Jun 2015 00:17:53 +0000 (03:17 +0300)]
Skip spnego filtering since we already filter it

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoAcquire server creds with given cred_usage rather than both
Isaac Boukris [Tue, 23 Jun 2015 00:15:31 +0000 (03:15 +0300)]
Acquire server creds with given cred_usage rather than both

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoAdd initial test framework
Simo Sorce [Tue, 23 Jun 2015 00:57:26 +0000 (20:57 -0400)]
Add initial test framework

Requires various python packages nd the cwrap project's scoket_wrapper
and nss_wrapper tools, as well as the krb5kdc and the httpd server and
related modules (like mod_session).

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoSupport allowing arbitrary mechanisms
Simo Sorce [Mon, 22 Jun 2015 14:20:48 +0000 (10:20 -0400)]
Support allowing arbitrary mechanisms

Use gss_str_to_oid so OIDs can be used to set arbitrary mechanism in
allow lists like GssapiAllowedMech or GssapiBasicAuthMech.

Closes #46

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoAcquire creds only once for basic_auth
Simo Sorce [Sun, 21 Jun 2015 19:07:24 +0000 (15:07 -0400)]
Acquire creds only once for basic_auth

Instead of acquiring creds by looping at each round, use
gss_inquire_cred_by_mech() to work around the union_name issue and
get the correct per-mechanism server name.

Closes #45

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoSet krb5 ccache only if krb5 is used
Simo Sorce [Sun, 21 Jun 2015 19:06:15 +0000 (15:06 -0400)]
Set krb5 ccache only if krb5 is used

Check if the krb5 mechanism is present and only then set the cache, this
avoid wasteful operations if we are not even using krb5.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoAdd GssapiBasicAuthMech option
Simo Sorce [Fri, 19 Jun 2015 21:11:42 +0000 (17:11 -0400)]
Add GssapiBasicAuthMech option

This option allows to set a different list of mechanisms to use
with Basic Auth (Basic Auth must be explicitly enabled) than the
list of mechs that are allowed with Negotiate or Raw GSSAPI Client
authentication.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoFix Basic Auth with non-krb5 mechanisms
Simo Sorce [Tue, 16 Jun 2015 20:06:57 +0000 (16:06 -0400)]
Fix Basic Auth with non-krb5 mechanisms

Try each allowed mechanism explicitly in a loop including sourcing
the server name per mechanism to insure the proper name type is
used in the accept.
Otherwise secondary mechanims will fail to work.

Fixes #43

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoBetter handling of desired_mechs
Simo Sorce [Tue, 16 Jun 2015 19:07:37 +0000 (15:07 -0400)]
Better handling of desired_mechs

If no explicit allowed mechanism is set in configuration just ask
GSSAPI for a list of known mechanisms and use that. Do not try to
artificially acquire credentials as ultimatily all that does is
just call gss_inidicate_mechs() internally.

Do not store the result of gss_inidicate_mechs() on cfg->allowed_mechs
as that would lead to a leak given that cfg->allowed_mechs is allocated
on a memory pool, while gss_inidate_mechs()s results are not.

Closes #44

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoEnforce GssapiAllowedMech over raw gssapi mechs
Isaac Boukris [Sun, 14 Jun 2015 15:56:01 +0000 (18:56 +0300)]
Enforce GssapiAllowedMech over raw gssapi mechs

Implemented by aqcuiring creds only for allowed_mechs and by
explicity adding spnego to the allowed_mechs set (while still
restricting spengo only to the allowed mechanism as before).

8 years agoAlways require authentication with basic auth
Simo Sorce [Tue, 16 Jun 2015 17:34:21 +0000 (13:34 -0400)]
Always require authentication with basic auth

When connection bound authentication is used, we must deny access if
basci auth is used and a request does not have the basic auth header.
Basic auth authenticate each and every request, so if it is missing
this means such request is no more authenticated and we should not
allow access based on our cached metadata in this case.

Closes #41

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoMove most of basic_auth handling to a function
Simo Sorce [Sun, 14 Jun 2015 22:23:16 +0000 (18:23 -0400)]
Move most of basic_auth handling to a function

Consolidate and simplify AUTH BASIC Handling - Part 3.

By moving all the special operation one for auth basic into its own
segment we make the code simpler (less exceptions) and more readable.

Closes #39

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoSeparate basic auth loop from the main accept.
Simo Sorce [Sun, 14 Jun 2015 22:23:16 +0000 (18:23 -0400)]
Separate basic auth loop from the main accept.

Consolidate and simplify AUTH BASIC Handling - Part 2.

By moving all the special operation one for auth basic into its own
segment we make the code simpler (less exceptions) and more readable.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoMove the initial part of basic auth processing
Simo Sorce [Sun, 14 Jun 2015 22:23:16 +0000 (18:23 -0400)]
Move the initial part of basic auth processing

Consolidate and simplify AUTH BASIC Handling - Part 1.

By moving all the special operation one for auth basic into its own
segment we make the code simpler (less exceptions) and more readable.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoImprove mag_conn memory handling
Simo Sorce [Tue, 16 Jun 2015 13:36:34 +0000 (09:36 -0400)]
Improve mag_conn memory handling

Create a pool just for the mag_conn structure, so that we can clear up
all the memory used when a reset is necessary.
This also fixes a segfault introduced by a previous patch where we mistakenly
zeroed the whole structure including the memory pool pointer, which needs to
be preserved.

Closes #40

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoFix re-authentication when connection bound is on
Simo Sorce [Sun, 14 Jun 2015 22:08:53 +0000 (18:08 -0400)]
Fix re-authentication when connection bound is on

When re-using a context on a connection, a re-authentication request
may end up trying to use an established context handler to establish
a new context. This will fail with an error in GSSAPI.
Make sure to completely clean up the connection data when a brand
new authentication needs to happen so that no data is mistakenly
carried over.

Note this may leak a small amount of data, but only if authentication is
successful, so it is probably fine as is.

Closes #38

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoFix connection/session bound auth
Isaac Boukris [Sun, 14 Jun 2015 19:57:26 +0000 (22:57 +0300)]
Fix connection/session bound auth

A previous commit mistakenly removed the jump to the end with a successful
error.
Example scenario that is fixed with this patch:
$ curl -v -u usera:passa http://myhost/ http://myhost/ --ntlm

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoUse apr_pool_cleanup_register() to cleanup mc
Isaac Boukris [Sun, 14 Jun 2015 19:34:28 +0000 (22:34 +0300)]
Use apr_pool_cleanup_register() to cleanup mc

Instead of using apr_pool_userdata_set() since we don't use apr_pool_userdata_get() with the mag_conn_ptr apr_pool_cleanup_register() seem cleaner.

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoMake sure to release the ctx when no 'mc' available
Isaac Boukris [Tue, 9 Jun 2015 19:55:53 +0000 (22:55 +0300)]
Make sure to release the ctx when no 'mc' available

And some other cleanup adjusments.

8 years agoWhen an authorization haeder is sent, recheck auth
Simo Sorce [Sat, 13 Jun 2015 21:44:32 +0000 (17:44 -0400)]
When an authorization haeder is sent, recheck auth

Except for BASIC AUTH, if a client send an authorization header it
means it wants to re-check authentication.
So, if an authorization header is sent, go through the regular
path and do not set request variables based on the session data.
In case of Basic Auth we still use session data if user/pwd match
the stored hash.

Closes #22

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoStore data in session as the last thing
Simo Sorce [Sat, 13 Jun 2015 22:44:18 +0000 (18:44 -0400)]
Store data in session as the last thing

mag_attempt_session() was being called too early.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoAvoid segfault when skey is not set in config
Simo Sorce [Sat, 13 Jun 2015 22:52:53 +0000 (18:52 -0400)]
Avoid segfault when skey is not set in config

When the skey is generated on the fly, we will get an empty key on the very
first auth attempt. If that uses basic auth then we'll segfault when trying
to compute the hmac as we pass in a NULL key and immediately dereference it.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoActually store basic_hash in the session data
Simo Sorce [Sat, 13 Jun 2015 22:02:45 +0000 (18:02 -0400)]
Actually store basic_hash in the session data

Also fixes a segfault when mc->basic_hash.value is NULL

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoOptimize BASIC AUTH checks with sessions.
Simo Sorce [Sat, 13 Jun 2015 20:46:40 +0000 (16:46 -0400)]
Optimize BASIC AUTH checks with sessions.

If sessions are enbled store a MAC of the password and use it to check
if the password is the same on follow-up requests. If it is, avoid the
whole gssapi dance and use the session data instead.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoSplit HMAC_BUFFER out as a separate publi function
Simo Sorce [Sat, 13 Jun 2015 20:18:39 +0000 (16:18 -0400)]
Split HMAC_BUFFER out as a separate publi function

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoSet KRB5CCNAME on follow up requests with session
Simo Sorce [Sat, 11 Apr 2015 21:27:21 +0000 (17:27 -0400)]
Set KRB5CCNAME on follow up requests with session

If the original context establishment delegated credentials, set
the KRB5CCNAME variable to the proper file name for follow up
connections that uses the session to validate access.

Closes #18

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoUse a compiler to marshall/unmarshall the sessions
Simo Sorce [Tue, 9 Jun 2015 17:30:57 +0000 (13:30 -0400)]
Use a compiler to marshall/unmarshall the sessions

This way changes are easier, all is needed is to change the session.asn1
file to add or remove elements, and different session types can also be
supported at the same time.

8 years agoDisable connection-bound for basic-auth
Isaac Boukris [Sun, 7 Jun 2015 21:52:30 +0000 (00:52 +0300)]
Disable connection-bound for basic-auth

Clients don't expect this and therefore might inappropriately reuse the
connection for another user identity (with or without creds).

This is currently more of an issue due to issue 22, example:
curl -v http://myhost/ -u usera:passa --next http://myhost/ -u userb:passb

Closes #36

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoFix segfault if req->main is NULL
Simo Sorce [Sat, 6 Jun 2015 14:18:43 +0000 (10:18 -0400)]
Fix segfault if req->main is NULL

Seen in the wild.

Closes #35

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoAllow raw NTLM authentication
Simo Sorce [Mon, 25 May 2015 15:04:08 +0000 (17:04 +0200)]
Allow raw NTLM authentication

Some clients may decide to use raw NTLM authentication instead
of wrapping it into a Negotiate (SPNEGO) authentication request.
If the NTLMSSP mechanism is allowed/supported then allow this request
to be processed.

Closes #23

8 years agoAdd GssapiAllowedMech option
Simo Sorce [Mon, 25 May 2015 14:46:23 +0000 (16:46 +0200)]
Add GssapiAllowedMech option

This option allows the admin to list the mechanisms that can be used for
authentication. An empty list allows any locally supported mechanisms.

8 years agoMove acquire_cred functions into a helper
Simo Sorce [Mon, 1 Jun 2015 21:48:15 +0000 (17:48 -0400)]
Move acquire_cred functions into a helper

This makes the code more readable and easier to deal with.
Side effect: now we always acquire credentials

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoMore work on keeping cred_store functions optional
Simo Sorce [Mon, 1 Jun 2015 21:55:34 +0000 (17:55 -0400)]
More work on keeping cred_store functions optional

Some more definitions that depend on cred_store functions were
not properly ifdef-ed

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoFix conditional support for gss_acquire_cred_from
Simo Sorce [Mon, 1 Jun 2015 19:22:18 +0000 (15:22 -0400)]
Fix conditional support for gss_acquire_cred_from

This function is supported only on some GSSAPI versions.
Keep it optional.

Signed-off-by: Simo Sorce <simo@redhat.com>
8 years agoFind the right server name when using basic auth
Simo Sorce [Mon, 25 May 2015 13:53:44 +0000 (15:53 +0200)]
Find the right server name when using basic auth

When S4U2Proxy is used in combination with Basic Auth, the gss_inquire_cred()
call will return the client name instead of the server name we need.
Detect this case and aquire a separate set of credentials in that case.

Fixes #28

8 years agoIgnore generated files.
Joe Orton [Sat, 23 May 2015 11:15:53 +0000 (12:15 +0100)]
Ignore generated files.

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoExport only the symbol named auth_gssapi_module
Joe Orton [Sat, 23 May 2015 12:04:43 +0000 (13:04 +0100)]
Export only the symbol named auth_gssapi_module

The only entry point into the module DSO is the module structure itself;
use libtool's export-symbols linker trick to hide all the other global
symbols, which otherwise are potentially visible outside the module
itself (SEAL_* etc).

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoRemove all uses of APLOG_NOERRNO
Joe Orton [Sat, 23 May 2015 11:26:36 +0000 (12:26 +0100)]
Remove all uses of APLOG_NOERRNO

This directive is deprecated and has no effect in all httpd 2.x releases.

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoFix typo.
Joe Orton [Sat, 23 May 2015 11:24:03 +0000 (12:24 +0100)]
Fix typo.

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoDrop OOM handling.
Joe Orton [Sat, 23 May 2015 11:09:06 +0000 (12:09 +0100)]
Drop OOM handling.

In httpd/APR it is best practice to assume that memory allocation always
succeeds, which simplifies module code.

APR internally calls abort() if memory allocation ever actually fails,
so in pratice you cannot trigger these code paths anyway.

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoUse the "ssl_is_https" definition from mod_ssl.h.
Joe Orton [Sat, 23 May 2015 11:04:11 +0000 (12:04 +0100)]
Use the "ssl_is_https" definition from mod_ssl.h.

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoAdd GssapiSignalPersistentAuth directive
Isaac Boukris [Sat, 25 Apr 2015 12:36:40 +0000 (15:36 +0300)]
Add GssapiSignalPersistentAuth directive

Controls whether to send the Persistent-Auth header, and sets it only
when necessary/appropriate

Reviewed-by: Simo Sorce <simo@redhat.com>
8 years agoExport variable with session expiration time
Simo Sorce [Tue, 5 May 2015 17:36:04 +0000 (13:36 -0400)]
Export variable with session expiration time

Closes #16

8 years agoRevert "Use aes-256-gcm rather than aes-128-cbc"
Simo Sorce [Thu, 23 Apr 2015 18:51:00 +0000 (14:51 -0400)]
Revert "Use aes-256-gcm rather than aes-128-cbc"

This reverts commit e9c92795d87a316ea47f6bf37c9636e86eec57e7.

AESGCM is a neat idea but it is not really appropriate to be used in
mod_auth_gssapi because we cannot gurantee that the nonce will never be
reused. It is not very probable, and it is also not easy to force the
server to generate so many encyrpted sessions to have a good chance of
a collision that I know of, but better to avoid the whole issue, than
risk unforseen cases where it may happen.

8 years agoBump version to 1.2.0 v1.2.0
Simo Sorce [Tue, 21 Apr 2015 15:48:38 +0000 (11:48 -0400)]
Bump version to 1.2.0

8 years agoProperly complete context establishment
Simo Sorce [Sun, 19 Apr 2015 19:59:51 +0000 (15:59 -0400)]
Properly complete context establishment

On success do not forget to send the last negotiate packet (if any)
to the client within the 200 Reply.

Fixes #21

9 years agoAdd support for delegate creds on basic auth
Simo Sorce [Tue, 14 Apr 2015 17:52:05 +0000 (13:52 -0400)]
Add support for delegate creds on basic auth

When doing fallback basic auth, we may also want to honor the
configured directive about storing delegated credentials.
Detect if we are configured to store them and set the appopriate
init_sec_context flag that will cause the accept_sec_context call
to get valid delegated credentials for later storage.

9 years agoBump version to 1.1.1 v1.1.1
Simo Sorce [Thu, 2 Apr 2015 22:00:51 +0000 (18:00 -0400)]
Bump version to 1.1.1

9 years agoHandle authentication on subrequests
Simo Sorce [Mon, 30 Mar 2015 16:48:30 +0000 (12:48 -0400)]
Handle authentication on subrequests

In some cases (like during directory listing) Apache will re-run the
authentication code. Many GSSAPI mechanism have replay detection so
we cannot simply rerun the accept_sec_context phase. Others require
multiple steps. When authntication has already been estalished just
implicitly consider the authentication successfully performed and
copy the user name. Otherwise fail.
If a subrequest hits a location with a different mod_auth_gssapi
configuration warn but do not error off right away.

Fixes #15

9 years agoEscape principal name to remove the path separator
Simo Sorce [Thu, 26 Mar 2015 20:30:56 +0000 (16:30 -0400)]
Escape principal name to remove the path separator

The principla name is used as a file name, any embedded path separators
are going to cause trouble if used in the file name, so we need to escape
them away. Usee ~ as the escape chracter (~~ to escape ~ itself)

Fixes #14

9 years agoBump version to 1.1.0 v1.1.0
Simo Sorce [Thu, 12 Mar 2015 19:49:09 +0000 (15:49 -0400)]
Bump version to 1.1.0

9 years agoUse aes-256-gcm rather than aes-128-cbc
Nathaniel McCallum [Tue, 10 Mar 2015 14:57:23 +0000 (10:57 -0400)]
Use aes-256-gcm rather than aes-128-cbc

Also, remove all the manual HMAC code since it is no longer needed.

The end result should be faster and stronger authenticated encryption.

Closes #12
Reviewed-by: Simo Sorce <simo@redhat.com>
9 years agoDo not free orig_ccache
Simo Sorce [Tue, 10 Mar 2015 21:14:33 +0000 (17:14 -0400)]
Do not free orig_ccache

It realy is const memory referenced internally by MIT's gssapi.
Freeing it will cause a segfault on the next invocation.
This memory is kept in thread local storage and freed by gssapi itself
as needed.

Fixes #11

9 years agoImprove Basic Auth based logins
Simo Sorce [Tue, 10 Mar 2015 16:23:12 +0000 (12:23 -0400)]
Improve Basic Auth based logins

Set a per-thread Credentials Cache Name that will be thrown away once
authentication is done. This handles both an issue with stomping on
ccaches if two authentications happen in concurrent threads, as well
as issues with gss_acquire_cred_with_password() reusing the ccache
without actually performing an AS request.

Fixes #11

9 years agoFix random number generation
Simo Sorce [Tue, 10 Mar 2015 17:32:36 +0000 (13:32 -0400)]
Fix random number generation

Untested code is broken code :(

9 years agoUse apr function for random bytes
Simo Sorce [Tue, 10 Mar 2015 16:15:50 +0000 (12:15 -0400)]
Use apr function for random bytes

The apr function is thread safe while the OpenSSL one depdns on setting
up custom locking, which is hard in a library.

9 years agoDocumentation fixes
Simo Sorce [Mon, 9 Mar 2015 14:46:55 +0000 (10:46 -0400)]
Documentation fixes

Fix GssapiDelegCcacheDir examples and add all the required options to
make GssapiUseS4U2Proxy really work.

Thanks to David Kupka for testing that highlighted these issues.

9 years agoRemove forward basic auth and fix docs
Simo Sorce [Fri, 6 Mar 2015 14:30:51 +0000 (09:30 -0500)]
Remove forward basic auth and fix docs

Fixes #8

9 years agoAdd support for handling Basic Auth
Simo Sorce [Thu, 5 Mar 2015 22:26:45 +0000 (17:26 -0500)]
Add support for handling Basic Auth

Support either passing Basic Auth Through to another module,
or handling it directly through gss_acquire_cred_with_password()

Fixes #8

9 years agoDo not leak acquired_cred
Simo Sorce [Thu, 5 Mar 2015 17:05:45 +0000 (12:05 -0500)]
Do not leak acquired_cred

9 years agoReplace block size constants with actual block size
Nathaniel McCallum [Tue, 3 Feb 2015 14:20:15 +0000 (15:20 +0100)]
Replace block size constants with actual block size

9 years agoBump version to 1.0.4 v1.0.4
Simo Sorce [Sat, 8 Nov 2014 19:20:41 +0000 (14:20 -0500)]
Bump version to 1.0.4

9 years agoFix error message copy&paste error
Simo Sorce [Tue, 21 Oct 2014 17:15:29 +0000 (13:15 -0400)]
Fix error message copy&paste error

9 years agoFix build on some platforms by adding extra flags
Simo Sorce [Tue, 14 Oct 2014 13:17:46 +0000 (09:17 -0400)]
Fix build on some platforms by adding extra flags

For some reason all the necessary CFALGS are not returned by simply
querying the CFLAGS from apxs. We also need to query EXTRA_CPPFLAGS
apparently.

9 years agoProperly initialize logging
Simo Sorce [Mon, 13 Oct 2014 20:46:26 +0000 (16:46 -0400)]
Properly initialize logging

We need to call APLOG_USE_MODULE() so that the module name is reported
properly in log lines, and per module logging level can be set.

Fixes #6

9 years agoAttempt to use sessions only when they are enabled
Simo Sorce [Mon, 13 Oct 2014 20:35:57 +0000 (16:35 -0400)]
Attempt to use sessions only when they are enabled

9 years agoBump version to 1.0.3 v1.0.3
Simo Sorce [Fri, 12 Sep 2014 14:40:06 +0000 (10:40 -0400)]
Bump version to 1.0.3

9 years agoChange the modules build process
Simo Sorce [Thu, 11 Sep 2014 21:01:26 +0000 (17:01 -0400)]
Change the modules build process

USe automake directives to directly invoke the apxs favored libtool,
and use APXS only to perform the final install.

Fixes #4

9 years agoInclude only necessary libs when calling apxs
Simo Sorce [Fri, 29 Aug 2014 17:29:42 +0000 (13:29 -0400)]
Include only necessary libs when calling apxs

Drop cflags and libs options that make apxs unhappy

Closes #3

9 years agoBump version to 1.0.2 v1.0.2
Simo Sorce [Tue, 26 Aug 2014 22:11:40 +0000 (18:11 -0400)]
Bump version to 1.0.2

9 years agoAdd instructions to README file
Simo Sorce [Tue, 26 Aug 2014 22:06:49 +0000 (18:06 -0400)]
Add instructions to README file

9 years agoFix GssapiCredStore usage
Simo Sorce [Tue, 26 Aug 2014 21:10:18 +0000 (17:10 -0400)]
Fix GssapiCredStore usage

This allows to always define the keytab in terms of GssapiCredStore
options instead of having to set a KRB5_KTNAME variable.

Fixes Issue 2

9 years agoRelease v1.0.1 v1.0.1
Simo Sorce [Thu, 14 Aug 2014 12:58:59 +0000 (08:58 -0400)]
Release v1.0.1

9 years agoFix typo in contrib spec file
Simo Sorce [Thu, 14 Aug 2014 12:38:46 +0000 (08:38 -0400)]
Fix typo in contrib spec file

9 years agoAnnounce module name and version in the server signature
Alexander Bokovoy [Thu, 14 Aug 2014 11:50:27 +0000 (14:50 +0300)]
Announce module name and version in the server signature

9 years agoGssapiLocalName is about translating principals to local usernames
Alexander Bokovoy [Thu, 14 Aug 2014 11:45:51 +0000 (14:45 +0300)]
GssapiLocalName is about translating principals to local usernames

Fix wrong description

9 years agoMake dependency on openssl for EVP functions explicit
Alexander Bokovoy [Thu, 14 Aug 2014 09:26:44 +0000 (12:26 +0300)]
Make dependency on openssl for EVP functions explicit