File tree Expand file tree Collapse file tree 6 files changed +31
-24
lines changed
Expand file tree Collapse file tree 6 files changed +31
-24
lines changed Original file line number Diff line number Diff line change @@ -1408,11 +1408,11 @@ dependencies = [
14081408 " linkerd-tls-test-util" ,
14091409 " ring" ,
14101410 " rustls-pemfile" ,
1411+ " rustls-webpki" ,
14111412 " thiserror" ,
14121413 " tokio" ,
14131414 " tokio-rustls" ,
14141415 " tracing" ,
1415- " webpki" ,
14161416]
14171417
14181418[[package ]]
@@ -2462,6 +2462,15 @@ dependencies = [
24622462 " base64" ,
24632463]
24642464
2465+ [[package ]]
2466+ name = " rustls-webpki"
2467+ version = " 0.101.5"
2468+ source = " git+https://github.com/cpu/webpki?rev=702d57f444e3f7d743277524e832a2363290ec4d#702d57f444e3f7d743277524e832a2363290ec4d"
2469+ dependencies = [
2470+ " ring" ,
2471+ " untrusted" ,
2472+ ]
2473+
24652474[[package ]]
24662475name = " rustversion"
24672476version = " 1.0.11"
@@ -3149,8 +3158,9 @@ dependencies = [
31493158
31503159[[package ]]
31513160name = " webpki"
3152- version = " 0.22.0"
3153- source = " git+https://github.com/linkerd/webpki?branch=cert-dns-names-0.22#a26def03ec88d3b69542ccd2f0073369ecedc4f9"
3161+ version = " 0.22.1"
3162+ source = " registry+https://github.com/rust-lang/crates.io-index"
3163+ checksum = " f0e74f82d49d545ad128049b7e88f6576df2da6b02e9ce565c6f533be576957e"
31543164dependencies = [
31553165 " ring" ,
31563166 " untrusted" ,
Original file line number Diff line number Diff line change @@ -82,4 +82,5 @@ debug = false
8282lto = true
8383
8484[patch .crates-io ]
85- webpki = { git = " https://github.com/linkerd/webpki" , branch = " cert-dns-names-0.22" }
85+ # remove this patch when https://github.com/rustls/webpki/pull/170 is published!
86+ rustls-webpki = { git = " https://github.com/cpu/webpki" , rev = " 702d57f444e3f7d743277524e832a2363290ec4d" }
Original file line number Diff line number Diff line change @@ -72,8 +72,7 @@ skip-tree = [
7272unknown-registry = " deny"
7373unknown-git = " deny"
7474allow-registry = [" https://github.com/rust-lang/crates.io-index" ]
75-
76- [sources .allow-org ]
77- github = [
78- " linkerd" ,
75+ allow-git = [
76+ # remove this when https://github.com/rustls/webpki/pull/170 is published!
77+ " https://github.com/cpu/webpki" ,
7978]
Original file line number Diff line number Diff line change @@ -19,11 +19,11 @@ linkerd-tls = { path = "../../tls" }
1919linkerd-tls-test-util = { path = " ../../tls/test-util" , optional = true }
2020ring = { version = " 0.16" , features = [" std" ] }
2121rustls-pemfile = " 1.0"
22+ rustls-webpki = { version = " 0.101.5" , features = [ " std" ] }
2223thiserror = " 1"
2324tokio = { version = " 1" , features = [" macros" , " rt" , " sync" ] }
2425tokio-rustls = { version = " 0.23" , features = [" dangerous_configuration" ] }
2526tracing = " 0.1"
26- webpki = " 0.22"
2727
2828[dev-dependencies ]
2929linkerd-tls-test-util = { path = " ../../tls/test-util" }
Original file line number Diff line number Diff line change @@ -239,9 +239,11 @@ impl rustls::server::ResolvesServerCert for CertResolver {
239239 hello : rustls:: server:: ClientHello < ' _ > ,
240240 ) -> Option < Arc < rustls:: sign:: CertifiedKey > > {
241241 let server_name = match hello. server_name ( ) {
242- Some ( name) => webpki:: DnsNameRef :: try_from_ascii_str ( name)
243- . expect ( "server name must be a valid server name" ) ,
244-
242+ Some ( name) => {
243+ let name = webpki:: DnsNameRef :: try_from_ascii_str ( name)
244+ . expect ( "server name must be a valid server name" ) ;
245+ webpki:: SubjectNameRef :: DnsName ( name)
246+ }
245247 None => {
246248 debug ! ( "no SNI -> no certificate" ) ;
247249 return None ;
@@ -251,7 +253,7 @@ impl rustls::server::ResolvesServerCert for CertResolver {
251253 // Verify that our certificate is valid for the given SNI name.
252254 let c = self . 0 . cert . first ( ) ?;
253255 if let Err ( error) = webpki:: EndEntityCert :: try_from ( c. as_ref ( ) )
254- . and_then ( |c| c. verify_is_valid_for_dns_name ( server_name) )
256+ . and_then ( |c| c. verify_is_valid_for_subject_name ( server_name) )
255257 {
256258 debug ! ( %error, "Local certificate is not valid for SNI" ) ;
257259 return None ;
Original file line number Diff line number Diff line change @@ -130,18 +130,13 @@ fn client_identity<I>(tls: &tokio_rustls::server::TlsStream<I>) -> Option<Client
130130 let certs = session. peer_certificates ( ) ?;
131131 let c = certs. first ( ) . map ( Certificate :: as_ref) ?;
132132 let end_cert = webpki:: EndEntityCert :: try_from ( c) . ok ( ) ?;
133- let dns_names = end_cert. dns_names ( ) . ok ( ) ?;
134-
135- match dns_names. first ( ) ? {
136- webpki:: GeneralDnsNameRef :: DnsName ( n) => {
137- let s: & str = ( * n) . into ( ) ;
138- s. parse ( ) . ok ( ) . map ( ClientId )
139- }
140- webpki:: GeneralDnsNameRef :: Wildcard ( _) => {
141- // Wildcards can perhaps be handled in a future path...
142- None
143- }
133+ let name: & str = end_cert. dns_names ( ) . ok ( ) ?. next ( ) . map ( Into :: into) ?;
134+ if name == "*" {
135+ // Wildcards can perhaps be handled in a future path...
136+ return None ;
144137 }
138+
139+ name. parse ( ) . ok ( ) . map ( ClientId )
145140}
146141
147142// === impl ServerIo ===
You can’t perform that action at this time.
0 commit comments