Check for .internal with SubjectIsInternal (#305)

This commit is contained in:
Nick Ubels 2024-08-10 02:24:33 +02:00 committed by GitHub
parent ba418d86ad
commit 3bad5b6bb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -553,6 +553,7 @@ func SubjectIsInternal(subj string) bool {
return subj == "localhost" || return subj == "localhost" ||
strings.HasSuffix(subj, ".localhost") || strings.HasSuffix(subj, ".localhost") ||
strings.HasSuffix(subj, ".local") || strings.HasSuffix(subj, ".local") ||
strings.HasSuffix(subj, ".internal") ||
strings.HasSuffix(subj, ".home.arpa") || strings.HasSuffix(subj, ".home.arpa") ||
isInternalIP(subj) isInternalIP(subj)
} }

View File

@ -163,6 +163,8 @@ func TestSubjectQualifiesForPublicCert(t *testing.T) {
{"local", true}, {"local", true},
{"foo.local", false}, {"foo.local", false},
{"foo.bar.local", false}, {"foo.bar.local", false},
{"foo.internal", false},
{"foo.bar.internal", false},
{"foo.home.arpa", false}, {"foo.home.arpa", false},
{"foo.bar.home.arpa", false}, {"foo.bar.home.arpa", false},
{"192.168.1.3", false}, {"192.168.1.3", false},