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
|
|
@ -138,6 +138,49 @@ func TestValidateRejectsUnknownMinTLSVersion(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestMaxTLSVersionDefaultsTo13(t *testing.T) {
|
||||
cfg := validCfg(t)
|
||||
if cfg.AD.MaxTLSVersion != "1.3" {
|
||||
t.Errorf("MaxTLSVersion = %q, want Default 1.3", cfg.AD.MaxTLSVersion)
|
||||
}
|
||||
if err := cfg.Validate(); err != nil {
|
||||
t.Fatalf("Default muss gültig sein: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateAcceptsCappedMaxTLSVersion(t *testing.T) {
|
||||
// Alte Schannel-Stacks brechen an einem TLS-1.3-ClientHello ab. Dann muss
|
||||
// sich die Hoechstversion auf 1.2 deckeln lassen.
|
||||
cfg := validCfg(t)
|
||||
cfg.AD.MaxTLSVersion = "1.2"
|
||||
if err := cfg.Validate(); err != nil {
|
||||
t.Fatalf("max_tls_version 1.2 muss zulässig sein: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateRejectsMaxBelowMin(t *testing.T) {
|
||||
cfg := validCfg(t)
|
||||
cfg.AD.MinTLSVersion = "1.2"
|
||||
cfg.AD.MaxTLSVersion = "1.1"
|
||||
err := cfg.Validate()
|
||||
if err == nil {
|
||||
t.Fatal("max_tls_version unter min_tls_version muss abgelehnt werden")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "max_tls_version") {
|
||||
t.Errorf("Fehler muss das Feld nennen: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateRejectsUnknownMaxTLSVersion(t *testing.T) {
|
||||
for _, v := range []string{"1.4", "tls1.3", "", "13"} {
|
||||
cfg := validCfg(t)
|
||||
cfg.AD.MaxTLSVersion = v
|
||||
if err := cfg.Validate(); err == nil {
|
||||
t.Errorf("max_tls_version %q muss abgelehnt werden", v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMinTLSVersionIsWeakBelow12(t *testing.T) {
|
||||
cfg := validCfg(t)
|
||||
for v, wantWeak := range map[string]bool{"1.0": true, "1.1": true, "1.2": false, "1.3": false} {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue