Use remote IP feeds in an access list¶
Let a published prober list reach only the health endpoints of a host that is otherwise LAN/VPN-only.
Prerequisites¶
- An access list already attached to the host, with
defaultAction: deny. - The provider's published feed URL. It must be
https, one IP or CIDR per line,#comments and blanks ignored. settings.accessListSyncleft enabled (it is by default) so the fetcher runs.- The exact health paths and methods the prober needs, so the grant can be scoped to them.
Steps¶
The case this exists for: a host is LAN/VPN-only, but an external uptime monitor has to be able to probe it. The prober list stays its own object, so the base list keeps meaning what its name says.
-
Create a prober list that grants the provider's published addresses the health paths, and nothing else:
yaml name: monitor defaultAction: deny rules: # Health endpoints only, read-only methods only. - action: allow source: uptimerobot paths: [/api/health, /v1/health, /-/healthy, /status.php] methods: [GET, HEAD] sources: - name: uptimerobot url: https://uptimerobot.com/inc/files/ips/IPv4andIPv6.txt interval: 24h -
Attach it beside the base list and set
accessListsMode: any, so a request passes when either list allows it:yaml name: app domains: [app.example.com] upstream: {scheme: http, host: 10.0.0.40, port: 8080} accessLists: [lan-vpn, monitor] accessListsMode: anyA discovery template or profile takes the same two keys (
accessLists,accessListsMode), so every derived host gets the pair.anycomposes allow-lists only: both lists needdefaultAction: deny, and a list withgeo.countryDenyis refused. -
Fallback, when the host must keep
accessListsMode: all(for example because another attached list has to restrict everyone, or the base list is a blocklist withdefaultAction: allow): copy the prober rule and its source into the base list instead of attachingmonitor:yaml name: lan-vpn defaultAction: deny rules: # Unchanged LAN/VPN rules: every path, every method. - {action: allow, cidr: 10.0.0.0/8} - {action: allow, cidr: 192.168.0.0/16} - action: allow source: uptimerobot paths: [/api/health, /v1/health, /-/healthy, /status.php] methods: [GET, HEAD] sources: - name: uptimerobot url: https://uptimerobot.com/inc/files/ips/IPv4andIPv6.txt interval: 24h
Either way, a prober hitting /api/health gets through; the same prober hitting
/ or POSTing to /api/health gets a 403, and so does anyone else off-LAN.
The ~200 IPv4/IPv6 entries are fetched and kept current automatically: you never
paste them into a file.
Pair every source rule with paths. A source rule without them is an
ordinary allow rule: it grants every address in a third party's feed full access
to the host, on every path and method.
Verify¶
| Check | Expected |
|---|---|
GET /api/access-list-sources/status |
The source listed with a recent fetchedAt and a plausible entryCount |
refused in that status |
0. Anything above zero means a list is being served from a set that is no longer refreshed |
curl a health path from an allowed address |
2xx |
curl / from the same address |
403 |
POST to a health path from the same address |
403: the rule defaults to GET and HEAD |
curl / from a LAN client |
2xx: the base list still allows it on every path |
config/access-list-sources.yaml |
One entry per source, with a sha256 over its network set |
How the fetcher behaves¶
An AccessList may declare
sources: published, plain-text IP feeds (one IP or CIDR per line) that a rule
references by name instead of you pasting hundreds of CIDRs into the config. The
motivating case is letting a monitoring provider's prober addresses reach only
the health paths of a host that is otherwise LAN/VPN-only.
The fetcher runs in-process, on settings.accessListSync.pollInterval (default
15m), and downloads a source only once its own interval (default 24h) has
elapsed. It is leader-only: the fetched sets are a config-repo commit, and a
follower that committed locally would break its fast-forward-only pull. A
follower still serves the sets, because it replicates the ledger file.
Ledger file. The fetched sets live in config/access-list-sources.yaml
(list, source, url, fetchedAt, expiredAt when expired, maxAgeSince when maxAge is set, sha256, sorted entries), committed like
everything else: diffable, auditable and reverted with the rest of the config.
Do not hand-edit it: every entry carries a sha256 over its network set, and
a mismatch fails the load rather than serving a set somebody widened by hand. A
source whose entry is missing (never fetched, or refused before the first
success) resolves to the empty set, so its rules match nothing and the list
falls through to defaultAction.
Commit behaviour. Only a changed set writes the ledger. An unchanged feed
deliberately does not advance fetchedAt, because doing so would commit a
timestamp-only diff to the config repo every interval, forever; the process keeps
the last attempt in memory instead, so a re-fetch still waits out the interval. A
restart therefore re-fetches each source once, finds it unchanged, and commits
nothing. A source with maxAge is the exception: its unchanged fetch advances
fetchedAt (one commit per interval, without a data-plane reload on the leader), and adding
or removing maxAge writes or removes maxAgeSince (one commit, no reload).
Refusals fail closed. A fetch is rejected whole (keeping whatever was
fetched before) when the source answers anything but 200, returns no valid
entries, returns more than maxEntries (default 10000), covers more address
space than maxCoverage (only when set on the source), sends a body
over 1 MiB, or contains a single line that is neither a comment nor a valid IP/CIDR. A feed
that changed shape is a feed gpm no longer understands; keeping the subset it
still parses would be a silent, partial allow list.
A refused fetch does not start the source's interval clock, so the retry is
on the next poll tick (pollInterval, default 15m) rather than after the
source's own interval (up to a day). One transient blip therefore costs minutes
of staleness, not a day of it, and the previously fetched set is served
throughout.
Optional expiry. Without maxAge the previously fetched set is served for as
long as fetches keep failing. With maxAge: 72h (say) on the source, once the
set is older than that and a fetch is refused, the set is emptied in the ledger
(one commit, one WARN), the status reports expired: true, and every rule
naming the source matches nothing: an allow rule admits nobody and a deny
rule denies nobody. The age is measured from the last successful fetch recorded in the ledger (fetchedAt), or from when maxAge was first applied to the source (maxAgeSince) if that is later; a success that could not be committed before a restart is not counted. The next successful fetch restores it. See
source expiry.
What a feed may contain. Individual entries are bounded as well as counted. A
line is refused (and with it the whole fetch) when it is a default route
(0.0.0.0/0, ::/0), a prefix broader than /8 for IPv4 or /32 for IPv6, or
any network that overlaps a range a public monitoring feed never legitimately
carries (loopback, link-local, RFC1918, ULA, CGNAT 100.64.0.0/10, multicast,
192.0.0.0/24, 198.18.0.0/15, 64:ff9b::/96). An IPv4-mapped entry
(::ffff:192.0.2.0/120) is judged as the IPv4 network it matches. Without this a single hijacked
or fat-fingered 0.0.0.0/0 would pass every other check (valid CIDR, HTTP 200,
under maxEntries) and a source rule with no paths would then allow the
entire internet.
What a feed may cover in total. Every entry can be acceptable on its own
while the feed as a whole names most of the internet (two hundred public /8s
pass the per-entry rules). Setting maxCoverage on a source bounds that: the
entries are summed per family and the fetch is refused when they exceed the
budget. maxCoverage: {} allows as many addresses as one IPv4 /8 (16,777,216)
and one IPv6 /24 (256 /32s), which fits monitoring and CDN feeds; a feed that
legitimately publishes more (a cloud provider's whole range list) sets
maxCoverage: {ipv4: 4} or similar. Overlapping entries count twice. A source
without maxCoverage has no total budget (the per-entry rules above still
apply), and a fetch that covers more than one /8 of IPv4 or one /24 of IPv6 logs
a WARN (access-list source is broad ... set maxCoverage on the source to bound
it). See the AccessList reference.
Stored sets are re-checked. The data plane applies both rules again when it
compiles the ledger: a stored entry the entry rules refuse is dropped and
logged, and a stored set over its maxCoverage matches nothing. A set stored
before a rule existed therefore stops being served at once, even though a
refused fetch keeps it in the ledger. A set that matches nothing also stops a
deny rule that references it from denying.
SSRF guard. A source URL must be https, redirects are never followed, no
proxy is honoured (HTTP_PROXY/HTTPS_PROXY are deliberately ignored on this
client: through a proxy the address the guard inspects is the proxy, not the
destination), and the dialer refuses the destination post-DNS, at connect time
if it falls in any of the ranges above. Unlike DNS sync (whose whole point is a
LAN Pi-hole), nothing legitimate here is internal, so a source cannot be aimed at
169.254.169.254 or an internal endpoint even via a rebinding resolver.
Scope a source rule with paths. A rule that names a source but no paths
grants every address in that feed full access to the host. Path scoping is what
bounds a third party's published list to the endpoints you chose to expose; and
because an exact path match cannot be relied on to deny, paths are allow-only
(action: deny alongside them is refused at validation: use a guard middleware
for deny-by-path).
# What each source last resolved to.
curl -s https://<admin>/api/access-list-sources/status -H 'Authorization: Bearer gpm_...' | jq
# {"enabled":true,"lastRun":"...","refused":0,"sources":[
# {"list":"lan-vpn","name":"uptimerobot","url":"https://uptimerobot.com/inc/files/ips/IPv4andIPv6.txt",
# "fetchedAt":"...","entryCount":206,"lastAttempt":"..."}]}
# An expired source (maxAge passed) adds "expired":true and reports "entryCount":0.
# Fetch every due source now.
curl -s -X POST https://<admin>/api/access-list-sources/reconcile -H 'Authorization: Bearer gpm_...' | jq
A reconcile also fires automatically after any access-list write, restore or
whole-config revert, so a newly added source is fetched without waiting out the
poll. The manual endpoint does not queue: while a run is in flight it answers
409 Conflict. After a successful ledger write the proxy listeners reload, so
the new set is served on the very next request.
Scopes: access-lists:read for status, access-lists:write for reconcile.
refused > 0 in the status is the number to alert on: it means at least one
list is being served from a set that is no longer being refreshed.
Troubleshooting¶
| Symptom | Cause | Fix |
|---|---|---|
refused > 0 in the status |
The feed answered non-200, was empty, exceeded maxEntries or maxCoverage, sent over 1 MiB, or held one unparseable line. A fetch is refused whole |
Fix the feed; the previously fetched set keeps serving, and the retry is on the next poll tick rather than after the source's own interval |
A source rule matches nothing |
The source has never been fetched, so it resolves to the empty set | Trigger a reconcile and check fetchedAt; an unfetched feed can never widen access |
A source rule matches nothing; the status says expired: true and the log access-list source expired |
The source sets maxAge and its feed has not been fetched successfully for longer than that; the stored set was emptied |
Fix the feed (see lastError); the next successful fetch restores the set. To keep serving an old set instead, raise or remove maxAge; that does not bring back an already expired set |
Config write refused: maxAge must not be shorter than its fetch interval |
maxAge is below the source's interval (or the 24h default), so every set would expire between fetches |
Raise maxAge, ideally to two or three intervals |
coverage budget in lastError, or the log says the stored set is over its coverage budget |
The source sets maxCoverage and the feed's entries together cover more (a family left at 0 allows one /8 of IPv4 or one /24 of IPv6) |
If the feed really publishes that much, raise maxCoverage on the source; otherwise take it up with the feed publisher |
The log says access-list source is broad |
The source has no maxCoverage and its feed covers more than one /8 of IPv4 or one /24 of IPv6 in total. The feed is still served |
If the feed should be that large, nothing to do; to bound it, set maxCoverage on the source with room for what it publishes |
| The whole fetch is refused over one line | The feed carries a default route, a prefix broader than /8 (v4) or /32 (v6), or a non-public address |
That bound is deliberate: one hijacked 0.0.0.0/0 would otherwise allow the internet. Take it up with the feed publisher |
Config write refused: sources: source "name" url must be an absolute https URL |
http source URLs are refused |
Use the https endpoint |
| Config load fails on the source ledger | config/access-list-sources.yaml was hand-edited; each entry carries a sha256 over its set |
Never hand-edit it: revert the file and let the fetcher rewrite it |
| The list is refused on a stream host | A stream host resolves no ledger and has no request path, so sources and paths rules are refused there |
Use a plain CIDR list at L4 |
| Nothing is ever fetched | settings.accessListSync.enabled: false, or this instance is an HA follower |
Re-enable it; only the leader fetches, and a follower serves the replicated ledger |
LAN clients get 403 on every path after attaching monitor |
The host combines its lists with accessListsMode: all (the default), so monitor must allow too, and it allows only the prober |
Set accessListsMode: any on the host, or use the fallback in step 3 |
Config write refused: ... has defaultAction: allow (or geo.countryDeny) ... under accessListsMode: any |
The base list is a blocklist; any composes allow-lists only |
Give the base list defaultAction: deny with allow rules, or use the fallback in step 3 |
Config write refused: accessListsMode: any needs at least one entry in accessLists |
any with an empty accessLists |
Attach the lists, or drop the mode |
Config write refused: ... has basicAuth users, which cannot be combined under accessListsMode: any |
One list still carries the deprecated basicAuth users |
Migrate it to an auth middleware, or keep all |