progon-agent 1.0.2 → 1.1.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.
package/README.md CHANGED
@@ -50,6 +50,40 @@ and Node escape hatches apply to the download exactly as they later apply to the
50
50
  | `PLAYWRIGHT_DOWNLOAD_HOST` | The Playwright CDN is blocked — point this at an internal mirror |
51
51
  | `PLAYWRIGHT_BROWSERS_PATH` | The browser cache must live somewhere other than the per-user default |
52
52
 
53
+ ### Self-signed stands
54
+
55
+ An internal stand behind a certificate this machine does not trust is refused by the run browser,
56
+ and the run ends at the `entry_navigation` stage with `net::ERR_CERT_AUTHORITY_INVALID` naming the
57
+ address. There are two settings, and they cover **different connections** — read the table before
58
+ picking one:
59
+
60
+ | Variable | Whose TLS it affects |
61
+ | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
62
+ | `PROGON_AGENT_ALLOW_INSECURE_HTTPS` | The **run browser**. Set it to `true` and Chromium opens the stand without verifying its certificate. |
63
+ | `PROGON_AGENT_EXTRA_CA_CERTS` | The **agent's own** calls to the Progon backend, when a corporate gateway re-signs their TLS. Absolute path to a PEM bundle; it is added to the public roots, never substituted for them. |
64
+
65
+ `PROGON_AGENT_EXTRA_CA_CERTS` does **not** make the browser trust anything: Chromium has no flag
66
+ for adding a certificate authority — its trust store is the operating system's. To have the browser
67
+ verify your stand properly rather than skip the check, install the root certificate into the OS
68
+ store; `PROGON_AGENT_ALLOW_INSECURE_HTTPS` is the escape hatch for when you cannot.
69
+
70
+ Both are **the machine operator's** settings and exist only here, on this machine. Neither is a
71
+ project, environment or per-run field, and nothing a Progon user dispatches can turn certificate
72
+ verification off on your machine.
73
+
74
+ ```bash
75
+ PROGON_AGENT_ALLOW_INSECURE_HTTPS=true progon-agent start
76
+ ```
77
+
78
+ Unlike `NODE_EXTRA_CA_CERTS`, which Node ignores with a warning when the path is wrong,
79
+ `PROGON_AGENT_EXTRA_CA_CERTS` is checked when the daemon starts: a relative path, a missing file, a
80
+ directory, or a file this daemon is not allowed to open is refused by name, before anything else
81
+ happens. The bundle is read during that check, so "the agent can use it" is established at startup
82
+ rather than assumed until the first call to the backend.
83
+
84
+ It also covers those calls when they go through a proxy: with `HTTPS_PROXY` set, the bundle is
85
+ applied both to the tunnelled connection to the backend and to the connection to the proxy itself.
86
+
53
87
  ---
54
88
 
55
89
  ## 2. Install
@@ -68,6 +102,9 @@ machine, install included:
68
102
  npm i -g progon-agent && progon-agent enroll <code> --server "https://your-progon-host" && progon-agent start
69
103
  ```
70
104
 
105
+ `--server` is remembered: enrollment persists it next to the credential, so the third command —
106
+ and every later `progon-agent start` — needs no environment variable of its own.
107
+
71
108
  On Windows, run this in PowerShell 7 or cmd — Windows PowerShell 5.1 does not support `&&`;
72
109
  there, run the commands one at a time.
73
110
 
@@ -104,9 +141,10 @@ Enrollment binds this machine to one agent record in your Progon company and giv
104
141
  progon-agent enroll <code> --server "https://your-progon-host"
105
142
  ```
106
143
 
107
- `--server` is how `PROGON_SERVER_URL` gets set for this command; it may be omitted only if that
108
- variable is already exported. The command redeems the code, persists the credential and exits — it
109
- does not start the daemon, does not download Chromium and does not need the extension dist.
144
+ `--server` is how `PROGON_SERVER_URL` gets set for this command; omit it only if that variable is
145
+ already exported, or if this machine is already enrolled and you mean the deployment it is enrolled
146
+ against. The command redeems the code, persists the credential — the server URL with it — and exits:
147
+ it does not start the daemon, does not download Chromium and does not need the extension dist.
110
148
 
