Widen or narrow a route
Checked with iron-vault 0.2.0-alpha (features: dev-mode), built from main at 378d57d.
Make a route allow more, or less, and check the approval summary before you type yes: it shows what the
approval changes, including any edit to the file you didn’t make.
Prerequisites
- The service running and Ready, with the
mecaller andhttpbinroute from getting started. - Your config file,
dev-config.toml, and the approval passphrase.
Steps
1. Widen the route
Allow httpbin’s compressed and streamed echoes too. In [routes.httpbin]:
paths = ["/anything/**", "/headers", "/gzip", "/stream/*"]
* matches exactly one path segment, and ** zero or more; see configuration.
iron-vault config approve dev-config.toml
Approval summary
vault: 8c597c79-…
version to commit: 8
config digest: blake2b:e540c2d8…
committed version: 7
routes:
~ httpbin: paths /anything/**, /headers -> /anything/**, /gzip, /headers, /stream/*
Approve this config as version 8? Type yes to approve: yes
Approval passphrase for "approval passphrase":
approved version 8 (blake2b:e540c2d8…)
callers: none; route grants: none; routes: 1 changed; listeners: none; limits: none; logging: none; recovery: none
The new paths work at once, with no restart:
AUTH="Proxy-Authorization: Bearer $(cat ~/.iron-vault-tokens/me)"
curl -s -H "$AUTH" http://127.0.0.1:7878/httpbin/stream/2
{"id":0,"args":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Authorization":"Bearer [iron-vault:scrubbed]","Host":"httpbin.org","User-Agent":"curl/8.5.0"},"origin":"…","url":"https://httpbin.org/stream/2"}
{"id":1,"args":{},"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate, br","Authorization":"Bearer [iron-vault:scrubbed]","Host":"httpbin.org","User-Agent":"curl/8.5.0"},"origin":"…","url":"https://httpbin.org/stream/2"}
2. Narrow it
Take /stream/* away again and slow the route down:
paths = ["/anything/**", "/headers", "/gzip"]
rate_limit = { requests = 10, per_seconds = 60, burst = 2 }
Approval summary
vault: 8c597c79-…
version to commit: 9
config digest: blake2b:f8020a2b…
committed version: 8
routes:
~ httpbin: paths /anything/**, /gzip, /headers, /stream/* -> /anything/**, /gzip, /headers; rate limit 30 per 60s burst 5 -> 10 per 60s burst 2
Approve this config as version 9? Type yes to approve: yes
Approval passphrase for "approval passphrase":
approved version 9 (blake2b:f8020a2b…)
callers: none; route grants: none; routes: 1 changed; listeners: none; limits: none; logging: none; recovery: none
curl -si -H "$AUTH" http://127.0.0.1:7878/httpbin/stream/2 | head -1
HTTP/1.1 403 Forbidden
The log gives the reason path_not_allowed. After each approval the route’s rate limit
starts empty.
3. Read the summary, and say no when it’s wrong
Suppose the file now holds a change you didn’t make, or one bigger than you meant:
Approval summary
vault: 8c597c79-…
version to commit: 10
config digest: blake2b:869e704b…
committed version: 9
routes:
~ httpbin: methods GET -> DELETE, GET, POST; paths /anything/**, /gzip, /headers -> /**
Approve this config as version 10? Type yes to approve: no
iron-vault: the service answered error 8 (declined): the config was not approved: the confirmation was not `yes`
Anything but yes declines. Nothing changes: status still shows approval committed: 9 and
approval highest reserved: 9. Fix the file and approve again.
What to check in a summary:
- Header.
vaultis your vault, andcommitted versionis the onestatusshows. After tamper detection it readsno active config, and every table is listed as added. callers(+added,-removed,~changed). A new caller, a changed listener ortoken changedyou didn’t expect.route grants: which caller gains or loses which route.routes: each changed field as old->new: prefix, upstream, credential, slot, CA file, methods, paths, rate limit and confirmation. Watchupstreamandslotmost.listeners: a new address changes who can reach every route on it.- The last line counts every section, so
nonein a section confirms nothing changed there.
What can go wrong
iron-vault: the service answered error 8 (declined): the config was not approved: the confirmation was not `yes`. You typed something other thanyes. Nothing changed.iron-vault: the service answered error 7 (config-invalid): the proposed config is invalid: …. Refused before the summary; the message names the problem. A listener moved to192.0.2.10:8443withouttls_certificateandtls_keygivesthe proposed config is invalid: listener public on 192.0.2.10:8443 needs tls_certificate and tls_key: plain HTTP is allowed only on loopback. Check the configuration reference for that table.403withpath_not_allowedafter widening. Patterns leave out the upstream’s base path.429straight after the approval. The bucket starts empty.
Reference
- Configuration: routes, path patterns, methods and rate limits.
- CLI:
config approve. - The approval summary’s design.
- Related: rotate or revoke a caller token, tamper detection and recovery.