Skip to content

Allow email SANs for S/MIME certificates - #152

Merged
FiloSottile merged 2 commits into
FiloSottile:masterfrom
btoews:smime
Apr 12, 2019
Merged

Allow email SANs for S/MIME certificates#152
FiloSottile merged 2 commits into
FiloSottile:masterfrom
btoews:smime

Conversation

@btoews

@btoews btoews commented Apr 9, 2019

Copy link
Copy Markdown
Contributor

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

btoews commented Apr 9, 2019

Copy link
Copy Markdown
Contributor Author

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

Comment thread main.go Outdated
continue
}
if email, err := mail.ParseAddress(name); err == nil {
args[i] = email.Address

Copy link
Copy Markdown
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
Copy Markdown
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 <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

FiloSottile commented Apr 12, 2019 via email

Copy link
Copy Markdown
Owner

@btoews

btoews commented Apr 12, 2019

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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