111
149
  ### Enroll without a code (browser approval)
112
150
 
@@ -156,9 +194,10 @@ itself with ever reaches the terminal, which is what makes this flow safe to run
156
194
  whose transcript you do not control. The confirmation code is useless to anyone without your own
157
195
  web session.
158
196
 
159
- Exit codes: `0` enrolled (or already enrolled); `1` the enrollment did not happen — denied,
160
- expired, `--timeout` exhausted, already completed from another machine, no longer valid, or the
161
- network still failing when the deadline passed; `2` the command line was wrong; `130` interrupted
197
+ Exit codes: `0` enrolled, or already enrolled **against this same server**; `1` the enrollment did
198
+ not happen — denied, expired, `--timeout` exhausted, already completed from another machine, no
199
+ longer valid, this machine is already enrolled against a **different** server, or the network was
200
+ still failing when the deadline passed; `2` the command line was wrong; `130` interrupted
162
201
  with Ctrl-C — the first Ctrl-C withdraws the pending request before exiting, a second one exits at
163
202
  once and leaves the request to expire on its own.
164
203
 
@@ -193,14 +232,51 @@ Precedence, highest first:
193
232
  Two consequences worth knowing:
194
233
 
195
234
  - **The server URL must match the enrollment.** On the state-file path the daemon refuses to start
196
- if `PROGON_SERVER_URL` differs from the URL the credential was enrolled against — a `pgat_`
197
- token is meaningless at another deployment, and authenticating blind would show up as an endless
198
- 401 backoff.
235
+ if `PROGON_SERVER_URL` is set to something other than the URL the credential was enrolled
236
+ against — a `pgat_` token is meaningless at another deployment, and authenticating blind would
237
+ show up as an endless 401 backoff.
199
238
  - **`PROGON_AGENT_TOKEN` alone is not enough to run.** An env token carries no `agentId`, and the
200
239
  extension's `agent-manifest.json` must name one, so that path additionally requires
201
240
  `PROGON_AGENT_EXTENSION_DIST` pointing at an already agent-mode dist. For ordinary operation,
202
241
  enroll instead.
203
242
 
243
+ ### Which server the daemon uses
244
+
245
+ Precedence, highest first:
246
+
247
+ 1. **`--server <url>`** on the `enroll` command — it sets `PROGON_SERVER_URL` for that one process.
248
+ 2. **`PROGON_SERVER_URL`** in the environment.
249
+ 3. **The enrolled deployment** — the `serverUrl` this machine's state file records. This is why
250
+ `progon-agent start` needs no environment after `enroll`: the URL was persisted together with
251
+ the credential it belongs to.
252
+
253
+ Two rules complete it:
254
+
255
+ - **Set means checked, not preferred.** When `PROGON_SERVER_URL` is set it must still match the
256
+ enrollment; `start` refuses on a mismatch rather than authenticating blind. Unsetting it is a
257
+ valid way to go back to the enrolled server.
258
+ - **`PROGON_AGENT_TOKEN` requires it.** That token names no deployment, and it is also the path
259
+ for recovering from a state file that cannot be read — so on that path the state file is not
260
+ consulted for the server either, and `PROGON_SERVER_URL` is required.
261
+
262
+ On a machine that is not enrolled and has no `PROGON_SERVER_URL`, every command that needs a server
263
+ says so and names both remedies. `progon-agent install-browser` is the exception that needs neither:
264
+ it reads no configuration at all.
265
+
266
+ ### Enrolling one machine into two deployments
267
+
268
+ The credential and the server URL live together in one state directory, so a second enrollment gets
269
+ a second directory:
270
+
271
+ ```bash
272
+ PROGON_RUNNER_STATE_DIR=~/.progon-agent-staging progon-agent enroll --server "https://staging.example"
273
+ PROGON_RUNNER_STATE_DIR=~/.progon-agent-staging progon-agent start
274
+ ```
275
+
276
+ Running `enroll` for a different deployment **without** a separate state directory is refused: the
277
+ command reports which deployment this machine is already enrolled against, exits `1`, and removes
278
+ nothing — a credential is only ever deleted by you.
279
+
204
280
  ---
