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

Conversation

Projects
None yet
2 participants
@mastahyeti
Copy link
Contributor

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

@mastahyeti

This comment has been minimized.

Copy link
Contributor Author

commented Apr 9, 2019

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

@mastahyeti mastahyeti force-pushed the mastahyeti:smime branch from 6eb2d6f to 803db3b Apr 10, 2019

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

This comment has been minimized.

Copy link
@FiloSottile

FiloSottile Apr 11, 2019

Owner

Why modify the argument here?

This comment has been minimized.

Copy link
@mastahyeti

mastahyeti Apr 11, 2019

Author Contributor

Otherwise, someone could pass Foo Bar <foo@bar.com> 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

This comment has been minimized.

Copy link
Owner

commented Apr 12, 2019

@mastahyeti

This comment has been minimized.

Copy link
Contributor Author

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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@FiloSottile

This comment has been minimized.

Copy link
Owner

commented Apr 12, 2019

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.