Skip to content

Commit 56425ab

Browse files
committed
CentOS / Fedora path to CA certificates (microsoft#52880)
1 parent 6cc7eea commit 56425ab

1 file changed

Lines changed: 22 additions & 8 deletions

File tree

src/vs/workbench/services/extensions/node/proxyResolver.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -488,15 +488,29 @@ async function readMacCaCertificates() {
488488
};
489489
}
490490

491+
const linuxCaCertificatePaths = [
492+
'/etc/ssl/certs/ca-certificates.crt',
493+
'/etc/ssl/certs/ca-bundle.crt',
494+
];
495+
491496
async function readLinuxCaCertificates() {
492-
const content = await promisify(fs.readFile)('/etc/ssl/certs/ca-certificates.crt', { encoding: 'utf8' });
493-
const seen = {};
494-
const certs = content.split(/(?=-----BEGIN CERTIFICATE-----)/g)
495-
.filter(pem => !!pem.length && !seen[pem] && (seen[pem] = true));
496-
return {
497-
certs,
498-
append: false
499-
};
497+
for (const certPath of linuxCaCertificatePaths) {
498+
try {
499+
const content = await promisify(fs.readFile)(certPath, { encoding: 'utf8' });
500+
const seen = {};
501+
const certs = content.split(/(?=-----BEGIN CERTIFICATE-----)/g)
502+
.filter(pem => !!pem.length && !seen[pem] && (seen[pem] = true));
503+
return {
504+
certs,
505+
append: false
506+
};
507+
} catch (err) {
508+
if (err.code !== 'ENOENT') {
509+
throw err;
510+
}
511+
}
512+
}
513+
return undefined;
500514
}
501515

502516
function derToPem(blob) {

0 commit comments

Comments
 (0)