Skip to main content

MFA for AWS CLI using SafeNet Trusted Access (STA)

Project description

sta-awscli

MFA for AWS CLI using SafeNet Trusted Access (STA)

This script allows using SafeNet Trusted Access (STA) IDP based authentication when working with AWSCLI. At the moment, the supported configuration is using Keycloak (https://www.keycloak.org) as an "agent" between STA and AWS, allowing us to support AWS with multiple accounts and roles. The script assumes STA and Keycloak are configured and working for SAML based access to AWS.

The script supports all STA authentication methods, including manual OTP, Push based OTP and GriDsure. GriDsure support is experimental and requires "tesseract" v4.0 and above to be installed on the host (https://tesseract-ocr.github.io/tessdoc/Installation.html).

Configuration

On first execution, the script will collect the required information to create a configuration file (sta-awscli.config) that is stored in ~.aws folder. It's possible to run the script with -c switch to specify an alternative location for the config file.
The configuration file includes:

  • AWS Region
  • Keycloak URL
  • Keycloak version
  • Keycloak Realm Name
  • AWS application name in Keycloak

For example:

[config]
aws_region =  
cloud_idp =  
is_new_kc =  
tenant_reference_id =  
aws_app_name =  

Usage

Once the configuration is created, a connection is established to STA through Keycloak and the user will be asked to provide a username, based on STA authentication policy, AD Password and OTP. If the user only has single token (MobilePASS+ or GriDsure) assigned, the authentication will be triggered automatically (Push for MobilePASS+ or the pattern grid presented for GriDsure). For auto triggered Push - the user can cancel the Push using CTRL+C to manually enter OTP. If the user has multiple tokens assigned, the user is aksed to provide an OTP, but still has the abbility to trigger Push ("p" or blank OTP) and GriDsure ("g").

After successful authentication, if a user has a single role assigned, an Access Token is generated and stored in .aws\credentials file. If the user has multiple roles assigned, the user is presented with the list of available roles to select the desired role and an Access Token is generated and stored.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sta-awscli-2.0.5.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

sta_awscli-2.0.5-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file sta-awscli-2.0.5.tar.gz.

File metadata

  • Download URL: sta-awscli-2.0.5.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.15 CPython/3.10.6 Linux/5.15.0-1017-azure

File hashes

Hashes for sta-awscli-2.0.5.tar.gz
Algorithm Hash digest
SHA256 97a4c1397e6a54cd1b19b74cd6f8e755aef8443505bb4bb23d0ca88be457df09
MD5 23f2d0a33de457f530a65dca12054f93
BLAKE2b-256 def5fca185f35fd40cbb26ae093e586fd3a0a14fecfe1063a6f69cda54e3ce66

See more details on using hashes here.

File details

Details for the file sta_awscli-2.0.5-py3-none-any.whl.

File metadata

  • Download URL: sta_awscli-2.0.5-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.15 CPython/3.10.6 Linux/5.15.0-1017-azure

File hashes

Hashes for sta_awscli-2.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 418d9cbb8b8b544e0538bafab3bc5205e516c59b9638685e89c7cee4c0fd1ed1
MD5 9f1071e0ac181e6def0589fffda2a625
BLAKE2b-256 71e2ccbfcc4a79b4fa440a2e0fefa46fa9b91d462c965c3ba4db17a3ba04239a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page