aws-xfa 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aws_xfa-1.0.0/.gitignore +28 -0
- aws_xfa-1.0.0/CONTRIBUTING.md +56 -0
- aws_xfa-1.0.0/DCO +34 -0
- aws_xfa-1.0.0/DISCLAIMER.md +127 -0
- aws_xfa-1.0.0/LICENSE +12 -0
- aws_xfa-1.0.0/PKG-INFO +185 -0
- aws_xfa-1.0.0/README.md +153 -0
- aws_xfa-1.0.0/SECURITY.md +97 -0
- aws_xfa-1.0.0/assets/banner.svg +10 -0
- aws_xfa-1.0.0/aws-xfa +7 -0
- aws_xfa-1.0.0/awsxfa/__init__.py +714 -0
- aws_xfa-1.0.0/awsxfa/__main__.py +4 -0
- aws_xfa-1.0.0/awsxfa/daemon.py +657 -0
- aws_xfa-1.0.0/awsxfa/util.py +156 -0
- aws_xfa-1.0.0/awsxfa/xfa_config.py +51 -0
- aws_xfa-1.0.0/pyproject.toml +48 -0
aws_xfa-1.0.0/.gitignore
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
*.py[cod]
|
|
2
|
+
*.bak
|
|
3
|
+
*.sw[po]
|
|
4
|
+
|
|
5
|
+
.Python
|
|
6
|
+
env/
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
*.egg-info/
|
|
19
|
+
.installed.cfg
|
|
20
|
+
*.egg
|
|
21
|
+
.idea
|
|
22
|
+
.vscode
|
|
23
|
+
.venv
|
|
24
|
+
.omc
|
|
25
|
+
.claude
|
|
26
|
+
.serena
|
|
27
|
+
AGENTS.md
|
|
28
|
+
CLAUDE.md
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Contributing to aws-xfa
|
|
2
|
+
|
|
3
|
+
## License
|
|
4
|
+
|
|
5
|
+
By contributing to this project, you agree that your contributions will be
|
|
6
|
+
licensed under the [BSD Zero Clause License (0BSD)](LICENSE).
|
|
7
|
+
|
|
8
|
+
## Developer Certificate of Origin (DCO)
|
|
9
|
+
|
|
10
|
+
All contributions must be signed off under the [Developer Certificate of
|
|
11
|
+
Origin](DCO) (DCO 1.1). This certifies that you have the right to submit
|
|
12
|
+
the contribution under the project's open source license.
|
|
13
|
+
|
|
14
|
+
### How to sign off
|
|
15
|
+
|
|
16
|
+
Add a `Signed-off-by` line to every commit message:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
Signed-off-by: Your Name <your.email@example.com>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The easiest way is to use the `-s` flag when committing:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
git commit -s -m "your commit message"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Fixing unsigned commits
|
|
29
|
+
|
|
30
|
+
If you forgot to sign off, amend the most recent commit:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git commit --amend -s --no-edit
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
For multiple commits, use interactive rebase:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
git rebase -i HEAD~N # N = number of commits to fix
|
|
40
|
+
# Change 'pick' to 'edit' for each commit, then:
|
|
41
|
+
git commit --amend -s --no-edit
|
|
42
|
+
git rebase --continue
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Pull Request Requirements
|
|
46
|
+
|
|
47
|
+
1. All commits must be signed off (DCO).
|
|
48
|
+
2. All source files must include `# SPDX-License-Identifier: 0BSD` as the
|
|
49
|
+
first comment line.
|
|
50
|
+
3. Do not introduce dependencies with copyleft licenses (GPL, AGPL, etc.)
|
|
51
|
+
without discussion.
|
|
52
|
+
|
|
53
|
+
## Security Vulnerabilities
|
|
54
|
+
|
|
55
|
+
Do **not** open a public issue for security vulnerabilities. See
|
|
56
|
+
[SECURITY.md](SECURITY.md) for reporting instructions.
|
aws_xfa-1.0.0/DCO
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Developer Certificate of Origin
|
|
2
|
+
Version 1.1
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
|
5
|
+
|
|
6
|
+
Everyone is permitted to copy and distribute verbatim copies of this
|
|
7
|
+
license document, but changing it is not allowed.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Developer's Certificate of Origin 1.1
|
|
11
|
+
|
|
12
|
+
By making a contribution to this project, I certify that:
|
|
13
|
+
|
|
14
|
+
(a) The contribution was created in whole or in part by me and I
|
|
15
|
+
have the right to submit it under the open source license
|
|
16
|
+
indicated in the file; or
|
|
17
|
+
|
|
18
|
+
(b) The contribution is based upon previous work that, to the best
|
|
19
|
+
of my knowledge, is covered under an appropriate open source
|
|
20
|
+
license and I have the right under that license to submit that
|
|
21
|
+
work with modifications, whether created in whole or in part
|
|
22
|
+
by me, under the same open source license (unless I am
|
|
23
|
+
permitted to submit under a different license), as indicated
|
|
24
|
+
in the file; or
|
|
25
|
+
|
|
26
|
+
(c) The contribution was provided directly to me by some other
|
|
27
|
+
person who certified (a), (b) or (c) and I have not modified
|
|
28
|
+
it.
|
|
29
|
+
|
|
30
|
+
(d) I understand and agree that this project and the contribution
|
|
31
|
+
are public and that a record of the contribution (including all
|
|
32
|
+
personal information I submit with it, including my sign-off) is
|
|
33
|
+
maintained indefinitely and may be redistributed consistent with
|
|
34
|
+
this project or the open source license(s) involved.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Disclaimer
|
|
2
|
+
|
|
3
|
+
## General Disclaimer
|
|
4
|
+
|
|
5
|
+
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
|
6
|
+
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
|
7
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT,
|
|
8
|
+
AND FREEDOM FROM DEFECTS OR ERRORS.
|
|
9
|
+
|
|
10
|
+
USE OF THIS SOFTWARE IS ENTIRELY AT YOUR OWN RISK. THE AUTHOR(S) SHALL NOT
|
|
11
|
+
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
12
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
13
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; UNAUTHORIZED
|
|
14
|
+
ACCESS TO OR ALTERATION OF YOUR CREDENTIALS; BUSINESS INTERRUPTION; OR
|
|
15
|
+
SECURITY BREACH) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
16
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
17
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
18
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
19
|
+
|
|
20
|
+
## Security Disclaimer
|
|
21
|
+
|
|
22
|
+
This software handles sensitive security credentials including, but not
|
|
23
|
+
limited to, AWS access keys, secret keys, session tokens, and MFA/TOTP
|
|
24
|
+
codes. **No guarantees of any kind are made regarding the security,
|
|
25
|
+
integrity, confidentiality, or safe handling of these credentials.**
|
|
26
|
+
|
|
27
|
+
Specifically, the author(s) make no representations or warranties that:
|
|
28
|
+
|
|
29
|
+
- Credentials are stored, transmitted, or handled securely
|
|
30
|
+
- The software is free from vulnerabilities, bugs, or defects
|
|
31
|
+
- The software will prevent unauthorized access to your AWS accounts
|
|
32
|
+
- The software meets any specific security standard, certification, or
|
|
33
|
+
compliance requirement
|
|
34
|
+
- The software is suitable for production, regulated, or high-security
|
|
35
|
+
environments
|
|
36
|
+
|
|
37
|
+
**You are solely responsible for:**
|
|
38
|
+
|
|
39
|
+
- Evaluating whether this software is appropriate for your use case
|
|
40
|
+
- Securing your own systems, credentials, and AWS accounts
|
|
41
|
+
- Complying with your organization's security policies
|
|
42
|
+
- Any and all consequences of using this software
|
|
43
|
+
|
|
44
|
+
This software has NOT been independently audited. It is NOT certified under
|
|
45
|
+
SOC2, ISO 27001, FedRAMP, or any other security framework. Do not assume
|
|
46
|
+
fitness for any particular security purpose.
|
|
47
|
+
|
|
48
|
+
## Third-Party Services Disclaimer
|
|
49
|
+
|
|
50
|
+
This software interacts with third-party services including, but not limited
|
|
51
|
+
to:
|
|
52
|
+
|
|
53
|
+
- **Amazon Web Services (AWS)** — including IAM, STS, and related APIs
|
|
54
|
+
- **1Password CLI** — including credential retrieval and TOTP generation
|
|
55
|
+
|
|
56
|
+
The author(s) are not affiliated with, endorsed by, or sponsored by Amazon
|
|
57
|
+
Web Services, 1Password (AgileBits Inc.), or any other third-party service
|
|
58
|
+
provider. All product names, trademarks, and registered trademarks are
|
|
59
|
+
property of their respective owners.
|
|
60
|
+
|
|
61
|
+
The author(s) are not responsible for:
|
|
62
|
+
|
|
63
|
+
- Changes to third-party APIs that may break this software
|
|
64
|
+
- Third-party service outages, data loss, or security incidents
|
|
65
|
+
- Your compliance with third-party terms of service
|
|
66
|
+
- Any fees, charges, or costs incurred through third-party service usage
|
|
67
|
+
|
|
68
|
+
## Patent Notice
|
|
69
|
+
|
|
70
|
+
This software is released under the BSD Zero Clause License (0BSD), which
|
|
71
|
+
does not include an explicit patent grant or patent disclaimer. The author(s)
|
|
72
|
+
are not aware of any patent claims covering this software and do not
|
|
73
|
+
intentionally withhold any patent rights. However, NO EXPRESS OR IMPLIED
|
|
74
|
+
PATENT LICENSE IS GRANTED by this software's license.
|
|
75
|
+
|
|
76
|
+
## Data and Privacy Notice
|
|
77
|
+
|
|
78
|
+
This software operates entirely on your local machine. It does not collect,
|
|
79
|
+
transmit, phone home, or share any data with the author(s) or any third
|
|
80
|
+
party. All credentials and configuration remain under your control on your
|
|
81
|
+
local filesystem.
|
|
82
|
+
|
|
83
|
+
However, the author(s) make no guarantees regarding:
|
|
84
|
+
|
|
85
|
+
- How third-party services (AWS, 1Password) handle your data
|
|
86
|
+
- Whether your credentials may be logged by your system, shell history,
|
|
87
|
+
or other local software
|
|
88
|
+
- Compliance with GDPR, CCPA, HIPAA, or any other data protection regulation
|
|
89
|
+
|
|
90
|
+
You are solely responsible for your own data protection compliance.
|
|
91
|
+
|
|
92
|
+
## Export Control Notice
|
|
93
|
+
|
|
94
|
+
This software may use or interact with cryptographic functionality provided
|
|
95
|
+
by underlying system libraries (e.g., Python's ssl module, OpenSSL) and
|
|
96
|
+
cloud service APIs. It does not itself implement cryptographic algorithms.
|
|
97
|
+
|
|
98
|
+
The country in which you reside may have restrictions on the import,
|
|
99
|
+
possession, use, and/or re-export of encryption software. BEFORE using this
|
|
100
|
+
software, please check your country's laws, regulations, and policies
|
|
101
|
+
concerning the import, possession, or use of encryption software to determine
|
|
102
|
+
if this is permitted. See https://www.wassenaar.org/ for more information.
|
|
103
|
+
|
|
104
|
+
The author(s) are not responsible for your compliance with export control
|
|
105
|
+
regulations.
|
|
106
|
+
|
|
107
|
+
## Limitation of Liability by Jurisdiction
|
|
108
|
+
|
|
109
|
+
Some jurisdictions do not allow the exclusion or limitation of implied
|
|
110
|
+
warranties or liability for incidental or consequential damages. In such
|
|
111
|
+
jurisdictions, the liability of the author(s) shall be limited to the
|
|
112
|
+
maximum extent permitted by applicable law.
|
|
113
|
+
|
|
114
|
+
Nothing in this disclaimer shall be construed to limit any rights you may
|
|
115
|
+
have under mandatory consumer protection legislation in your jurisdiction.
|
|
116
|
+
|
|
117
|
+
## No Professional Advice
|
|
118
|
+
|
|
119
|
+
Nothing in this software, its documentation, or its associated materials
|
|
120
|
+
constitutes legal, security, financial, or professional advice. Consult a
|
|
121
|
+
qualified professional for guidance specific to your situation.
|
|
122
|
+
|
|
123
|
+
## Acceptance
|
|
124
|
+
|
|
125
|
+
By using this software, you acknowledge that you have read this disclaimer,
|
|
126
|
+
understand it, and agree to be bound by its terms. If you do not agree, do
|
|
127
|
+
not use this software.
|
aws_xfa-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
BSD Zero Clause License
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
+
purpose with or without fee is hereby granted.
|
|
5
|
+
|
|
6
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
7
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
8
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
9
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
10
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
11
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
12
|
+
PERFORMANCE OF THIS SOFTWARE.
|
aws_xfa-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aws-xfa
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: AWS MFA credential helper — exchange long-term credentials for temporary STS tokens
|
|
5
|
+
Project-URL: Homepage, https://github.com/karmazin-me/aws-xfa
|
|
6
|
+
Project-URL: Repository, https://github.com/karmazin-me/aws-xfa
|
|
7
|
+
Project-URL: Issues, https://github.com/karmazin-me/aws-xfa/issues
|
|
8
|
+
Author-email: Eugene Karmazin <awsxfa@icloud.com>
|
|
9
|
+
License: 0BSD
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: 1password,aws,cli,credentials,mfa,sts
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: License :: OSI Approved :: Zero-Clause BSD (0BSD)
|
|
17
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
18
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Operating System :: POSIX
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
|
+
Classifier: Topic :: Security
|
|
28
|
+
Classifier: Topic :: System :: Systems Administration
|
|
29
|
+
Requires-Python: >=3.9
|
|
30
|
+
Requires-Dist: boto3
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
<p align="center">
|
|
34
|
+
<img src="assets/banner.svg" alt="aws-xfa" />
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
# aws-xfa
|
|
38
|
+
|
|
39
|
+
Exchange long-term AWS credentials for temporary STS tokens — handles MFA automatically, integrates with 1Password, and can run as a background daemon that keeps credentials fresh without any manual steps.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
pip install aws-xfa
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## First run
|
|
48
|
+
|
|
49
|
+
If you don't have `~/.aws/credentials` yet, just run:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
aws-xfa
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
It will prompt you for everything:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
AWS Access Key ID: AKIA...
|
|
59
|
+
AWS Secret Access Key: ************
|
|
60
|
+
MFA device ARN (e.g. arn:aws:iam::123456789012:mfa/username): arn:aws:iam::...
|
|
61
|
+
AWS region (e.g. us-east-1): us-east-1
|
|
62
|
+
Use 1Password CLI to automatically fetch MFA codes? [y/N]:
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Then it calls AWS STS and writes your temporary credentials to `~/.aws/credentials`.
|
|
66
|
+
|
|
67
|
+
## Existing credentials file
|
|
68
|
+
|
|
69
|
+
If you already have `~/.aws/credentials` with a `[default]` section, aws-xfa will migrate it automatically — creating `[default-long-term]` for your permanent keys, and using `[default]` for the temporary STS credentials.
|
|
70
|
+
|
|
71
|
+
Your credentials file structure after setup:
|
|
72
|
+
|
|
73
|
+
```ini
|
|
74
|
+
[default-long-term]
|
|
75
|
+
aws_access_key_id = AKIA... # your permanent keys — never exposed to AWS CLI
|
|
76
|
+
aws_secret_access_key = ...
|
|
77
|
+
aws_mfa_device = arn:aws:iam::123456789012:mfa/username
|
|
78
|
+
|
|
79
|
+
[default]
|
|
80
|
+
aws_access_key_id = ASIA... # temporary — written by aws-xfa after each STS call
|
|
81
|
+
aws_secret_access_key = ...
|
|
82
|
+
aws_session_token = ...
|
|
83
|
+
aws_security_token = ...
|
|
84
|
+
expiration = 2026-03-04 22:00:00
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Daily usage
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
aws-xfa
|
|
91
|
+
# Enter AWS MFA code for device [...]: 123456
|
|
92
|
+
# Success! Your credentials will expire in 12h 0m 0s at: 2026-03-05 10:00:00 UTC
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Running again while credentials are still valid does nothing:
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
aws-xfa
|
|
99
|
+
# Your credentials are still valid for 11h 55m 34s, they will expire at ...
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
For a named profile (`[work-long-term]` → `[work]`):
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
aws-xfa work
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Force refresh before expiry:
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
aws-xfa --force
|
|
112
|
+
aws-xfa work --force
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 1Password integration
|
|
116
|
+
|
|
117
|
+
Skip manual OTP entry entirely. If you answered `y` during setup, you're already configured. To enable it later:
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
aws-xfa --1pass
|
|
121
|
+
# Enter 1Password item name for profile 'default': AWS MFA
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The item name is saved to `~/.config/aws-xfa/config.json`. **From then on, aws-xfa fetches the OTP automatically on every run** — no `--1pass` flag needed.
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
aws-xfa # OTP fetched from 1Password silently
|
|
128
|
+
aws-xfa work # same for named profile
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Requires the [`op` CLI](https://developer.1password.com/docs/cli/) to be installed and signed in. If `op` fails, aws-xfa falls back to prompting you manually.
|
|
132
|
+
|
|
133
|
+
## Auto-refresh daemon
|
|
134
|
+
|
|
135
|
+
Keep credentials fresh in the background — no manual intervention ever. The daemon wakes 5 minutes before expiry and renews automatically.
|
|
136
|
+
|
|
137
|
+
**Requires 1Password** to be configured for the profile first (the daemon runs unattended).
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
aws-xfa daemon install default # configure 1Password if needed, then install and start
|
|
141
|
+
aws-xfa daemon status default # show running status
|
|
142
|
+
aws-xfa daemon stop default # stop without removing config
|
|
143
|
+
aws-xfa daemon delete default # stop and remove all artifacts and logs
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
What gets installed per platform:
|
|
147
|
+
|
|
148
|
+
| Platform | Persistence method |
|
|
149
|
+
|----------|--------------------|
|
|
150
|
+
| macOS | LaunchAgent plist (`~/Library/LaunchAgents/com.user.aws-xfa-daemon-PROFILE.plist`) |
|
|
151
|
+
| Linux | systemd user unit (falls back to double-fork on systems without systemd) |
|
|
152
|
+
| Windows | detached process + `schtasks` on-logon scheduled task |
|
|
153
|
+
|
|
154
|
+
Error logs: `~/.config/aws-xfa/errors-PROFILE.log`
|
|
155
|
+
|
|
156
|
+
On Linux without systemd (Alpine, OpenRC, WSL), the daemon won't survive reboot automatically. The install command prints the command to add to your init scripts.
|
|
157
|
+
|
|
158
|
+
## Options
|
|
159
|
+
|
|
160
|
+
| Flag | Description |
|
|
161
|
+
|------|-------------|
|
|
162
|
+
| `--force` | Refresh even if credentials are still valid |
|
|
163
|
+
| `--1pass` | Configure 1Password for this profile (one-time setup) |
|
|
164
|
+
| `--duration SECONDS` | Session duration (default: 43200 = 12 h, min: 900, max: 129600) |
|
|
165
|
+
| `--log-level debug` | Verbose output |
|
|
166
|
+
|
|
167
|
+
Environment variables:
|
|
168
|
+
|
|
169
|
+
| Variable | Effect |
|
|
170
|
+
|----------|--------|
|
|
171
|
+
| `MFA_STS_DURATION` | Session duration (same as `--duration`) |
|
|
172
|
+
| `AWS_REGION` / `AWS_DEFAULT_REGION` | Region used for the STS endpoint |
|
|
173
|
+
| `AWS_SHARED_CREDENTIALS_FILE` | Override the default `~/.aws/credentials` path |
|
|
174
|
+
| `AWS_CONFIG_FILE` | Override the default `~/.aws/config` path |
|
|
175
|
+
|
|
176
|
+
CLI flags take precedence over environment variables.
|
|
177
|
+
|
|
178
|
+
## Before you use this tool
|
|
179
|
+
|
|
180
|
+
Please read these before deploying aws-xfa in any environment:
|
|
181
|
+
|
|
182
|
+
- [DISCLAIMER.md](DISCLAIMER.md) — no warranty; you are responsible for your AWS credentials and account security
|
|
183
|
+
- [SECURITY.md](SECURITY.md) — how to report vulnerabilities
|
|
184
|
+
- [LICENSE](LICENSE) — Zero-Clause BSD (0BSD)
|
|
185
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md) — how to contribute
|
aws_xfa-1.0.0/README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/banner.svg" alt="aws-xfa" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# aws-xfa
|
|
6
|
+
|
|
7
|
+
Exchange long-term AWS credentials for temporary STS tokens — handles MFA automatically, integrates with 1Password, and can run as a background daemon that keeps credentials fresh without any manual steps.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pip install aws-xfa
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## First run
|
|
16
|
+
|
|
17
|
+
If you don't have `~/.aws/credentials` yet, just run:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
aws-xfa
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
It will prompt you for everything:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
AWS Access Key ID: AKIA...
|
|
27
|
+
AWS Secret Access Key: ************
|
|
28
|
+
MFA device ARN (e.g. arn:aws:iam::123456789012:mfa/username): arn:aws:iam::...
|
|
29
|
+
AWS region (e.g. us-east-1): us-east-1
|
|
30
|
+
Use 1Password CLI to automatically fetch MFA codes? [y/N]:
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Then it calls AWS STS and writes your temporary credentials to `~/.aws/credentials`.
|
|
34
|
+
|
|
35
|
+
## Existing credentials file
|
|
36
|
+
|
|
37
|
+
If you already have `~/.aws/credentials` with a `[default]` section, aws-xfa will migrate it automatically — creating `[default-long-term]` for your permanent keys, and using `[default]` for the temporary STS credentials.
|
|
38
|
+
|
|
39
|
+
Your credentials file structure after setup:
|
|
40
|
+
|
|
41
|
+
```ini
|
|
42
|
+
[default-long-term]
|
|
43
|
+
aws_access_key_id = AKIA... # your permanent keys — never exposed to AWS CLI
|
|
44
|
+
aws_secret_access_key = ...
|
|
45
|
+
aws_mfa_device = arn:aws:iam::123456789012:mfa/username
|
|
46
|
+
|
|
47
|
+
[default]
|
|
48
|
+
aws_access_key_id = ASIA... # temporary — written by aws-xfa after each STS call
|
|
49
|
+
aws_secret_access_key = ...
|
|
50
|
+
aws_session_token = ...
|
|
51
|
+
aws_security_token = ...
|
|
52
|
+
expiration = 2026-03-04 22:00:00
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Daily usage
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
aws-xfa
|
|
59
|
+
# Enter AWS MFA code for device [...]: 123456
|
|
60
|
+
# Success! Your credentials will expire in 12h 0m 0s at: 2026-03-05 10:00:00 UTC
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Running again while credentials are still valid does nothing:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
aws-xfa
|
|
67
|
+
# Your credentials are still valid for 11h 55m 34s, they will expire at ...
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
For a named profile (`[work-long-term]` → `[work]`):
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
aws-xfa work
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Force refresh before expiry:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
aws-xfa --force
|
|
80
|
+
aws-xfa work --force
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 1Password integration
|
|
84
|
+
|
|
85
|
+
Skip manual OTP entry entirely. If you answered `y` during setup, you're already configured. To enable it later:
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
aws-xfa --1pass
|
|
89
|
+
# Enter 1Password item name for profile 'default': AWS MFA
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The item name is saved to `~/.config/aws-xfa/config.json`. **From then on, aws-xfa fetches the OTP automatically on every run** — no `--1pass` flag needed.
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
aws-xfa # OTP fetched from 1Password silently
|
|
96
|
+
aws-xfa work # same for named profile
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Requires the [`op` CLI](https://developer.1password.com/docs/cli/) to be installed and signed in. If `op` fails, aws-xfa falls back to prompting you manually.
|
|
100
|
+
|
|
101
|
+
## Auto-refresh daemon
|
|
102
|
+
|
|
103
|
+
Keep credentials fresh in the background — no manual intervention ever. The daemon wakes 5 minutes before expiry and renews automatically.
|
|
104
|
+
|
|
105
|
+
**Requires 1Password** to be configured for the profile first (the daemon runs unattended).
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
aws-xfa daemon install default # configure 1Password if needed, then install and start
|
|
109
|
+
aws-xfa daemon status default # show running status
|
|
110
|
+
aws-xfa daemon stop default # stop without removing config
|
|
111
|
+
aws-xfa daemon delete default # stop and remove all artifacts and logs
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
What gets installed per platform:
|
|
115
|
+
|
|
116
|
+
| Platform | Persistence method |
|
|
117
|
+
|----------|--------------------|
|
|
118
|
+
| macOS | LaunchAgent plist (`~/Library/LaunchAgents/com.user.aws-xfa-daemon-PROFILE.plist`) |
|
|
119
|
+
| Linux | systemd user unit (falls back to double-fork on systems without systemd) |
|
|
120
|
+
| Windows | detached process + `schtasks` on-logon scheduled task |
|
|
121
|
+
|
|
122
|
+
Error logs: `~/.config/aws-xfa/errors-PROFILE.log`
|
|
123
|
+
|
|
124
|
+
On Linux without systemd (Alpine, OpenRC, WSL), the daemon won't survive reboot automatically. The install command prints the command to add to your init scripts.
|
|
125
|
+
|
|
126
|
+
## Options
|
|
127
|
+
|
|
128
|
+
| Flag | Description |
|
|
129
|
+
|------|-------------|
|
|
130
|
+
| `--force` | Refresh even if credentials are still valid |
|
|
131
|
+
| `--1pass` | Configure 1Password for this profile (one-time setup) |
|
|
132
|
+
| `--duration SECONDS` | Session duration (default: 43200 = 12 h, min: 900, max: 129600) |
|
|
133
|
+
| `--log-level debug` | Verbose output |
|
|
134
|
+
|
|
135
|
+
Environment variables:
|
|
136
|
+
|
|
137
|
+
| Variable | Effect |
|
|
138
|
+
|----------|--------|
|
|
139
|
+
| `MFA_STS_DURATION` | Session duration (same as `--duration`) |
|
|
140
|
+
| `AWS_REGION` / `AWS_DEFAULT_REGION` | Region used for the STS endpoint |
|
|
141
|
+
| `AWS_SHARED_CREDENTIALS_FILE` | Override the default `~/.aws/credentials` path |
|
|
142
|
+
| `AWS_CONFIG_FILE` | Override the default `~/.aws/config` path |
|
|
143
|
+
|
|
144
|
+
CLI flags take precedence over environment variables.
|
|
145
|
+
|
|
146
|
+
## Before you use this tool
|
|
147
|
+
|
|
148
|
+
Please read these before deploying aws-xfa in any environment:
|
|
149
|
+
|
|
150
|
+
- [DISCLAIMER.md](DISCLAIMER.md) — no warranty; you are responsible for your AWS credentials and account security
|
|
151
|
+
- [SECURITY.md](SECURITY.md) — how to report vulnerabilities
|
|
152
|
+
- [LICENSE](LICENSE) — Zero-Clause BSD (0BSD)
|
|
153
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md) — how to contribute
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Important Notice
|
|
4
|
+
|
|
5
|
+
THIS SOFTWARE IS PROVIDED "AS IS" WITH NO SECURITY GUARANTEES OF ANY KIND.
|
|
6
|
+
See [DISCLAIMER.md](DISCLAIMER.md) and [LICENSE](LICENSE) for full terms.
|
|
7
|
+
|
|
8
|
+
The author(s) provide this software on a best-effort, volunteer basis.
|
|
9
|
+
**There is no obligation, express or implied, to fix any reported
|
|
10
|
+
vulnerability, to respond within any timeframe, or to maintain this software
|
|
11
|
+
at any security standard.**
|
|
12
|
+
|
|
13
|
+
## Threat Model
|
|
14
|
+
|
|
15
|
+
### What aws-xfa IS designed to do
|
|
16
|
+
|
|
17
|
+
- Simplify the AWS MFA credential workflow for individual developers
|
|
18
|
+
- Reduce manual `aws sts get-session-token` invocations
|
|
19
|
+
- Optionally retrieve TOTP codes from 1Password CLI
|
|
20
|
+
- Cache temporary session credentials locally in `~/.aws/credentials`
|
|
21
|
+
|
|
22
|
+
### What aws-xfa is NOT designed to protect against
|
|
23
|
+
|
|
24
|
+
- **Compromised local machine**: If an attacker has access to your local
|
|
25
|
+
filesystem, shell, or memory, this tool cannot protect your credentials.
|
|
26
|
+
This tool assumes no attackers on your local machine.
|
|
27
|
+
- **Malicious dependencies**: Supply chain attacks on Python packages,
|
|
28
|
+
pip, or system libraries are outside the scope of this tool.
|
|
29
|
+
- **AWS account misconfiguration**: This tool does not validate or enforce
|
|
30
|
+
IAM policies, permission boundaries, or account-level security settings.
|
|
31
|
+
- **Credential leakage via shell history**: Commands and environment
|
|
32
|
+
variables may be logged by your shell. This tool does not scrub shell
|
|
33
|
+
history.
|
|
34
|
+
- **Side-channel attacks**: Timing attacks, memory inspection, or other
|
|
35
|
+
side-channel vectors are not mitigated.
|
|
36
|
+
- **Network-level attacks**: MITM, DNS hijacking, or TLS downgrade attacks
|
|
37
|
+
on connections to AWS or 1Password APIs are handled by underlying system
|
|
38
|
+
TLS libraries, not by this tool.
|
|
39
|
+
|
|
40
|
+
### Credential storage
|
|
41
|
+
|
|
42
|
+
- Long-term AWS credentials are stored in `~/.aws/credentials` in plaintext,
|
|
43
|
+
consistent with AWS CLI's own behavior.
|
|
44
|
+
- Temporary session tokens are written to `~/.aws/credentials` in plaintext.
|
|
45
|
+
- File permissions are set to user-only (0600) on supported systems, but
|
|
46
|
+
this is a best-effort measure, not a security guarantee.
|
|
47
|
+
- **Credentials may persist in memory** during the lifetime of the process.
|
|
48
|
+
- **Git history**: If your `~/.aws/` directory is accidentally committed to
|
|
49
|
+
a git repository, credentials will be visible in the git history even
|
|
50
|
+
after removal.
|
|
51
|
+
|
|
52
|
+
## Reporting a Vulnerability
|
|
53
|
+
|
|
54
|
+
If you discover a security vulnerability, please report it responsibly:
|
|
55
|
+
|
|
56
|
+
1. **DO NOT** open a public GitHub issue for security vulnerabilities.
|
|
57
|
+
2. Send a description of the vulnerability to: **[INSERT EMAIL OR USE
|
|
58
|
+
GITHUB SECURITY ADVISORIES]**
|
|
59
|
+
3. Include steps to reproduce, if possible.
|
|
60
|
+
4. Allow reasonable time for assessment before public disclosure.
|
|
61
|
+
|
|
62
|
+
### What to expect
|
|
63
|
+
|
|
64
|
+
- Acknowledgment of receipt is provided on a best-effort basis.
|
|
65
|
+
- **There is no guaranteed response time, fix timeline, or SLA.**
|
|
66
|
+
- The author(s) may or may not issue a fix, at their sole discretion.
|
|
67
|
+
- The author(s) may or may not issue a CVE or security advisory.
|
|
68
|
+
- If you require guaranteed security response times, this software is
|
|
69
|
+
not suitable for your use case.
|
|
70
|
+
|
|
71
|
+
## Supported Versions
|
|
72
|
+
|
|
73
|
+
Only the latest released version receives any security attention.
|
|
74
|
+
Previous versions are not supported, patched, or maintained.
|
|
75
|
+
|
|
76
|
+
| Version | Status |
|
|
77
|
+
|---------|-------------------|
|
|
78
|
+
| Latest | Best-effort only |
|
|
79
|
+
| < Latest| Not supported |
|
|
80
|
+
|
|
81
|
+
## Dependencies
|
|
82
|
+
|
|
83
|
+
This software depends on third-party packages. The author(s) are not
|
|
84
|
+
responsible for vulnerabilities in dependencies. Users should:
|
|
85
|
+
|
|
86
|
+
- Regularly update dependencies (`pip install --upgrade aws-xfa`)
|
|
87
|
+
- Monitor advisories for boto3, botocore, and other dependencies
|
|
88
|
+
- Use `pip audit` or similar tools to check for known vulnerabilities
|
|
89
|
+
|
|
90
|
+
## Security Best Practices (Your Responsibility)
|
|
91
|
+
|
|
92
|
+
- Rotate your AWS long-term credentials regularly
|
|
93
|
+
- Use the shortest practical session duration
|
|
94
|
+
- Enable CloudTrail logging on your AWS accounts
|
|
95
|
+
- Do not run this tool as root
|
|
96
|
+
- Do not store credentials in version-controlled directories
|
|
97
|
+
- Review the source code yourself if your threat model requires it
|