205
281
 
206
282
  ## 4. Run
@@ -209,7 +285,9 @@ Two consequences worth knowing:
209
285
  progon-agent start
210
286
  ```
211
287
 
212
- Requires `PROGON_SERVER_URL` and an enrolled machine. The daemon boots (config → identity →
288
+ Requires an enrolled machine, and nothing else: the server comes from the state file the
289
+ enrollment wrote, so no environment variable is needed (set `PROGON_SERVER_URL` and it must match
290
+ that enrollment). The daemon boots (config → identity →
213
291
  extension dist → Chromium → gateway), then reconciles the backend's desired state and executes the
214
292
  runs it is given, until you stop it.
215
293
 
@@ -252,23 +330,26 @@ A `401` is _not_ revocation: it backs off and retries, and never wipes anything.
252
330
 
253
331
  ### Runtime
254
332
 
255
- | Variable | Required | Meaning |
256
- | ----------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
257
- | `PROGON_SERVER_URL` | **yes** (`enroll`, `start`) | Base URL of the Progon backend. `https://` only, except loopback hosts. Scheme + host + optional path prefix — **no** embedded credentials, **no** query string, **no** fragment (the agent-gateway routes are appended to it). |
258
- | `PROGON_AGENT_TOKEN` | no | An existing `pgat_` credential. Takes precedence over the state file — this is the rotation mechanism. Must match the `pgat_` wire format; set-but-empty is rejected. |
259
- | `PROGON_AGENT_ENROLL_CODE` | no | One-shot enrollment code, the env form of `progon-agent enroll <code>`. Must be at least 32 characters. |
260
- | `PROGON_RUNNER_STATE_DIR` | no | Overrides the platform state directory. **Required** on platforms other than darwin/linux/win32, and when the user has no home directory. |
261
- | `PROGON_AGENT_EXTENSION_DIST` | no | Absolute path of an already agent-mode qa-extension dist, replacing the bundled one (dev/E2E). Relative paths are rejected. |
262
- | `PROGON_AGENT_HEADFUL` | no | `true`/`false`/`1`/`0`. Shows the browser window on this machine's desktop. Default `false`. It can only turn headful **on** — the server still decides per run. Any other value is rejected. |
263
- | `PROGON_LOG_LEVEL` | no | pino log level. Default: `info` when `NODE_ENV=production`, `debug` otherwise. |
264
- | `NODE_ENV` | no | Default `production`. Anything else additionally switches logging to human-readable `pino-pretty` output. |
333
+ | Variable | Required | Meaning |
334
+ | ----------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
335
+ | `PROGON_SERVER_URL` | until enrolled | Base URL of the Progon backend. `https://` only, except loopback hosts. Scheme + host + optional path prefix — **no** embedded credentials, **no** query string, **no** fragment (the agent-gateway routes are appended to it). Once this machine is enrolled the URL comes from the state file, and setting this variable to a different deployment makes `start` refuse; it stays **required** alongside `PROGON_AGENT_TOKEN`. See [Which server the daemon uses](#which-server-the-daemon-uses). |
336
+ | `PROGON_AGENT_TOKEN` | no | An existing `pgat_` credential. Takes precedence over the state file — this is the rotation mechanism. Must match the `pgat_` wire format; set-but-empty is rejected. |
337
+ | `PROGON_AGENT_ENROLL_CODE` | no | One-shot enrollment code, the env form of `progon-agent enroll <code>`. Must be at least 32 characters. |
338
+ | `PROGON_RUNNER_STATE_DIR` | no | Overrides the platform state directory. **Required** on platforms other than darwin/linux/win32, and when the user has no home directory. |
339
+ | `PROGON_AGENT_EXTENSION_DIST` | no | Absolute path of an already agent-mode qa-extension dist, replacing the bundled one (dev/E2E). Relative paths are rejected. |
340
+ | `PROGON_AGENT_HEADFUL` | no | `true`/`false`/`1`/`0`. Shows the browser window on this machine's desktop. Default `false`. It can only turn headful **on** — the server still decides per run. Any other value is rejected. |
341
+ | `PROGON_AGENT_ALLOW_INSECURE_HTTPS` | no | `true`/`false`/`1`/`0`. The run browser opens a stand whose certificate it cannot verify — a self-signed internal stand. Default `false`. Any other value is rejected. See [Self-signed stands](#self-signed-stands). |
342
+ | `PROGON_AGENT_EXTRA_CA_CERTS` | no | Absolute path to a readable PEM bundle whose authority the **agent's own** connections to the backend trust, on top of the public roots. Refused at startup if the path is relative or the file cannot be read. Does not reach the browser. |
343
+ | `PROGON_LOG_LEVEL` | no | pino log level. Default: `info` when `NODE_ENV=production`, `debug` otherwise. |
344
+ | `NODE_ENV` | no | Default `production`. Anything else additionally switches logging to human-readable `pino-pretty` output. |
265
345
 
266
346
  ### Inherited by the Chromium installer and launch
267
347
 
268
348
  `HTTPS_PROXY`, `NO_PROXY`, `NODE_EXTRA_CA_CERTS`, `PLAYWRIGHT_DOWNLOAD_HOST`,
269
349
  `PLAYWRIGHT_BROWSERS_PATH` — see [Corporate networks](#corporate-networks). The agent reads none of
270
350
  them itself; it passes the whole environment through, so they behave exactly as Playwright and Node
271
- document.
351
+ document. For TLS specifically the agent has settings of its own, and they cover connections these
352
+ do not — see [Self-signed stands](#self-signed-stands).
272
353
 
273
354
  ---
274
355
 
@@ -304,6 +385,14 @@ A download killed at the 60-minute deadline is the known Playwright stall
304
385
  (microsoft/playwright#40998) — usually a connection that went silent rather than failed. Nothing is
305
386
  assumed installed: the next start simply downloads again.
306
387
 
388
+ **A run fails with `net::ERR_CERT_AUTHORITY_INVALID` (or another `net::ERR_CERT_*`).** The stand's
389
+ certificate is not one this machine trusts — typically a self-signed internal stand. The failure
390
+ now carries the network cause and the address all the way to the job's page in Progon, so the
391
+ address in it is the one the browser actually tried. Install the stand's root certificate into the
392
+ OS trust store, or start the agent with `PROGON_AGENT_ALLOW_INSECURE_HTTPS=true` — see
393
+ [Self-signed stands](#self-signed-stands). `NODE_EXTRA_CA_CERTS` and `PROGON_AGENT_EXTRA_CA_CERTS`
394
+ do **not** help here: neither reaches Chromium.
395
+
307
396
  **`start` fails with "No extension dist is bundled in this package".** The installation is damaged:
308
397
  every published package ships the extension inside it. Reinstall:
309
398
 
@@ -312,8 +401,15 @@ npm i -g progon-agent@latest
312
401
  ```
313
402
 
314
403
  **`start` fails saying the credential was enrolled against a different server.** `PROGON_SERVER_URL`
315
- no longer matches the enrollment. Point it back, or remove the state file and enroll against the
316
- new deployment.
404
+ is set to something the enrollment does not match. Point it back, unset it — an enrolled machine
405
+ reads the server from its own state file — or remove the state file and enroll against the new
406
+ deployment.
407
+
408
+ **`start` fails saying this machine is not enrolled and `PROGON_SERVER_URL` is not set.** Nothing
409
+ on this machine names a deployment: there is no state file in the state directory and no
410
+ environment variable. Enroll it (`progon-agent enroll --server "https://your-progon-host"`), or
411
+ export `PROGON_SERVER_URL`. If you enrolled with `PROGON_RUNNER_STATE_DIR` set, `start` needs the
412
+ same variable — that is where the credential is.
317
413
 
318
414
  **The daemon exits 1 mid-run reporting a revocation.** The agent was revoked server-side and its
319
415
  local credential has been wiped. Mint a new code and re-enroll — see