Commit Graph

438 Commits

Author SHA1 Message Date
Olav Morken 262768ae19 NEWS: Add consistent whitespace between releases. 2018-03-16 08:21:38 +01:00
Olav Morken 7bb98cf9dd Fix config.h.in missing in .tar.gz. 2018-03-16 08:21:38 +01:00
Olav Morken 4f2265fcf0
Merge pull request #159 from jdennis/adfs-doc
Update User Guide on error responses and ADFS issues
2018-02-27 07:40:09 +01:00
John R. Dennis bdc95cce4f
Merge pull request #1 from davidkretch/adfs-doc
Fix typos in the user guide
2018-02-25 12:25:15 -05:00
David Kretch aee068f4a1 Fix typos in the user guide
Fix some typos in the newly-added sections in the user guide on error
responses and ADFS issues.
2018-02-25 12:05:25 -05:00
John Dennis 8abbcf9dc6 Update User Guide on error responses and ADFS issues
Add documentation in the User Guide on how to determine if a SAML
transaction succeeded or failed and how to determine the cause of the
failure.

Add documentation in the User Guide on known quirks with ADFS
integration.

Signed-off-by: John Dennis <jdennis@redhat.com>
2018-02-22 19:04:04 -05:00
Olav Morken f86a86519e
Merge pull request #156 from jdennis/sign_alg
Add MellonSignatureMethod to control signature algorithm
2018-02-22 07:20:00 +01:00
John Dennis 9b17e5c107 Add MellonSignatureMethod to control signature algorithm
Previously there was no way to control the signature algorithm used
when Mellon signed it's SAML messages. It simply defaulted to whatever
the default was in the LassoServer server object. Currently the lasso
default is LASSO_SIGNATURE_METHOD_RSA_SHA1. Some IdP's require a
different or more secure method (e.g. ADFS). This patch allows
controlling the signature method on a per directory basis via the
MellonSignatureMethod configuration directive.

It currently supports the following configuration values which map to
these Lasso enumerated constants (provided these definition exist in
Lasso):

rsa-sha1:    LASSO_SIGNATURE_METHOD_RSA_SHA1
rsa-sha256:  LASSO_SIGNATURE_METHOD_RSA_SHA256
rsa-sha384:  LASSO_SIGNATURE_METHOD_RSA_SHA384
rsa-sha512:  LASSO_SIGNATURE_METHOD_RSA_SHA512

configure.ac was modified to test for the existence of the above
Lasso definitions, support is only compiled into Mellon if they
are defined at build time.

Important: This patch also changes the default used by Mellon from
rsa-sha1 to rsa-sha256. This was done because SHA1 is no longer
considered safe, SHA256 is now the current recommendation.

The patch also includes a few corrections in the diagnostics code
where it failed to use CFG_VALUE. Also fixed the diagnostics code when
an unknown value was encounted to print what that unknown value was.

Signed-off-by: John Dennis <jdennis@redhat.com>
2018-02-21 18:39:46 -05:00
Olav Morken 31b70eb296
Merge pull request #157 from jdennis/log-status-response
Log SAML status response information
2018-02-21 08:21:56 +01:00
John Dennis 582f283c49 Log SAML status response information
Knowing if a SAML operation failed and the reason why is essential to
diagnose problems. The SAML Status Response is always included in all
SAML responses. In addition to the major reason why a transaction
failed it may also include extra expository information giving
additional details. Unfortunately we never logged any of the status
response information when a failure occurred. This patch adds code to
log the status response information.

In addition the patch adds diagnostic logging of received POST data.

