All Projects → jmhale → Okta Awscli

jmhale / Okta Awscli

Licence: apache-2.0
Provides Okta authentication for awscli

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Okta Awscli

Awsrun
CLI and library to execute commands over one or more AWS accounts concurrently.
Stars: ✭ 53 (-67.08%)
Mutual labels:  aws, aws-cli
Torchlambda
Lightweight tool to deploy PyTorch models to AWS Lambda
Stars: ✭ 83 (-48.45%)
Mutual labels:  aws, aws-cli
Limes
Limes provides an easy work flow with MFA protected access keys, temporary credentials and access to multiple roles/accounts.
Stars: ✭ 67 (-58.39%)
Mutual labels:  aws, aws-cli
Bash My Aws
Bash-my-AWS provides simple but powerful CLI commands for managing AWS resources
Stars: ✭ 782 (+385.71%)
Mutual labels:  aws, aws-cli
Awsscripts
Various AWS Automation Scripts
Stars: ✭ 116 (-27.95%)
Mutual labels:  aws, aws-cli
Homebrew Aws Session Manager Plugin
Install the AWS session manager plugin with Homebrew
Stars: ✭ 27 (-83.23%)
Mutual labels:  aws, aws-cli
Perun
A command-line validation tool for AWS Cloud Formation that allows to conquer the cloud faster!
Stars: ✭ 82 (-49.07%)
Mutual labels:  aws, aws-cli
Saws
A supercharged AWS command line interface (CLI).
Stars: ✭ 4,886 (+2934.78%)
Mutual labels:  aws, aws-cli
Aws Toolbox
A collection of DevOps tools including shell & python scripts that automate the boring stuff in AWS.
Stars: ✭ 89 (-44.72%)
Mutual labels:  aws, aws-cli
Awesome Aws
A curated list of awesome Amazon Web Services (AWS) libraries, open source repos, guides, blogs, and other resources. Featuring the Fiery Meter of AWSome.
Stars: ✭ 9,895 (+6045.96%)
Mutual labels:  aws, aws-cli
Aws Shell
An integrated shell for working with the AWS CLI.
Stars: ✭ 6,359 (+3849.69%)
Mutual labels:  aws, aws-cli
Awsprocesscreds
Process credential providers for AWS SDKs and Tools
Stars: ✭ 123 (-23.6%)
Mutual labels:  aws, aws-cli
Ecs Deploy
Powerful CLI tool to simplify Amazon ECS deployments, rollbacks & scaling
Stars: ✭ 541 (+236.02%)
Mutual labels:  aws, aws-cli
Workshop Donkeytracker
Workshop to build a serverless tracking application for your mobile device with an AWS backend
Stars: ✭ 27 (-83.23%)
Mutual labels:  aws, aws-cli
Awless
A Mighty CLI for AWS
Stars: ✭ 4,821 (+2894.41%)
Mutual labels:  aws, aws-cli
Awsconsolerecorder
Records actions made in the AWS Management Console and outputs the equivalent CLI/SDK commands and CloudFormation/Terraform templates.
Stars: ✭ 1,152 (+615.53%)
Mutual labels:  aws, aws-cli
Aws
A collection of bash shell scripts for automating various tasks with Amazon Web Services using the AWS CLI and jq.
Stars: ✭ 493 (+206.21%)
Mutual labels:  aws, aws-cli
Aws Security Viz
Visualize your aws security groups.
Stars: ✭ 511 (+217.39%)
Mutual labels:  aws, aws-cli
Athena Cli
Presto-like CLI tool for AWS Athena
Stars: ✭ 85 (-47.2%)
Mutual labels:  aws, aws-cli
Awsu
Enhanced account switching for AWS, supports Yubikey as MFA source
Stars: ✭ 118 (-26.71%)
Mutual labels:  aws, yubikey

okta-awscli - Retrieve AWS credentials from Okta

Main branch: Build Status - main

Develop branch: Build Status - develop

Authenticates a user against Okta and then uses the resulting SAML assertion to retrieve temporary STS credentials from AWS.

This project is largely inspired by https://github.com/nimbusscale/okta_aws_login, but instead uses a purely API-driven approach, instead of parsing HTML during the authentication phase.

