feat(auth): ad.max_tls_version zum Deckeln der angebotenen TLS-Version

Alte Schannel-Stacks brechen an einem TLS-1.3-ClientHello kommentarlos ab:
sie nehmen die TCP-Verbindung an, lesen den ClientHello und setzen zurueck,
ohne ein Zertifikat zu schicken. Herunterhandeln hilft dann nicht — TLS 1.3
darf gar nicht erst angeboten werden.

max_tls_version (Default 1.3) deckelt die Hoechstversion; die Validierung
lehnt eine Hoechstversion unterhalb der Mindestversion ab.

check erkennt zusaetzlich zurueckgesetzte Verbindungen und nennt die beiden
plausiblen Ursachen: fehlendes LDAPS-Zertifikat auf dem Server oder
TLS-1.3-Inkompatibilitaet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBHF4R9EAejDJUMdwr6C68
This commit is contained in:
Carsten Abele 2026-08-14 13:36:03 +02:00
parent fd88251e07
commit 11a3ec2e5f
10 changed files with 136 additions and 10 deletions

View file

@ -110,10 +110,22 @@ func (c *Config) Validate() error {
if !slices.Contains([]string{"ldaps", "starttls"}, c.AD.TLSMode) {
errs = append(errs, fmt.Errorf("ad.tls_mode %q ist ungültig (erlaubt: ldaps, starttls)", c.AD.TLSMode))
}
if !slices.Contains(MinTLSVersions, c.AD.MinTLSVersion) {
minOK := slices.Contains(MinTLSVersions, c.AD.MinTLSVersion)
maxOK := slices.Contains(MinTLSVersions, c.AD.MaxTLSVersion)
if !minOK {
errs = append(errs, fmt.Errorf("ad.min_tls_version %q ist ungültig (erlaubt: %s)",
c.AD.MinTLSVersion, strings.Join(MinTLSVersions, ", ")))
}
if !maxOK {
errs = append(errs, fmt.Errorf("ad.max_tls_version %q ist ungültig (erlaubt: %s)",
c.AD.MaxTLSVersion, strings.Join(MinTLSVersions, ", ")))
}
if minOK && maxOK &&
slices.Index(MinTLSVersions, c.AD.MaxTLSVersion) < slices.Index(MinTLSVersions, c.AD.MinTLSVersion) {
errs = append(errs, fmt.Errorf(
"ad.max_tls_version %q liegt unter ad.min_tls_version %q — so kommt keine Verbindung zustande",
c.AD.MaxTLSVersion, c.AD.MinTLSVersion))
}
if c.AD.Port <= 0 || c.AD.Port > 65535 {
errs = append(errs, fmt.Errorf("ad.port %d liegt außerhalb 165535", c.AD.Port))
}