Add TLS and mTLS support

This commit is contained in:
Jason O'Donnell 2020-08-05 16:36:27 -04:00
parent cd01494ae2
commit e59c94afbe
19 changed files with 6942 additions and 4389 deletions

View file

@ -29,7 +29,28 @@ async function exportSecrets() {
const defaultOptions = {
prefixUrl: vaultUrl,
headers: {}
headers: {},
https: {}
}
const tlsSkipVerify = core.getInput('tlsSkipVerify', { required: false }) != 'false';
if (tlsSkipVerify == true) {
defaultOptions.https.rejectUnauthorized = true;
}
const caCertificateRaw = core.getInput('caCertificate', { required: false });
if (caCertificateRaw != null) {
defaultOptions.https.certificateAuthority = Buffer.from(caCertificateRaw, 'base64').toString();
}
const clientCertificateRaw = core.getInput('clientCertificate', { required: false });
if (clientCertificateRaw != null) {
defaultOptions.https.certificate = Buffer.from(clientCertificateRaw, 'base64').toString();
}
const clientKeyRaw = core.getInput('clientKey', { required: false });
if (clientKeyRaw != null) {
defaultOptions.https.key = Buffer.from(clientKeyRaw, 'base64').toString();
}
for (const [headerName, headerValue] of extraHeaders) {
@ -200,4 +221,4 @@ module.exports = {
parseSecretsInput,
normalizeOutputKey,
parseHeadersInput
};
};

View file

@ -7,4 +7,4 @@ const { exportSecrets } = require('./action');
} catch (error) {
core.setFailed(error.message);
}
})();
})();