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 client certificate validation #162

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

gxtaillon
Copy link

@gxtaillon gxtaillon commented Apr 25, 2020

Todo:

Provides a configuration mechanism for client certification verification ie: two-way tls.

  • openssl
  • schannel
  • security_framework
  • tests

I don't have windows or mac environments for oss, feel free to cannibalize this PR if you can do the implementation on these systems.

Related to: #161

if let Some(client_ca_cert) = &builder.client_cert_verification_ca_cert {
acceptor.add_client_ca((client_ca_cert.0).0.as_ref())?;
// below call is required if the ca is not already trusted
acceptor.cert_store_mut().add_cert((client_ca_cert.0).0.to_owned())?;
Copy link
Author

Choose a reason for hiding this comment

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

This line is required to run the tests as-is. Not sure if this should stay in.

@cypheratheist
Copy link

I just encountered the limitation this is supposed to fix.

I'm writing a decentralized peer-to-peer network, and I need mutual authentication in the communication between the nodes. Because it's decentralized, there's no CA, so each node does custom per-peer validation.

In short, I need both server and client to exchange certificates -- but the reason I'm writing this is because I also need danger_accept_invalid_certs() in both ends. Are you intending to cover this case as well?

@gxtaillon
Copy link
Author

gxtaillon commented Jun 10, 2020

@cypheratheist This PR only adds the ability to request or require client certificate. It would not allow to set a custom verification callback #161 (comment) to let you accept invalid certs.

On top of this PR, you'd need to also make a call to set_verify_callback (openssl), verify_callback (schannel), set_break_on_client_auth (secure_transport).

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.

2 participants