Hacksaws
Hacksaws is a command-line utility for AWS profiles that use dynamic authentication methods such as multi-factor authentication (MFA). It replaces a profile's long-term access key and secret with temporary session credentials, while storing the long-term credentials in a local backup until the next login or logout.
Only MFA-based dynamic login is currently supported. Hacksaws supports Python 3.13 and 3.14.
Installation
Install Hacksaws as an isolated command-line tool with uv:
uv tool install hacksaws
As a fallback, install it into the active Python environment with pip:
python -m pip install hacksaws
Usage
Log in with MFA by supplying an AWS profile and the current MFA code:
hacksaws mfa login <PROFILE_NAME> <MFA_CODE>
The --lifespan option changes how long the temporary session remains valid.
The default is 12 hours (--lifespan=43200 seconds). AWS allows at most 24
hours, and the profile's role or account policy may set a lower maximum.
Hacksaws can also log Docker into Amazon ECR in the profile's default region:
hacksaws mfa login <PROFILE_NAME> <MFA_CODE> --ecr
Use --ecr-region more than once to add regions. The profile's primary region
is processed first, followed by each additional region once in the order
provided:
hacksaws mfa login <PROFILE_NAME> <MFA_CODE> \
--ecr \
--ecr-region=eu-central-1 \
--ecr-region=us-west-2 \
--ecr-region=ca-central-1
Log out of the AWS profile and restore its long-term credentials:
hacksaws mfa logout <PROFILE_NAME>
Add --ecr to the logout command to log Docker out of the configured ECR
registries as well:
hacksaws mfa logout <PROFILE_NAME> --ecr
Use --directory to select a different AWS configuration directory:
hacksaws mfa login <PROFILE_NAME> <MFA_CODE> --directory=/path/to/aws
For directories in the ~/.aws-<NAME> form, --name is shorthand for choosing
the named account directory:
hacksaws mfa login <PROFILE_NAME> <MFA_CODE> --name=sandbox
The action aliases in and out, the directory alias --dir, and the account
name alias --account-name remain available.
Requiring MFA
The repository includes an example IAM policy that lets users manage their own credentials while requiring MFA for other AWS operations.
AWS provides further guidance:
- Allow MFA-authenticated IAM users to manage their own credentials
- Allow IAM users to self-manage an MFA device
- Configure MFA-protected API access
- Set an IAM account password policy
Development
Install the locked Python and Node.js development dependencies:
uv sync --locked --all-groups
npm ci
Format the repository:
uv run task format
Run the same non-mutating quality and test checks used by GitHub Actions:
uv run task check
Run an individual check when iterating:
uv run task lint
uv run task test
uv run task build
Release process
Publishing is handled by the
publish.yaml
GitHub Actions workflow and PyPI trusted publishing.
- Update
project.versioninpyproject.toml. - Run
uv lock,npm ci, anduv run task check. - Build locally with
uv buildand inspect the wheel and source distribution. - Merge the version change to
main. - Create and push a
v<version>tag, such asv0.3.0.
The workflow verifies that the tag exactly matches the project version before it
builds and publishes. The repository's pypi environment must be configured as
a trusted publisher for owner rocketboosters, repository hacksaws, workflow
publish.yaml, and environment pypi.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hacksaws-0.3.1.tar.gz.
File metadata
- Download URL: hacksaws-0.3.1.tar.gz
- Upload date:
- Size: 38.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c9cdb9a1d8f0441a626091a3719b8124d684b7cc28c2ea5f5e8aa1acd23abe4
|
|
| MD5 |
7df1d36f925dc78d005b42c239bc3386
|
|
| BLAKE2b-256 |
af80066acf78cda7065d1f7a3949250f2a0542ea833c144567263d8335df3b10
|
Provenance
The following attestation bundles were made for hacksaws-0.3.1.tar.gz:
Publisher:
publish.yaml on rocketboosters/hacksaws
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hacksaws-0.3.1.tar.gz -
Subject digest:
7c9cdb9a1d8f0441a626091a3719b8124d684b7cc28c2ea5f5e8aa1acd23abe4 - Sigstore transparency entry: 2290876259
- Sigstore integration time:
-
Permalink:
rocketboosters/hacksaws@20a6c8f887c875da3a63c093f7b1737712420d1c -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/rocketboosters
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@20a6c8f887c875da3a63c093f7b1737712420d1c -
Trigger Event:
push
-
Statement type:
File details
Details for the file hacksaws-0.3.1-py3-none-any.whl.
File metadata
- Download URL: hacksaws-0.3.1-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8db1d1df5fc356f9bf72fe125b2f858e69d54398cebf5fcc98c585a759abf5f
|
|
| MD5 |
b02e3df6a7fb950f20b86832b3241b4b
|
|
| BLAKE2b-256 |
14ca02b78c120168dabbe31637d9bdf2162fb3d2b2e6948427170301f4eaca34
|
Provenance
The following attestation bundles were made for hacksaws-0.3.1-py3-none-any.whl:
Publisher:
publish.yaml on rocketboosters/hacksaws
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hacksaws-0.3.1-py3-none-any.whl -
Subject digest:
d8db1d1df5fc356f9bf72fe125b2f858e69d54398cebf5fcc98c585a759abf5f - Sigstore transparency entry: 2290876294
- Sigstore integration time:
-
Permalink:
rocketboosters/hacksaws@20a6c8f887c875da3a63c093f7b1737712420d1c -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/rocketboosters
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@20a6c8f887c875da3a63c093f7b1737712420d1c -
Trigger Event:
push
-
Statement type: