-
-
Notifications
You must be signed in to change notification settings - Fork 326
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
Update rustls
to 0.20.1
#704
Conversation
kube-client/src/client/tls.rs
Outdated
for item in rustls_pemfile::read_all(&mut reader) | ||
.map_err(|e| Error::SslError(format!("failed to read identity PEM: {}", e)))? | ||
{ | ||
match item { | ||
Item::X509Certificate(cert) => cert_chain.push(Certificate(cert)), | ||
Item::PKCS8Key(key) => pkcs8_key = Some(PrivateKey(key)), | ||
Item::RSAKey(key) => rsa_key = Some(PrivateKey(key)), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to get all sections at once, but it should behave the same. Use the last found private key, and PKCS8 key is preferred.
474a52d
to
eb32afa
Compare
eb32afa
to
fff848e
Compare
This seems to work as well as before. Thought I had a regression on rustls vs rancher, but turns out rancher just never worked with local kubeconfig on rustls. rancher gives this type of setup: clusters:
- cluster:
server: https://rancher.xxx.io/k8s/clusters/clusterid
name: mycluster
users:
- name: myuser
user:
token: kubeconfig-u-somegenuser.c-id:somelongtoken
contexts:
- context:
cluster: mycluster
user: myuser
name: mycontext error
[2021-11-15T22:06:29Z DEBUG kube_client::config] failed to load client identity from kubeconfig: failed to load client certificate
[2021-11-15T22:06:29Z DEBUG kube_client::client] HTTP; http.method=GET http.url=https://rancher.xxx.io/k8s/clusters/clusterid/api/v1/namespaces/default/pods? otel.name="list" otel.kind="client"
[2021-11-15T22:06:29Z DEBUG kube_client::client] requesting
[2021-11-15T22:06:30Z WARN rustls::conn] Sending fatal alert BadCertificate
[2021-11-15T22:06:30Z DEBUG kube_client::client] HTTP; otel.status_code="ERROR"
[2021-11-15T22:06:30Z ERROR kube_client::client] failed with error error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer
Error: failed to perform initial object list: HyperError: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer
Caused by:
0: HyperError: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer
1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer
2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer
Location:
/rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1915:27
interestingly this works with openssl, but with rustls i have to add |
I think |
#711 is working :)
|
371c0db
to
ee85982
Compare
35d5c06
to
2e294c0
Compare
d24d8e6
to
c813deb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 👍
Signed-off-by: clux <[email protected]> Signed-off-by: kazk <[email protected]>
Signed-off-by: kazk <[email protected]>
Remove `Error::SslError` Signed-off-by: kazk <[email protected]>
Signed-off-by: kazk <[email protected]>
Signed-off-by: kazk <[email protected]>
Signed-off-by: kazk <[email protected]>
I'll merge this after cleaning up the commits:
I thought of squash merging, but I think it's better to keep the upgrade and refactoring separate after merging. |
c813deb
to
988705f
Compare
Continuing from #692 for #644 after rebasing.
webpki
is no longer necessary, so this is the last one.TODO
hyper_rustls::HttpsConnector::with_native_roots
withHttpsConnectorBuilder
hyper-rustls
(Prepare 0.23 rustls/hyper-rustls#159)Closes #644