az2aws 1.1.2 → 1.2.0
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.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +21 -0
- package/README.md +27 -41
- package/lib/index.js +6 -2
- package/lib/login.js +12 -9
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.0](https://github.com/kuma0128/az2aws/compare/v1.1.3...v1.2.0) (2026-01-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Add version flag to CLI command ([#67](https://github.com/kuma0128/az2aws/issues/67)) ([b89290f](https://github.com/kuma0128/az2aws/commit/b89290fe16d554f6a8a1bf09df0194a64d692b55))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* Add default duration of 1 hour if parsing fails ([#70](https://github.com/kuma0128/az2aws/issues/70)) ([337d12c](https://github.com/kuma0128/az2aws/commit/337d12c90ab0eccf4034bd438ecfb2f0ad98db47))
|
|
14
|
+
* Fix SAML assertion decoding to use UTF-8 encoding ([#72](https://github.com/kuma0128/az2aws/issues/72)) ([14e44a7](https://github.com/kuma0128/az2aws/commit/14e44a7ffe19e48177078aa6d87feb7e8ecf0c94))
|
|
15
|
+
* resolve --no-verify-ssl and proxy settings conflict ([#73](https://github.com/kuma0128/az2aws/issues/73)) ([3fd9adf](https://github.com/kuma0128/az2aws/commit/3fd9adf6dd39109bb428b56215200ad1df3752a9))
|
|
16
|
+
|
|
17
|
+
## [1.1.3](https://github.com/kuma0128/az2aws/compare/v1.1.2...v1.1.3) (2026-01-19)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* snapcraft deploy flow ([#65](https://github.com/kuma0128/az2aws/issues/65)) ([a4a41d7](https://github.com/kuma0128/az2aws/commit/a4a41d79c3142762f3d593796c8bf31b558bb8fe))
|
|
23
|
+
|
|
3
24
|
## [1.1.2](https://github.com/kuma0128/az2aws/compare/v1.1.1...v1.1.2) (2026-01-19)
|
|
4
25
|
|
|
5
26
|
|
package/README.md
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
# az2aws
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Log in to AWS CLI using [Azure Active Directory](https://azure.microsoft.com) SSO. Supports MFA and places temporary credentials in the proper location for AWS CLI and SDKs.
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
12
12
|
### mise (Recommended)
|
|
13
13
|
|
|
14
|
-
[mise](https://mise.jdx.dev/) is a
|
|
14
|
+
[mise](https://mise.jdx.dev/) is a version manager that can install az2aws directly.
|
|
15
15
|
|
|
16
16
|
Install mise:
|
|
17
17
|
|
|
@@ -66,12 +66,10 @@ Run az2aws with a volume mounted to your AWS configuration directory:
|
|
|
66
66
|
|
|
67
67
|
docker run --rm -it -v ~/.aws:/root/.aws az2aws/az2aws
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
You can also put the docker-launch.sh script into your bin directory for the az2aws command to function as usual:
|
|
69
|
+
You can also install the docker-launch.sh script to your PATH:
|
|
72
70
|
|
|
73
71
|
# Download the script (replace VERSION with a specific release tag, e.g., v1.0.0)
|
|
74
|
-
curl -o /tmp/az2aws https://raw.githubusercontent.com/
|
|
72
|
+
curl -o /tmp/az2aws https://raw.githubusercontent.com/kuma0128/az2aws/VERSION/docker-launch.sh -L
|
|
75
73
|
|
|
76
74
|
# IMPORTANT: Review the script before installing
|
|
77
75
|
cat /tmp/az2aws
|
|
@@ -80,9 +78,7 @@ You can also put the docker-launch.sh script into your bin directory for the az2
|
|
|
80
78
|
sudo mv /tmp/az2aws /usr/local/bin/az2aws
|
|
81
79
|
sudo chmod +x /usr/local/bin/az2aws
|
|
82
80
|
|
|
83
|
-
> **Security Note:** Always download from a specific release tag (not `main`) and review the script
|
|
84
|
-
|
|
85
|
-
Now just run `az2aws`.
|
|
81
|
+
> **Security Note:** Always download from a specific release tag (not `main`) and review the script before installing.
|
|
86
82
|
|
|
87
83
|
### Snap
|
|
88
84
|
|
|
@@ -104,13 +100,12 @@ https://snapcraft.io/az2aws
|
|
|
104
100
|
| `--enable-chrome-seamless-sso` | Enable Azure AD Seamless SSO |
|
|
105
101
|
| `--no-disable-extensions` | Keep browser extensions enabled |
|
|
106
102
|
| `--disable-gpu` | Disable GPU acceleration |
|
|
103
|
+
| `--version (-v)` | Show version number |
|
|
107
104
|
|
|
108
105
|
## Usage
|
|
109
106
|
|
|
110
107
|
### Configuration
|
|
111
108
|
|
|
112
|
-
#### AWS
|
|
113
|
-
|
|
114
109
|
To configure the az2aws client run:
|
|
115
110
|
|
|
116
111
|
az2aws --configure
|
|
@@ -119,22 +114,16 @@ You'll need your [Azure Tenant ID and the App ID URI](#getting-your-tenant-id-an
|
|
|
119
114
|
|
|
120
115
|
az2aws --configure --profile foo
|
|
121
116
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
To use az2aws with AWS GovCloud, set the `region` profile property in your ~/.aws/config to the one of the GovCloud regions:
|
|
125
|
-
|
|
126
|
-
- us-gov-west-1
|
|
127
|
-
- us-gov-east-1
|
|
128
|
-
|
|
129
|
-
##### China Region Support
|
|
117
|
+
#### GovCloud / China Region Support
|
|
130
118
|
|
|
131
|
-
|
|
119
|
+
Set the `region` in your ~/.aws/config to use non-standard AWS partitions:
|
|
132
120
|
|
|
133
|
-
-
|
|
121
|
+
- **GovCloud**: us-gov-west-1, us-gov-east-1
|
|
122
|
+
- **China**: cn-north-1, cn-northwest-1
|
|
134
123
|
|
|
135
124
|
#### Stay Logged In
|
|
136
125
|
|
|
137
|
-
|
|
126
|
+
Enable "Stay logged in" during configuration to use `--no-prompt` without storing passwords:
|
|
138
127
|
|
|
139
128
|
az2aws --no-prompt
|
|
140
129
|
az2aws --profile foo --no-prompt
|
|
@@ -154,28 +143,26 @@ To avoid storing passwords in bash history, use a leading space:
|
|
|
154
143
|
|
|
155
144
|
#### Use an Existing Chrome Install and Profile
|
|
156
145
|
|
|
157
|
-
|
|
146
|
+
Use your own Chrome installation by setting these environment variables:
|
|
158
147
|
|
|
159
148
|
- `BROWSER_CHROME_BIN` - Path to Chrome executable
|
|
160
149
|
- `BROWSER_USER_DATA_DIR` - Chrome user data directory
|
|
161
150
|
- `BROWSER_PROFILE_DIR` - Chrome profile name (e.g., "Default")
|
|
162
151
|
|
|
163
|
-
Example
|
|
152
|
+
Example:
|
|
164
153
|
|
|
154
|
+
# macOS
|
|
165
155
|
export BROWSER_CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
|
166
|
-
export BROWSER_USER_DATA_DIR="/
|
|
167
|
-
export BROWSER_PROFILE_DIR="Default"
|
|
168
|
-
az2aws --mode gui --no-disable-extensions --no-sandbox
|
|
169
|
-
|
|
170
|
-
Example (Linux):
|
|
156
|
+
export BROWSER_USER_DATA_DIR="$HOME/Library/Application Support/Google/Chrome"
|
|
171
157
|
|
|
158
|
+
# Linux
|
|
172
159
|
export BROWSER_CHROME_BIN="/usr/bin/google-chrome"
|
|
173
|
-
export BROWSER_USER_DATA_DIR="
|
|
160
|
+
export BROWSER_USER_DATA_DIR="$HOME/.config/google-chrome"
|
|
161
|
+
|
|
162
|
+
# Common
|
|
174
163
|
export BROWSER_PROFILE_DIR="Default"
|
|
175
164
|
az2aws --mode gui --no-disable-extensions --no-sandbox
|
|
176
165
|
|
|
177
|
-
Using Chrome instead of Chromium allows you to use browser extensions such as password managers.
|
|
178
|
-
|
|
179
166
|
### Logging In
|
|
180
167
|
|
|
181
168
|
az2aws # Default profile
|
|
@@ -187,12 +174,11 @@ You'll be prompted for username, password, and MFA if required. After login, use
|
|
|
187
174
|
**Tips:**
|
|
188
175
|
- Set `AWS_PROFILE` env var instead of using `--profile`
|
|
189
176
|
- Use `--mode gui --disable-gpu` on VMs or if rendering fails
|
|
190
|
-
- Use `--no-sandbox` on Linux
|
|
191
177
|
- Set `https_proxy` env var for corporate proxy
|
|
192
178
|
|
|
193
179
|
## Automation
|
|
194
180
|
|
|
195
|
-
Renew all profiles at once
|
|
181
|
+
Renew all profiles at once:
|
|
196
182
|
|
|
197
183
|
az2aws --all-profiles
|
|
198
184
|
az2aws --all-profiles --no-prompt # With "Stay logged in" enabled
|
|
@@ -201,21 +187,21 @@ Credentials are only refreshed if expiring within 11 minutes - safe to run as a
|
|
|
201
187
|
|
|
202
188
|
## Getting Your Tenant ID and App ID URI
|
|
203
189
|
|
|
204
|
-
|
|
190
|
+
Ask your Azure AD admin for these values, or extract them from myapps.microsoft.com:
|
|
205
191
|
|
|
206
192
|
1. Load the myapps.microsoft.com page.
|
|
207
|
-
2. Click the
|
|
208
|
-
3. In the window
|
|
193
|
+
2. Click the app tile for the login you want.
|
|
194
|
+
3. In the window that pops open, quickly copy the login.microsoftonline.com URL. (You can also use browser DevTools with "Preserve log" enabled to capture it.)
|
|
209
195
|
4. The GUID right after login.microsoftonline.com/ is the tenant ID.
|
|
210
196
|
5. Copy the SAMLRequest URL param.
|
|
211
197
|
6. Paste it into a URL decoder ([like this one](https://www.samltool.com/url.php)) and decode.
|
|
212
|
-
7. Paste the decoded output into
|
|
198
|
+
7. Paste the decoded output into a SAML deflated and encoded XML decoder ([like this one](https://www.samltool.com/decode.php)).
|
|
213
199
|
8. In the decoded XML output the value of the `Audience` tag is the App ID URI.
|
|
214
|
-
9.
|
|
200
|
+
9. Verify the tenant ID using the `tenantid` attribute in the XML.
|
|
215
201
|
|
|
216
202
|
## How It Works
|
|
217
203
|
|
|
218
|
-
|
|
204
|
+
az2aws uses [Puppeteer](https://github.com/GoogleChrome/puppeteer) to automate a Chromium browser for Azure AD login. It parses the SAML response and calls [AWS STS AssumeRoleWithSAML](http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithSAML.html) to get temporary credentials.
|
|
219
205
|
|
|
220
206
|
## Troubleshooting
|
|
221
207
|
|
|
@@ -227,7 +213,7 @@ If login fails, try these in order:
|
|
|
227
213
|
|
|
228
214
|
## Support for Other Authentication Providers
|
|
229
215
|
|
|
230
|
-
|
|
216
|
+
This tool only supports Azure AD. Contributions for other SAML providers are welcome - open an issue on GitHub to discuss.
|
|
231
217
|
|
|
232
218
|
## Acknowledgements
|
|
233
219
|
|
package/lib/index.js
CHANGED
|
@@ -6,8 +6,11 @@ process.on("SIGTERM", () => process.exit(1));
|
|
|
6
6
|
const commander_1 = require("commander");
|
|
7
7
|
const configureProfileAsync_1 = require("./configureProfileAsync");
|
|
8
8
|
const login_1 = require("./login");
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
10
|
+
const { version } = require("../package.json");
|
|
9
11
|
const program = new commander_1.Command();
|
|
10
12
|
program
|
|
13
|
+
.version(version, "-v, --version")
|
|
11
14
|
.option("-p, --profile <name>", "The name of the profile to log in with (or configure)")
|
|
12
15
|
.option("-a, --all-profiles", "Run for all configured profiles")
|
|
13
16
|
.option("-f, --force-refresh", "Force a credential refresh, even if they are still valid")
|
|
@@ -16,7 +19,7 @@ program
|
|
|
16
19
|
.option("--no-sandbox", "Disable the Puppeteer sandbox (usually necessary on Linux)")
|
|
17
20
|
.option("--no-prompt", "Do not prompt for input and accept the default choice", false)
|
|
18
21
|
.option("--enable-chrome-network-service", "Enable Chromium's Network Service (needed when login provider redirects with 3XX)")
|
|
19
|
-
.option("--no-verify-ssl", "Disable SSL Peer Verification for connections to AWS
|
|
22
|
+
.option("--no-verify-ssl", "Disable SSL Peer Verification for connections to AWS")
|
|
20
23
|
.option("--enable-chrome-seamless-sso", "Enable Chromium's pass-through authentication with Azure Active Directory Seamless Single Sign-On")
|
|
21
24
|
.option("--no-disable-extensions", "Tell Puppeteer not to pass the --disable-extensions flag to Chromium")
|
|
22
25
|
.option("--disable-gpu", "Tell Puppeteer to pass the --disable-gpu flag to Chromium")
|
|
@@ -49,6 +52,7 @@ Promise.resolve()
|
|
|
49
52
|
process.exit(2);
|
|
50
53
|
}
|
|
51
54
|
else {
|
|
52
|
-
console.
|
|
55
|
+
console.error(err);
|
|
56
|
+
process.exit(1);
|
|
53
57
|
}
|
|
54
58
|
});
|
package/lib/login.js
CHANGED
|
@@ -16,7 +16,7 @@ const querystring_1 = __importDefault(require("querystring"));
|
|
|
16
16
|
const debug_1 = __importDefault(require("debug"));
|
|
17
17
|
const CLIError_1 = require("./CLIError");
|
|
18
18
|
const awsConfig_1 = require("./awsConfig");
|
|
19
|
-
const
|
|
19
|
+
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
20
20
|
const paths_1 = require("./paths");
|
|
21
21
|
const mkdirp_1 = __importDefault(require("mkdirp"));
|
|
22
22
|
const https_1 = require("https");
|
|
@@ -674,8 +674,8 @@ exports.login = {
|
|
|
674
674
|
* @private
|
|
675
675
|
*/
|
|
676
676
|
_parseRolesFromSamlResponse(assertion) {
|
|
677
|
-
debug("Converting assertion from base64 to
|
|
678
|
-
const samlText = Buffer.from(assertion, "base64").toString("
|
|
677
|
+
debug("Converting assertion from base64 to UTF-8");
|
|
678
|
+
const samlText = Buffer.from(assertion, "base64").toString("utf8");
|
|
679
679
|
debug("Converted", samlText);
|
|
680
680
|
debug("Parsing SAML XML");
|
|
681
681
|
const saml = (0, cheerio_1.load)(samlText, { xmlMode: true });
|
|
@@ -710,7 +710,7 @@ exports.login = {
|
|
|
710
710
|
*/
|
|
711
711
|
async _askUserForRoleAndDurationAsync(roles, noPrompt, defaultRoleArn, defaultDurationHours) {
|
|
712
712
|
let role;
|
|
713
|
-
let durationHours = parseInt(defaultDurationHours, 10);
|
|
713
|
+
let durationHours = parseInt(defaultDurationHours, 10) || 1;
|
|
714
714
|
const questions = [];
|
|
715
715
|
if (roles.length === 0) {
|
|
716
716
|
throw new CLIError_1.CLIError("No roles found in SAML response.");
|
|
@@ -784,18 +784,21 @@ exports.login = {
|
|
|
784
784
|
var _a, _b, _c, _d, _e;
|
|
785
785
|
console.log(`Assuming role ${role.roleArn} in region ${region}...`);
|
|
786
786
|
let stsOptions = {};
|
|
787
|
+
if (awsNoVerifySsl) {
|
|
788
|
+
console.warn("WARNING: SSL certificate verification is disabled. " +
|
|
789
|
+
"This makes the connection vulnerable to MITM attacks. " +
|
|
790
|
+
"Consider using NODE_EXTRA_CA_CERTS environment variable instead.");
|
|
791
|
+
}
|
|
787
792
|
if (process.env.https_proxy) {
|
|
793
|
+
const proxyOptions = awsNoVerifySsl ? { rejectUnauthorized: false } : {};
|
|
788
794
|
stsOptions = {
|
|
789
795
|
...stsOptions,
|
|
790
796
|
requestHandler: new node_http_handler_1.NodeHttpHandler({
|
|
791
|
-
httpsAgent:
|
|
797
|
+
httpsAgent: new https_proxy_agent_1.HttpsProxyAgent(process.env.https_proxy, proxyOptions),
|
|
792
798
|
}),
|
|
793
799
|
};
|
|
794
800
|
}
|
|
795
|
-
if (awsNoVerifySsl) {
|
|
796
|
-
console.warn("WARNING: SSL certificate verification is disabled. " +
|
|
797
|
-
"This makes the connection vulnerable to MITM attacks. " +
|
|
798
|
-
"Consider using NODE_EXTRA_CA_CERTS environment variable instead.");
|
|
801
|
+
else if (awsNoVerifySsl) {
|
|
799
802
|
stsOptions = {
|
|
800
803
|
...stsOptions,
|
|
801
804
|
requestHandler: new node_http_handler_1.NodeHttpHandler({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "az2aws",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Use Azure AD SSO to log into the AWS CLI. A modern, actively maintained alternative to aws-azure-login.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
"cheerio": "^1.0.0-rc.10",
|
|
61
61
|
"commander": "^9.5.0",
|
|
62
62
|
"debug": "^4.3.1",
|
|
63
|
+
"https-proxy-agent": "^7.0.6",
|
|
63
64
|
"ini": "^3.0.1",
|
|
64
65
|
"inquirer": "^8.2.6",
|
|
65
66
|
"lodash": "^4.17.21",
|
|
66
67
|
"mkdirp": "^1.0.4",
|
|
67
|
-
"proxy-agent": "^6.4.0",
|
|
68
68
|
"puppeteer": "^24.34.0",
|
|
69
69
|
"uuid": "^8.3.2"
|
|
70
70
|
},
|