Signed-off-by: John Dennis <jdennis@redhat.com>
2018-02-20 16:55:17 -05:00
Olav Morken 72d12b3789
Merge pull request #155 from andrew-schulman/master
convert README to README.md
2018-02-09 09:25:17 +01:00
Andrew Schulman 524d5580db convert README to README.md 2018-02-08 14:38:13 -05:00
Olav Morken 906d7fd030
Merge pull request #154 from andrew-schulman/master
Fix consistency, grammar, and usage in user guide
2018-02-08 08:49:12 +01:00
Andrew Schulman 0851045f73 Fix consistency, grammar, and usage in user guide 2018-02-07 12:18:14 -05:00
Olav Morken 3a70773164
Merge pull request #152 from UNINETT/fix-apache-2-2-build
Fix build on Apache 2.2
2018-01-18 19:09:33 +01:00
Olav Morken 70e8abc3a4 Give clear error if building with diagnostics support on old Apache
This patch ensures that we fail with a clear error message if building
with diagnostics support on Apache 2.2 or older.
2018-01-18 18:44:28 +01:00
Olav Morken 15fcbf7c9d Fix build error on Apache 2.2.
The `mi` parameter to `ap_log_rerror()` was added in Apache 2.4. This
makes the macro expansion in `AM_LOG_RERROR()` incorrect on Apache
2.2.

This patch works around this issue by forwarding the `AM_LOG_RERROR()`
macro directly to `ap_log_rerror()`.

Fixes issue 151.
2018-01-18 18:36:22 +01:00
Olav Morken 4eb25e621d
Merge pull request #149 from nneul/patch-1
Add clarification on using info vs auth
2018-01-12 09:28:16 +01:00
Olav Morken bc6ffdfd45
Merge pull request #150 from nneul/patch-2
Add example for dual auth support.
2018-01-12 09:27:57 +01:00
Nathan Neulinger fe8b978429
Add example for dual auth support. 2018-01-11 15:21:34 -06:00
Nathan Neulinger f865919896
Add clarification on using info vs auth 2018-01-11 15:15:50 -06:00
Olav Morken 1dd4a5be09
Merge pull request #147 from davidkretch/fix-typos
Fix Mellon user guide typos
2017-12-18 08:48:29 +01:00
David Kretch 5927b5c383 Fix Mellon user guide typos
Fix some typos in the Mellon user guide.
2017-12-17 15:44:00 -05:00
Olav Morken 39c22c275f
Merge pull request #146 from jdennis/diag_condtional_build
Fix conditional build of auth_mellon_diagnostics.c
2017-12-11 14:43:45 +01:00
John Dennis 86eb3440b2 Fix conditional build of auth_mellon_diagnostics.c
Commit de853e15 introduced using config.h to define optional build
parameters instead of putting them on the compile command
line. Unfortunately that broke the compilation of
auth_mellon_diagostics.c.

We used to have this:

ifdef ENABLE_DIAGNOSTICS
include "auth_mellon.h"

but the flag ENABLE_DIAGNOSTICS is now defined by including
auth_mellon.h (which includes config.h) hence it would be impossible
for the ENABLE_DIAGNOSTICS to be defined during compilation.

The solution is simple, just reverse the order of the two lines such
that the defines are seen before the #ifdef conditional.

Signed-off-by: John Dennis <jdennis@redhat.com>
2017-12-07 15:43:33 -05:00
Olav Morken e5e90f8c27
Merge pull request #140 from jdennis/nameid_doc
Add NameID discussion to User Guide
2017-10-31 11:46:00 +01:00
John Dennis 89a3c8174b Add NameID discussion to User Guide
How NameIDs are used in SAML often confuse people trying to configure
a service provider especially when they try to emulate a userid. This
patch adds several sections describing the concept of a SAML NameID,
how the use of NameIDs are configured in SAML and some suggested
approaches to utilizing NameIDs.

Signed-off-by: John Dennis <jdennis@redhat.com>
2017-10-10 20:25:37 -04:00
Olav Morken 7ed00f45ea Merge pull request #139 from nneul/feature-more-diag
Add additional diagnostic information for invalid destination and audience
2017-10-06 15:19:12 +02:00
nneul at neulinger.org 93faba4505 Update log msg for Invalid Destination and Invalid Audience to show both the expected and received values. 2017-10-06 12:12:51 +00:00
Olav Morken 85ffa837e2 Merge pull request #137 from jdennis/autotools
Add user_guide to distribution, use AC_DEFINE instead of CFLAGS
2017-10-02 11:46:10 +02:00
John Dennis de853e1554 Add user_guide to distribution, use AC_DEFINE instead of CFLAGS
This patch corrects a few minor autotool issues.

