|
5 | 5 |
|
6 | 6 | import vscode from 'vscode' |
7 | 7 | import { getLogger } from '../logger/logger' |
8 | | -import { tmpdir } from 'os' |
9 | | -import { join } from 'path' |
10 | | -import * as nodefs from 'fs' // eslint-disable-line no-restricted-imports |
11 | 8 |
|
12 | 9 | interface ProxyConfig { |
13 | 10 | proxyUrl: string | undefined |
@@ -104,41 +101,6 @@ export class ProxyUtil { |
104 | 101 | process.env.NODE_EXTRA_CA_CERTS = config.certificateAuthority |
105 | 102 | process.env.AWS_CA_BUNDLE = config.certificateAuthority |
106 | 103 | this.logger.debug(`Set certificate bundle path: ${config.certificateAuthority}`) |
107 | | - } else { |
108 | | - // Fallback to system certificates if no custom CA is configured |
109 | | - await this.setSystemCertificates() |
110 | | - } |
111 | | - } |
112 | | - |
113 | | - /** |
114 | | - * Sets system certificates as fallback when no custom CA is configured |
115 | | - */ |
116 | | - private static async setSystemCertificates(): Promise<void> { |
117 | | - try { |
118 | | - const tls = await import('tls') |
119 | | - // @ts-ignore Get system certificates |
120 | | - const systemCerts = tls.getCACertificates('system') |
121 | | - // @ts-ignore Get any existing extra certificates |
122 | | - const extraCerts = tls.getCACertificates('extra') |
123 | | - const allCerts = [...systemCerts, ...extraCerts] |
124 | | - if (allCerts && allCerts.length > 0) { |
125 | | - this.logger.debug(`Found ${allCerts.length} certificates in system's trust store`) |
126 | | - |
127 | | - const tempDir = join(tmpdir(), 'aws-toolkit-vscode') |
128 | | - if (!nodefs.existsSync(tempDir)) { |
129 | | - nodefs.mkdirSync(tempDir, { recursive: true }) |
130 | | - } |
131 | | - |
132 | | - const certPath = join(tempDir, 'vscode-ca-certs.pem') |
133 | | - const certContent = allCerts.join('\n') |
134 | | - |
135 | | - nodefs.writeFileSync(certPath, certContent) |
136 | | - process.env.NODE_EXTRA_CA_CERTS = certPath |
137 | | - process.env.AWS_CA_BUNDLE = certPath |
138 | | - this.logger.debug(`Set system certificate bundle path: ${certPath}`) |
139 | | - } |
140 | | - } catch (err) { |
141 | | - this.logger.error(`Failed to extract system certificates: ${err}`) |
142 | 104 | } |
143 | 105 | } |
144 | 106 | } |
0 commit comments