Commit Graph

163 Commits

Author SHA1 Message Date
Ryan Petrello
e45e4b3cda fix a deadlock when Python garbage collects LDAPBackend objects
we shouldn't call signal.disconnect in __del__ because it can lead to
deadlocks in Django signal dispatch code

The Signal.connect, Signal.disconnect, and Signal._live_receivers
methods all share a threading.Lock():

22a60f8d0b/django/dispatch/dispatcher.py (L49)

It's possible for this to lead to a deadlock:

1.  Have code that calls Signal._live_receivers and enter the critical
    path inside the shared threading.Lock()
2.  Python garbage collection occurs and finds one or more LDAPBackend
    objects with no more references
3.  This __del__ is called, which calls Signal.disconnect
4.  Code in Signal._disconnect attempts to obtain the (already held)
    threading.Lock
5.  Python hangs forever while attempting to garbage collect
2019-01-18 11:27:50 -05:00
Ryan Petrello
af4234556e remove dm.xmlsec.binding
python-saml uses dm.xmlsec.binding only supports python2
by moving to py3, we now use python3-saml (which uses python-xmlsec
instead)

see: https://github.com/onelogin/python-saml/issues/145#issuecomment-222021691
2019-01-15 14:09:05 -05:00
Ryan Petrello
f223df303f convert py2 -> py3 2019-01-15 14:09:01 -05:00
adamscmRH
05d988349c make current_user ck secure and httponly 2018-11-21 10:36:35 -05:00
Ryan Petrello
d3dc126d45 truncate user first/last name if it exceeds 30 chars on LDAP auth 2018-11-14 15:51:43 -05:00
chris meyers
2e98446394 fix issue with ldap queries containing unicode 2018-10-12 10:33:01 -04:00
Ryan Petrello
27f4e487ec simpilfy LDAP GROUP_SEARCH misconfiguration failure handling 2018-08-02 10:11:18 -04:00
Ryan Petrello
2102c1ef0a fix a bug in multi-LDAP authentication
see: https://github.com/ansible/tower/issues/2738
2018-08-01 17:55:13 -04:00
Bill Nottingham
80abe4b937 Merge pull request #2387 from wenottingham/certificates-for-everyone
Require certpair for SAML.
2018-07-30 22:32:05 -04:00
Ryan Petrello
78eb0444ae fix a bug that causes orphaned auth_user rows when LDAP is misconfigured
see: https://github.com/ansible/tower/issues/2465
2018-07-30 09:59:20 -04:00
chris meyers
3fcd1575c1 fix saml_admin_attr 2018-07-23 10:08:18 -04:00
Jijo Varghese
e1dde21ec3 ldap attributes filter in user_groups()
ldap search currently fetches ALL attributes which is a waste of bandwidth resources and
woefully slow on large ldap groups when it only needs to parse the name_attr

Signed-off-by: Jijo Varghese <jijojv@gmail.com>
2018-07-18 16:51:21 -04:00
Antony PERIGAULT
53b5291a56 Fix functional tests 2018-07-16 17:03:00 -04:00
Antony PERIGAULT
3b6ab6217b New feature: Add SAML users as organization admins 2018-07-16 17:02:53 -04:00
Antony PERIGAULT
6ec2228885 Revert "Map users in organizations based on saml groups"
This reverts commit b4e0ff650165e6b0ab08d9a78be85f2f46182b94.
2018-07-16 17:02:46 -04:00
Antony PERIGAULT
062c18efa0 Map users in organizations based on saml groups 2018-07-16 17:02:38 -04:00
Bill Nottingham
fa5132991f Require certpair for SAML. 2018-07-05 11:12:00 -04:00
adamscmRH
8cc77234fc revert django-radius from 1.3.3 to 1.1.0 2018-06-22 15:01:11 -04:00
Ryan Petrello
c3bda8e259 properly detect settings.AUTHENTICATION_BACKEND changes for SSO logins
see: https://github.com/ansible/tower/issues/1979
2018-06-12 15:24:09 -04:00
Ryan Petrello
28a42850a2 allow AUTH_LDAP_USER_FLAGS_BY_GROUP to specify an OR'd list for a flag
see: https://github.com/ansible/tower/issues/968
2018-05-23 14:45:46 -04:00
chris meyers
04767641af isolate cache 2018-05-17 12:58:11 -04:00
adamscmRH
90308066af update radius backend for dr1.3.3 2018-04-25 15:04:46 -04:00
adamscmRH
3627c713fa fix multiple auth backends 2018-04-20 13:34:51 -04:00
AlanCoding
8ea323895a fix conditional LDAP test fail
Previously, if the main unit tests, test_common.py was
run before running this test, it would fail.
By clearing the cache at the start of the test, we
make its behavior consistent and predictable no
matter what other tests are also being ran,
and the assertion is adjusted to match.
2018-04-16 07:53:44 -04:00
chris meyers
00cd6cb384 set better defaults for ldap
* LDAP params is a new field. It contains the kwargs that will be passed
to the python class specified by group type. The default for group type
is MemberDNGroupType. The required params are now those in the defaults.
2018-04-10 15:44:08 -04:00
chris meyers
dc46a732bc fix ldap group type params label
* copy pasted ldap group type label and did no previously update. This
updates.
2018-03-28 09:12:06 -04:00
chris meyers
b9b8502738 introspect ldap group types for param validation
* Instead of keeping a hard-coded mapping of valid args for each ldap
group type; introspect the subclass to determine valid/invalid fields
2018-03-26 11:40:49 -04:00
chris meyers
1c578cdd74 validate group type params 2018-03-21 09:13:08 -04:00
chris meyers
17795f82e8 more parameters 2018-03-21 09:13:08 -04:00
chris meyers
e3c362956d add ldap group type like posixGroupType
* Adds pattern to easy add django-auth-ldap group types classes and to
pass parameters via AUTH_LDAP_GROUP_TYPE_PARAMS
* Adds new group type PosixUIDGroupType that accepts the attribute,
ldap_group_user_attr, on which to search for the user(s) in the group.
2018-03-21 09:13:08 -04:00
adamscmRH
310f37dd37 clears authtoken & add PAT 2018-02-22 15:18:12 -05:00
Aaron Tan
1c2621cd60 Implement session-based and OAuth 2 authentications
Relates #21. Please see acceptance docs for feature details.

