Skip to content

add -mutual-tls-san option#874

Open
adamjacobmuller wants to merge 1 commit intocloudflare:masterfrom
adamjacobmuller:master
Open

add -mutual-tls-san option#874
adamjacobmuller wants to merge 1 commit intocloudflare:masterfrom
adamjacobmuller:master

Conversation

@adamjacobmuller
Copy link
Copy Markdown

similar to -mutual-tls-cn option, but allows the regular expression to
match against any SAN on the supplied certificate

@adamjacobmuller
Copy link
Copy Markdown
Author

not sure if there is any interest in merging this, but, I needed this so I added it.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Mar 10, 2018

Codecov Report

Merging #874 into master will decrease coverage by 0.12%.
The diff coverage is 5.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #874      +/-   ##
==========================================
- Coverage   56.55%   56.42%   -0.13%     
==========================================
  Files          80       80              
  Lines        7113     7131      +18     
==========================================
+ Hits         4023     4024       +1     
- Misses       2634     2651      +17     
  Partials      456      456
Impacted Files Coverage Δ
cli/serve/serve.go 40.32% <0%> (-4.06%) ⬇️
cli/config.go 89.55% <100%> (+0.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea4033a...4384373. Read the comment docs.

@kisom
Copy link
Copy Markdown
Contributor

kisom commented Mar 21, 2018

@adamjacobmuller will try to go over the PR in the next day or two.

@kisom kisom self-assigned this Mar 21, 2018
@adamjacobmuller
Copy link
Copy Markdown
Author

Thanks @kisom!

Comment thread cli/serve/serve.go
}
server.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r != nil && r.TLS != nil && len(r.TLS.PeerCertificates) > 0 {
for _, name := range r.TLS.PeerCertificates[0].DNSNames {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The SAN list includes more than DNS names; if you look at the Certificate structure, it has

        // Subject Alternate Name values
        DNSNames       []string
        EmailAddresses []string
        IPAddresses    []net.IP
        URIs           []*url.URL

so this should probably also check more than the DNS names.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hi Kisom,

I'd considered this, but, should it?

I wasn't too sure what the use-case would be for validating based on those other attributes, but, validating based on the DNSNames is ultimately arbitrary.

If I updated to validate against all of them, do you consider this merge ready/worthy?

-Adam

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@adamjacobmuller Other than that, it looks fine.

similar to -mutual-tls-cn option, but allows the regular expression to
match against any SAN on the supplied certificate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants