Bug 39181 - Expired password change not demanded during SAML login
Expired password change not demanded during SAML login
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: SAML
UCS 4.1
Other Mac OS X 10.1
: P5 normal (vote)
: UCS 4.1
Assigned To: Erik Damrose
Stefan Gohmann
: interim-2
Depends on:
Blocks: 39694 39616
  Show dependency treegraph
 
Reported: 2015-08-14 15:52 CEST by remko.gerbranda
Modified: 2015-11-17 12:12 CET (History)
3 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description remko.gerbranda 2015-08-14 15:52:42 CEST
During testing I discovered that an expired password change is not requested
when the user logs on to a SSO service.

As SimpleSAMLphp is integrated in UCS, I expected a password expiration check.

Reference: 
http://docs.univention.de/manual-3.1.html#users:passwords
http://wiki.univention.de/index.php?title=SAML_Identity_Provider
Comment 1 Florian Best univentionstaff 2015-09-08 10:31:20 CEST
I would implement this using the simplesamlphp module "expirycheck":
https://simplesamlphp.org/docs/1.9/expirycheck:expirycheck

This module requires a (pseudo)LDAP-Attribute which can be parsed by the PHP Date() function.

The user password expiry is currently set in the LDAP attributes krb5PasswordEnd, sambaPwdLastSet, shadowLastChange, shadowMax.
We probably also need to check the account deactivation. That would be the LDAP attributes: krb5ValidEnd, sambaKickoffTime, shadowExpire

Implementation could look like:
1. Add a simplesamlphp module which evaluates the above attributes and creates a unified date-parseable pseudo-LDAP attribute which is evaluated by the expirycheck module.
This could be written in PHP or we could make a subprocess in PHP with a python process which uses UDM for that task.

2. An alternative would be to switch from LDAP-bind to PAM by writing a simplesamlphp authentication module.
There is a PHP extension for PAM (https://pecl.php.net/package/PAM) which provides the function:
bool pam_auth(string $username, string $password [, string &$error [ $checkacctmgmt = true ] ]).

I don't know if this is able to interact correctly with our PAM stack.
It seems the conversation is only able to transmit username and password:
http://svn.php.net/viewvc/pecl/pam/trunk/pam.c?view=markup#l213
Our PAM stack often also asks for PAM_TEXT_INFO and PAM_ERROR_MSG which would end in a PAM conversation error.


I think 1) is the best variant if written in python as if we change the UDM users/user handler we don't need to adapt this implementation again. PHP must be set up to allow subprocesses then.
Which LDAP attributes must be evaluated?
What do you think, Stefan?
Comment 2 Erik Damrose univentionstaff 2015-10-22 12:05:47 CEST
The expirycheck module unfortunately only has one message that is displayed for the user, which is something like 'permission denied'.

I implemented an adapted uLDAP class which mimics the LDAP Auth behavior, and has additional checks for expired passwords, required password changes and locked / disabled accounts. Appropriate error messages will be given to the user.

r64732 univention-saml 3.0.24-5.78.201510221159
r64734 changelog
Comment 3 remko.gerbranda 2015-10-22 12:12:10 CEST
Hi Erik,

Good to hear that this is implemented! When will it be available in the repository?

Kind regards,
Remko
Comment 4 Erik Damrose univentionstaff 2015-10-22 12:15:49 CEST
Hi Remko, this is a planned feature for UCS 4.1, which is scheduled to be released in November. See [1] for the release schedule and information about testing our milestone and release candidate

[1] http://wiki.univention.de/index.php?title=UCS_4.1_Development
Comment 5 Stefan Gohmann univentionstaff 2015-10-31 11:12:51 CET
Accound disabled: OK
Account locked: OK
Account expired: OK
Password change at next login: OK
Password change in the future: OK
Password change in the past: OK

We should add automatic tests for it. I've created a bug for ucs-test: Bug #39694.
Comment 6 Stefan Gohmann univentionstaff 2015-11-17 12:12:49 CET
UCS 4.1 has been released:
 https://docs.software-univention.de/release-notes-4.1-0-en.html
 https://docs.software-univention.de/release-notes-4.1-0-de.html

If this error occurs again, please use "Clone This Bug".