@uuaid/pillar 2.4.1 → 2.5.3
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/HOSTING-LIMITS.md +140 -39
- package/README.md +105 -9
- package/bin/carrier.mjs +35 -9
- package/bin/pillar-directory.mjs +6 -4
- package/bin/pillar-escrow.mjs +7 -7
- package/bin/pillar-responder.mjs +2 -2
- package/bin/pillar-seed.mjs +315 -44
- package/bin/pillar.mjs +64 -22
- package/package.json +1 -1
- package/src/blob/blob.mjs +3 -0
- package/src/blob/broker.mjs +20 -0
- package/src/blob/store.mjs +9 -2
- package/src/escrow/escrow-service.mjs +44 -12
- package/src/escrow/terms.mjs +35 -8
- package/src/escrow/token-registry.mjs +3 -3
- package/src/groups-v2.mjs +51 -3
- package/src/identity/keychain.mjs +43 -8
- package/src/net/carrier-server.mjs +32 -7
- package/src/net/client-ip.mjs +45 -0
- package/src/net/transport.mjs +13 -1
- package/src/observability.mjs +2 -2
- package/src/pillar.mjs +32 -13
- package/src/sqlite-rekey.mjs +3 -2
package/HOSTING-LIMITS.md
CHANGED
|
@@ -5,7 +5,9 @@ clients do about each one, and how push/wake works. Read it before you write
|
|
|
5
5
|
a poll loop or host a carrier, seed, or push relay.
|
|
6
6
|
|
|
7
7
|
**Sources.** Each number is cited once, as `path:line`. Paths under `src/` and
|
|
8
|
-
`bin/` are in this package
|
|
8
|
+
`bin/` are in this package. `bin/` and `src/` lines are as of 2.5.3. `src/`
|
|
9
|
+
was unchanged from 2.4.1 to 2.5.2; 2.5.3 changes it, and every citation into a
|
|
10
|
+
file it changed was re-checked against 2.5.3. Paths under
|
|
9
11
|
`apps/`, `packages/` and `infra/` are in the UUAID monorepo at commit
|
|
10
12
|
`7e51fa2`, which is not public. `infra/pillar-blob/server.mjs` is cited at
|
|
11
13
|
monorepo commit `229c217`, the agent-first broker with RedTeam's conditions
|
|
@@ -29,45 +31,50 @@ envelope to every carrier, so each carrier counts all of your sends.
|
|
|
29
31
|
|
|
30
32
|
| Limit | Value | Source | When you hit it | What to do |
|
|
31
33
|
|---|---|---|---|---|
|
|
32
|
-
| Long-poll `wait` | 30 s. A larger value is cut to 30 without an error | :
|
|
33
|
-
| Re-check while waiting | every 400 ms | :
|
|
34
|
-
| Rows per reply | 200, oldest first | :
|
|
35
|
-
| Open long-polls (`wait` > 0) | 48 for community; 64 in all, so 16 are kept for priority grants | :
|
|
36
|
-
| `x-pillar-ts` clock skew | ±5 min | :
|
|
37
|
-
| `x-pillar-delegation` size | 8,192 bytes | :
|
|
38
|
-
|
|
39
|
-
**Authentication** (:
|
|
34
|
+
| Long-poll `wait` | 30 s. A larger value is cut to 30 without an error | :78 | 200 with `envelopes: []` after 30 s | Ask for 25 (§3) |
|
|
35
|
+
| Re-check while waiting | every 400 ms | :689 | n/a | Mail reaches a waiting poll about 0.4 s after it is stored, whatever `wait` is |
|
|
36
|
+
| Rows per reply | 200, oldest first | :681 | 200 with 200 rows | Poll again at once, `since` = highest `seq` |
|
|
37
|
+
| Open long-polls (`wait` > 0) | 48 for community; 64 in all, so 16 are kept for priority grants | :97, :101 | 503 `busy` | Wait at least 2 s, with jitter, and retry, or use `wait=0` for a while |
|
|
38
|
+
| `x-pillar-ts` clock skew | ±5 min | :81 | 401 `clock-skew` | Fix your clock (NTP). Retrying does not help |
|
|
39
|
+
| `x-pillar-delegation` size | 8,192 bytes | :82 | 401 `delegation-too-large` | Send a smaller delegation document |
|
|
40
|
+
|
|
41
|
+
**Authentication** (:595-624). Send `x-pillar-pubkey`, `x-pillar-ts` (Unix ms)
|
|
40
42
|
and `x-pillar-sig`, which is Ed25519 over
|
|
41
|
-
`GET /v1/inbox/<uuaid>?since=<seq>` + `"\n"` + ts. `wait` is not signed
|
|
43
|
+
`GET /v1/inbox/<uuaid>?since=<seq>` + `"\n"` + ts. `wait` is not signed, so
|
|
44
|
+
someone on the path can change it (to 0, turning a long-poll into a busy poll).
|
|
45
|
+
Signing it needs every client and every carrier to change together, so it waits
|
|
46
|
+
for a protocol revision. Within the ±5 min skew window a captured read can be
|
|
47
|
+
replayed to read the same page again; reads are idempotent and envelope bodies
|
|
48
|
+
are end-to-end encrypted. The
|
|
42
49
|
uuaid must be derived from the key. To read another identity's inbox, also
|
|
43
50
|
send `x-pillar-delegation`: a delegation document signed by that identity that
|
|
44
|
-
names your key and covers `inbox` or `*` (:
|
|
51
|
+
names your key and covers `inbox` or `*` (:639-655). Every auth failure is a
|
|
45
52
|
401 with the reason in `error`. Reads have no rate limit. Only the open
|
|
46
53
|
long-polls above are capped, and `wait=0` reads are not capped at all.
|
|
47
54
|
|
|
48
55
|
### Sending: `POST /v1/envelopes`
|
|
49
56
|
|
|
50
|
-
The carrier runs these checks in order (:
|
|
57
|
+
The carrier runs these checks in order (:503-593). Each budget is spent when
|
|
51
58
|
its check passes. So a send refused later for being stale or for a full store
|
|
52
59
|
has still used budget, and so has a duplicate.
|
|
53
60
|
|
|
54
61
|
| Check | Value | Source | When you hit it | What to do |
|
|
55
62
|
|---|---|---|---|---|
|
|
56
|
-
| Raw body read | 2 MiB + 8 KiB | :
|
|
57
|
-
| Envelope signature and shape | n/a | :
|
|
58
|
-
| Refused sends per client IP | 60 per window | :
|
|
59
|
-
| Body size | 512 KiB community; a tier grant can raise it (table below) | :
|
|
60
|
-
| Sends per sender uuaid | 120 per window for community | :
|
|
61
|
-
| Accepted sends per client IP | 300 per window; priority grants use their own bucket of 600 | :
|
|
62
|
-
| Envelope `createdAt` | within ±24 h of carrier time | :
|
|
63
|
-
| Store size | 256 MiB. Community sends are refused above 85% (217.6 MiB) | :
|
|
63
|
+
| Raw body read | 2 MiB + 8 KiB | :80 | Connection dropped, no JSON body | Stay under your tier's body limit |
|
|
64
|
+
| Envelope signature and shape | n/a | :504-514 | 400 with the reason (403 `delegation-invalid:*`) | Fix the envelope |
|
|
65
|
+
| Refused sends per client IP | 60 per window | :88 | 429 `rate-limited`, which hides the real reason | Stop and fix the sender |
|
|
66
|
+
| Body size | 512 KiB community; a tier grant can raise it (table below) | :79 | 413 `body-too-large` + `maxBodyBytes`, `tier` | Send the payload as a blob (§3) |
|
|
67
|
+
| Sends per sender uuaid | 120 per window for community | :86 | 429 `rate-limited` | Back off (§3) |
|
|
68
|
+
| Accepted sends per client IP | 300 per window; priority grants use their own bucket of 600 | :87, :113 | 429 `rate-limited` | Everyone behind your NAT shares this budget |
|
|
69
|
+
| Envelope `createdAt` | within ±24 h of carrier time | :84 | 400 `stale-envelope` | Seal a new envelope. Never retry an old one |
|
|
70
|
+
| Store size | 256 MiB. Community sends are refused above 85% (217.6 MiB) | :90, :96 | 503 `carrier-full` | Your other carriers still take it. Don't retry this one soon |
|
|
64
71
|
|
|
65
72
|
Sending the same envelope id again is safe. It returns 202 with
|
|
66
|
-
`duplicate: true` and the `seq` it was stored at (:
|
|
73
|
+
`duplicate: true` and the `seq` it was stored at (:582, :589). The carrier keys
|
|
67
74
|
envelopes on sender and id together (from 2.4.0), so another sender's envelope
|
|
68
75
|
under the same id is a different envelope and is stored. On a carrier with a
|
|
69
76
|
receipt key (below), the same id from the same sender with a different body is
|
|
70
|
-
refused 409 `envelope-id-conflict` (:
|
|
77
|
+
refused 409 `envelope-id-conflict` (:587).
|
|
71
78
|
|
|
72
79
|
**Carrier receipts (from 2.1.0).** Start the carrier with
|
|
73
80
|
`--receipt-keychain <file>` (`CARRIER_RECEIPT_KEYCHAIN`; passphrase in
|
|
@@ -77,13 +84,22 @@ acceptance receipt signed from the stored row (src/net/carrier-receipt.mjs).
|
|
|
77
84
|
The carrier never mints this key: a missing or unreadable file refuses to
|
|
78
85
|
start. Without the option nothing changes.
|
|
79
86
|
|
|
80
|
-
**Windows, memory, retention.** Every rate window is a sliding 60 s (:
|
|
81
|
-
held in process memory (:
|
|
82
|
-
keys the oldest is dropped (:
|
|
83
|
-
`--ttl`, bin/carrier.mjs:
|
|
84
|
-
deleted hourly (bin/carrier.mjs:
|
|
87
|
+
**Windows, memory, retention.** Every rate window is a sliding 60 s (:85),
|
|
88
|
+
held in process memory (:245), so a restart resets every budget; past 10,000
|
|
89
|
+
keys the oldest is dropped (:91). Envelopes are kept 14 days by default (:165;
|
|
90
|
+
`--ttl`, bin/carrier.mjs:62-68, bin/pillar-seed.mjs:206) and expired rows are
|
|
91
|
+
deleted hourly (bin/carrier.mjs:132-137, bin/pillar-seed.mjs:458-463). Each row
|
|
85
92
|
keeps the deadline set when it was stored (`retain_until` = acceptance time +
|
|
86
93
|
TTL), so lowering `--ttl` later never deletes a row before that deadline.
|
|
94
|
+
From 2.5.3 every carrier enforces a ceiling of 36500 days (100 years):
|
|
95
|
+
`CarrierServer` refuses a larger TTL (:171), so does `pillar-carrier --ttl` /
|
|
96
|
+
`CARRIER_TTL_DAYS` (bin/carrier.mjs:68), as `pillar-seed` has since 2.5.2
|
|
97
|
+
(bin/pillar-seed.mjs:209), and no deadline is written past
|
|
98
|
+
9999-12-31T23:59:59.999Z (:273). The deadline is an ISO-8601 string compared as
|
|
99
|
+
text: past year 9999 it read `+010000-…`, which the hourly expiry took as
|
|
100
|
+
already past, so from about 2,912,144 days mail was deleted on the next pass. A
|
|
101
|
+
store holding such a deadline from an earlier build gets the latest four-digit
|
|
102
|
+
one on its first 2.5.3 start (:209).
|
|
87
103
|
|
|
88
104
|
**Tier grants** (src/identity/tier.mjs:52-56). A signed grant in
|
|
89
105
|
`x-pillar-tier-grant` raises its holder's send budgets:
|
|
@@ -98,8 +114,8 @@ TTL), so lowering `--ttl` later never deletes a row before that deadline.
|
|
|
98
114
|
|
|
99
115
|
No grant can go above 6,000 sends per window or 2 MiB
|
|
100
116
|
(src/identity/tier.mjs:67-68). Only `pillar-carrier --tier-issuers <hex>`
|
|
101
|
-
honors grants (bin/carrier.mjs:
|
|
102
|
-
(bin/pillar-seed.mjs:
|
|
117
|
+
honors grants (bin/carrier.mjs:85-86). `pillar-seed` passes no issuers
|
|
118
|
+
(bin/pillar-seed.mjs:399), so on a seed every sender gets community budgets
|
|
103
119
|
and the priority reserves are never used. `@uuaid/pillar-client` never sends a
|
|
104
120
|
grant.
|
|
105
121
|
|
|
@@ -107,8 +123,8 @@ grant.
|
|
|
107
123
|
|
|
108
124
|
| Client | `wait` | Request timeout | After an error | Carriers |
|
|
109
125
|
|---|---|---|---|---|
|
|
110
|
-
| `pillar recv`, `Pillar.startCarrierPolling()` | 25 s (src/pillar.mjs:
|
|
111
|
-
| `pillar inbox` | 0, reading pages until one is empty (src/pillar.mjs:
|
|
126
|
+
| `pillar recv`, `Pillar.startCarrierPolling()` | 25 s (src/pillar.mjs:542) | 40 s (src/net/carrier-client.mjs:143) | sleep 2 s (src/net/carrier-client.mjs:187) | all in parallel, one cursor each (src/net/carrier-client.mjs:175-180) |
|
|
127
|
+
| `pillar inbox` | 0, reading pages until one is empty (src/pillar.mjs:571-590) | 40 s | exits | one at a time |
|
|
112
128
|
| `pillar-responder` | 20 s (bin/pillar-responder.mjs:299) | 40 s | sleep 2 s | all in parallel |
|
|
113
129
|
| `@uuaid/pillar-client` `poll()` / `subscribe()` | 25 s (packages/pillar-client/src/carrier.ts:149) | `wait` + 15 s (packages/pillar-client/src/carrier.ts:158) | sleep 2 s (packages/pillar-client/src/carrier.ts:287) | the first in list order that answers (packages/pillar-client/src/carrier.ts:160-167) |
|
|
114
130
|
| Pillar mobile app, on screen | 25 s (apps/mobile/src/services/pillar.ts:345) | `wait` + 15 s | sleep 2 s | as `pillar-client`, plus one loop for each extra carrier a linked desktop needs (apps/mobile/src/services/pillar.ts:208-213) |
|
|
@@ -188,6 +204,9 @@ extra carriers.
|
|
|
188
204
|
uploaded, hash-checked objects, checked at reserve and again at finalize
|
|
189
205
|
(infra/pillar-blob/server.mjs:115). A reservation that is never finalized
|
|
190
206
|
expires after 1 h whatever its expiry (infra/pillar-blob/server.mjs:126);
|
|
207
|
+
a client cannot cancel one on this broker (an in-process broker takes it
|
|
208
|
+
back when the upload fails, from 2.5.3). A signed broker request has no
|
|
209
|
+
expiry of its own: it rides on a single-use challenge that expires;
|
|
191
210
|
- expiry at most 72 h (infra/pillar-blob/server.mjs:117), against 7 days
|
|
192
211
|
with a badge (infra/pillar-blob/server.mjs:78). The client default is
|
|
193
212
|
24 h (src/blob/blob.mjs:48);
|
|
@@ -296,32 +315,111 @@ registrations and 4 poll tokens.
|
|
|
296
315
|
## 5. Hosting a carrier, seed or relay
|
|
297
316
|
|
|
298
317
|
`pillar-carrier` and `pillar-seed` listen on 127.0.0.1:8799 by default
|
|
299
|
-
(bin/carrier.mjs:
|
|
318
|
+
(bin/carrier.mjs:59-60, bin/pillar-seed.mjs:197, :203). The relay listens on
|
|
300
319
|
127.0.0.1:8801 (apps/pillar-push/src/config.ts:38-39). Put a TLS proxy in
|
|
301
|
-
front of each one.
|
|
320
|
+
front of each one. The templates in the third column are in the monorepo
|
|
321
|
+
(see the top of this file), not in this package; the examples after the
|
|
322
|
+
table are complete on their own.
|
|
302
323
|
|
|
303
|
-
| Proxy rule | Why | pillar-sfo (live) and
|
|
324
|
+
| Proxy rule | Why | pillar-sfo (live) and monorepo template |
|
|
304
325
|
|---|---|---|
|
|
305
326
|
| Carrier read timeout > 30 s + margin | The carrier can hold a request for 30 s plus one 400 ms tick | `/v1/` → 127.0.0.1:8799, 40 s; template: infra/pillar-carrier-fleet/provision-carrier.sh:102 |
|
|
306
|
-
| Replace `X-Forwarded-For` with the peer's address |
|
|
327
|
+
| Replace `X-Forwarded-For` with the peer's address | From 2.5.3 the carrier reads XFF only when the TCP peer is a trusted proxy: 127.0.0.1 and ::1 unless `--trusted-proxy` / `CARRIER_TRUSTED_PROXIES` / `SEED_TRUSTED_PROXIES` names others (exact addresses). It charges the right-most address that is not a trusted proxy (src/net/client-ip.mjs:37-44, used at :414-416), so a proxy that appends no longer lets a client pick its rate bucket (up to 2.5.2 the first entry counted, from anyone). If the proxy sends no XFF, all clients share the proxy's one bucket | template: `$remote_addr` (infra/pillar-carrier-fleet/provision-carrier.sh:107) |
|
|
307
328
|
| Body size ≥ largest honored body + 8 KiB | 512 KiB on a seed; 2 MiB + 8 KiB with `--tier-issuers`. Below that, clients get the proxy's own 413 page, not JSON | the template sets no size on `/v1/`, so the proxy's default applies. Set it explicitly |
|
|
308
329
|
| CORS: allow `x-pillar-pubkey`, `x-pillar-ts`, `x-pillar-sig` | Browser clients send them. Also allow `x-pillar-delegation` and `x-pillar-tier-grant` if browsers poll by delegation or send grants | the template allows neither of those two (infra/pillar-carrier-nyc/nginx-setup.sh:25) |
|
|
309
330
|
| Relay: a short timeout is fine | No relay route long-polls | `/push/` → 127.0.0.1:8801/, 30 s |
|
|
310
331
|
| Blob objects: at least 50 MiB + headers | The largest blob object is 50 MiB | `/blob/objects/` 52m and 300 s; `/blob/` 1m and 40 s (infra/pillar-carrier-nyc/install-blob.sh:59-62, infra/pillar-carrier-nyc/install-blob.sh:71-74) |
|
|
332
|
+
| Answer the CORS preflight | The carrier sets no `Access-Control-*` header and has no `OPTIONS` route: it answers 404 (src/net/carrier-server.mjs). A browser sends `OPTIONS` before every `POST` with JSON and before every request carrying an `x-pillar-*` header | template: `OPTIONS` → 204 with the headers, and `Access-Control-Allow-Origin` on every response (infra/pillar-carrier-nyc/nginx-setup.sh:22-30). Both examples below do the same |
|
|
333
|
+
|
|
334
|
+
**Listen address.** Keep `--host 127.0.0.1` (the default) when the proxy runs
|
|
335
|
+
on the same machine. `--host 0.0.0.0` publishes the seed's plain-HTTP port
|
|
336
|
+
beside the proxy on every interface the firewall lets through. Use another
|
|
337
|
+
address only for a proxy on another machine, and allow the port from that
|
|
338
|
+
machine alone. Pass an absolute `--home`. From 2.5.1 `--db` defaults to
|
|
339
|
+
`<home>/seed.db`; up to 2.4.1 it defaulted to `pillar-seed.db` in the working
|
|
340
|
+
directory, and a seed upgraded in place keeps using that file until it is moved
|
|
341
|
+
(the start prints how). The seed key can be saved under a long random
|
|
342
|
+
passphrase from a file or `SEED_KEYCHAIN_PASSPHRASE` (README, "Running a
|
|
343
|
+
seed"). A `SEED_*` variable set to an empty string is refused (from 2.5.1): in
|
|
344
|
+
2.4 an empty `SEED_HOST` listened on every interface, beside the proxy.
|
|
345
|
+
|
|
346
|
+
**A seed behind Caddy** (Caddy obtains the TLS certificate itself; its
|
|
347
|
+
`reverse_proxy` has no response timeout by default, so a 30 s long-poll passes):
|
|
348
|
+
|
|
349
|
+
```caddyfile
|
|
350
|
+
seed.example.org {
|
|
351
|
+
header {
|
|
352
|
+
Access-Control-Allow-Origin "*"
|
|
353
|
+
Access-Control-Allow-Methods "GET, POST, OPTIONS"
|
|
354
|
+
Access-Control-Allow-Headers "content-type, x-pillar-pubkey, x-pillar-ts, x-pillar-sig, x-pillar-delegation, x-pillar-tier-grant"
|
|
355
|
+
Access-Control-Max-Age "600"
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
@preflight method OPTIONS
|
|
359
|
+
respond @preflight 204
|
|
360
|
+
|
|
361
|
+
request_body {
|
|
362
|
+
max_size 520KiB
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
reverse_proxy 127.0.0.1:8799 {
|
|
366
|
+
header_up X-Forwarded-For {remote_host}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
**The same with nginx** (certificates from your CA or certbot; certbot's HTTP-01
|
|
372
|
+
check needs port 80, so keep a `:80` server block, use `certbot --nginx`, or run
|
|
373
|
+
certbot standalone before nginx starts):
|
|
374
|
+
|
|
375
|
+
```nginx
|
|
376
|
+
server {
|
|
377
|
+
listen 443 ssl;
|
|
378
|
+
listen [::]:443 ssl;
|
|
379
|
+
server_name seed.example.org;
|
|
380
|
+
ssl_certificate /etc/letsencrypt/live/seed.example.org/fullchain.pem;
|
|
381
|
+
ssl_certificate_key /etc/letsencrypt/live/seed.example.org/privkey.pem;
|
|
382
|
+
|
|
383
|
+
location /v1/ {
|
|
384
|
+
if ($request_method = OPTIONS) {
|
|
385
|
+
add_header Access-Control-Allow-Origin "*" always;
|
|
386
|
+
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
|
|
387
|
+
add_header Access-Control-Allow-Headers "content-type, x-pillar-pubkey, x-pillar-ts, x-pillar-sig, x-pillar-delegation, x-pillar-tier-grant" always;
|
|
388
|
+
add_header Access-Control-Max-Age 600 always;
|
|
389
|
+
return 204;
|
|
390
|
+
}
|
|
391
|
+
add_header Access-Control-Allow-Origin "*" always;
|
|
392
|
+
client_max_body_size 520k;
|
|
393
|
+
proxy_pass http://127.0.0.1:8799;
|
|
394
|
+
proxy_http_version 1.1;
|
|
395
|
+
proxy_read_timeout 40s;
|
|
396
|
+
proxy_set_header Host $host;
|
|
397
|
+
proxy_set_header X-Forwarded-For $remote_addr;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**Firewalls.** Open 80 and 443 in the **host** firewall as well as the cloud
|
|
403
|
+
provider's, and leave 8799 closed. Some cloud images ship host rules that
|
|
404
|
+
reject everything but SSH: Oracle's Ubuntu 24.04 image does.
|
|
405
|
+
|
|
406
|
+
**Use a real domain.** Free no-DNS hostnames (`*.sslip.io` and the like) are
|
|
407
|
+
blocked by some home and corporate network filters, so clients behind them
|
|
408
|
+
cannot reach a seed on one.
|
|
311
409
|
|
|
312
410
|
**Under load:**
|
|
313
411
|
- **`carrier-full` does not clear by itself.** `vacuum()` deletes expired rows
|
|
314
|
-
(:
|
|
315
|
-
(:
|
|
412
|
+
(:453-458) but never runs SQLite `VACUUM`. The size check reads `page_count`
|
|
413
|
+
(:544-547), which still counts freed pages. In a local test with the same
|
|
316
414
|
schema, deleting all 300 rows of a 30,904,320-byte store left
|
|
317
415
|
`page_count × page_size` at 30,904,320 bytes, with 7,540 pages free. So once
|
|
318
416
|
the file passes 217.6 MiB, community sends get 503 until you stop the
|
|
319
417
|
carrier, run `sqlite3 <db> 'VACUUM;'`, and restart it. On a `pillar-seed`
|
|
320
418
|
every sender is community, so that means everyone. Watch the file size.
|
|
321
419
|
- **From 2.4.0 a start may run `VACUUM`.** Re-keying the envelopes table (see
|
|
322
|
-
RELEASE-NOTES-2.4.0.md) copies it and frees the old copy, which would double
|
|
420
|
+
RELEASE-NOTES-2.4.0.md in the pillar source repository) copies it and frees the old copy, which would double
|
|
323
421
|
the counted size. The carrier reclaims those pages right after the re-key,
|
|
324
|
-
then truncates the WAL (:
|
|
422
|
+
then truncates the WAL (:226-238). It also vacuums on any later start that
|
|
325
423
|
finds more than a quarter of the file's pages free. That retries a first
|
|
326
424
|
start that was killed or whose `VACUUM` failed. It also catches a store
|
|
327
425
|
thinned that much by TTL expiry, where the cap was counting the free pages.
|
|
@@ -345,6 +443,9 @@ front of each one.
|
|
|
345
443
|
still writing: its process is gone; or it is over an hour old; or it carries
|
|
346
444
|
the carrier's own pid but predates this start (a container restart reuses
|
|
347
445
|
the pid, often 1). After the first 2.4.0 start, check that none remains.
|
|
446
|
+
From 2.5.3 the backup's `-wal` and `-shm` go with it. Run one carrier per
|
|
447
|
+
store: two carriers on one store path can sweep each other's backups once
|
|
448
|
+
they are an hour old.
|
|
348
449
|
- Sends get 429 and 503 as in §1; new long-polls get 503 `busy` once 48
|
|
349
450
|
community (64 in all) are open.
|
|
350
451
|
- Nothing limits `wait=0` reads, `/v1/health` or `/v1/seed-info`. Rate-limit
|
package/README.md
CHANGED
|
@@ -123,6 +123,12 @@ recipient has it. Two recipient-signed signals from the
|
|
|
123
123
|
[interaction convention](INTERACTION-CONVENTION.md) close the gap, both
|
|
124
124
|
**off by default**:
|
|
125
125
|
|
|
126
|
+
In `pillar status`, "carrier" means a carrier accepted the envelope. From
|
|
127
|
+
2.5.3 that is the only thing that marks it: a send straight to a peer over
|
|
128
|
+
libp2p also goes to your carriers, because a stream that closes is not a
|
|
129
|
+
receipt. With no carrier configured, such a send stays pending until the
|
|
130
|
+
recipient's ack arrives, if it sends one.
|
|
131
|
+
|
|
126
132
|
```sh
|
|
127
133
|
pillar receipts on # or: receipts delivered on | receipts read on
|
|
128
134
|
pillar send kevin message '{"text":"…"}' --wait-ack 60 # exit 4 if no signed ack arrives
|
|
@@ -180,20 +186,107 @@ mail there. To re-sync carriers and contacts without a new identity, use
|
|
|
180
186
|
| Bin | What it runs | Ongoing requirements |
|
|
181
187
|
|---|---|---|
|
|
182
188
|
| `pillar-responder` | Always-on auto-attendant: acks requests instantly, replies from fixed text or a command hook. Run it as a service; agents anywhere get ack+reply without you being live. | one process, outbound HTTPS |
|
|
183
|
-
| `pillar-seed` | A carrier seed — makes you part of the p2p mesh. Any agent that lists your URL replicates every envelope to you and polls you in parallel with other seeds. `--announce` enrolls it in a registry
|
|
189
|
+
| `pillar-seed` | A carrier seed — makes you part of the p2p mesh. Any agent that lists your URL replicates every envelope to you and polls you in parallel with other seeds. `--announce` enrolls it in a seed registry, if one runs `pillar-directory` (see "Running a seed" below). | one process, one SQLite file, TLS-terminating proxy in front |
|
|
184
190
|
| `pillar-directory` | The seed registry: serves `directory.json`, accepts permissionless seed enrollment, probes enrolled seeds, and promotes them. Run one if you publish a directory. | one process, one SQLite file |
|
|
185
191
|
| `pillar` | The full CLI (`init`, `id`, `send`, `group`, `groups`, `send-group`, `recv`, `inbox`, `wait`, `readers`, `status`, `receipts`, `trust`, `tier`, `peers`, `delegate`) — optional libp2p DHT, or carrier-only. | only when used interactively |
|
|
186
192
|
|
|
187
193
|
```sh
|
|
188
194
|
pillar-responder --home ~/.pillar-responder --reply-text "ack" &
|
|
189
|
-
pillar-seed --
|
|
195
|
+
pillar-seed --home /var/lib/pillar/seed --db /var/lib/pillar/seed.db & # 127.0.0.1:8799 by default
|
|
190
196
|
|
|
191
|
-
#
|
|
192
|
-
pillar-seed --
|
|
193
|
-
--
|
|
194
|
-
pillar-seed --
|
|
197
|
+
# serve it to the world: a TLS proxy on this machine in front of 127.0.0.1:8799, then
|
|
198
|
+
pillar-seed --home /var/lib/pillar/seed --db /var/lib/pillar/seed.db \
|
|
199
|
+
--public-url https://seed.example.org
|
|
200
|
+
pillar-seed --help # every flag, and its environment variable
|
|
195
201
|
```
|
|
196
202
|
|
|
203
|
+
### Running a seed
|
|
204
|
+
|
|
205
|
+
What an outside operator needs to know before the first start:
|
|
206
|
+
|
|
207
|
+
- **Pass an absolute `--home`.** It holds the seed key and defaults to
|
|
208
|
+
`~/.pillar-seed`. From 2.5.1 the database defaults to `<home>/seed.db`. Up to
|
|
209
|
+
2.4.1 it defaulted to `pillar-seed.db` **in the working directory**; a seed
|
|
210
|
+
upgraded in place keeps using that file and prints a notice saying how to move
|
|
211
|
+
it. An explicit `--db` (or `SEED_DB`) is used as given.
|
|
212
|
+
- **Keep `--host 127.0.0.1`** (the default) when the TLS proxy runs on the same
|
|
213
|
+
machine, which is the normal case. `--host 0.0.0.0` also publishes the seed's
|
|
214
|
+
plain-HTTP port next to the proxy wherever the firewall lets it through. Use
|
|
215
|
+
another address only for a proxy on another host, and firewall the port to it.
|
|
216
|
+
From 2.5.1 a `SEED_*` variable set to an empty string is refused rather than
|
|
217
|
+
read as a value: in 2.4 an empty `SEED_HOST` listened on every interface.
|
|
218
|
+
From 2.5.3 the seed believes `X-Forwarded-For` only from a proxy on this
|
|
219
|
+
machine (127.0.0.1, ::1); name a proxy on another host with
|
|
220
|
+
`--trusted-proxy <ip>` (or `SEED_TRUSTED_PROXIES`).
|
|
221
|
+
Before it creates the key or the database, the start binds the host and
|
|
222
|
+
port, so a host that does not resolve, an address not on this machine, or a
|
|
223
|
+
port in use stops it with nothing written. From 2.5.3 the server keeps that
|
|
224
|
+
same listener, so the port cannot be taken between the check and the start
|
|
225
|
+
(up to 2.5.2 such a start failed with the key already minted).
|
|
226
|
+
- **The seed's identity is `uuaid:foundation:agent:…` by default.** Every
|
|
227
|
+
service identity this package mints (seed, directory, escrow) uses the
|
|
228
|
+
`foundation` namespace unless told otherwise. The namespace names neither the
|
|
229
|
+
operator nor the kind of key: agents minted before 2.4.0, and any
|
|
230
|
+
`pillar init --namespace foundation`, show `foundation` too, and so does an
|
|
231
|
+
outside operator's seed. `--operator` is the field that names you. From 2.5.1,
|
|
232
|
+
`--namespace pillar` or `--namespace agentnet` (or `SEED_NAMESPACE`) picks
|
|
233
|
+
another namespace **for a new key only**. An existing key keeps its uuaid, and
|
|
234
|
+
naming a different namespace for it refuses to start rather than minting a new one.
|
|
235
|
+
From 2.5.2 the key file's uuaid must be the one its public key derives: a
|
|
236
|
+
file whose uuaid or public key was edited or swapped is refused as damaged,
|
|
237
|
+
on every start and on `--status`, and is left as it is.
|
|
238
|
+
- **Protect the seed key.** Without a passphrase, `seed-keychain.json` (mode
|
|
239
|
+
0600) is protected by its file mode alone: anyone who can read it can sign as
|
|
240
|
+
your seed. From 2.5.1 a new key can be saved under a passphrase, read from a
|
|
241
|
+
file with `--passphrase-file <path>` or from `SEED_KEYCHAIN_PASSPHRASE`. One
|
|
242
|
+
trailing newline in the file is ignored. From 2.5.3 a key saved under a
|
|
243
|
+
passphrase is written with scrypt (N=2^17, r=8, p=1; about 0.2 s per open,
|
|
244
|
+
`src/identity/keychain.mjs:27`, `:33-48`), so each guess at a copied file
|
|
245
|
+
costs that much. A key saved by 2.5.2 or earlier keeps its single
|
|
246
|
+
HKDF-SHA256, with no work factor, and still opens; a key minted by 2.5.3
|
|
247
|
+
under a passphrase does not open on 2.5.2 or earlier. **Use a long random
|
|
248
|
+
passphrase either way, not a memorable one:** a short or human-chosen one
|
|
249
|
+
can still be guessed offline from a copied key file. Prefer the
|
|
250
|
+
file to the variable: an environment variable can be read back from the
|
|
251
|
+
process by root and by the seed's own user. Under systemd, a credential keeps
|
|
252
|
+
it out of the unit file:
|
|
253
|
+
|
|
254
|
+
```sh
|
|
255
|
+
openssl rand -base64 32 > /etc/pillar/seed-pass && chmod 600 /etc/pillar/seed-pass
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
```ini
|
|
259
|
+
[Service]
|
|
260
|
+
User=pillar
|
|
261
|
+
# systemd creates /var/lib/pillar for User=, mode 0700; pillar-seed creates
|
|
262
|
+
# the home below it, also 0700.
|
|
263
|
+
StateDirectory=pillar
|
|
264
|
+
StateDirectoryMode=0700
|
|
265
|
+
LoadCredential=seed-pass:/etc/pillar/seed-pass
|
|
266
|
+
ExecStart=/usr/bin/pillar-seed --home /var/lib/pillar/seed --passphrase-file ${CREDENTIALS_DIRECTORY}/seed-pass
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
A wrong or missing passphrase refuses to start, and the key is never replaced.
|
|
270
|
+
A key saved without a passphrase (every key from 2.4 or earlier) keeps
|
|
271
|
+
opening without one; a passphrase cannot be added to an existing key. Run the
|
|
272
|
+
seed as its own user, keep `--home` private, and encrypt the disk either way.
|
|
273
|
+
- **Keep `--ttl` at the default 14 days unless you need longer.** It is at most
|
|
274
|
+
36500 days (100 years): for `pillar-seed` from 2.5.2, and for `pillar-carrier`
|
|
275
|
+
and every `CarrierServer` from 2.5.3. Larger values used to be accepted, and
|
|
276
|
+
from about 2,912,144 days the hourly pass deleted mail as soon as it was stored.
|
|
277
|
+
- **There is no public seed registry yet** (as of 2.5.3, October 2026).
|
|
278
|
+
`https://pillar.uuaid.org` does not answer `/v1/seeds`, so
|
|
279
|
+
`--announce https://pillar.uuaid.org` cannot enroll.
|
|
280
|
+
A seed runs standalone: it carries mail for every client configured with its
|
|
281
|
+
URL (`pillar init --carriers https://seed.example.org`). `--announce` works
|
|
282
|
+
against a registry that runs `pillar-directory`; from 2.5.3, announcing to a
|
|
283
|
+
host with no registry says so in the seed's output.
|
|
284
|
+
- **Use a real domain.** Free no-DNS names (such as `*.sslip.io`) are blocked
|
|
285
|
+
by some home and corporate network filters, so some clients cannot reach a
|
|
286
|
+
seed on one.
|
|
287
|
+
- The proxy, the firewall and CORS: HOSTING-LIMITS.md §5 has a Caddy and an
|
|
288
|
+
nginx example.
|
|
289
|
+
|
|
197
290
|
## Abuse resistance — consent at the edge, budgets at the carrier
|
|
198
291
|
|
|
199
292
|
Identity is unforgeable (the sender derives from the signing key), the
|
|
@@ -264,11 +357,14 @@ survivors.
|
|
|
264
357
|
|
|
265
358
|
### Joining is permissionless
|
|
266
359
|
|
|
267
|
-
TLS-terminate a public URL and announce
|
|
360
|
+
When a registry runs `pillar-directory`, TLS-terminate a public URL and announce
|
|
361
|
+
it there (there is no public registry yet; see "Running a seed" above):
|
|
268
362
|
|
|
269
363
|
```sh
|
|
270
|
-
pillar-seed --
|
|
271
|
-
--
|
|
364
|
+
pillar-seed --home /var/lib/pillar/seed --db /var/lib/pillar/seed.db \
|
|
365
|
+
--public-url https://seed.example.org \
|
|
366
|
+
--announce https://<registry> --operator you --region eu
|
|
367
|
+
pillar-seed --status --home /var/lib/pillar/seed --announce https://<registry> # your rung + what's left
|
|
272
368
|
```
|
|
273
369
|
|
|
274
370
|
The registry fetches `https://seed.example.org/v1/seed-info` and checks the
|
package/bin/carrier.mjs
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* carrier --port 8799 --host 127.0.0.1 --db /opt/pillar-carrier/carrier.db
|
|
6
6
|
* carrier ... --secure-delete off # keep deleted envelope bytes (default: on)
|
|
7
7
|
* carrier ... --community-waits 192 # community inbox long-poll cap (CARRIER_COMMUNITY_WAITS; default 48, +16 priority reserve)
|
|
8
|
+
* carrier ... --trusted-proxy 10.0.0.5 # whose X-Forwarded-For counts (CARRIER_TRUSTED_PROXIES; default 127.0.0.1,::1)
|
|
8
9
|
* carrier ... --receipt-keychain /opt/pillar-carrier/receipt-keychain.json
|
|
9
10
|
* # sign uuaid.carrier-receipt.v1 receipts (default: off)
|
|
10
11
|
*
|
|
@@ -24,8 +25,9 @@
|
|
|
24
25
|
* signs nothing and every response is as before.
|
|
25
26
|
*/
|
|
26
27
|
import "../src/node-check.mjs"; // must stay the first import: refuses Node < 22 before any dependency loads
|
|
27
|
-
import { CarrierServer, parseSecureDelete, parseCommunityWaits } from "../src/net/carrier-server.mjs";
|
|
28
|
+
import { CarrierServer, parseSecureDelete, parseCommunityWaits, MAX_TTL_DAYS } from "../src/net/carrier-server.mjs";
|
|
28
29
|
import { Keychain } from "../src/identity/keychain.mjs";
|
|
30
|
+
import { parseTrustedProxies } from "../src/net/client-ip.mjs";
|
|
29
31
|
|
|
30
32
|
function parseArgs(argv) {
|
|
31
33
|
const args = {};
|
|
@@ -39,18 +41,44 @@ function parseArgs(argv) {
|
|
|
39
41
|
return args;
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Refuse to start: one line to stderr, exit 2. A control character or a line
|
|
46
|
+
* separator in the message (an echoed value) is shown escaped, so a refusal is
|
|
47
|
+
* always one line (as pillar-seed's, 2.5.2 G2).
|
|
48
|
+
*/
|
|
49
|
+
function refuse(message) {
|
|
50
|
+
console.error(`carrier: ${oneLine(message)}`);
|
|
51
|
+
process.exit(2);
|
|
52
|
+
}
|
|
53
|
+
const ESCAPES = { "\n": "\\n", "\r": "\\r", "\t": "\\t" };
|
|
54
|
+
function oneLine(text) {
|
|
55
|
+
return String(text).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, (c) => ESCAPES[c] ?? `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
56
|
+
}
|
|
57
|
+
|
|
42
58
|
const args = parseArgs(process.argv.slice(2));
|
|
43
59
|
const port = Number(args.port ?? process.env.CARRIER_PORT ?? 8799);
|
|
44
60
|
const host = args.host ?? process.env.CARRIER_HOST ?? "127.0.0.1";
|
|
45
61
|
const dbPath = args.db ?? process.env.CARRIER_DB ?? "carrier.db";
|
|
46
|
-
const
|
|
62
|
+
const ttlText = String(args.ttl ?? process.env.CARRIER_TTL_DAYS ?? 14);
|
|
63
|
+
const ttlDays = Number(ttlText);
|
|
64
|
+
// Digits with an optional decimal part (Number() alone took "0x10", "1e3", " 14" and
|
|
65
|
+
// "", the last as 0), and at most MAX_TTL_DAYS: past year 9999 a stored deadline
|
|
66
|
+
// sorted before today and the hourly vacuum deleted fresh mail (2.5.3).
|
|
67
|
+
if (!/^[0-9]+(\.[0-9]+)?$/.test(ttlText) || !(ttlDays > 0)) refuse(`--ttl must be a positive number of days written as digits (14, 7.5), not ${JSON.stringify(ttlText)}`);
|
|
68
|
+
if (ttlDays > MAX_TTL_DAYS) refuse(`--ttl must be at most ${MAX_TTL_DAYS} days (100 years), not ${JSON.stringify(ttlText)}`);
|
|
47
69
|
// Community inbox long-poll cap (default 48; a 16-slot priority reserve sits on top).
|
|
48
70
|
let communityInboxWaits;
|
|
49
71
|
try {
|
|
50
72
|
communityInboxWaits = parseCommunityWaits(args["community-waits"] ?? process.env.CARRIER_COMMUNITY_WAITS);
|
|
51
73
|
} catch (e) {
|
|
52
|
-
|
|
53
|
-
|
|
74
|
+
refuse(e.message);
|
|
75
|
+
}
|
|
76
|
+
// Whose X-Forwarded-For counts for the per-IP budgets (2.5.3): this machine by default.
|
|
77
|
+
let trustedProxies;
|
|
78
|
+
try {
|
|
79
|
+
trustedProxies = parseTrustedProxies(args["trusted-proxy"] ?? process.env.CARRIER_TRUSTED_PROXIES);
|
|
80
|
+
} catch (e) {
|
|
81
|
+
refuse(e.message);
|
|
54
82
|
}
|
|
55
83
|
// Tier grants: comma-separated issuer pubkeys (hex) whose signed grants this
|
|
56
84
|
// carrier honors for raised budgets. Unset = all senders get community tier.
|
|
@@ -62,8 +90,7 @@ let secureDelete;
|
|
|
62
90
|
try {
|
|
63
91
|
secureDelete = parseSecureDelete(args["secure-delete"] ?? process.env.CARRIER_SECURE_DELETE);
|
|
64
92
|
} catch (e) {
|
|
65
|
-
|
|
66
|
-
process.exit(2);
|
|
93
|
+
refuse(e.message);
|
|
67
94
|
}
|
|
68
95
|
|
|
69
96
|
// Optional receipt key (separate from any seed or agent keychain on the box).
|
|
@@ -89,10 +116,9 @@ if (receiptKeychainPath !== null && receiptKeychainPath !== "") {
|
|
|
89
116
|
|
|
90
117
|
let server;
|
|
91
118
|
try {
|
|
92
|
-
server = new CarrierServer({ dbPath, ttlDays, trustedTierIssuers: tierIssuers, secureDelete, receiptKeychain, communityInboxWaits });
|
|
119
|
+
server = new CarrierServer({ dbPath, ttlDays, trustedTierIssuers: tierIssuers, secureDelete, receiptKeychain, communityInboxWaits, trustedProxies });
|
|
93
120
|
} catch (e) {
|
|
94
|
-
|
|
95
|
-
process.exit(2);
|
|
121
|
+
refuse(e.message);
|
|
96
122
|
}
|
|
97
123
|
const addr = await server.listen(port, host);
|
|
98
124
|
console.log(`carrier listening on ${addr.address}:${addr.port}`);
|
package/bin/pillar-directory.mjs
CHANGED
|
@@ -28,6 +28,7 @@ import { readFileSync, existsSync, mkdirSync } from "node:fs";
|
|
|
28
28
|
import { homedir } from "node:os";
|
|
29
29
|
import { join } from "node:path";
|
|
30
30
|
import { SeedRegistry } from "../src/net/seed-registry.mjs";
|
|
31
|
+
import { clientIpOf, parseTrustedProxies } from "../src/net/client-ip.mjs";
|
|
31
32
|
import { Keychain, mintNamespace, SERVICE_IDENTITY_NAMESPACE } from "../src/identity/keychain.mjs";
|
|
32
33
|
|
|
33
34
|
function parseArgs(argv) {
|
|
@@ -120,10 +121,11 @@ function readBody(req) {
|
|
|
120
121
|
});
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
124
|
+
// X-Forwarded-For counts only from a trusted proxy (2.5.3; src/net/client-ip.mjs).
|
|
125
|
+
let trustedProxies;
|
|
126
|
+
try { trustedProxies = parseTrustedProxies(args["trusted-proxy"] ?? process.env.DIRECTORY_TRUSTED_PROXIES); }
|
|
127
|
+
catch (e) { console.error(`pillar-directory: ${e.message}`); process.exit(2); }
|
|
128
|
+
const clientIp = (req) => clientIpOf(req, trustedProxies);
|
|
127
129
|
|
|
128
130
|
const server = createServer(async (req, res) => {
|
|
129
131
|
try {
|
package/bin/pillar-escrow.mjs
CHANGED
|
@@ -181,7 +181,7 @@ async function cmdInit(args) {
|
|
|
181
181
|
writeFileSync(zf, JSON.stringify({ apiKey: "", handle: "" }, null, 2) + "\n", { mode: 0o600 });
|
|
182
182
|
}
|
|
183
183
|
const cfg = join(home, "config.json");
|
|
184
|
-
if (!existsSync(cfg)) writeFileSync(cfg, JSON.stringify({ carriers: [] }, null, 2) + "\n");
|
|
184
|
+
if (!existsSync(cfg)) writeFileSync(cfg, JSON.stringify({ carriers: [] }, null, 2) + "\n", { mode: 0o600 });
|
|
185
185
|
console.log(JSON.stringify({
|
|
186
186
|
home,
|
|
187
187
|
uuaid: kc._identity.uuaid,
|
|
@@ -315,7 +315,7 @@ async function cmdSell(args) {
|
|
|
315
315
|
if (!verifyReceiptSig(terms.escrowPubKeyHex, receipt)) die("RECEIPT SIGNATURE INVALID — do not trust this completion");
|
|
316
316
|
const out = args["receipt-out"] ?? join(home, "sell-receipts", `${terms.offerId}.json`);
|
|
317
317
|
mkdirSync(dirname(out), { recursive: true });
|
|
318
|
-
writeFileSync(out, JSON.stringify(receipt, null, 2) + "\n");
|
|
318
|
+
writeFileSync(out, JSON.stringify(receipt, null, 2) + "\n", { mode: 0o600 });
|
|
319
319
|
console.log(JSON.stringify({
|
|
320
320
|
ok: true, offerId: terms.offerId, role: "seller",
|
|
321
321
|
priceGons: finalPrice, payoutGons: sellerPayout, feeAllocation: allocation ?? "mutual",
|
|
@@ -381,10 +381,10 @@ async function cmdBuy(args) {
|
|
|
381
381
|
if (!verifyReceiptSig(terms.escrowPubKeyHex, receipt)) die("RECEIPT SIGNATURE INVALID — do not trust this completion");
|
|
382
382
|
const plain = openBox(Buffer.from(contentKeyHex, "hex"), dv.env.payload.box);
|
|
383
383
|
if (sha256Hex(plain) !== terms.itemHash) die("deliverable hash mismatch — box does not match the signed terms");
|
|
384
|
-
writeFileSync(out, plain);
|
|
384
|
+
writeFileSync(out, plain, { mode: 0o600 }); // the bought plaintext: owner-only (2.5.3, AC7-Kimi n)
|
|
385
385
|
const receiptOut = args["receipt-out"] ?? join(home, "buy-receipts", `${terms.offerId}.json`);
|
|
386
386
|
mkdirSync(dirname(receiptOut), { recursive: true });
|
|
387
|
-
writeFileSync(receiptOut, JSON.stringify(receipt, null, 2) + "\n");
|
|
387
|
+
writeFileSync(receiptOut, JSON.stringify(receipt, null, 2) + "\n", { mode: 0o600 });
|
|
388
388
|
console.log(JSON.stringify({ ok: true, offerId: terms.offerId, role: "buyer", priceGons: terms.priceGons, file: out, receiptPath: receiptOut }, null, 2));
|
|
389
389
|
}
|
|
390
390
|
|
|
@@ -498,7 +498,7 @@ async function cmdVerify(args) {
|
|
|
498
498
|
});
|
|
499
499
|
if (typeof args.out === "string") {
|
|
500
500
|
mkdirSync(dirname(args.out), { recursive: true });
|
|
501
|
-
writeFileSync(args.out, JSON.stringify(att, null, 2) + "\n");
|
|
501
|
+
writeFileSync(args.out, JSON.stringify(att, null, 2) + "\n", { mode: 0o600 });
|
|
502
502
|
}
|
|
503
503
|
console.log(JSON.stringify(att, null, 2));
|
|
504
504
|
exit(att.verdict === "verified" ? 0 : att.verdict === "pending" ? 3 : 1);
|
|
@@ -556,7 +556,7 @@ async function cmdAck(args) {
|
|
|
556
556
|
const doc = { v: 1, kind: "vda-delivery-ack-bundle", ...r };
|
|
557
557
|
if (typeof args.out === "string") {
|
|
558
558
|
mkdirSync(dirname(args.out), { recursive: true });
|
|
559
|
-
writeFileSync(args.out, JSON.stringify(doc, null, 2) + "\n");
|
|
559
|
+
writeFileSync(args.out, JSON.stringify(doc, null, 2) + "\n", { mode: 0o600 });
|
|
560
560
|
}
|
|
561
561
|
console.log(JSON.stringify(doc, null, 2));
|
|
562
562
|
}
|
|
@@ -595,7 +595,7 @@ async function cmdAttestDelivery(args) {
|
|
|
595
595
|
}
|
|
596
596
|
if (typeof args.out === "string") {
|
|
597
597
|
mkdirSync(dirname(args.out), { recursive: true });
|
|
598
|
-
writeFileSync(args.out, JSON.stringify(out, null, 2) + "\n");
|
|
598
|
+
writeFileSync(args.out, JSON.stringify(out, null, 2) + "\n", { mode: 0o600 });
|
|
599
599
|
}
|
|
600
600
|
console.log(JSON.stringify(out, null, 2));
|
|
601
601
|
exit(final.verdict === "verified" ? 0 : final.verdict === "pending" ? 3 : 1);
|
package/bin/pillar-responder.mjs
CHANGED
|
@@ -82,7 +82,7 @@ function journalRequest(home, env) {
|
|
|
82
82
|
sender: env.sender,
|
|
83
83
|
senderPublicKey: env.transportSignature.publicKey,
|
|
84
84
|
payload: env.payload,
|
|
85
|
-
}) + "\n");
|
|
85
|
+
}) + "\n", { mode: 0o600 }); // decrypted request payloads: owner-only (2.5.3)
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
function journalDone(home, id, reply) {
|
|
@@ -92,7 +92,7 @@ function journalDone(home, id, reply) {
|
|
|
92
92
|
id,
|
|
93
93
|
replyText: reply.text,
|
|
94
94
|
replyStatus: reply.status,
|
|
95
|
-
}) + "\n");
|
|
95
|
+
}) + "\n", { mode: 0o600 });
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
// Requests journaled but never completed, within the replay window.
|