Bug 51932 - Only the first saml authentication works
Only the first saml authentication works
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: SAML
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0
Assigned To: Jürn Brodersen
Florian Best
https://repos.entrouvert.org/lasso.git/
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-08-31 11:19 CEST by Jürn Brodersen
Modified: 2021-05-25 15:58 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
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
saml message working login (8.07 KB, text/plain)
2020-08-31 12:02 CEST, Jürn Brodersen
Details
saml message broken login (8.07 KB, text/plain)
2020-08-31 12:03 CEST, Jürn Brodersen
Details
Representation of the saml message in python (broken login) (10.83 KB, text/plain)
2020-08-31 12:07 CEST, Jürn Brodersen
Details
crudesaml patch (3.03 KB, patch)
2021-02-19 10:28 CET, Jürn Brodersen
Details | Diff
crudesaml patch (3.08 KB, patch)
2021-02-19 10:33 CET, Jürn Brodersen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jürn Brodersen univentionstaff 2020-08-31 11:19:13 CEST
Only the first saml authentication works

Any subsequent login fails.

/var/log/syslog:
Aug 31 11:15:41 ucs-8750 simplesamlphp[8285]: 5 STAT [ddeec5e115] passive-saml20-idp-SSO https://ucs-8750.univention.intranet/univention/saml/metadata https://ucs-sso.univention.intranet/simplesamlphp/saml2/idp/metadata.php NA
Aug 31 11:15:42 ucs-8750 python2.7: Loaded metadata from "/usr/share/univention-management-console/saml/idp/ucs-sso.univention.intranet.xml"
Aug 31 11:15:42 ucs-8750 python2.7: SAML assertion contains no Issuer
Aug 31 11:15:42 ucs-8750 python2.7: pam_ldap: error trying to bind as user "uid=Administrator,cn=users,dc=univention,dc=intranet" (Invalid credentials)
Aug 31 11:15:47 ucs-8750 simplesamlphp[8290]: 5 STAT [ddeec5e115] passive-saml20-idp-SSO https://ucs-8750.univention.intranet/univention/saml/metadata https://ucs-sso.univention.intranet/simplesamlphp/saml2/idp/metadata.php NA
Aug 31 11:15:48 ucs-8750 python2.7: Loaded metadata from "/usr/share/univention-management-console/saml/idp/ucs-sso.univention.intranet.xml"
Aug 31 11:15:48 ucs-8750 python2.7: SAML assertion contains no Issuer


This seems to be a bug in lasso. Commit (in lasso) 8d06806db6869cbc2ac8df13128d401d241c9744 is the first broken commit, thanks to git bisect ;)
Comment 2 Florian Best univentionstaff 2020-08-31 11:32:29 CEST
Can you print the SAML assertion which is send to the UMC?

diff --git a/management/univention-management-console/src/univention/management/console/auth.py b/management/univention-management-console/src/univention/management/console/auth.py
index 2999ee6006..93eed57735 100644
--- a/management/univention-management-console/src/univention/management/console/auth.py
+++ b/management/univention-management-console/src/univention/management/console/auth.py
@@ -107,6 +107,7 @@ class AuthHandler(signals.Provider):
 
        def __authenticate_thread(self, pam, username, password, new_password, **custom_prompts):
                AUTH.info('Trying to authenticate user %r' % (username,))
+               AUTH.error('## SAML MESSAGE: %r' % (password,))
                username = self.__canonicalize_username(username)
                try:
                        pam.authenticate(username, password, **custom_prompts)


→ ensure that there is an "Issuer" set; to ensure that this has nothing to do with the Python 3 migration and some string issues.
Comment 3 Jürn Brodersen univentionstaff 2020-08-31 12:02:59 CEST
Created attachment 10467 [details]
saml message working login
Comment 4 Jürn Brodersen univentionstaff 2020-08-31 12:03:26 CEST
Created attachment 10468 [details]
saml message broken login
Comment 5 Jürn Brodersen univentionstaff 2020-08-31 12:07:44 CEST
Created attachment 10469 [details]
Representation of the saml message in python (broken login)
Comment 6 Jürn Brodersen univentionstaff 2020-08-31 12:09:01 CEST
Other than the expected differences (time, session, signature), I don't see any difference between the two messages.
Comment 7 Florian Best univentionstaff 2020-08-31 12:19:26 CEST
(In reply to Jürn Brodersen from comment #6)
> Other than the expected differences (time, session, signature), I don't see
> any difference between the two messages.
Yes, thank you.
Comment 8 Jürn Brodersen univentionstaff 2021-02-19 10:28:00 CET
Created attachment 10624 [details]
crudesaml patch

r19169: Bug #51932: Fix: Empty issuer after reinitialization

Upstream does not like the patch. It is not supported to call "lasso_init" after "lasso_shutdown".
And I can't reproduce the problem with the current UCS5 UMC anyway.

I suggest to remove the patch again. We might want to patch crudesaml though, not to call "lasso_shutdown()", but it seems it's not really needed right now.
Comment 9 Jürn Brodersen univentionstaff 2021-02-19 10:28:39 CET
Upstream bug: https://dev.entrouvert.org/issues/51248
Comment 10 Jürn Brodersen univentionstaff 2021-02-19 10:33:39 CET
Created attachment 10625 [details]
crudesaml patch
Comment 11 Jürn Brodersen univentionstaff 2021-02-22 11:02:02 CET
As discussed the lasso patch has been reverted:
r19289: Bug #51932: revert patch 20-Fix-Empty-issuer-after-reinitialization.quilt
Comment 12 Florian Best univentionstaff 2021-03-06 11:59:10 CET
OK: lasso 2.6.0-2A~5.0.0.202102191532
Comment 13 Florian Best univentionstaff 2021-05-25 15:58:04 CEST
UCS 5.0 has been released:
 https://docs.software-univention.de/release-notes-5.0-0-en.html
 https://docs.software-univention.de/release-notes-5.0-0-de.html

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