GithubHelp home page GithubHelp logo

nytimes / vault-fastly-secret-engine Goto Github PK

View Code? Open in Web Editor NEW
37.0 33.0 5.0 7.98 MB

Vault plugin to generate short lived Fastly API tokens

Home Page: https://open.nytimes.com/we-built-a-plugin-but-its-not-a-secret-dfdf68b0e44f

License: Apache License 2.0

Dockerfile 1.19% Makefile 8.83% Go 89.99%
vault vault-plugin vault-plugins vault-backend secret-management fastly fastly-api fastly-secrets-engine

vault-fastly-secret-engine's Introduction

vault-fastly-secret-engine

This plugin will allow you to create a secret backend that will use the Fastly API to generate dynamic short lived Fastly token. Usage can be restricted using the highly customizable Vault ACL system.

Setup

Most secrets engines must be configured in advance before they can perform their functions. These steps are usually completed by an operator or configuration management tool.

  1. Register the plugin with the catalog

    $ SHASUM=$(shasum -a 256 vault-fastly-secret-engine | cut -d " " -f1)
    $ vault write sys/plugins/catalog/vault-fastly-secret-engine sha_256="$SHASUM" command="vault-fastly-secret-engine" 
    Success! Data written to: sys/plugins/catalog/vault-fastly-secret-engine
    
  2. Enable the Fastly secrets engine:

    $ vault secrets enable -path="fastly" -plugin-name="vault-fastly-secret-engine" plugin
    Success! Enabled the vault-fastly-secret-engine plugin at: fastly/
    

    By default, the secrets engine will mount at the name of the engine. To enable the secrets engine at a different path, use the -path argument.

  3. Configure the backend with user credentials that will be able to interact with the Fastly API and create tokens.

    $ vault write fastly/config username="sam" password="test" sharedSecret="123"
    Success! Data written to: fastly/config
    

    The sharedSecret corresponds to the shared secret key produced by fastly when configuring MFA login. This will be used to generate the Fastly tokens.

Usage

After the secrets engine is configured and a user/machine has a Vault token with the proper permission, it can generate tokens.

  1. Generate a new fastly token by writing to the /fastly/generate endpoint with the scope of the desired token as well as the service ID:

    $ vault write fastly/generate scope="global" service_id="Xj62345gmTix9gh67U"
    Key      Value
    ---      -----
    token    d118a65cdfe314202cf969e1fb2e8afc
    

    NOTE you can provide multiple service IDs by using a comma delimited string.

    $ vault write fastly/generate scope="global" service_id="Xj62345gmTix9gh67U,45MDE6457BT4IRZdf7z"
    Key      Value
    ---      -----
    token    f2732f475773ab0d0bce1cd371d72b48
    

    Using ACLs, it is possible to restrict the type of tokens that can be generated. Any combination of scope and service ID can be used

Local Development

Build the code

GOOS=linux GOARCH=amd64 go build
docker build -t vault-plugin .
docker run --cap-add=IPC_LOCK -e 'VAULT_DEV_ROOT_TOKEN_ID=myroot' -e 'VAULT_DEV_LISTEN_ADDRESS=0.0.0.0:1234' -p 1234:1234 vault-plugin

Configure the local vault

In a second terminal window...

export VAULT_ADDR='http://0.0.0.0:1234'
vault login myroot
SHASUM=$(shasum -a 256 vault-fastly-secret-engine | cut -d " " -f1)
vault write sys/plugins/catalog/vault-fastly-secret-engine   sha_256="$SHASUM"   command="vault-fastly-secret-engine"
vault secrets enable -path="fastly" -plugin-name="vault-fastly-secret-engine" plugin
vault write fastly/config username="sam" password="test" sharedSecret="123"

vault-fastly-secret-engine's People

Contributors

emmawaterman avatar kant avatar sbower avatar tonglil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vault-fastly-secret-engine's Issues

Hello From HashiCorp Vault team

Hi,
This is not really an issue. I am from the HashiCorp Vault team looking to do some interviews with plugin developers. I wanted to reach out to whomever developed the vault-fastly plugin to ask a few questions...

this is regarding some new features we are planning on introducing in future releases.
Would anyone like to participate and help out?

Thanks in advance!!

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.