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

ERR_TLS_CERT_ALTNAME_INVALID for socks-proxy-agent #365

Open
warjiang opened this issue Feb 21, 2025 · 1 comment
Open

ERR_TLS_CERT_ALTNAME_INVALID for socks-proxy-agent #365

warjiang opened this issue Feb 21, 2025 · 1 comment

Comments

@warjiang
Copy link

warjiang commented Feb 21, 2025

Background

I found that the client-node sdk(you can treat the sdk as another client-go sdk implementation for node), if there is a proxy-url in the kubeconfig file, client-node sdk will create agent for proxy request to kubernetes apiserver.

Problems

The feature seems not work for me, code snippet as following:

import * as k8s from '@kubernetes/client-node';


const kc = new k8s.KubeConfig();
kc.loadFromFile('path/to/local/kubeconfig')
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
k8sApi.listNamespacedPod({ namespace: "default" }).then((res) => {
  console.log(res);
});

error occured:
Image

the root cause for the error is that, when invoke the tls.connect, the proxy-agents sdk will ignore the host information:

const tlsSocket = tls.connect({
...omit(
setServernameFromNonIpHost(opts),
'host',
'path',
'port'
),
socket,
});

And I try to add host field by removing the host field from omit list, like following:
Image

It seems it works, so any explantation about omitting host field, and should we avoidding omit host field? @TooTallNate

@warjiang
Copy link
Author

warjiang commented Feb 23, 2025

I think it's the problem of omitting host fileld, for duo tls verification, proxy-agents should not ignore the host field. If ignoring the host field, node.js seems to add host=localhost internally, which equals to setting wrong host field

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

No branches or pull requests

1 participant