Commit Graph

417 Commits

Author SHA1 Message Date
Olav Morken 31e324d15c
Merge pull request #211 from siemens/feat/authn-context-comparision-type
feat: add MellonAuthnContextComparisonType option
2019-07-23 13:19:31 +02:00
Roger Meier 59648dda65 feat: add MellonAuthnContextComparisonType option 2019-07-19 16:55:33 +02:00
Olav Morken 6b66c3b31f
Merge pull request #208 from vit4/master
Fix implicit function declaration: rindex on Solaris
2019-06-07 10:47:11 +02:00
Vita Batrla f9b925f21c Fix implicit function declaration: rindex on Solaris
Compilation on reports warning:

"auth_mellon_diagnostics.c", line 188: warning: implicit function declaration: rindex
"auth_mellon_diagnostics.c", line 188: warning: improper pointer/integer combination: op "="

And binary dumps core, because rindex() is assumed to be integer type, so
compiler sign extends its return value and then uses the number as pointer:

am_diag_cond_str+0x154:      call   -0x1e119 <PLT=libc.so.1`rindex>
am_diag_cond_str+0x159:      movslq %eax,%rax
am_diag_cond_str+0x15c:      testq  %rax,%rax
am_diag_cond_str+0x15f:      je     +0x7     <am_diag_cond_str+0x168>
am_diag_cond_str+0x161:      movb   $0x5d,(%rax)  <- SIGSEGV

Fixes issue #207.
2019-06-07 10:28:14 +02:00
Olav Morken 8949b0e3d9
Merge pull request #200 from jhrozek/conf_prefix
Make the environment variable prefix configurable
2019-04-30 09:34:31 +02:00
Jakub Hrozek caea8d78dd Make the environment variable prefix configurable
mellon passes on every attribute received in a SAML assertion as an
Apache variable. By default, the variable is prefixed with "MELLON_".

In some cases, for example when migrating from a different SP to mellon
it might be beneficial to change the prefix. And while using
MellonSetEnvNoPrefix is an option as well, the MellonSetEnvNoPrefix has
to be specified for each variable independently.
2019-04-12 14:38:41 +02:00
Olav Morken ef60270745
Merge pull request #201 from jcpunk/attribute-map
Add mellon-attribute-map.xsl to convert shibboleth:2.0:attribute-map
2019-04-11 09:15:20 +02:00
Pat Riehecky f03fb14214 Add mellon-attribute-map.xsl to convert urn:mace:shibboleth:2.0:attribute-map 2019-04-10 11:46:43 -05:00
Olav Morken 7d681177cb Bump version to 0.14.2 2019-03-21 14:58:35 +01:00
Olav Morken 62e0f423ac Add changelog for 0.14.2 2019-03-21 14:58:27 +01:00
Olav Morken 62041428a3 Fix redirect URL validation bypass
It turns out that browsers silently convert backslash characters into
forward slashes, while apr_uri_parse() does not.

This mismatch allows an attacker to bypass the redirect URL validation
by using an URL like:

  https://sp.example.org/mellon/logout?ReturnTo=https:%5c%5cmalicious.example.org/

mod_auth_mellon will assume that it is a relative URL and allow the
request to pass through, while the browsers will use it as an absolute
url and redirect to https://malicious.example.org/ .

This patch fixes this issue by rejecting all redirect URLs with
backslashes.
2019-03-20 08:29:16 +01:00
Olav Morken 7bc436760d
Merge pull request #196 from jhrozek/am_handler_except_proxy
Modify am_handler setup to run before mod_proxy
2019-03-19 12:46:45 +01:00
John Dennis e09a28a30e Modify am_handler setup to run before mod_proxy
The way the ECP flow works is that when a client initiates the flow, the
SP's response is HTTP 200, but not the requested content, but a signed XML
document that contains the "samlp:AuthnRequest" element. The idea is that
the ECP client would then determine the IDP and send the document to the
IDP, get a samlp:Response and convey that to the SP to get access to the
protected resource.

Internally, the auth check which is normally done with am_check_uid() set to
apache's ap_hook_check_user_id() hook, just responds with OK, so it pretends
to authenticate the user. Then in the usual flow, the request reaches the
ap_hook_handler which handles the request. There in the pipeline, mellon
registers functions am_handler() which should run first (APR_HOOK_FIRST),
determine that this request is an ECP one and return the ECP AuthnRequest
document. But in case the proxy module is also in the picture, the proxy
module "races" for who gets to be the first to handle the request in the
pipeline and wins. Therefore, the request reaches the protected resource
via mod_proxy and returns it.

This fix modifies the ap_hook_handler() call to explicitly run before
handlers from mod_proxy.c

To reproduce the bug:
0) Have a SP with mellon connected to a Keycloak IDP (or any other IDP I
   guess). In the example below, my SAML SP is saml.federation.test
1) Set a Location protected by mellon that proxies requests to another
   URL. For example:

    ProxyPass         /sp-proxy  http://app.federation.test/example_app/
    <Location /sp-proxy>
        AuthType Mellon
        MellonEnable auth
        Require valid-user
    </Location>

2) call:
 curl -L -H "Accept: application/vnd.paos+xml" \
         -H 'PAOS: ver="urn:liberty:paos:2003-08";"urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp"' \
          http://saml.federation.test/sp-proxy

Before the patch, you would see whatever is served from the proxied
page. With the patch, you should get back a XML document with a
samlp:AuthnRequest.
2019-03-19 12:41:26 +01:00
Olav Morken 881d11cafd Bump version to 0.14.1 2019-02-11 08:26:56 +01:00
Olav Morken e9771dc9b2 Add changes for 0.14.1
This patch addes the changelog for version 0.14.1.
2019-02-11 08:26:11 +01:00
Olav Morken 599e2b4de6
Merge pull request #193 from dnmvisser/dnmvisser-readme-syntaxhighlight
Highlight syntax
2019-01-31 13:30:48 +01:00
Dick Visser 157cfd17c8
Highlight syntax
Github supports this https://github.com/github/linguist/blob/master/lib/linguist/languages.yml#L240, it makes things more readable, especially in the large configfile with a lot of comment lines.
2019-01-31 11:27:28 +01:00
Olav Morken 71cf0c9889 Fix trailing semi-colon in Set-Cookie header
A trailing semi-colon in the Set-Cookie header confuses the AWS
Elastic Load Balancer. This patch fixes the code that generates the
Set-Cookie header so that it no longer ends with a semi-colon.

Fixes issue #190
2018-11-30 08:33:43 +01:00
Olav Morken 32a3dd423c
Merge pull request #180 from orimanabu/fix_host_regexp
Exclude ':PORT' from  when endopint URL contains port number.
2018-09-04 14:20:48 +02:00
Manabu Ori 2370b4199b Exclude ':PORT' from when endopint URL contains port number. 2018-09-04 17:36:47 +09:00
Olav Morken 6358a51697 Fix incorrect header used for detecting AJAX requests
The code was looking for "X-Request-With", but the header is actually
"X-Requested-With". As far as I can tell, it has always been the
latter, at least in the jQuery source code.

Fixes issue #174.
2018-07-25 12:19:39 +02:00
Olav Morken c5d4159031
Merge pull request #172 from thijskh/master
Ship mellon_create_metadata.sh in release tarball.
2018-06-11 09:03:10 +02:00
Thijs Kinkhorst ae926cd679 Ship mellon_create_metadata.sh in release tarball. 2018-05-30 18:16:04 +00:00
Olav Morken faec7a0392
Merge pull request #167 from thrillhouse82/fix-env-refs
Fix usage of environment variables in MellonCond
2018-04-18 12:15:05 +02:00
Markus Hosch 6c191bfc0f Fix usage of environment variables in MellonCond
Using Apache environment variables in MellonCond expressions didn't
work for various reasons:
* The substitution was never executed if no backrefs were present.
* Only the OS environment was queried without checking the Apache
  internal variable stores.
* The output string after substitution was set to an empty string.

Fixing these issues makes %{ENV:...} work properly.
2018-04-17 15:01:54 +02:00
Olav Morken 83f817920d
Merge pull request #165 from TimoL/TimoL-typo-fixes
Fix some minor typos
2018-04-16 08:57:39 +02:00
Timo Lotterbach f3065d4f8d
Fix some minor typos
Trivial fixes in the text.
2018-04-13 20:28:30 +02:00
Olav Morken 29d2872f9b Bump version to 0.14.0. 2018-03-16 08:21:38 +01:00
Olav Morken 21f78ab060 Add release notes for version 0.14.0. 2018-03-16 08:21:38 +01:00
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