-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CSR common name to SANs if no other SANs are defined in CSR #1172
Conversation
dopey
commented
May 7, 2024
•
edited
Loading
edited
- Fixes [Bug]: CN not added as SAN #1171
command/certificate/sign.go
Outdated
if addCNSAN { | ||
cnInSANs := false | ||
for _, v := range sans { | ||
if v == cr.Subject.CommonName { | ||
cnInSANs = true | ||
break | ||
} | ||
} | ||
if !cnInSANs { | ||
sans = append(sans, cr.Subject.CommonName) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to do this only if there are no SANs.
command/certificate/sign.go
Outdated
cli.BoolTFlag{ | ||
Name: "add-cn-san", | ||
Usage: `Ensure that Common Name from CSR subject is added to Subject Alternative | ||
Name (SAN) extension of the certificate. This flag is enabled by default. To | ||
disable default behavior pass the flag as '--add-cn-san=false'.`, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do something like --omit-cn-san
as @hslatman suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 😄
Co-authored-by: Mariano Cano <[email protected]>