Coder Social home page Coder Social logo

aws-saml-cli's Introduction

aws-saml

This tool will authenticate into AWS using ADFS SAML. It is based on the blogpost at https://aws.amazon.com/blogs/security/how-to-implement-a-general-solution-for-federated-apicli-access-using-saml-2-0/ but was modified to support Azure MFA. You should receive an authentication request on your phone, then after accepting will presented with a list of roles that you are authorized to assume. Choose the desired role. You will then receive a set of temporary access keys and token for this role. The credentials will be stored in ~/.aws/credentials under the 'saml' profile. You may then use any aws tools by passing the --profile saml option.

You may pass the username with -u <username> or with an environment variable AWS_SAML_USERNAME. If not passed, the script will prompt you for it.

You may also bypass the role list if you already know the index of the role you wish to assume by passing the -r <index> parameter

install

pip install -r requirements.txt

usage

python aws-saml.py

Set shell variables

If you would like to have the saml token directly set in your aws shell variables, you can create a bash alias function that will do this.

$ vim ~/.bashrc

Go to the end of the file and a function like this:

    setSAMLToken() {
       # confirm path below is correct for your env
       if python ~/daws-saml-cli/aws-saml.py; then
          source ~/.aws/.token_file
          echo "Your creds have been set in your shell."
       fi
    }
    alias saml=setSAMLToken

Be sure to check the path to your aws-saml.py file and your tokenfile

Then you can just run the script from any bash prompt by just typing your alias:

$ saml

aws-saml-cli's People

Contributors

asagage avatar

Watchers

 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.