Coder Social home page Coder Social logo

mgrennan / aws-vault-reference-application Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mike-goodwin/aws-vault-reference-application

0.0 1.0 0.0 20 KB

A sample client application for the Vault defined in https://github.com/mike-goodwin/aws-vault-reference-infrastructure

License: Apache License 2.0

JavaScript 68.09% CSS 0.31% HTML 31.59%

aws-vault-reference-application's Introduction

aws-vault-reference-application

A sample Vault aware client application for the Vault defined by https://github.com/mike-goodwin/aws-vault-reference-infrastructure.

Prerequisites (for local development)

  1. Vault (quel surprise)
  2. MySQL: The reference architecture uses a MySQL secret backend
  3. The "world" sample MySQL database
  4. node: This example application is a simple node application
  5. Clone this repo and install the app with npm install

Setup (for local development)

The example application requires some environment variables:

  • DB_HOST: The DB server (e.g localhost)
  • DB_DATABASE: The name of the database (e.g. world)
  • VAULT_LEASE_ADDR: The URL where the app can renew credential leases (e.g. http://127.0.0.1:8200/v1/sys/renew/) (needs the trailing slash)
  • VAULT_CRED_ADDR: The URL where the app can fetch credentials (e.g. http://127.0.0.1:8200/v1/mysql/creds/readonly)
  • VAULT_LEASE: How long the app will wait before renewing a lease, in seconds (must be less than the actual lease time (e.g. 10)
  • VAULT_LEASE_PADDING: A bit of padding to prevent accidental lease expiries, in seconds (e.g. 2)
  • VAULT_TOKEN: The root token that Vault generates when it starts in dev mode (e.g. 85e9e183-4997-f203-0200-1f89461eae16)

To start and configure Vault in dev mode:

vault server -dev

vault mount mysql

vault write mysql/config/connection connection_url="root:<YOUR PWD HERE>@tcp(localhost:3306)/"

vault write mysql/config/lease lease=15s lease_max=1m

vault write mysql/roles/readonly sql="CREATE USER '{{name}}'@'%' IDENTIFIED BY '{{password}}';GRANT SELECT ON *.* TO '{{name}}'@'%';"

About the authors

We are not affiliated to Hashicorp or the Vault project in any way and any recommendations made are our own and not endorsed by Hashicorp. We just like Vault, AWS, security and messing about with cool tech :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.