Anoop M Nair
Anoop M Nair

Reputation: 1087

Vault Integration SSL certificate issue NodeJS

I was trying to integrate vault in my Nodejs application using "node-vault ". I am getting below error enter image description here

Please see the code snippet

  var options = {
  apiVersion: 'v1', // default
  endpoint: 'https://XXXXXXXXXX', 
  token: 'XXXXXX' 
};

// get new instance of the client
var vault = require("node-vault")(options);

// init vault server
vault.init({ secret_shares: 1, secret_threshold: 1 })
.then( (result) => {
  var keys = result.keys;
  // set token for all following requests
  vault.token = result.root_token;
  // unseal vault server
  return vault.unseal({ secret_shares: 1, key: keys[0] })
})
.catch(console.error);

Upvotes: 0

Views: 1281

Answers (1)

Shubham Prasad
Shubham Prasad

Reputation: 146

I ran into same issue. Here is something that worked for me.

import NodeVault from "node-vault";
const vault = NodeVault({
    endpoint: "https://xxxxxx.com",
    requestOptions: {
      strictSSL: false
    }
})

// this should now work without errror
const result = await vault.approleLogin({
  role_id: VAULT_ROLE_ID,
  secret_id: VAULT_SECRET_ID,
});

Upvotes: 3

Related Questions