Git Product home page Git Product logo

serverless-approle-manager's Introduction

Vault AppRole Manager

After receiving a few requests we decided to open source our AWS lambda code following this blog post.

Prerequisites:

  • Before using this lambda you will need a policy written in Vault specific to your app and environment, the policy should be named <app>-<environment> for example kickstarter-dev.
  • You will need to create a Vault token with restricted access to Vault and store it in S3.
  • You will need AWS credentials.
  • You will need to add a local.yml file at the root of the directory with all the variables specific to your environment.
  • You will need to add your own SSL certificate ca.pemat the root as well.
  • We use serverless to deploy our lambdas, install with npm install serverless -g and deploy with serverless deploy

How does this work ?

This AWS lambda leverages the AppRole Authentication method offered by Hashicorp's Vault. When a new container starts it runs an entrypoint script that will retrieve a Vault token by using the secret id and role id stored on S3, in a directory named after its own task role. This will allow the container to populate its environment with all the secrets. An example of this entrypoint script is included in the Docker folder.

To trigger this lambda in an AWS CloudFormation template, add this to your template:

LambdaVaultAuth:
  Type: Custom::VaultAuth
  Properties:
    ServiceToken: 'arn:aws:lambda:us-east-1:11111111111:function:serverless-approle-manager'
    Service: MyAppName
    Environment: MyEnv
    Iam:
      Ref: MyECSTaskRole

In case of a CREATE event, this lambda will create a role in Vault for your service, and retrieve the corresponding role-id and secret-id, and put them securely (server side encryption enabled) in S3.

These credentials can then be pulled by a service to generate a client token to access Vault.

In case of a DELETE event, this lambda will delete the corresponding role on Vault.

In case of a UPDATE event, this lambda will delete the old role and create a new one.

serverless-approle-manager's People

Contributors

natachas avatar

Stargazers

Umut Erol Kaçar avatar  avatar Felipe Monteiro avatar otakuSiD avatar Miguel avatar Sebastian Herzberg avatar karthik Ramamoorthy avatar Michael de Silva avatar Moto Ishizawa avatar Jeremy Pruitt avatar AJ Kerrigan avatar Michael Gruber avatar  avatar Jonathan Freedman avatar Logan McDonald avatar Riley Shott avatar Matías Agustín Méndez avatar  avatar

Watchers

Kyle Burckhard avatar Tieg Zaharia avatar Andy Baio avatar Justin Jones avatar Miguel Senquiz avatar Garrow Bedrossian avatar Chavez avatar Dannel Jurado avatar Molly Neuman avatar Mahesh Guruswamy avatar Zack Sears avatar Corey Farwell avatar Brian McMurray avatar Patrick Presto avatar Will Duffy avatar James Cloos avatar Rushaine McBean avatar Jon Chang avatar Kilian McMahon avatar Julie Swoope avatar Nick Yulman avatar  avatar Sarah Groff Hennigh-Palermo avatar Daniel Hunninghake avatar  avatar Rae Farine avatar Teddy Pendergast avatar David Ouyang Moench avatar Steve Klise avatar Pedro Carmo avatar Jamie Roth avatar Jackson Lynch avatar Amanda Pickering avatar Brett Shollenberger avatar Isabel Martin avatar Setsun avatar Heather Swift Hunt  avatar Jonathan Samudio avatar  avatar Carol Benovic avatar  avatar Robert Lum avatar  avatar  avatar  avatar  avatar Ingerid Fosli avatar  avatar Mil Reyes avatar Nick Novak avatar  avatar  avatar  avatar Corin Cerami avatar Jeena Lee avatar Courtney avatar Susanna Brumm avatar travis brace avatar Aidan Lavis avatar Amy Fain avatar Caitlin Bahari avatar Soph Ng avatar  avatar Saarim Zaman avatar Christella avatar  avatar Darell Koh avatar  avatar Ruti Wajnberg avatar Lena Imamura avatar  avatar Alexa avatar Wen Fu avatar Arjun Mahesh avatar Brittany Levers avatar Elliott Cost avatar  avatar  avatar Toy Vano avatar Shubha Rajan avatar Tyler avatar  avatar  avatar

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.