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:
parent
fd88251e07
commit
11a3ec2e5f
10 changed files with 136 additions and 10 deletions
|
|
@ -45,11 +45,17 @@ func ParseTLSVersion(s string) uint16 {
|
|||
// aktiv — für LDAP gibt es bewusst keine Insecure-Option. Lediglich die
|
||||
// Protokoll-Mindestversion ist konfigurierbar, damit Altsysteme wie ein
|
||||
// Windows Server 2012 R2 ohne TLS 1.2 erreichbar bleiben.
|
||||
func tlsConfigFor(server, caFile string, minVersion uint16) (*tls.Config, error) {
|
||||
func tlsConfigFor(server, caFile string, minVersion, maxVersion uint16) (*tls.Config, error) {
|
||||
if minVersion == 0 {
|
||||
minVersion = tls.VersionTLS12
|
||||
}
|
||||
cfg := &tls.Config{ServerName: server, MinVersion: minVersion}
|
||||
if maxVersion == 0 {
|
||||
maxVersion = tls.VersionTLS13
|
||||
}
|
||||
if maxVersion < minVersion {
|
||||
maxVersion = minVersion
|
||||
}
|
||||
cfg := &tls.Config{ServerName: server, MinVersion: minVersion, MaxVersion: maxVersion}
|
||||
if minVersion < tls.VersionTLS12 {
|
||||
// Go bietet die CBC-Suiten alter Schannel-Stacks nicht mehr von sich
|
||||
// aus an. Ohne sie scheitert der Handshake mit einem 2012 R2, der auf
|
||||
|
|
@ -94,9 +100,9 @@ func legacyCipherSuites() []uint16 {
|
|||
}
|
||||
|
||||
// realDialer erzeugt die Dial-Funktion für den Produktivbetrieb.
|
||||
func realDialer(port int, tlsMode, caFile string, minVersion uint16, timeout time.Duration) func(context.Context, string) (conn, error) {
|
||||
func realDialer(port int, tlsMode, caFile string, minVersion, maxVersion uint16, timeout time.Duration) func(context.Context, string) (conn, error) {
|
||||
return func(ctx context.Context, server string) (conn, error) {
|
||||
tlsCfg, err := tlsConfigFor(server, caFile, minVersion)
|
||||
tlsCfg, err := tlsConfigFor(server, caFile, minVersion, maxVersion)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue