az2aws 1.0.0 → 1.0.1

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.
@@ -10,7 +10,8 @@
10
10
  "Bash(yarn install)",
11
11
  "WebFetch(domain:github.com)",
12
12
  "WebFetch(domain:patch-diff.githubusercontent.com)",
13
- "Bash(ls:*)"
13
+ "Bash(ls:*)",
14
+ "WebFetch(domain:mise.jdx.dev)"
14
15
  ]
15
16
  }
16
17
  }
package/README.md CHANGED
@@ -76,6 +76,23 @@ Now just run `az2aws`.
76
76
 
77
77
  https://snapcraft.io/az2aws
78
78
 
79
+ ## Command Options
80
+
81
+ | Option | Description |
82
+ |--------|-------------|
83
+ | `--profile (-p)` | Profile name to use. Default: `default` or `AWS_PROFILE` |
84
+ | `--all-profiles (-a)` | Run for all configured profiles |
85
+ | `--force-refresh (-f)` | Force refresh even if credentials are valid |
86
+ | `--configure (-c)` | Configure the profile |
87
+ | `--mode (-m) <mode>` | `cli` (default), `gui`, or `debug` |
88
+ | `--no-sandbox` | Disable Puppeteer sandbox (needed on Linux) |
89
+ | `--no-prompt` | Skip prompts, use defaults |
90
+ | `--enable-chrome-network-service` | Enable Network Service (for 3XX redirects) |
91
+ | `--no-verify-ssl` | Disable AWS SSL verification |
92
+ | `--enable-chrome-seamless-sso` | Enable Azure AD Seamless SSO |
93
+ | `--no-disable-extensions` | Keep browser extensions enabled |
94
+ | `--disable-gpu` | Disable GPU acceleration |
95
+
79
96
  ## Usage
80
97
 
81
98
  ### Configuration
@@ -103,43 +120,25 @@ To use az2aws with AWS China Cloud, set the `region` profile property in your ~/
103
120
 
104
121
  - cn-north-1
105
122
 
106
- #### Staying logged in, skip username/password for future logins
107
-
108
- During the configuration you can decide to stay logged in:
123
+ #### Stay Logged In
109
124
 
110
- ? Stay logged in: skip authentication while refreshing aws credentials (true|false) (false)
111
-
112
- If you set this configuration to true, the usual authentication with username/password/MFA is skipped as it's using session cookies to remember your identity. This enables you to use `--no-prompt` without the need to store your password anywhere, it's an alternative for using environment variables as described below.
113
- As soon as you went through the full login procedure once, you can just use:
125
+ During configuration, you can enable "Stay logged in" to skip username/password/MFA on subsequent logins. Session cookies will remember your identity, allowing you to use `--no-prompt` without storing passwords:
114
126
 
115
127
  az2aws --no-prompt
116
-
117
- or
118
-
119
128
  az2aws --profile foo --no-prompt
120
129
 
121
- to refresh your aws credentials.
122
-
123
130
  #### Environment Variables
124
131
 
125
- You can optionally store your responses as environment variables:
132
+ You can set defaults via environment variables (use with `--no-prompt`):
126
133
 
127
- - `AZURE_TENANT_ID`
128
- - `AZURE_APP_ID_URI`
129
- - `AZURE_DEFAULT_USERNAME`
130
- - `AZURE_DEFAULT_PASSWORD`
131
- - `AZURE_DEFAULT_ROLE_ARN`
132
- - `AZURE_DEFAULT_DURATION_HOURS`
134
+ - `AZURE_TENANT_ID` / `AZURE_APP_ID_URI` - Azure AD settings
135
+ - `AZURE_DEFAULT_USERNAME` / `AZURE_DEFAULT_PASSWORD` - Credentials
136
+ - `AZURE_DEFAULT_ROLE_ARN` / `AZURE_DEFAULT_DURATION_HOURS` - AWS role settings
133
137
 
134
- To avoid having to `<Enter>` through the prompts after setting these environment variables, use the `--no-prompt` option when running the command.
138
+ To avoid storing passwords in bash history, use a leading space:
135
139
 
136
- az2aws --no-prompt
137
-
138
- Use the `HISTCONTROL` environment variable to avoid storing the password in your bash history (notice the space at the beginning):
139
-
140
- $ HISTCONTROL=ignoreboth
141
- $ export AZURE_DEFAULT_PASSWORD=mypassword
142
- $ az2aws
140
+ HISTCONTROL=ignoreboth
141
+ export AZURE_DEFAULT_PASSWORD=mypassword
143
142
 
144
143
  #### Use an Existing Chrome Install and Profile
145
144
 
@@ -154,63 +153,39 @@ Example (macOS):
154
153
  export BROWSER_CHROME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
155
154
  export BROWSER_USER_DATA_DIR="/Users/<user>/Library/Application Support/Google/Chrome"
156
155
  export BROWSER_PROFILE_DIR="Default"
157
- aws-azure-login --mode gui --no-disable-extensions --no-sandbox
156
+ az2aws --mode gui --no-disable-extensions --no-sandbox
158
157
 
159
158
  Example (Linux):
160
159
 
161
160
  export BROWSER_CHROME_BIN="/usr/bin/google-chrome"
162
161
  export BROWSER_USER_DATA_DIR="/home/<user>/.config/google-chrome"
163
162
  export BROWSER_PROFILE_DIR="Default"