The user_guide was recently added but that commit failed to include
adding the new documentation to the tarball, Makefile.in was augmented
to include the new files to the list of distribution files.

Formerly the #defines generated by configure were passed to the
compiler on the command line in various CFLAGS values. Although that
works the more -Dxxx that configure generates the longer the compile
command becomes and it starts to get unreadable and possibly exceed
command line length. A more common practice with autotools is to
employ autoheader whereby configure generates a file typically called
config.h which then is included by the C files. The contents of
config.h contains the #defines as generated by configure. configure.ac
was updated to utilize the AC_DEFINE in lieu of adding -Dxxx to CFLAGS
and to generate and output config.h.

Note: autogen.sh needs to be re-run to pick up these changes so that
the configure included in the tarball contains the updated version.

Signed-off-by: John Dennis <jdennis@redhat.com>
2017-09-29 13:42:24 -04:00
Olav Morken 5f001e637b Merge pull request #133 from jdennis/diagnostics
Adds support for diagnostics-logging, which provides a detailed log from the request processing in mod_auth_mellon.
2017-09-26 08:50:29 +02:00
John Dennis 8d49ab65a1 Replace ap_log_rerror with AM_LOG_RERROR
If diagnostics is enabled we want error messages written to the
diagnostics log as well as the Apache error_log. AM_LOG_RERROR
replaces the use of ap_log_rerror, it invokes ap_log_rerror as
previously but then also logs the same message to the diagnostics
log. If diagnostics is not enabled it reverts to ap_log_rerror.

Signed-off-by: John Dennis <jdennis@redhat.com>
2017-09-25 11:09:23 -04:00
John Dennis e8579f6387 Add diagnostic logging
Field experience with Mellon has demonstrated there are many
opportunities for deployment problems. Although there are tools such
as browser plugins which can capture SAML messages it's onerous for
site personnel to install and capture the relevant information. The
problem with this approach is further compounded by the fact the
external SAML messages are not correlated to Mellon's
requests/responses. Mellon currently can dump the Lasso session and
SAML Response messages and place them in Apache environment variables,
however these do not appear in the log file. To get them into the log
you have to add custom logging to the Apache config. Another issue is
the dumps are not human readable, they are base64 encoded, anyone
looking at the logs after setting up the custom logging will have to
find the base64 text and then manually copy the text into an external
base64 decoder. At that point you'll discover the XML is not pretty
printed making human interpretation difficult.

The Mellon debug messages written to the Apache error are often
insufficient to diagnose problems. And since the Mellon log messages
are written to the Apache error log they are interspersed with a lot
of non-Mellon message.

Compounding the problem of writing Mellon debug messages to the Apache
error log is the fact Apache log messages have a fixed maximum length
(currently 8192) which is insufficient to completely write out such
things as SAML Assertions, metadata, etc. Apache logging also escapes
all control characters with the consequence line breaks are not
preserved and what was a nicely formatted human readable piece of text
becomes a single line with escape characters and may be truncated.

It would be really nice if we could capture diagnostic information
with these properties:

* All relevant data is collected in exactly one file.

* Only information relevant to Mellon appears in the file.

* All information is human readable (pretty printed, decrypted) with
  no need to rely on other tools.

* The diagnostic information is grouped by requests.

* The requests can be cross correlated with other Apache logs because
  they utilize the same unique request identifier.

This patch adds diagnostic logging to a independent Mellon diagnostics
log file. Every piece of relevant information is captured, including:

* Request information which includes:

  - Request method
  - Request URL (raw and processed)
  - Scheme
  - Port
  - Request query parameters
  - Server name
  - Unique request ID
  - process ID, thread ID
  - Request headers

* Mellon per directory configuration

  A complete dump of the entire am_dir_cfg_rec structure keyed using
  both the Mellon directive it is associated with and it's internal
  name. This is emitted once on first use for a given URL.

  The per directory dump includes the pathname of each file read as
  well as the file contents. This includes:

  - IdP metadata
  - SP metadata
  - SP cert
  - SP key
  - IdP public key file
  - IdP CA file

* All session management operations

  - cookie
  - session lookup
  - session creation
  - session deletion
  - cache management
  - cache entry information

