Skip to main content

[![CircleCI](https://circleci.com/gh/Nextdoor/nd_okta_auth.svg?style=svg&circle-token=7266b58fbbe52af8d01e72ce02d9fae6a7f4d1c6)](https://circleci.com/gh/Nextdoor/nd_okta_auth)

# Nextdoor Okta Auth-er

This is a simple command-line tools for logging into Okta and generating temporary Amazon AWS Credentials. This tool makes it easy and secure for your developers to generate short-lived, [logged and user-attributed][tracking] credentials that can be used for any of the Amazon SDK libraries or CLI tools.

# Features

We have support for logging into Okta, optionally handling MFA Authentication, and then generating new SAML authenticated AWS sessions. In particular, this tool has a few core features.

## Optional MFA Authentication

If your organization requires MFA for the _[initial login into Okta][okta_mfa]_, we will automatically detect that requirement on a per-user basis and prompt the user to complete the Multi Factor Authentication. The following factors are supported by _nd_okta_auth_:

  • [FIDO U2F][okta_u2f] (eg yubikey)

  • [Okta Verify with Push][okta_verify]

  • TOTP (Okta Verify, Duo, and Google Authenticator)

If a user has multiple factors they will be prompted in the above order. A user can hit Control-C to skip a factor.

## Re-Up Mode .. Automatic Credential Re-Generation

Amazon IAM only supports Federated Login sessions that last up to 1 hour. For developers, it can be painful to re-authenticate every hour during your work day. This is made much worse if your organization requires MFA on each login.

You may run the Okta Auth-er tool in “reup” mode to get around this. The tool will stay running in a daemon-like mode, and it will reach out regularly to Okta, generate a new SAML Assertion, and then generate updated Amazon AWS credentials. This can run for as long as your Okta administrator has allowed your Login Session to be - often a full work day.

See the –reup commandline option for help here!

# Usage

For detailed usage instructions, see the –help commandline argument. Basic instructions though:

$ nd_okta_auth -a <application id> -o <your org name> -u <your username> 08:27:44 (INFO) Nextdoor Okta Auther v0.0.1 Password: 08:27:48 (WARNING) Okta Verify Push being sent… 08:27:48 (INFO) Waiting for Okta Verification… … 08:28:09 (INFO) Waiting for Okta Verification… 08:28:10 (INFO) Successfully authed Matt Wise 08:28:10 (INFO) Getting SAML Assertion from foobar 08:28:11 (INFO) Found credentials in shared credentials file: ~/.aws/credentials 08:28:11 (INFO) Wrote profile “default” to /Users/diranged/.aws/credentials 08:28:11 (INFO) Session expires at 2017-07-24 16:28:13+00:00 $

## Okta Setup Before you can use this tool, your Okta administrator needs to set up [Amazon/Okta integration][okta_aws_guide] using SAML roles.

## Inspiration This code is heavily based on the previous work done by [ThoughtWorksInc][thoughtworksinc] on their [OktaAuth][oktaauth] and [AWS Role Credentials][aws_role_credentials] tools. We took their general purpose code and re-wrote them into a singularly focused tool that added some new features.

In particular, we found it clumsy to use two CLI tools together to do a single task. Additionally, the tools did not have support for [Okta Verify with Push][okta_verify].

# Developer Setup

If you are interested in working on the codebase, setting up your development environment is quick and easy.

$ virtualenv .venv $ source .venv/bin/activate $ pip install -r requirements.txt

## Python Versions

Python 2.7.1+ and Python 3.5.0+ are supported

## Running Tests

$ nosetests -vv –with-coverage –cover-erase –cover-package=nd_okta_auth

[oktaauth]: https://github.com/ThoughtWorksInc/oktaauth [aws_role_credentials]: https://github.com/ThoughtWorksInc/aws_role_credentials [thoughtworksinc]: https://github.com/ThoughtWorksInc [tracking]: https://aws.amazon.com/blogs/security/how-to-easily-identify-your-federated-users-by-using-aws-cloudtrail/ [okta_aws_guide]: https://support.okta.com/help/servlet/fileField?retURL=%2Fhelp%2Farticles%2FKnowledge_Article%2FAmazon-Web-Services-and-Okta-Integration-Guide&entityId=ka0F0000000MeyyIAC&field=File_Attachment__Body__s [okta_mfa]: https://www.okta.com/products/adaptive-multi-factor-authentication/ [okta_verify]: https://www.okta.com/blog/tag/okta-verify-with-push/ [okta_u2f]: https://support.okta.com/help/s/article/Using-YubiKey-Authentication-in-Okta [aws_saml]: http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithSAML.html

Metadata

Release files for nd-okta-auth 1.0.6

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

Source distribution (sdist)

Source distribution for nd-okta-auth 1.0.6
File Size Uploaded Provenance
nd_okta_auth-1.0.6.tar.gz 17.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nd-okta-auth 1.0.6
File Interpreter ABI Platform
nd_okta_auth-1.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 38.7 kB

Release files / nd_okta_auth-1.0.6.tar.gz

Download URL nd_okta_auth-1.0.6.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3b4fb889a431bb6696d6ee00ea49d65155a3c893a15037806af6e319960f5ef6
BLAKE2b-256 checksum
How to use checksums
aa6ce74acc8f0eefe945a9285c6bbac9479a6deecec8324ac64193a272e8a3a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / nd_okta_auth-1.0.6-py3-none-any.whl

Download URL nd_okta_auth-1.0.6-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e3ea285ccd422c7c739dc93c39e6cc74613adf1ff817686aa429303ea061cba
BLAKE2b-256 checksum
How to use checksums
52285ecc0bb285480a14c62285c1b7b8dbe0b512245456968f11533ea05af4f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for nd-okta-auth 1.0.6

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.

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