164
- aws-azure-login --mode gui --no-disable-extensions --no-sandbox
163
+ az2aws --mode gui --no-disable-extensions --no-sandbox
165
164
 
166
165
  Using Chrome instead of Chromium allows you to use browser extensions such as password managers.
167
166
 
168
167
  ### Logging In
169
168
 
170
- Once az2aws is configured, you can log in. For the default profile, just run:
171
-
172
- az2aws
173
-
174
- You will be prompted for your username and password. If MFA is required you'll also be prompted for a verification code or mobile device approval. To log in with a named profile:
175
-
176
- az2aws --profile foo
177
-
178
- Alternatively, you can set the `AWS_PROFILE` environmental variable to the name of the profile just like the AWS CLI.
169
+ az2aws # Default profile
170
+ az2aws --profile foo # Named profile
171
+ az2aws --mode gui # Use browser UI (more reliable)
179
172
 
180
- Once you log in you can use the AWS CLI or SDKs as usual!
173
+ You'll be prompted for username, password, and MFA if required. After login, use AWS CLI/SDKs as usual.
181
174
 
182
- If you are logging in on an operating system with a GUI, you can log in using the actual Azure web form instead of the CLI:
183
-
184
- az2aws --mode gui
185
-
186
- Logging in with GUI mode is likely to be much more reliable.
187
-
188
- _Note:_ on virtual machines, or when rendering of the puppeteer UI fails, you might need to disable the GPU Hardware Acceleration:
189
-
190
- az2aws --mode gui --disable-gpu
191
-
192
- _Note:_ on Linux you will likely need to disable the Puppeteer sandbox or Chrome will fail to launch:
193
-
194
- az2aws --no-sandbox
195
-
196
- ### Behind corporate proxy
197
-
198
- If behind corporate proxy, then just set https_proxy env variable.
175
+ **Tips:**
176
+ - Set `AWS_PROFILE` env var instead of using `--profile`
177
+ - Use `--mode gui --disable-gpu` on VMs or if rendering fails
178
+ - Use `--no-sandbox` on Linux
179
+ - Set `https_proxy` env var for corporate proxy
199
180
 
200
181
  ## Automation
201
182
 
202
- ### Renew credentials for all configured profiles
203
-
204
- You can renew credentials for all configured profiles in one run. This is especially useful, if the maximum session length on AWS side is configured to a low value due to security constraints. Just run:
183
+ Renew all profiles at once (useful for short session limits):
205
184
 
206
185
  az2aws --all-profiles
186
+ az2aws --all-profiles --no-prompt # With "Stay logged in" enabled
207
187
 
208
- If you configure all profiles to stay logged in, you can easily skip the prompts:
209
-
210
- az2aws --all-profiles --no-prompt
211
-
212
- This will allow you to automate the credentials refresh procedure, eg. by running a cronjob every 5 minutes.
213
- To skip unnecessary calls, the credentials are only getting refreshed if the time to expire is lower than 11 minutes.
188
+ Credentials are only refreshed if expiring within 11 minutes - safe to run as a cron job.
214
189
 
215
190
  ## Getting Your Tenant ID and App ID URI
216
191
 
@@ -232,14 +207,11 @@ The Azure login page uses JavaScript, which requires a real web browser. To auto
232
207
 
233
208
  ## Troubleshooting
234
209
 
235
- The nature of browser automation with Puppeteer means the solution is bit brittle. A minor change on the Microsoft side could break the tool. If something isn't working, you can fall back to GUI mode (above). To debug an issue, you can run in debug mode (--mode debug) to see the GUI while az2aws tries to populate it. You can also have the tool print out more detail on what it is doing to try to do in order to diagnose. az2aws uses the [Node debug module](https://www.npmjs.com/package/debug) to print out debug info. Just set the DEBUG environmental variable to 'az2aws'. On Linux/OS X:
236
-
237
- DEBUG=az2aws az2aws
238
-
239
- On Windows:
210
+ If login fails, try these in order:
240
211
 
241
- set DEBUG=az2aws
242
- az2aws
212
+ 1. **GUI mode**: `az2aws --mode gui` - most reliable
213
+ 2. **Debug mode**: `az2aws --mode debug` - see browser while CLI runs
214
+ 3. **Verbose logging**: `DEBUG=az2aws az2aws` (Windows: `set DEBUG=az2aws && az2aws`)
243
215
 
244
216
  ## Support for Other Authentication Providers
245
217
 
package/lib/login.js CHANGED
@@ -788,6 +788,9 @@ exports.login = {
788
788
  };
789
789
  }
790
790
  if (awsNoVerifySsl) {
791
+ console.warn("WARNING: SSL certificate verification is disabled. " +
792
+ "This makes the connection vulnerable to MITM attacks. " +
793
+ "Consider using NODE_EXTRA_CA_CERTS environment variable instead.");
791
794
  stsOptions = {
792
795
  ...stsOptions,
793
796
  requestHandler: new node_http_handler_1.NodeHttpHandler({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "az2aws",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Use Azure AD SSO to log into the AWS CLI.",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -10,9 +10,9 @@
10
10
  "license": "MIT",
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "git+https://github.com/az2aws/az2aws.git"
13
+ "url": "git+https://github.com/kuma0128/az2aws.git"
14
14
  },
15
- "bugs": "https://github.com/az2aws/az2aws/issues",
15
+ "bugs": "https://github.com/kuma0128/az2aws/issues",
16
16
  "engines": {
17
17
  "node": ">=22.0"
18
18
  },