You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With an older version of Hyper using OpenSSL I could do something like this:
if let Some(sslstream) = request.ssl::<SslStream<HttpStream>>() {
let ssl: &Ssl = sslstream.ssl();
let peer_x509: X509 = ssl.peer_certificate().unwrap();
let sn = peer_x509.subject_name();
cn = sn.text_by_nid(Nid::CN).unwrap();
debug!("cn: {}", &cn);
}
I need the CN to do anything useful on our corporate network.
Is it possible to do something like this when I'm using hyper-rustls?
If yes, how?
@alex I'm not too familiar with proto/service myself, but yes I think the only away is to write your own logic on top of tokio-rustls, without using the proto portion of that crate.
I think the end result will look quite similar to tokio-rustls server example but I'm not sure about the hyper part.
Would you mind sharing a gist with your current solution? Does it completely bypass hyper-rustls? Depending on the final result it may (or may not) be helpful to have it here as a proto-less server example.
--
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: D1B3 ADC0 E023 8CA6
Following up a year later (😬), the solution I put in that gist was working well, but the latest release of hyper no longer has the bind_connection API, and I'm struggling to figure out what the new way of expressing the same thing is.
Activity
alex commentedon Sep 22, 2017
I've been struggling with the same challenge of how to get at the client certificate: hyperium/hyper#1241
I haven't been able to figure out how to implement any of those suggestions though.
Has anyone been able to determine if this is actually possible at the moment, and if not, what's the best way to contribute to making it happen?
alex commentedon Sep 23, 2017
Ultimate solution was just to drop tokio-proto and have my own
incoming()stream where I could grab theServerSessionfrom theTlsStreamlucab commentedon Sep 23, 2017
@alex I'm not too familiar with proto/service myself, but yes I think the only away is to write your own logic on top of tokio-rustls, without using the proto portion of that crate.
I think the end result will look quite similar to tokio-rustls server example but I'm not sure about the hyper part.
Would you mind sharing a gist with your current solution? Does it completely bypass hyper-rustls? Depending on the final result it may (or may not) be helpful to have it here as a proto-less server example.
alex commentedon Sep 23, 2017
alex commentedon Oct 22, 2018
Following up a year later (😬), the solution I put in that gist was working well, but the latest release of hyper no longer has the
bind_connectionAPI, and I'm struggling to figure out what the new way of expressing the same thing is.Merge pull request rustls#21 from sanmai-NL/reexport_rustls
Track the latest changes from upstream rustls (rustls#21)