- Notifications
You must be signed in to change notification settings - Fork24
Closed
Description
This is related tocoder/coder#8889
We run the coder api behind a TLS proxy and would like to be able to specify the client cert/key on the vscode plugin requests.
It appears we just need to addcert
andkey
options to theaxios
default client:
https://github.com/coder/vscode-coder/blob/main/src/extension.ts#L39-L43
I hacked on the plugin a bit it seems these were the only changes necessary:
const applyInsecure = () => { const cfg = vscode.workspace.getConfiguration() const insecure = Boolean(cfg.get("coder.insecure")) const certFile = String(cfg.get("coder.certFile")) const keyFile = String(cfg.get("coder.keyFile")) const caFile = String(cfg.get("coder.caFile")) axios.defaults.httpsAgent = new https.Agent({ cert: certFile === "" ? undefined : fs.readFileSync(certFile), key: keyFile === "" ? undefined : fs.readFileSync(keyFile), ca: caFile === "" ? undefined : fs.readFileSync(caFile), // rejectUnauthorized defaults to true, so we need to explicitly set it to false // if we want to allow self-signed certificates. rejectUnauthorized: !insecure, }) }
I know little typescript, so there is likely a better way to do it, and we would likely want to change theapplyInsecure
name for the expanded scope.
Metadata
Metadata
Assignees
Labels
No labels