Code Monkey home page Code Monkey logo

aws-cli-auth-with-mfa's Introduction

Project Title

Enforce authentication to AWS account via CLI with MFA token usage

Quick summary

It's a best practice to protect your account and its resources by using a multi-factor authentication device (MFA). If you plan to interact with Company resources using the AWS Command Line Interface (CLI) you must use MFA device and request each time a temporary session token instead.

Briefly

This script prompts you to select target profile from your locally stored AWS config profiles and ask to provide MFA token for this profile. If successful new AWS temporary credentials will be stored in your AWS CLI configuration and credentials files.

NOTE. New profiles name will be generated with mask 'mfa-<old_profile_name>'

Getting Started

Prerequisites

Please see REQUIREMENTS.TXT

pip install -r requirements.txt

Installing

Clone repository to you local folder.

Configuration

  1. Create IAM policy (see template in additional/iam_mfa_policy.template)
  2. Create IAM group, move all users to this group and assign newly created IAM policy to this group.
  3. Add alias to your shell run command file (.bashrc, .zshrc, etc)
alias awslogin='python ~/<PATH_TO_REPo>/aws-cli-auth-with-mfa/awsmfalogin.py'

Usage

Run script and provide profiles ids just simply typing integer or integers separated by any symbol or type 'all'.

References

https://aws.amazon.com/premiumsupport/knowledge-center/authenticate-mfa-cli/

Authors

  • Nikolay Srebniuk

aws-cli-auth-with-mfa's People

Contributors

unk1nd0n3 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.