What went wrong?
Tried to use ldap3 with gssapi and I can't get SASL GSSAPI auth over LDAPS to work.
- GSSAPI over LDAP works
- NO AUTH/PLAIN over LDAPS works
- GSSAPI over LDAPS doesn't work
GSSAPI over LDAPS works on Linux (I tried ArchLinux but should work on any)
How do we reproduce?
$ python3 -m venv ldap3gssapitest
$ cd ldap3gssapitest
$ source bin/activate
$ pip3 install ldap3 gssapi cryptography
$ cat > search.py <<EOF
#!/usr/bin/env python3
from ldap3 import Server, Connection, Tls, SASL, KERBEROS
import ssl
tls = Tls(validate=ssl.CERT_NONE, version=ssl.PROTOCOL_TLSv1_2)
server = Server('yourldapserver', use_ssl=True, tls=tls)
c = Connection(
server, authentication=SASL, sasl_mechanism=KERBEROS)
c.bind()
print(c.extend.standard.who_am_i())
EOF
$ python3 search.py
dn:uid=simlu,cn=gssapi,cn=auth
That should yield an LDAP dn which should match your Kerberos principal.
With macOS 11.1 I get:
$ python3 search.py
Traceback (most recent call last):
File "/private/tmp/ldap3gssapitest/search.py", line 8, in <module>
c.bind()
File "/private/tmp/ldap3gssapitest/lib/python3.9/site-packages/ldap3/core/connection.py", line 608, in bind
response = self.do_sasl_bind(controls)
File "/private/tmp/ldap3gssapitest/lib/python3.9/site-packages/ldap3/core/connection.py", line 1336, in do_sasl_bind
result = sasl_gssapi(self, controls)
File "/private/tmp/ldap3gssapitest/lib/python3.9/site-packages/ldap3/protocol/sasl/kerberos.py", line 118, in sasl_gssapi
out_token = ctx.step(in_token)
File "<decorator-gen-15>", line 2, in step
File "/private/tmp/ldap3gssapitest/lib/python3.9/site-packages/gssapi/_utils.py", line 155, in check_last_err
return func(self, *args, **kwargs)
File "<decorator-gen-5>", line 2, in step
File "/private/tmp/ldap3gssapitest/lib/python3.9/site-packages/gssapi/_utils.py", line 128, in catch_and_return_token
return func(self, *args, **kwargs)
File "/private/tmp/ldap3gssapitest/lib/python3.9/site-packages/gssapi/sec_contexts.py", line 519, in step
return self._initiator_step(token=token)
File "/private/tmp/ldap3gssapitest/lib/python3.9/site-packages/gssapi/sec_contexts.py", line 535, in _initiator_step
res = rsec_contexts.init_sec_context(self._target_name, self._creds,
File "gssapi/raw/sec_contexts.pyx", line 245, in gssapi.raw.sec_contexts.init_sec_context
gssapi.raw.exceptions.MalformedParameterError: Major (51183616): A parameter was malformed Miscellaneous failure (see text), Minor (0): Success
$
Component versions (python-gssapi, Kerberos, OS / distro, etc.)
$ pip3 freeze
cffi==1.14.4
cryptography==3.3.1
decorator==4.4.2
gssapi==1.6.12
ldap3==2.8.1
pyasn1==0.4.8
pycparser==2.20
six==1.15.0
$ pacman -Qi krb5 | grep Version
Version : 1.18.2-1
What went wrong?
Tried to use ldap3 with gssapi and I can't get SASL GSSAPI auth over LDAPS to work.
GSSAPI over LDAPS works on Linux (I tried ArchLinux but should work on any)
How do we reproduce?
That should yield an LDAP dn which should match your Kerberos principal.
With macOS 11.1 I get:
Component versions (python-gssapi, Kerberos, OS / distro, etc.)