mirror of
https://github.com/hashicorp/vault-action.git
synced 2026-04-22 11:35:43 +00:00
fix: Adiciona logs para inspecionar o certificado
This commit is contained in:
parent
6438637277
commit
caaa3e4030
1 changed files with 25 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ const vaultUrl = `${process.env.VAULT_HOST}:${process.env.VAULT_PORT}`;
|
||||||
const caCertificateRaw = `${process.env.VAULTCA}`;
|
const caCertificateRaw = `${process.env.VAULTCA}`;
|
||||||
const clientCertificateRaw = `${process.env.VAULT_CLIENT_CERT}`;
|
const clientCertificateRaw = `${process.env.VAULT_CLIENT_CERT}`;
|
||||||
const clientKeyRaw = `${process.env.VAULT_CLIENT_KEY}`;
|
const clientKeyRaw = `${process.env.VAULT_CLIENT_KEY}`;
|
||||||
|
const tls = require('tls');
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -28,7 +29,30 @@ const clientKeyRaw = `${process.env.VAULT_CLIENT_KEY}`;
|
||||||
if (clientKey == null) {
|
if (clientKey == null) {
|
||||||
throw Error("VAULT_CLIENT_KEY env not set.")
|
throw Error("VAULT_CLIENT_KEY env not set.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
const socket = tls.connect({
|
||||||
|
host: process.env.VAULT_HOST,
|
||||||
|
port: parseInt(process.env.VAULT_PORT),
|
||||||
|
ca: caCertificate,
|
||||||
|
cert: clientCertificate,
|
||||||
|
key: clientKey,
|
||||||
|
}, () => {
|
||||||
|
const cert = socket.getPeerCertificate();
|
||||||
|
console.log('Server cert Subject:', JSON.stringify(cert.subject));
|
||||||
|
console.log('Server cert SAN:', cert.subjectaltname);
|
||||||
|
console.log('Server cert Issuer:', JSON.stringify(cert.issuer));
|
||||||
|
console.log('Server cert Valid from:', cert.valid_from);
|
||||||
|
console.log('Server cert Valid to:', cert.valid_to);
|
||||||
|
socket.destroy();
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
socket.on('error', (e) => {
|
||||||
|
console.log('TLS debug error:', e.message);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
const {body} = await got(`https://${vaultUrl}/v1/sys/init`, {
|
const {body} = await got(`https://${vaultUrl}/v1/sys/init`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue