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

Implement TLS client authentication #75

Closed
wants to merge 3 commits into from
Closed

Implement TLS client authentication #75

wants to merge 3 commits into from

Conversation

nmeum
Copy link

@nmeum nmeum commented Jul 23, 2018

This pull request implements TLS client certificate authentication as requested in #73.

I tested this briefly with openssl s_client and restic which already has support for TLS client certificates due to restic/restic@e805b96. The code seems to work but further tests would be welcome.

Regarding the authentication itself: TLS client authentication is required if --no-http-auth and --tls-client-certs have been passed. If --tls-client-certs was passed but --no-http-auth wasn't it's entirely optional. This behavior is also documented in the README.md.

Any thoughts on this? I just quickly hacked this together, did I miss anything?

@nmeum nmeum changed the title [WIP] Implement TLS client authentication Implement TLS client authentication Jul 23, 2018
@nmeum
Copy link
Author

nmeum commented Jul 23, 2018

I documented the thing in the README.md and took the liberty of briefly restructuring the file while at it. Besides I autosquashed the fixup-commits. imho this is no longer WIP and ready to merge.

nmeum added 3 commits July 24, 2018 00:27
To clarify that authentication using TLS client certificates is still
supported when --no-http-auth is passed.
@mholt
Copy link
Contributor

mholt commented Jul 23, 2018

Awesome, thanks! Looking forward to reviewing this. I may not get to it for a little bit (I'm on the last few sprints to get my backup service which uses restic ready for testing) -- so if someone else wants to look in the meantime, that'd be helpful too. 👌

@gbolo
Copy link

gbolo commented Dec 18, 2019

Hi @nmeum why are the options here called --tls-client-certs? isn't the goal here to validate a client cert against a CA? The server would just need a list of CAs to trust when validating client certs

Copy link

@gbolo gbolo left a comment

Choose a reason for hiding this comment

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

It is my opinion that this PR gets adjusted to follow a more approriate TLS mutual auth approach.

authType = tls.RequireAndVerifyClientCert
}
httpServer.TLSConfig = &tls.Config{
ClientCAs: clientCerts,
Copy link

Choose a reason for hiding this comment

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

why are we siggesting that we add the actual client certs to the server truststore for client authentication? Shouldn't we be suggesting that they provide a CA cert here, which is responsible for signing the client certs?


authType := tls.VerifyClientCertIfGiven
if server.NoHTTPAuth {
authType = tls.RequireAndVerifyClientCert
Copy link

Choose a reason for hiding this comment

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

why cant we have both tls client auth here AND http basic auth?

@nmeum
Copy link
Author

nmeum commented Dec 19, 2019

Hi @nmeum why are the options here called --tls-client-certs? isn't the goal here to validate a client cert against a CA?

I think I didn't implemented checks against a CA because I didn't need it back then for my use-case. I also don't use rest-server in this configuration anymore and currently do not have enough free time on my hands to work on this PR.

If you are interested in authentication with TLS client certificates submit a new PR. I wasn't even aware that this PR is still open, will close it.

@nmeum nmeum closed this Dec 19, 2019
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.

3 participants