* All SAML messages

  Each SAML message is decrypted, decoded and XML pretty printed in
  human readable form.

* Request pipeline operations

  What operations Mellon performs, what decisions it makes and what
  data is being used to make those decisions.

* Response

  - response status
  - response headers
  - Apache user name
  - auth_type
  - all Apache environment variables

Diagnostics can be enabled/disabled both at compile time and run
time. Compile time inclusion of diagnostics is managed with the
ENABLE_DIAGNOSTICS preprocssor symbol. The configure script now accepts
the

  --enable-diagnostics and --disable-diagnostics

option. Building with diagnostics is disabled by default, you must
specify --enable-diagnostics to enable the run time option of generating
diagnostics.

The following server config directives have been added (e.g. may be
specified in the main server config area or within a <VirtualHost>
directive). If Mellon was not built with diagnostics enabled then
these config directives are no-ops and their use will generated a
warning in the log file indicating they have been ignored and to be
effective you must builld Mellon with diagnostics enabled.

  MellonDiagnosticsFile:
    The name of the diagnostics file or pipe,
    (default is logs/mellon_diagnostics)

  MellonDiagnosticsEnable:
    Currently either On or Off but it is designed so it can take other
    flags in the future to control what type of information is
    reported.

Signed-off-by: John Dennis <jdennis@redhat.com>
2017-09-25 11:09:10 -04:00
John Dennis 6d2ee845c0 Track file information
File information was handled inconsistently. Some configuration
directives which specified a file path replaced the file path with the
contents of the file. This made it impossible to report where the data
was read from. Other file configuration simply recorded the path. The
directives which immediately read the file contents would generate a
configuration error if the file wasn't readable, but those directives
which simply recorded the file path didn't check on the validity of
the path and relied on Lasso to report an error, however these errors
come significantly after configuration parsing because they are
evaluated in a lazy fashion on first use. The Lasso error reporting
can sometimes be cryptic making it difficult to realize the problem is
due to a improperly specified path in a configuration directive.

We want to be able to log the file pathnames where various files are
read from for diagnostic logging purposes.

This patch introduces a new struct am_file_data_t that encapsulates
all information concerning a file including it's pathname, it's stat
information, optionally it's content, when it was read, etc. as well
as maintaing error codes and an error description.

All file specifications and operations now use this mechanism for
consistency.

Signed-off-by: John Dennis <jdennis@redhat.com>
2017-09-22 13:44:13 -04:00
Olav Morken 3869c73d8d Merge pull request #135 from jdennis/user_guide
Add Mellon User Guide
2017-09-21 16:57:12 +02:00
John Dennis ee97812b97 Add Mellon User Guide
The User Guide is documentation intended to help people get started
with mod_auth_mellon, understand SAML concepts as they directly relate
to mod_auth_mellon, install mellon, understand mellon configuration,
learn how to diagnose deployment problems, address complex deployment
considerations such as behind proxies and load balancers and enumerate
the most common deployment problems and their solutions.

The document is written in AsciiDoc. It aspires to be vendor and
operating system neutral. When there are vendor or operating system
specific considerations those are called out separately.

Instructions on how to edit and render the AsciiDoc are provided in
the README.

Signed-off-by: John Dennis <jdennis@redhat.com>
2017-09-18 11:04:58 -04:00
John Dennis daa5d1e667 If no IdP's are defined explicitly log that fact
Sometimes configuration errors are made and a location does have any
IdP's defined for it. Previosly the error message in this case was:

"Error adding IdP to lasso server object. Please verify the following
configuration directives: MellonIdPMetadataFile and
MellonIdPPublicKeyFile."

But this message is misleading, it suggests an attempt was made to add
the IdP but somehow it failed, this will often cause folks to try to
determine what is wrong with the IdP metadata file, which may in fact
be defined in the mellon config but because of location inheritance is
not being included in the per directory config.

It would be much more helpful to indicate no IdP's were defined for
this config location which is clearly a different problem than
suggesting an attempt was made to add an IdP but it failed.

