Skip to content
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

Allow email SANs for S/MIME certificates #152

Merged
merged 2 commits into from
Apr 12, 2019
Merged

Allow email SANs for S/MIME certificates #152

merged 2 commits into from
Apr 12, 2019

Conversation

btoews
Copy link
Contributor

@btoews btoews commented Apr 9, 2019

This PR allows email addresses to be passed in, along with IP addresses and domain names. Email addresses are added as SANs. The appropriate EKUs are added to the cert based on which types of SANs are present. To identify email addresses, I try parsing them with the net/mail package. This is probably overkill and I'm happy to switch to a regex if that's preferrable.

/fixes #143
/cc @jcjones

@btoews
Copy link
Contributor Author

btoews commented Apr 9, 2019

Looks like I based this on an old master. I'll rebase this later today or tomorrow.

main.go Outdated
@@ -190,13 +191,17 @@ func (m *mkcert) Run(args []string) {
if ip := net.ParseIP(name); ip != nil {
continue
}
if email, err := mail.ParseAddress(name); err == nil {
args[i] = email.Address
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why modify the argument here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, someone could pass Foo Bar <[email protected]> in and we'd try to put that in the SAN. I guess an alternative would be to check that email.Address matches the name.

@FiloSottile
Copy link
Owner

FiloSottile commented Apr 12, 2019 via email

@btoews
Copy link
Contributor Author

btoews commented Apr 12, 2019

I fixed this in ba92743. Let me know if you want commits squashed or anything.

@FiloSottile FiloSottile merged commit 0d4cf75 into FiloSottile:master Apr 12, 2019
@FiloSottile
Copy link
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support s/mime email certificates
2 participants