credux 0.2.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.
- credux-0.2.0/.github/workflows/publish.yml +58 -0
- credux-0.2.0/.gitignore +8 -0
- credux-0.2.0/LICENSE +21 -0
- credux-0.2.0/PKG-INFO +217 -0
- credux-0.2.0/README.md +182 -0
- credux-0.2.0/docs/README.md +25 -0
- credux-0.2.0/docs/architecture.md +223 -0
- credux-0.2.0/docs/configuration.md +299 -0
- credux-0.2.0/docs/providers.md +70 -0
- credux-0.2.0/docs/releasing.md +69 -0
- credux-0.2.0/docs/security.md +89 -0
- credux-0.2.0/docs/testing.md +120 -0
- credux-0.2.0/docs/troubleshooting.md +90 -0
- credux-0.2.0/docs/usage.md +303 -0
- credux-0.2.0/examples/config.json +41 -0
- credux-0.2.0/examples/ulauncher-shortcuts.json.j2 +14 -0
- credux-0.2.0/pyproject.toml +91 -0
- credux-0.2.0/src/credux/__init__.py +1 -0
- credux-0.2.0/src/credux/app.py +55 -0
- credux-0.2.0/src/credux/awsfiles.py +276 -0
- credux-0.2.0/src/credux/browser.py +117 -0
- credux-0.2.0/src/credux/cli.py +1081 -0
- credux-0.2.0/src/credux/completion.py +136 -0
- credux-0.2.0/src/credux/config.py +159 -0
- credux-0.2.0/src/credux/doctor.py +286 -0
- credux-0.2.0/src/credux/errors.py +51 -0
- credux-0.2.0/src/credux/fsutil.py +64 -0
- credux-0.2.0/src/credux/integrations.py +194 -0
- credux-0.2.0/src/credux/model.py +137 -0
- credux-0.2.0/src/credux/naming.py +145 -0
- credux-0.2.0/src/credux/providers/__init__.py +1 -0
- credux-0.2.0/src/credux/providers/aws/__init__.py +65 -0
- credux-0.2.0/src/credux/providers/aws/federation.py +140 -0
- credux-0.2.0/src/credux/providers/aws/iam_role.py +54 -0
- credux-0.2.0/src/credux/providers/aws/iam_user.py +76 -0
- credux-0.2.0/src/credux/providers/aws/org.py +81 -0
- credux-0.2.0/src/credux/providers/aws/sso.py +174 -0
- credux-0.2.0/src/credux/providers/aws/sso_login.py +161 -0
- credux-0.2.0/src/credux/providers/base.py +145 -0
- credux-0.2.0/src/credux/sessions.py +279 -0
- credux-0.2.0/src/credux/shell/credux.fish +22 -0
- credux-0.2.0/src/credux/shell/credux.ps1 +17 -0
- credux-0.2.0/src/credux/shell/credux.sh +14 -0
- credux-0.2.0/src/credux/shellenv.py +82 -0
- credux-0.2.0/src/credux/state.py +125 -0
- credux-0.2.0/src/credux/store.py +74 -0
- credux-0.2.0/src/credux/sync.py +262 -0
- credux-0.2.0/src/credux/templates/aliases.sh.j2 +4 -0
- credux-0.2.0/src/credux/upgrade.py +222 -0
- credux-0.2.0/tests/conftest.py +10 -0
- credux-0.2.0/tests/providers/__init__.py +0 -0
- credux-0.2.0/tests/providers/aws/__init__.py +0 -0
- credux-0.2.0/tests/providers/aws/conftest.py +35 -0
- credux-0.2.0/tests/providers/aws/test_federation.py +273 -0
- credux-0.2.0/tests/providers/aws/test_iam_role.py +191 -0
- credux-0.2.0/tests/providers/aws/test_iam_user.py +142 -0
- credux-0.2.0/tests/providers/aws/test_org.py +187 -0
- credux-0.2.0/tests/providers/aws/test_sso.py +171 -0
- credux-0.2.0/tests/providers/aws/test_sso_login.py +276 -0
- credux-0.2.0/tests/providers/test_base.py +133 -0
- credux-0.2.0/tests/test_app.py +23 -0
- credux-0.2.0/tests/test_awsfiles.py +318 -0
- credux-0.2.0/tests/test_browser.py +160 -0
- credux-0.2.0/tests/test_cli_credentials.py +458 -0
- credux-0.2.0/tests/test_cli_matching.py +150 -0
- credux-0.2.0/tests/test_cli_sessions.py +862 -0
- credux-0.2.0/tests/test_cli_shell_init.py +227 -0
- credux-0.2.0/tests/test_cli_upgrade.py +99 -0
- credux-0.2.0/tests/test_completion.py +151 -0
- credux-0.2.0/tests/test_config.py +107 -0
- credux-0.2.0/tests/test_doctor.py +384 -0
- credux-0.2.0/tests/test_fsutil.py +75 -0
- credux-0.2.0/tests/test_integrations.py +303 -0
- credux-0.2.0/tests/test_model.py +196 -0
- credux-0.2.0/tests/test_naming.py +125 -0
- credux-0.2.0/tests/test_packaging.py +78 -0
- credux-0.2.0/tests/test_publish_workflow.py +46 -0
- credux-0.2.0/tests/test_sessions.py +464 -0
- credux-0.2.0/tests/test_shellenv.py +124 -0
- credux-0.2.0/tests/test_state.py +88 -0
- credux-0.2.0/tests/test_store.py +127 -0
- credux-0.2.0/tests/test_sync.py +361 -0
- credux-0.2.0/tests/test_upgrade.py +270 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Builds and uploads a release when a version tag is pushed.
|
|
2
|
+
#
|
|
3
|
+
# Every job is guarded on the repository name. This file is copied into more
|
|
4
|
+
# than one checkout, and a tag pushed in any of them would otherwise start a
|
|
5
|
+
# run that builds a distribution from that tree. The guard makes such a run a
|
|
6
|
+
# no-op before anything is checked out.
|
|
7
|
+
name: publish
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
push:
|
|
11
|
+
tags:
|
|
12
|
+
- "v*"
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
test:
|
|
16
|
+
if: github.repository == 'AlbertoSpinella/credux'
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v5
|
|
24
|
+
- uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
- run: python -m pip install --upgrade pip
|
|
28
|
+
- run: pip install -e ".[dev]"
|
|
29
|
+
- run: pytest
|
|
30
|
+
|
|
31
|
+
version-guard:
|
|
32
|
+
if: github.repository == 'AlbertoSpinella/credux'
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@v5
|
|
36
|
+
- name: The tag and the declared version must agree
|
|
37
|
+
run: |
|
|
38
|
+
declared="$(sed -n 's/^version = "\(.*\)"/\1/p' pyproject.toml | head -1)"
|
|
39
|
+
if [ "v$declared" != "${{ github.ref_name }}" ]; then
|
|
40
|
+
echo "tag ${{ github.ref_name }} does not match pyproject.toml version $declared" >&2
|
|
41
|
+
exit 1
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
publish:
|
|
45
|
+
if: github.repository == 'AlbertoSpinella/credux'
|
|
46
|
+
needs: [test, version-guard]
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
environment: pypi
|
|
49
|
+
permissions:
|
|
50
|
+
id-token: write
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@v5
|
|
53
|
+
- uses: actions/setup-python@v5
|
|
54
|
+
with:
|
|
55
|
+
python-version: "3.12"
|
|
56
|
+
- run: python -m pip install --upgrade build
|
|
57
|
+
- run: python -m build
|
|
58
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
credux-0.2.0/.gitignore
ADDED
credux-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alberto Spinella
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
credux-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: credux
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Manage cloud credentials and the profiles that use them
|
|
5
|
+
Project-URL: Homepage, https://github.com/AlbertoSpinella/credux
|
|
6
|
+
Project-URL: Repository, https://github.com/AlbertoSpinella/credux
|
|
7
|
+
Project-URL: Issues, https://github.com/AlbertoSpinella/credux/issues
|
|
8
|
+
Author: Alberto Spinella
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: aws,cli,credentials,iam,identity-center,profiles,sso
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Security
|
|
23
|
+
Classifier: Topic :: System :: Systems Administration
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Requires-Dist: boto3>=1.34
|
|
27
|
+
Requires-Dist: click>=8.1
|
|
28
|
+
Requires-Dist: jinja2>=3.1
|
|
29
|
+
Requires-Dist: keyring>=24.0
|
|
30
|
+
Requires-Dist: rich>=13.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: build>=1.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# credux
|
|
37
|
+
|
|
38
|
+
Credux manages your AWS credentials and materializes the ones you are actively
|
|
39
|
+
using into `~/.aws/credentials` and `~/.aws/config`, under profile names it
|
|
40
|
+
derives from a template you control.
|
|
41
|
+
|
|
42
|
+
It understands three kinds of credential:
|
|
43
|
+
|
|
44
|
+
- long-term **IAM user** access keys, kept in your OS keychain;
|
|
45
|
+
- **IAM roles** assumed on demand, optionally chained through other credux
|
|
46
|
+
credentials;
|
|
47
|
+
- **IAM Identity Center** (AWS SSO) permission sets, discovered automatically
|
|
48
|
+
from your Identity Center account.
|
|
49
|
+
|
|
50
|
+
Any tool that takes `--profile` or reads `AWS_PROFILE` works with the result: no
|
|
51
|
+
wrapper, no credential process, no AWS CLI installation required.
|
|
52
|
+
|
|
53
|
+
## Requirements
|
|
54
|
+
|
|
55
|
+
- Python 3.10 or later
|
|
56
|
+
- An OS keychain: macOS Keychain, Windows Credential Manager, or a Linux Secret
|
|
57
|
+
Service provider such as gnome-keyring or kwallet (see
|
|
58
|
+
[troubleshooting](docs/troubleshooting.md#headless-linux-and-wsl-no-keychain)
|
|
59
|
+
for headless Linux and WSL)
|
|
60
|
+
- For `credux console`'s default browser command: Firefox plus *two* extensions,
|
|
61
|
+
[Multi-Account Containers](https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/)
|
|
62
|
+
for the containers themselves and
|
|
63
|
+
[Open external links in a container](https://addons.mozilla.org/en-US/firefox/addon/open-url-in-container/)
|
|
64
|
+
for the `ext+container:` URL scheme credux hands to the browser. Any other
|
|
65
|
+
browser works by pointing `settings.browser_command` at it.
|
|
66
|
+
|
|
67
|
+
Runtime dependencies are `boto3`, `click`, `rich`, `keyring`, and `jinja2`.
|
|
68
|
+
|
|
69
|
+
## Install
|
|
70
|
+
|
|
71
|
+
Install it with [pipx](https://pipx.pypa.io/):
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pipx install credux
|
|
75
|
+
credux --version
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
pipx keeps credux in its own virtual environment and puts the `credux` command on
|
|
79
|
+
your `PATH` (usually `~/.local/bin`). Remove it with `pipx uninstall credux`.
|
|
80
|
+
|
|
81
|
+
If you do not have pipx: `brew install pipx`, `apt install pipx`, or
|
|
82
|
+
`python3 -m pip install --user pipx`.
|
|
83
|
+
|
|
84
|
+
A plain virtual environment does the same job:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
python3 -m venv .venv
|
|
88
|
+
.venv/bin/pip install credux
|
|
89
|
+
ln -s "$PWD/.venv/bin/credux" ~/.local/bin/credux
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Upgrading
|
|
93
|
+
|
|
94
|
+
`credux upgrade` replaces this installation with another release from the
|
|
95
|
+
index:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
credux upgrade # newest release
|
|
99
|
+
credux upgrade --version 0.1.0 # a specific release, also a way to repair
|
|
100
|
+
credux upgrade --from ./credux # whatever is checked out in a local clone
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
It drives whichever installer owns the environment credux is running in, and
|
|
104
|
+
refuses an editable install or an installation outside any virtual environment
|
|
105
|
+
rather than writing over either. Details in
|
|
106
|
+
[docs/releasing.md](docs/releasing.md#how-credux-upgrade-works).
|
|
107
|
+
|
|
108
|
+
## Quickstart
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
credux add iam-user # prompts for org, account, user, and keys
|
|
112
|
+
credux start acme-billing-User-ada
|
|
113
|
+
eval "$(credux shell-init)" # add this line to your shell rc instead, once
|
|
114
|
+
pu acme-billing-User-ada # sets AWS_PROFILE in *this* shell
|
|
115
|
+
aws sts get-caller-identity
|
|
116
|
+
credux console acme-billing-User-ada # open the account in a browser container
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`credux start` writes the profile into `~/.aws/credentials`, so any tool that
|
|
120
|
+
reads a profile can use it right away. `credux shell-init` installs the `pu`
|
|
121
|
+
shell function (which sets `AWS_PROFILE` in your current shell) and registers tab
|
|
122
|
+
completion for bash, zsh, and fish.
|
|
123
|
+
|
|
124
|
+
Profile names are searched, not spelled out: `credux console billing` finds
|
|
125
|
+
`acme-billing-User-ada`, and an ambiguous term asks which one you meant.
|
|
126
|
+
|
|
127
|
+
Using IAM Identity Center? Register the session once and let credux discover
|
|
128
|
+
every account and permission set you can reach:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
credux add sso-session acme --start-url https://acme.awsapps.com/start --sso-region eu-west-1
|
|
132
|
+
credux login acme # device-authorization flow in your browser
|
|
133
|
+
credux sync acme # discovers accounts/roles, creates/renames profiles
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Then `credux list` shows everything configured, which sessions are active, and
|
|
137
|
+
how long each has left.
|
|
138
|
+
|
|
139
|
+
## Profile names are a template you own
|
|
140
|
+
|
|
141
|
+
`acme-billing-User-ada` above is credux's default naming template, not a rule.
|
|
142
|
+
It is one house style, and `credux add`/`credux sync` say so until you have
|
|
143
|
+
picked your own:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
credux config set naming.iam_sso '{account_name}-{role}'
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Variables: `org`, `account_name`, `account_id`, `user`, `role`, `subdomain`,
|
|
150
|
+
`region`. Identity Center profiles are renamed by the next `credux sync`;
|
|
151
|
+
IAM user and role profiles keep the name they were added under. See
|
|
152
|
+
[docs/configuration.md](docs/configuration.md#naming).
|
|
153
|
+
|
|
154
|
+
## Your existing `~/.aws` files
|
|
155
|
+
|
|
156
|
+
Credux owns one marker-delimited block in `~/.aws/credentials` and
|
|
157
|
+
`~/.aws/config`, and preserves everything outside it byte for byte. Before its
|
|
158
|
+
first write to a file that already existed, it copies that file to
|
|
159
|
+
`<path>.credux.bak` (mode `0600`) and tells you where. See
|
|
160
|
+
[docs/security.md](docs/security.md#the-one-time-backup).
|
|
161
|
+
|
|
162
|
+
## The fake `default` profile
|
|
163
|
+
|
|
164
|
+
Every write to `~/.aws/credentials` also (re-)writes a profile literally named
|
|
165
|
+
`default`, holding deliberately invalid keys (`test`/`test` unless you configure
|
|
166
|
+
otherwise).
|
|
167
|
+
|
|
168
|
+
AWS SDKs and the `aws` CLI silently fall back to `default` whenever no
|
|
169
|
+
`--profile`/`AWS_PROFILE` is given. Without that slot pinned to keys AWS will
|
|
170
|
+
reject, a script or terminal tab that forgot to select a profile could quietly
|
|
171
|
+
run against whatever real credentials happened to be sitting there. With the fake
|
|
172
|
+
profile in place, the same mistake fails loudly with an authentication error.
|
|
173
|
+
|
|
174
|
+
Disable it with `credux config set default_profile.enabled false`. If you had a
|
|
175
|
+
`default` profile of your own, credux warns that the two now compete and
|
|
176
|
+
`credux doctor` keeps reporting it.
|
|
177
|
+
|
|
178
|
+
## Documentation
|
|
179
|
+
|
|
180
|
+
| Document | Covers |
|
|
181
|
+
|---|---|
|
|
182
|
+
| [docs/usage.md](docs/usage.md) | Every command, profile searching, `pu` and completion, Identity Center, several sessions at once, scheduled refresh, browser containers. |
|
|
183
|
+
| [docs/configuration.md](docs/configuration.md) | Every `config.json` key: settings, naming templates, the management-account prefix, integrations, `post_sync` hooks. |
|
|
184
|
+
| [docs/security.md](docs/security.md) | Where secrets live and where they never go, file permissions, the one-time backup. |
|
|
185
|
+
| [docs/troubleshooting.md](docs/troubleshooting.md) | `credux doctor`, keychain on headless Linux and WSL, exit codes. |
|
|
186
|
+
| [docs/architecture.md](docs/architecture.md) | For contributors: the layering rule, the invariants, the module map. |
|
|
187
|
+
|
|
188
|
+
`examples/config.json` is a complete configuration file to read alongside
|
|
189
|
+
[docs/configuration.md](docs/configuration.md).
|
|
190
|
+
|
|
191
|
+
## Contributing
|
|
192
|
+
|
|
193
|
+
Issues and pull requests are welcome. The project follows strict test-driven
|
|
194
|
+
development.
|
|
195
|
+
|
|
196
|
+
Development happens in a separate tree, and what arrives here is the released
|
|
197
|
+
state: one commit per release, which is why the history is short and every
|
|
198
|
+
commit is a version. A pull request is read as a proposal rather than something
|
|
199
|
+
merged into this branch - an accepted one is applied upstream and appears in the
|
|
200
|
+
next release commit, credited in the discussion it came from.
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
git clone https://github.com/AlbertoSpinella/credux.git
|
|
204
|
+
cd credux
|
|
205
|
+
python3 -m venv .venv
|
|
206
|
+
.venv/bin/pip install -e ".[dev]"
|
|
207
|
+
.venv/bin/pytest
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Before changing anything, read [docs/architecture.md](docs/architecture.md) for
|
|
211
|
+
the layering rule and the invariants any change must preserve, and
|
|
212
|
+
[docs/testing.md](docs/testing.md) for the test conventions and the traps this
|
|
213
|
+
project has already hit.
|
|
214
|
+
|
|
215
|
+
## Licence
|
|
216
|
+
|
|
217
|
+
MIT; see [LICENSE](LICENSE).
|
credux-0.2.0/README.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# credux
|
|
2
|
+
|
|
3
|
+
Credux manages your AWS credentials and materializes the ones you are actively
|
|
4
|
+
using into `~/.aws/credentials` and `~/.aws/config`, under profile names it
|
|
5
|
+
derives from a template you control.
|
|
6
|
+
|
|
7
|
+
It understands three kinds of credential:
|
|
8
|
+
|
|
9
|
+
- long-term **IAM user** access keys, kept in your OS keychain;
|
|
10
|
+
- **IAM roles** assumed on demand, optionally chained through other credux
|
|
11
|
+
credentials;
|
|
12
|
+
- **IAM Identity Center** (AWS SSO) permission sets, discovered automatically
|
|
13
|
+
from your Identity Center account.
|
|
14
|
+
|
|
15
|
+
Any tool that takes `--profile` or reads `AWS_PROFILE` works with the result: no
|
|
16
|
+
wrapper, no credential process, no AWS CLI installation required.
|
|
17
|
+
|
|
18
|
+
## Requirements
|
|
19
|
+
|
|
20
|
+
- Python 3.10 or later
|
|
21
|
+
- An OS keychain: macOS Keychain, Windows Credential Manager, or a Linux Secret
|
|
22
|
+
Service provider such as gnome-keyring or kwallet (see
|
|
23
|
+
[troubleshooting](docs/troubleshooting.md#headless-linux-and-wsl-no-keychain)
|
|
24
|
+
for headless Linux and WSL)
|
|
25
|
+
- For `credux console`'s default browser command: Firefox plus *two* extensions,
|
|
26
|
+
[Multi-Account Containers](https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/)
|
|
27
|
+
for the containers themselves and
|
|
28
|
+
[Open external links in a container](https://addons.mozilla.org/en-US/firefox/addon/open-url-in-container/)
|
|
29
|
+
for the `ext+container:` URL scheme credux hands to the browser. Any other
|
|
30
|
+
browser works by pointing `settings.browser_command` at it.
|
|
31
|
+
|
|
32
|
+
Runtime dependencies are `boto3`, `click`, `rich`, `keyring`, and `jinja2`.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
Install it with [pipx](https://pipx.pypa.io/):
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pipx install credux
|
|
40
|
+
credux --version
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
pipx keeps credux in its own virtual environment and puts the `credux` command on
|
|
44
|
+
your `PATH` (usually `~/.local/bin`). Remove it with `pipx uninstall credux`.
|
|
45
|
+
|
|
46
|
+
If you do not have pipx: `brew install pipx`, `apt install pipx`, or
|
|
47
|
+
`python3 -m pip install --user pipx`.
|
|
48
|
+
|
|
49
|
+
A plain virtual environment does the same job:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python3 -m venv .venv
|
|
53
|
+
.venv/bin/pip install credux
|
|
54
|
+
ln -s "$PWD/.venv/bin/credux" ~/.local/bin/credux
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Upgrading
|
|
58
|
+
|
|
59
|
+
`credux upgrade` replaces this installation with another release from the
|
|
60
|
+
index:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
credux upgrade # newest release
|
|
64
|
+
credux upgrade --version 0.1.0 # a specific release, also a way to repair
|
|
65
|
+
credux upgrade --from ./credux # whatever is checked out in a local clone
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
It drives whichever installer owns the environment credux is running in, and
|
|
69
|
+
refuses an editable install or an installation outside any virtual environment
|
|
70
|
+
rather than writing over either. Details in
|
|
71
|
+
[docs/releasing.md](docs/releasing.md#how-credux-upgrade-works).
|
|
72
|
+
|
|
73
|
+
## Quickstart
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
credux add iam-user # prompts for org, account, user, and keys
|
|
77
|
+
credux start acme-billing-User-ada
|
|
78
|
+
eval "$(credux shell-init)" # add this line to your shell rc instead, once
|
|
79
|
+
pu acme-billing-User-ada # sets AWS_PROFILE in *this* shell
|
|
80
|
+
aws sts get-caller-identity
|
|
81
|
+
credux console acme-billing-User-ada # open the account in a browser container
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`credux start` writes the profile into `~/.aws/credentials`, so any tool that
|
|
85
|
+
reads a profile can use it right away. `credux shell-init` installs the `pu`
|
|
86
|
+
shell function (which sets `AWS_PROFILE` in your current shell) and registers tab
|
|
87
|
+
completion for bash, zsh, and fish.
|
|
88
|
+
|
|
89
|
+
Profile names are searched, not spelled out: `credux console billing` finds
|
|
90
|
+
`acme-billing-User-ada`, and an ambiguous term asks which one you meant.
|
|
91
|
+
|
|
92
|
+
Using IAM Identity Center? Register the session once and let credux discover
|
|
93
|
+
every account and permission set you can reach:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
credux add sso-session acme --start-url https://acme.awsapps.com/start --sso-region eu-west-1
|
|
97
|
+
credux login acme # device-authorization flow in your browser
|
|
98
|
+
credux sync acme # discovers accounts/roles, creates/renames profiles
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Then `credux list` shows everything configured, which sessions are active, and
|
|
102
|
+
how long each has left.
|
|
103
|
+
|
|
104
|
+
## Profile names are a template you own
|
|
105
|
+
|
|
106
|
+
`acme-billing-User-ada` above is credux's default naming template, not a rule.
|
|
107
|
+
It is one house style, and `credux add`/`credux sync` say so until you have
|
|
108
|
+
picked your own:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
credux config set naming.iam_sso '{account_name}-{role}'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Variables: `org`, `account_name`, `account_id`, `user`, `role`, `subdomain`,
|
|
115
|
+
`region`. Identity Center profiles are renamed by the next `credux sync`;
|
|
116
|
+
IAM user and role profiles keep the name they were added under. See
|
|
117
|
+
[docs/configuration.md](docs/configuration.md#naming).
|
|
118
|
+
|
|
119
|
+
## Your existing `~/.aws` files
|
|
120
|
+
|
|
121
|
+
Credux owns one marker-delimited block in `~/.aws/credentials` and
|
|
122
|
+
`~/.aws/config`, and preserves everything outside it byte for byte. Before its
|
|
123
|
+
first write to a file that already existed, it copies that file to
|
|
124
|
+
`<path>.credux.bak` (mode `0600`) and tells you where. See
|
|
125
|
+
[docs/security.md](docs/security.md#the-one-time-backup).
|
|
126
|
+
|
|
127
|
+
## The fake `default` profile
|
|
128
|
+
|
|
129
|
+
Every write to `~/.aws/credentials` also (re-)writes a profile literally named
|
|
130
|
+
`default`, holding deliberately invalid keys (`test`/`test` unless you configure
|
|
131
|
+
otherwise).
|
|
132
|
+
|
|
133
|
+
AWS SDKs and the `aws` CLI silently fall back to `default` whenever no
|
|
134
|
+
`--profile`/`AWS_PROFILE` is given. Without that slot pinned to keys AWS will
|
|
135
|
+
reject, a script or terminal tab that forgot to select a profile could quietly
|
|
136
|
+
run against whatever real credentials happened to be sitting there. With the fake
|
|
137
|
+
profile in place, the same mistake fails loudly with an authentication error.
|
|
138
|
+
|
|
139
|
+
Disable it with `credux config set default_profile.enabled false`. If you had a
|
|
140
|
+
`default` profile of your own, credux warns that the two now compete and
|
|
141
|
+
`credux doctor` keeps reporting it.
|
|
142
|
+
|
|
143
|
+
## Documentation
|
|
144
|
+
|
|
145
|
+
| Document | Covers |
|
|
146
|
+
|---|---|
|
|
147
|
+
| [docs/usage.md](docs/usage.md) | Every command, profile searching, `pu` and completion, Identity Center, several sessions at once, scheduled refresh, browser containers. |
|
|
148
|
+
| [docs/configuration.md](docs/configuration.md) | Every `config.json` key: settings, naming templates, the management-account prefix, integrations, `post_sync` hooks. |
|
|
149
|
+
| [docs/security.md](docs/security.md) | Where secrets live and where they never go, file permissions, the one-time backup. |
|
|
150
|
+
| [docs/troubleshooting.md](docs/troubleshooting.md) | `credux doctor`, keychain on headless Linux and WSL, exit codes. |
|
|
151
|
+
| [docs/architecture.md](docs/architecture.md) | For contributors: the layering rule, the invariants, the module map. |
|
|
152
|
+
|
|
153
|
+
`examples/config.json` is a complete configuration file to read alongside
|
|
154
|
+
[docs/configuration.md](docs/configuration.md).
|
|
155
|
+
|
|
156
|
+
## Contributing
|
|
157
|
+
|
|
158
|
+
Issues and pull requests are welcome. The project follows strict test-driven
|
|
159
|
+
development.
|
|
160
|
+
|
|
161
|
+
Development happens in a separate tree, and what arrives here is the released
|
|
162
|
+
state: one commit per release, which is why the history is short and every
|
|
163
|
+
commit is a version. A pull request is read as a proposal rather than something
|
|
164
|
+
merged into this branch - an accepted one is applied upstream and appears in the
|
|
165
|
+
next release commit, credited in the discussion it came from.
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
git clone https://github.com/AlbertoSpinella/credux.git
|
|
169
|
+
cd credux
|
|
170
|
+
python3 -m venv .venv
|
|
171
|
+
.venv/bin/pip install -e ".[dev]"
|
|
172
|
+
.venv/bin/pytest
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Before changing anything, read [docs/architecture.md](docs/architecture.md) for
|
|
176
|
+
the layering rule and the invariants any change must preserve, and
|
|
177
|
+
[docs/testing.md](docs/testing.md) for the test conventions and the traps this
|
|
178
|
+
project has already hit.
|
|
179
|
+
|
|
180
|
+
## Licence
|
|
181
|
+
|
|
182
|
+
MIT; see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# credux documentation
|
|
2
|
+
|
|
3
|
+
Start at the [project README](../README.md) for what credux is, how to install
|
|
4
|
+
it, and a quickstart.
|
|
5
|
+
|
|
6
|
+
## Using credux
|
|
7
|
+
|
|
8
|
+
| Document | Covers |
|
|
9
|
+
|---|---|
|
|
10
|
+
| [usage.md](usage.md) | Command reference, profile searching, `pu` and tab completion, Identity Center, running several sessions at once, scheduled refresh, the AWS console and browser containers. |
|
|
11
|
+
| [configuration.md](configuration.md) | Every key in `config.json`: `settings`, naming templates and the management-account prefix, `sso_sessions`, `integrations`, `post_sync`. |
|
|
12
|
+
| [security.md](security.md) | Where secrets live and where they never go, file permissions, the one-time backup, the console-URL caveat. |
|
|
13
|
+
| [troubleshooting.md](troubleshooting.md) | `credux doctor`, keychain on headless Linux and WSL, common failures, the exit-code table. |
|
|
14
|
+
|
|
15
|
+
## Working on credux
|
|
16
|
+
|
|
17
|
+
| Document | Covers |
|
|
18
|
+
|---|---|
|
|
19
|
+
| [architecture.md](architecture.md) | The layering rule, the five invariants any change must preserve, the module map, resolution and chaining, repo-wide rules. |
|
|
20
|
+
| [providers.md](providers.md) | How to add a provider for another cloud. |
|
|
21
|
+
| [testing.md](testing.md) | How to run the suite, the test conventions, and the traps this project has actually hit. |
|
|
22
|
+
| [releasing.md](releasing.md) | Cutting a release and how `credux upgrade` decides what to do. |
|
|
23
|
+
|
|
24
|
+
Read [architecture.md](architecture.md) before changing structure and
|
|
25
|
+
[testing.md](testing.md) before writing tests.
|