aws-xfa 1.0.0__py3-none-any.whl

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.
@@ -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
@@ -0,0 +1,10 @@
1
+ awsxfa/__init__.py,sha256=2_IDRoTTjv6K09wqyFuPtf6yMPdfAphmlcZ0C15rlNw,25774
2
+ awsxfa/__main__.py,sha256=Ya8sPr8cTBUHu9YQcZUwZM77jGVLJHBfHx4OknXLSWk,64
3
+ awsxfa/daemon.py,sha256=Iz4OcDFnaBY63MxheCdYGr9W_XShcU7Wy33aDNUZ9QU,21116
4
+ awsxfa/util.py,sha256=AjCR0I63QGfDGJplgJJCN33dBMhM5U5f_De8DPE-iIg,4987
5
+ awsxfa/xfa_config.py,sha256=cKOWaHPcMnZRtkmNFpNn73OWuQuzz-RDKWsReCSI9N8,1611
6
+ aws_xfa-1.0.0.dist-info/METADATA,sha256=q5PJL7e0FT6jOgjwdZm1QfLua7NBhru5gtEo8b6DF9g,6311
7
+ aws_xfa-1.0.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
8
+ aws_xfa-1.0.0.dist-info/entry_points.txt,sha256=oV6T2Mfhb_W4MA5e09NdJpITAW-0A_d2w73fLk8wZyA,40
9
+ aws_xfa-1.0.0.dist-info/licenses/LICENSE,sha256=DbMza-HVDBjY0PhEqZbN3a9moBjb3uWKuUkzwcb_wuk,632
10
+ aws_xfa-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ aws-xfa = awsxfa:main
@@ -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.