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
|
|
@ -26,7 +26,7 @@ func TestParseTLSVersion(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTLSConfigDefaultsToTLS12(t *testing.T) {
|
||||
cfg, err := tlsConfigFor("dc01.firma.local", "", 0)
|
||||
cfg, err := tlsConfigFor("dc01.firma.local", "", 0, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -42,10 +42,40 @@ func TestTLSConfigDefaultsToTLS12(t *testing.T) {
|
|||
if cfg.CipherSuites != nil {
|
||||
t.Error("bei TLS 1.2+ sollen Gos sichere Vorgaben gelten, keine eigene Liste")
|
||||
}
|
||||
if cfg.MaxVersion != tls.VersionTLS13 {
|
||||
t.Errorf("MaxVersion = %#04x, want TLS 1.3", cfg.MaxVersion)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTLSConfigCapsMaxVersion(t *testing.T) {
|
||||
// Alte Schannel-Stacks brechen an einem TLS-1.3-ClientHello kommentarlos ab.
|
||||
// Dann darf 1.3 gar nicht erst angeboten werden.
|
||||
cfg, err := tlsConfigFor("dc01.firma.local", "", tls.VersionTLS12, tls.VersionTLS12)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if cfg.MaxVersion != tls.VersionTLS12 {
|
||||
t.Errorf("MaxVersion = %#04x, want TLS 1.2", cfg.MaxVersion)
|
||||
}
|
||||
if cfg.MinVersion != tls.VersionTLS12 {
|
||||
t.Errorf("MinVersion = %#04x, want TLS 1.2", cfg.MinVersion)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTLSConfigMaxNeverBelowMin(t *testing.T) {
|
||||
// Eine widerspruechliche Kombination darf keine unmoegliche Konfiguration
|
||||
// erzeugen; die Validierung faengt sie ohnehin vorher ab.
|
||||
cfg, err := tlsConfigFor("dc01", "", tls.VersionTLS12, tls.VersionTLS10)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if cfg.MaxVersion < cfg.MinVersion {
|
||||
t.Errorf("MaxVersion %#04x < MinVersion %#04x", cfg.MaxVersion, cfg.MinVersion)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTLSConfigLegacyAddsCBCSuites(t *testing.T) {
|
||||
cfg, err := tlsConfigFor("dc01.firma.local", "", tls.VersionTLS10)
|
||||
cfg, err := tlsConfigFor("dc01.firma.local", "", tls.VersionTLS10, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -92,7 +122,7 @@ func TestTLSConfigLegacyAddsCBCSuites(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestTLSConfigRejectsBadCAFile(t *testing.T) {
|
||||
if _, err := tlsConfigFor("dc01", "/gibt/es/nicht.pem", tls.VersionTLS12); err == nil {
|
||||
if _, err := tlsConfigFor("dc01", "/gibt/es/nicht.pem", tls.VersionTLS12, 0); err == nil {
|
||||
t.Fatal("fehlende CA-Datei muss abgelehnt werden")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue