vault-auth-aws
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/vault-auth-aws package

0.3.0 • Public • Published

vault-auth-aws

Build Status

A module for authenticating against Vault server by HashiCorp when running as AWS service such as Lambda using aws STS, Vault needs to be already configured to accept login attempts using this method.

Prerequisites

Uses AWS SDK v3.

install

npm install vault-auth-aws

Login

You can use below code to log in to vault server from Lambda; by default vault application name is lambda name

const vaultAuthClient = require('vault-auth-aws');

try {
  let vaultClient = new VaultAwsAuth({ host: 'vault.example.com' });
  const success = await vaultClient.authenticate();
  const vault = require('node-vault')({
    apiVersion: config.apiVersion,
    endpoint: config.endpoint,
    token: success.auth.client_token,
  });
  // get your super secrets.
} catch (ex) {
  // error here.
}

If you want to specify the vault application name, you can do

let vaultClient = new VaultAwsAuth({ host: 'vault.example.com', vaultAppName: 'mySuperSecerts' });

options

  • ssl: accepts boolean, specifying if the vault server operating under ssl, default false.
  • host: vault host name or IP address.
  • port: vault server port, default is 8200.
  • apiVersion: vault server API endpoint version, default is v1.
  • vaultLoginUrl: Vault login URL, default is auth/aws/login.
  • vaultAppName: Vault application name, default is lambda name if any.
  • followAllRedirects: accepts boolean, by default is true.
  • certFilePath: path for a certificate that might be needed by the server.
  • sslRejectUnAuthorized: accepts boolean, specified once the certificate is self-signed and cannot be verified, default is true.

License (ISC)

Copyright 2017 Abdullah Shahin eng.abd.shahin@gmail.com

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Dependents (4)

Package Sidebar

Install

npm i vault-auth-aws

Weekly Downloads

8,467

Version

0.3.0

License

ISC

Unpacked Size

22 kB

Total Files

12

Last publish

Collaborators

  • abdullah.shahin