Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions shared/ssl/ssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ type certificate struct {
subjectKeyID string
authKeyID string
isCa bool
isCritical bool
isRoot bool
}

Expand Down Expand Up @@ -193,6 +194,8 @@ func extractCertificateData(content []byte) (certificate, error) {
cert.authKeyID = strings.ToUpper(strings.TrimSpace(strings.SplitN(line, ":", 2)[1]))
} else if nextVal == "basicConstraints" && strings.Contains(line, "CA:TRUE") {
cert.isCa = true
} else if nextVal == "basicConstraints" && strings.Contains(line, "critical") {
cert.isCritical = true
} else {
// Unhandled extension value
continue
Expand All @@ -206,6 +209,11 @@ func extractCertificateData(content []byte) (certificate, error) {
}
}

// This configuration might not work anymore in the future.
if cert.isCa && !cert.isCritical {
log.Warn().Msgf(L("Basic constraints for CA should be marked as `%s`, could cause issues otherwise!"), "critical")
}

if cert.subject == cert.issuer {
cert.isRoot = true
// Some Root CAs might not have their authorityKeyIdentifier set to themself
Expand Down
1 change: 1 addition & 0 deletions uyuni-tools.changes.mfriedrich.warn-if-not-critical
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Check and warn if CA certificate isn't marked as critical
Loading