Skip to main content

Tool to obtain AWS CLI credentials from ADFS.

Project description

macaw-auth

Description

This repository contains code used to run the macaw-auth utility. Named after the Hyacinth and Scarlet Macaws of the Amazon Rainforest, this tool allows users to authenticate to ADFS to obtain their AWS credentials for use with the AWS CLI.

Prequisites

The user should have the following tools installed:

  • AWS CLI
  • Python 3.7+

NOTE: Rust may be required when installing on Debian Linux systems.

Installation

Install the tool using the following command

pip install macaw-auth

Usage

A sample config file can be found here. Your config file should be stored in ~/.aws/config, but if you store it elsewhere, you can pass it to macaw-auth using the --credentials-file flag. Be sure to update the following values in your config:

  • identity_url
  • username
  • role_arn
  • principal_arn

You should also update the profile name(s) to be meaningful to you. To use the role specified in the example config, call the tool using the following command:

macaw-auth example-profile

The tool can also be called without the profile name and you will be presented with a list of roles to which you have access.

Help Output

macaw-auth -h
usage: macaw-auth [-h] [--no-ssl-verify] [-r] [-a [{ntlm,web_form}]] [--duration-seconds DURATION_SECONDS]
                     [--identity-url IDENTITY_URL] [--disable-keyring] [--region REGION]
                     [--output {json,yaml,yaml-stream,text,table}] [--role-arn ROLE_ARN]
                     [--principal-arn PRINCIPAL_ARN] [--target-profile TARGET_PROFILE] [--config-file CONFIG_FILE]
                     [--credential-file CREDENTIAL_FILE] [--username-not-email]
                     [SOURCE_PROFILE]

Utility to obtain AWS CLI credentials

positional arguments:
  SOURCE_PROFILE        Name of the profile in your config file containing the desired configuration

options:
  -h, --help            show this help message and exit
  --no-ssl-verify       Make insecure SAML request
  -r, --reset-password  Reset keyring password
  -a [{ntlm,web_form}], --auth-type [{ntlm,web_form}]
                        Authorization type used for SAML request
  --duration-seconds DURATION_SECONDS
                        Length of time in seconds in which credentials are valid
  --identity-url IDENTITY_URL
                        URL used to initiate SAML request
  --disable-keyring     Disable storing password in keyring
  --region REGION       Default AWS region for CLI commands
  --output {json,yaml,yaml-stream,text,table}
                        The desired AWS CLI output format
  --role-arn ROLE_ARN   ARN of the role that you want to assume
  --principal-arn PRINCIPAL_ARN
                        ARN of the IAM SAML provider that describes the IdP
  --target-profile TARGET_PROFILE
                        Name of the section where credentials will be stored in the credentials file
  --config-file CONFIG_FILE
                        Path to config file if ~/.aws/config will not be used
  --credential-file CREDENTIAL_FILE
                        Path to credential file if ~/.aws/credentials will not be used
  --username-not-email  Indicates that the supplied username will not need to be in an email format

Troubleshooting

Clear Saved Password

If you receive an error indicating that there's no valid SAML assertation, please double check your config settings. If you have keyring enabled, you may have stored an incorrect password. To reset your keyring password, run one of the following commands:

macaw-auth -r

or

macaw-auth --reset-password

Errors Running the Utility With Keyring Enabled

This utility gives the option to use Keyring to locally store your password. If you attempt to use Keyring and do not have a proper backend set up as stated in the Keyring documentation, macaw-auth may not work. To disable Keyring, use one of the following options:

1. Disable Keyring in Config File

In your config file, you can set enable_keyring = False in the [macaw-auth] section

2. Disable Keyring via CLI

When running macaw-auth commands, you can add the --disable-keyring flag (e.g., macaw-auth --disable-keyring).

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

macaw_auth-1.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

macaw_auth-1.1.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file macaw_auth-1.1.0.tar.gz.

File metadata

  • Download URL: macaw_auth-1.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for macaw_auth-1.1.0.tar.gz
Algorithm Hash digest
SHA256 959d3c02599161e38969e1e98edb367f75df9c36e1ea3347b8f0f02d243112ea
MD5 d488db2b4fb33fa0e4690062e7350fce
BLAKE2b-256 28b6f7268247e0dec436cfe0d8a4d162035e18fc5cee9cdd92e901ba802cd5dc

See more details on using hashes here.

File details

Details for the file macaw_auth-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: macaw_auth-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for macaw_auth-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47c42bc89e927efe7dd7eba98febb19fb96739f3103b9716b93e3d1396106bd4
MD5 73c30100fb404a600abd6924097ae06d
BLAKE2b-256 e0e65e2eeb0ba4519769b328b374a64ae85b791f81f708b6b1d2cc98e1d8c4f4

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