Signed-off-by: John Dennis <jdennis@redhat.com>
2017-09-02 12:33:07 -04:00
John Dennis 119cbdd525 modify cache functions to take request_rec parameter instead of server_rec
The entire point of the cache is to persist state between requests so
conceptually it makes sense the cache functions would receive a
server_rec pointer because the cache is a server level data
structure. However most cache operations occur in the context of a
request. Passing a request_rec to a cache function has the following
advantages:

1) Any logging during a cache operation should be tied to the request.

2) Any need for temporary memory allocation is much easier to handle
with access to the request's memory pool which is cleaned up at the
end of the request as opposed to trying manage memory allocations at
the server level.

3) Any need for access to the server_rec is trivially easy to obtain
from the request_rec via r->server. In fact the caller of cache
functions inside requests simplyy provided the server_rec parameter
via r->server, so why not just pass the request_rec?

These changes are in anticipation of adding enhanced logging and
diagnostics into the cache functions, they will need access to the
request_rec and it's memory pool.

Signed-off-by: John Dennis <jdennis@redhat.com>
2017-09-02 12:31:24 -04:00
Olav Morken c29123244e Make MellonUser case-insensitive.
MellonUser used to perform its attribute match in a case-sesnsitive
manner, while environment variables are stored in a case-insensitive
table in Apache.

The result is a bit of inconsistency between the way mod_auth_mellon
handles the attribute names and the way they are accessed other places
in Apache.

This patch changes the code to use a case-insensitive match when
processing the MellonUser directive.

Fixes issue #131.
2017-08-16 17:28:16 +02:00
Olav Morken 2c2e19d960 Fix incorrect error check for many `lasso_*`-functions.
Several places in the code we assumed that Lasso error codes were
negative, however some of them are positive integers. This patch
ensures that we do direct check for a zero return code in all cases.

Fixes issue #128.
2017-08-08 14:34:24 +02:00
Olav Morken 5c5ed1d6ab Fix segmentation fault with POST field without a value.
This patch fixes a segmentation fault that can occur after the user
has logged in if the server is configured to replay POST data from
before login. If the POST data contained a field without a value we
would attempt to pass a constant string to the
am_urldecode()-function, which would crash with a segmentation fault.

This patch fixes that by using an empty string allocated on the stack
instead of a constant string.

Fixes #115.
2017-08-08 09:45:10 +02:00
Olav Morken 6ff514ceec Merge pull request #122 from thijskh/master
Fix some log message typos
2017-07-10 09:20:34 +02:00
Thijs Kinkhorst 4c924d9062 Fix some log message typos 2017-07-09 14:42:29 +00:00
Olav Morken 1851412d77 Version 0.13.1. 2017-03-13 10:14:53 +01:00
Olav Morken 8dafa59aa8 Fix segfault if POST replay is enabled but MellonPostDirectory is not set.
This patch fixes a segmentation fault when segmentation is enabled if
MellonPostDirectory is not set. This segmentation fault occurs when
trying to open the POSt directory.

The fix changes the behavior to log an error instead in this case.
2017-03-13 10:14:50 +01:00
Olav Morken 7af21c53da Fix Cross-Site Session Transfer vulnerability
mod_auth_mellon did not verify that the site the session was created
for was the same site as the site the user accessed. This allows an
attacker with access to one web site on a server to use the same
session to get access to a different site running on the same server.

This patch fixes this vulnerability by storing the cookie parameters
used when creating the session in the session, and verifying those
parameters when the session is loaded.

Thanks to François Kooman for reporting this vulnerability.

This vulnerability has been assigned CVE-2017-6807.
2017-03-13 09:55:48 +01:00
Olav Morken 3fe9a7ee17 Fix parameter order in comment
The order of parameters in this comment didn't match the function
definition. Update the comment to reflect the parameter order in the
function.
2017-03-10 14:42:32 +01:00
Olav Morken 6b41d56927 Add beginning of NEWS file for version 0.13.1 2017-03-10 14:42:32 +01:00
Olav Morken dba4bbd8f7 Merge pull request #114 from UNINETT/fix_segfault_missing_attr_name
Fix segmentation fault when the IdP returns an attribute without a Name.
2017-03-10 14:39:48 +01:00