Signed-off-by: Aaron Tan <jangsutsr@gmail.com>
2018-02-22 15:18:12 -05:00
cclauss
2e623ad80c Change unicode() --> six.text_type() for Python 3 2018-02-11 21:09:12 +01:00
cclauss
c371b869dc basestring to six.string_types for Python 3 2018-02-09 16:28:36 +01:00
Jake McDermott
3d421cc595 Merge pull request #1078 from jakemcdermott/saml-ldap-updates
update configuration views for multiple LDAP servers, SAML 2FA, and SAML attribute mapping
2018-02-02 12:15:44 -05:00
John Eismeier
026cbeb018 Propose small spelling changes 2018-02-02 10:49:55 -05:00
Ryan Petrello
81af34fce3 fix a bug which causes /api/v2/auth/ to list disabled auth backends
see: https://github.com/ansible/awx/issues/1073
2018-01-30 16:20:29 -05:00
Jake McDermott
44d223b6c9 add fields for team and organization saml attribute mappings 2018-01-30 00:27:51 -05:00
Chris Meyers
2b1d2b2976 Merge pull request #805 from chrismeyersfsu/feature-saml_import_attr
allow for saml attributes to define team and org
2018-01-15 11:57:05 -05:00
Chris Meyers
2ed97aeb0c implement multiple ldap servers 2018-01-11 09:03:14 -05:00
Chris Meyers
0a9d3d47b9 more efficiently determine saml team mapping 2018-01-09 12:16:07 -05:00
Chris Meyers
9d58b15135 allow for saml attributes to define team and org
related to https://github.com/ansible/awx/issues/217

* Adds a configure tower in tower setting for users to configure a saml
attribute that tower will use to put users into teams and orgs.
2018-01-04 15:35:11 -05:00
Matthew Jones
9dbcc5934e Merge remote-tracking branch 'tower/release_3.2.2' into devel 2017-12-13 12:25:47 -05:00
Chris Meyers
1899795d08 Merge pull request #721 from chrismeyersfsu/feature-2_factor
allow support for saml + 2-factor
2017-11-29 14:54:57 -05:00
Joachim Jablon
6609f38fa2 Fix import of social_core.exceptions in sso/pipeline.py
Signed-off-by: Joachim Jablon <ewjoachim@gmail.com>
2017-11-29 14:08:58 +01:00
Bill Nottingham
8cede51bac Remove stray quote from help string. 2017-11-28 14:32:39 -05:00
Chris Meyers
383c3cfe3e add more saml fields 2017-11-28 13:49:35 -05:00
Chris Meyers
98f2d936d9 allow support for saml + 2-factor
* python-social-auth has SOCIAL_AUTH_SAML_SECURITY_CONFIG, which is
forwarded to python-saml settings configuration. This commit exposes
SOCIAL_AUTH_SAML_SECURITY_CONFIG to configure tower in tower to allow
users to set requestedAuthnContext, which will disable the requesting of
password type auth from the idp. Thus, it's up to the idp to choose
which auth to use (i.e. 2-factor).
2017-11-17 09:25:50 -05:00
Wayne Witzel III
f118e27047 Flake8 fixes and URL updates 2017-11-10 17:04:33 -05:00
Wayne Witzel III
6d6bbbb627 Update URL strucuture, fixed string based calls 2017-11-09 17:24:04 -05:00