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