Skip to main content

pyokta-aws-cli-assume-role

pypi version pypi downloads source build License: GPL v3


Okta-AWS auth tool for humans

If you login to AWS via Okta SAML federation and assume an IAM role, this tool will help you easily achieve pragmatic access to AWS via the aws cli and SDKs. Also helpful for running terraform/terragrunt, packer, and credstash with iam roles.

Replaces okta-aws-cli-assume-role

Table of Contents

NOTICE: Though this project works in a limited capacity, keep in mind that this project is still in rapid development phase. No security audits have been performed.

Why a new tool?

Benefits over existing tool

  • No PATH changes or overriding aws executables - you're still using native awscli.
  • Supports multiple tenants.
  • One consistent config file for all tenants.
  • Env var changes are 100% optional.
  • Cleaner https error output.
  • Easy to install.
  • JVM not required.

Existing tool features missing in this tool

These features are planned to be supported in the near future. See roadmap.

  • Interactively select from multiple mfa options.
  • Set desired mfa option via cli args, env vars, or config file.
  • Support Okta Verify app mfa (currently only sms is verified to work).
  • Cross-OS compatibility testing (current focus is Linux systems).
  • Okta token caching/refresh.

Getting Started

Requirements

  • python 3.5+
  • pip
  • awscli: pip install awscli -- Though it's not required to run the tool, the tool exists to support friendly awscli auth via Okta.

Install

pip install pyokta-aws-cli-assume-role

Configure

Configuration can be input via cli args, env vars, or the pyokta-aws config file described above. Configuration takes presidence as follows: cli args > env vars > config file. For all supported args and env vars, run pyokta-aws --help and pyokta-aws [COMMAND] --help.

Interactive

Run pyokta-aws configure for interactive configuration (WIP).

Config file

Default configuration file location is ~/.pyokta_aws/config.

Example config file:

[my-aws-profile]
region = us-east-1
okta_org = example.okta.com
okta_aws_app_url = https://example.okta.com/home/amazon_aws/123456789
aws_role_to_assume = arn:aws:iam::987654321:role/AWSAdmin
aws_idp = arn:aws:iam::987654321:saml-provider/Okta
username = johnsmith
password = <it is recommended to keep this blank>
sts_duration = 14400
  • region: Target AWS region. (Will override default region in target aws cli profile)
  • okta_org: Base domain for okta org.
  • okta_aws_app_url: Okta app url (can be found by hovering over aws app chiclet).
  • aws_role_to_assume: Found in AWS console under IAM > Roles > <role_id>. Look for ARN.
  • aws_idp: Found in AWS console under IAM > Identity Providers > <provider_id>. Look for ARN.
  • username: Okta username.
  • password: it is recommended to keep this blank and enter it interactively.
  • sts_duration: Duration (in seconds) to keep token alive. Max duration found in IAM > Identity Providers > <provider_id>.

Usage

The main command is pyokta-aws auth.

Basic usage: pyokta-aws auth --profile <aws_profile>.

For supported args, run pyokta-aws auth --help.

How it works

The main pyokta-aws auth command authenticates with Okta and aquires a temporary set of credentials from AWS STS. These credentials get written to you local aws credentials file. This allows the awscli and other tools like terraform/terragrunt, packer, and credstash to run as expected without needing to override the awscli executable or export environment variables.

Before auth happens, your local aws cli config profile is updated via the profile and region set in the pyokta-aws config. Treat you pyokta-aws config file as the single source of truth for aws cli config when authenticating with Okta.

Roadmap

  • pypi package
  • cli and settings loaders
  • support multi-tenant settings
  • ci (testing) 👷
  • okta auth
  • okta 2fa (sms)
  • get saml from okta app
  • aws auth via okta auth
  • aws config if not previously setup
  • basic documentation 📝
  • support multiple 2fa methods
  • interactive initial config 🚸
  • readthedocs 📝
  • tests ✅
  • windows support 🏁
  • ci/cd (deploy to pypi)?
  • aws role list selection in interactive mode 🚸
  • okta 2fa (okta verify)
  • push notification 2fa
  • use context managers to auto-cancel okta verifications on cancel
  • okta token cache/refresh to speedup multiple logins 🚸

Metadata

Release files for pyokta-aws-cli-assume-role 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyokta-aws-cli-assume-role 0.1.0
File Size Uploaded Provenance Actions
pyokta-aws-cli-assume-role-0.1.0.tar.gz 25.8 kB Without provenance Details for pyokta-aws-cli-assume-role-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyokta-aws-cli-assume-role 0.1.0
File Interpreter ABI Platform Actions
pyokta_aws_cli_assume_role-0.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for pyokta_aws_cli_assume_role-0.1.0-py2.py3-none-any.whl

Total release size: 54.3 kB

Release files / pyokta-aws-cli-assume-role-0.1.0.tar.gz

Download URL pyokta-aws-cli-assume-role-0.1.0.tar.gz
Size 25.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5906540b92e1341f1b19b7a2a5347527a90c72eafce7e5f6c9b8223eca52c961
BLAKE2b-256 checksum
How to use checksums
ee3c02d721605576553b0e4a78a5f0b74e7ace8dc3d22f079666fb70f801ac35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / pyokta_aws_cli_assume_role-0.1.0-py2.py3-none-any.whl

Download URL pyokta_aws_cli_assume_role-0.1.0-py2.py3-none-any.whl
Size 28.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c778713be81d345e387d129e506ea1ff723b4999209e6e1d37e8a2c6e822cf8f
BLAKE2b-256 checksum
How to use checksums
40b64a531bf649727fc41b7202b7b9cb87082bdf5bdebb982c2c717863685a62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Security for pyokta-aws-cli-assume-role 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page