This is a PAM module (using pam_script) which validates SAML assertions given as password. It is inspired by crudesaml, but implemented in PHP using LightSAML Core library.
Currently (and probably definately) only the auth
PAM type is supported. For all other types you usually want to use another module (in the simplest case e.g. pam_permit.so
).
License: BSD 2-Clause
Inspired by crudesaml, but doesn't depend on (a patched) liblasso3.
- Verification of SAML2 assertions as password replacement
- configuration options similar to crudesaml
Integrates well with SOGo Groupware and the Dovecot MDA using PAM authentication.
Passed in the PAM configuration in the format key=value
(analog to crudesaml).
userid
: name of SAML attribute which contains the username. The value will be matched against the username passed by PAM. Default:uid
grace
: Time frame (in seconds) allowing the validation of the assertion deviating from the given time frame in the assertion (for clock skew or longer authentication validity). Default:600
saml_check_timeframe
: If0
(disabled), validates the assertion also when it's expired. Default:1
idp
: Path to metadata file from which IdP certificates for assertion signature validation are extracted (multiple allowed). Signature is not verified, if none is given (not recommended!).trusted_sp
: EntityID of SP which should be trusted (i.e. which is in the Audience {Assertion/Conditions/AudienceRestriction/Audience}). All are allowed, if none is given (not recommended!).only_from
: Comma-separated list of IPs which can authenticate.
Logging can be enabled by using the pam_script_auth
wrapper script and setting the LOGFILE
variable. This helps troubleshooting a lot, since pam-script-saml is indicating where the validation fails.
- Download:
- Clone via git:
git clone https://github.com/ck-ws/pam-script-saml.git
- Zipball:
https://github.com/ck-ws/pam-script-saml/archive/master.zip
- Clone via git:
- Install dependencies:
composer.phar install
- Make sure the following PHP extensions are installed: dom, mbstring, mcrypt, opcache (zend_extension)
- Configure (see below)
- Install pam_script from source or from your distribution.
- Install
pam-script-saml
in a directory of your choice (see above). - Use the given
pam_script_auth
file (or create a symlink frompam_script_auth
topam-script-saml.php
) - configure the PAM module in
/etc/pam.d/
like this, for example:
auth required pam_script.so dir=<dir> userid=mail grace=900 [...]
account required pam_permit.so
session required pam_permit.so