Package: python3-gssapi
Version: 1.9.0-1+b2
Severity: normal
Tags: patch upstream
Dear Maintainer,
I only tested with ED25519, the rest is somehow suggestive musings of Gemini. I
also didn't verify the claims about RFC5929 myself. The suggested fix looked
plausible to me.
# Description
When connecting over TLS (`use_ssl=True` or `start_tls()`) and authenticating
with SASL `KERBEROS` (or NTLM with channel bindings) against an LDAP server
whose X.509 certificate is signed with **Ed25519** (or **Ed448**), `ldap3`
crashes with:
```text
File ".../ldap3/protocol/sasl/kerberos.py", line 75, in get_channel_bindings
hash_algorithm = cert.signature_hash_algorithm
...
AttributeError: 'NoneType' object has no attribute 'name'
```
# Root Cause
In `cryptography.x509.Certificate`, `cert.signature_hash_algorithm` returns
`None` for signature algorithms that do not use a separate digest algorithm
(such as Ed25519 and Ed448). Both `ldap3/protocol/sasl/kerberos.py`
(`get_channel_bindings`) and `ldap3/core/connection.py` assume
`cert.signature_hash_algorithm` is always an object with a `.name` attribute.
# Expected Behavior (RFC 5929)
Per RFC 5929 Section 4.1 (`tls-server-end-point`), when the certificate's
signature algorithm has no associated hash function (or uses MD5/SHA-1), the
channel binding certificate hash should fall back to **SHA-256** (or omit
channel bindings when unsupported).
# Suggested Fix
In `ldap3/protocol/sasl/kerberos.py` (and the equivalent check in
`ldap3/core/connection.py`):
```python
hash_algorithm = cert.signature_hash_algorithm
if hash_algorithm is None or hash_algorithm.name in ('md5', 'sha1'):
digest_name = 'sha256'
else:
digest_name = hash_algorithm.name
cert_hash = hashlib.new(digest_name, server_certificate).digest()
```
-- System Information:
Debian Release: 13.7
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500,
'stable'), (100, 'trixie-fasttrack')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.12.105+deb13-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8),
LANGUAGE=de:en_US:fr:zh_CN:zh_TW:pa
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages python3-gssapi depends on:
ii libc6 2.41-12+deb13u4
ii libgssapi-krb5-2 1.21.3-5+deb13u1
ii python3 3.13.5-1
ii python3-decorator 5.2.1-2
python3-gssapi recommends no packages.
python3-gssapi suggests no packages.
-- no debconf information