Parsing the HTML is still required to get the SAML assertion, after authentication is complete. However, since we only need to look for the SAML assertion in a single, predictable tag, <input name="SAMLResponse"..., the results are a lot more stable across any changes that Okta may make to their interface.

Python Support

This project is written for Python 3. Running it with Python 2 may work, but it is not supported. Since Python 2 is end-of-life (as of 2020-JAN-01), feature requests and PRs to add Python 2 support will likely not be accepted, outside of extreme circumstances.

Installation

  • pip3 install okta-awscli
    • To install with U2F support (Yubikey): pip3 install "okta-awscli[U2F]"
  • Configure okta-awscli via the ~/.okta-aws file with the following parameters:
[default]
base-url = <your_okta_org>.okta.com

## The remaining parameters are optional.
## You may be prompted for them, if they're not included here.
username = <your_okta_username>
password = <your_okta_password> # Only save your password if you know what you are doing!
factor   = <your_preferred_mfa_factor> # Current choices are: GOOGLE or OKTA
role     = <your_preferred_okta_role> # AWS role name (match one of the options prompted for by "Please select the AWS role" when this parameter is not specified
profile  = <aws_profile_to_store_credentials> # Sets your temporary credentials to a profile in `.aws/credentials`. Overridden by `--profile` command line flag
app-link = <app_link_from_okta> # Found in Okta's configuration for your AWS account.
duration = 3600 # duration in seconds to request a session token for, make sure your accounts (both AWS itself and the associated okta application) allow for large durations. default: 3600

Supported Features

  • Tenant wide MFA support
  • Per-application MFA support (added in version 0.4.0)
  • Okta Verify Play Store | App Store
  • Okta Verify Push Support
  • Google Authenticator Play Store | App Store
  • YubiKey (Requires library python-u2flib-host) HomePage

Usage

okta-awscli --profile <aws_profile> <awscli action> <awscli arguments>

  • Follow the prompts to enter MFA information (if required) and choose your AWS app and IAM role.
  • Subsequent executions will first check if the STS credentials are still valid and skip Okta authentication if so.
  • Multiple Okta profiles are supported, but if none are specified, then default will be used.
  • Selections for AWS App and AWS Role are saved to the ~/.okta-aws file. Removing the app-link and role fields will enable the prompts for these selections.

Example

okta-awscli --profile my-aws-account iam list-users

If no awscli commands are provided, then okta-awscli will simply output STS credentials to your credentials file, or console, depending on how --profile is set.

Optional flags:

  • --profile or -p Sets your temporary credentials to a profile in .aws/credentials. If omitted and not configured in ~/.okta-aws, credentials will output to console.
  • --username or -U Okta username.
  • --password or -P Okta password.
  • --force or -f Ignores result of STS credentials validation and gets new credentials from AWS. Used in conjunction with --profile.
  • --verbose or -v More verbose output.
  • --debug or -d Very verbose output. Useful for debugging.
  • --cache or -c Cache the acquired credentials to ~/.okta-credentials.cache (only if --profile is unspecified)
  • --okta-profile or -o Use a Okta profile, other than default in .okta-aws. Useful for multiple Okta tenants.
  • --token or -t Pass in the TOTP token from your authenticator
  • --refresh-role or -r Refresh the AWS role to be assumed. Previously incorporated in --force.
  • --lookup or -l Lookup and return the AWS Account Alias for each role, instead of returning the raw ARN.
    • Note that this will attempt to perform iam:ListAccountAliases on every account that you have access to via Okta. This is important for two reasons:
      • All of your roles must have this permission attached to it via an IAM policy.
      • This may be important for you, if you have compliance considerations around only accessing accounts that you're actively doing work in.
  • --version or -V Outputs version number then exits.

Run from docker container

This process is taken from gimme-aws-creds and adapted

Build the image

docker build -t okta-awscli .

Run the image with the command

docker run -it --rm -v ~/.aws/credentials:/root/.aws/credentials -v ~/.okta-aws:/root/.okta-aws --profile default okta-awscli iam list-users

if you want to type less you can create an alias

alias okta-awscli='docker run -it --rm -v ~/.aws:/root/.aws -v ~/.okta-aws:/root/.okta-aws okta-awscli'

and just type

okta-awscli

you can add this to you .bashrc

source <PATH TO GIT REPO>/set-alias.bash
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].