dveselka / aws-dbg-saml

Automatic update of aws ~/.aws/credentials file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New version ./authOpenAM.py

Install packages on Fedora

sudo dnf install python-boto3
sudo dnf install python-beautifulsoup4
sudo dnf install python-tkinter

Run

python ./authOpenAM.py
aws configure
aws s3 ls s3://rdf-install
[dave@localhost ~]$ find .aws
.aws/config
.aws/credentials
 more .aws/config 
[default]
region = eu-central-1
ore .aws/credentials 
[default]
aws_access_key_id = VALUE
aws_secret_access_key = VALUE
aws_session_token = VALUE

Key Generator for AWS CLI Access

Language: Python 2.7

Description:

  • Script generates assumedRole.pkl storing AWS credentials. It's used for comparing timestamps and generating AWS credentials file.

  • Credentials file is stored in User profile ~/.aws directory.

  • If Credentials are going to expire in <5 minutes, user needs to provide UID/Token/Password again

Environmant names

It is difficult sometimes to differentiate enviroments from each other while running this script. User can preconfigure his enviromet description so the script will append additional text to each line.

Example

Original login dialog

Username: gi997
MFA token: 877303
Password: 
Please choose the role you would like to assume:
[0]: 147789435585 - role/EnergyDevelopment
[1]: 723232346150 - role/EnergyDevelopment
[2]: 322652345670 - role/PowerUser
[3]: 367821342543 - role/SharedComponentDevelopment
Selection: 
...

New login dialog

Username: gi997
MFA token: 877303
Password: 
Please choose the role you would like to assume:
[0]: 147789435585 - role/EnergyDevelopment - acceptance
[1]: 723232346150 - role/EnergyDevelopment - sandbox
[2]: 322652345670 - role/PowerUser - production
[3]: 367821342543 - role/SharedComponentDevelopment - simulation
Selection: 
...

Configuration

Create a json file ~/.aws/env.json with content in key:value form environment number : name

Example configuration

{
    "723232346150": "sandbox",
    "147789435585": "acceptance",
    "367821342543": "simulation",
    "322652345670": "production"
}

User configuration

You can configure a default user. You need to create a file ~/.aws/user containing just the username.

Example of ~/.aws/user for username ab123

ab123

About

Automatic update of aws ~/.aws/credentials file


Languages

Language:Python 100.0%