ProxyAuth / Security

IP abuse blocklists: the first gate, and the one setting that makes it inert

ProxyAuthSecurity / NetworkUpdated on 2026-09-18

Published abuse feeds are one of the cheapest protections a public service can have: someone else maintains the list of networks that should never be talking to you. ProxyAuth consumes them natively and checks them before anything else in the request lifecycle.

Configuration

{
  "ip_blocklists": [
    { "source": "https://www.spamhaus.org/drop/drop.txt", "name": "spamhaus" },
    { "source": "https://iplists.firehol.org/files/firehol_level1.netset", "name": "firehol1" },
    {
      "source": "https://internal.example.com/exports/abuse.csv.gz",
      "name": "internal",
      "csv": true,
      "csv_column": 2
    },
    { "source": "/etc/proxyauth/local-bans.txt", "name": "local" }
  ],
  "ip_blocklist_refresh_interval_secs": 3600
}

Each entry is a source object:

  • source (required) — an http(s):// URL or a local file path.
  • name — names the local cache file. Optional, but it is what makes the cache directory readable at a glance; without it a name is derived from source with unsafe characters replaced by _.
  • csv — split each line on commas instead of taking the first whitespace-separated token.
  • csv_column — which column holds the address, counting from zero. Surrounding double quotes are stripped.

An empty list (the default) means the feature is off and no background task is started at all.

Parsing third-party files

These feeds follow no common standard, so the parser is forgiving about everything except the address itself:

  • gzip is detected from the file’s magic bytes, not from a .gz extension, so a compressed feed served from a URL that does not say so still works.
  • Comments — a line starting with # or ; is skipped, and a trailing # comment is cut: 1.2.3.4 # some ISP reads as 1.2.3.4.
  • Trailing text — in plain-text mode only the first token is read, so 1.2.3.4 some-hostname works too.
  • Addresses — a bare IP or a CIDR, IPv4 or IPv6. Anything that parses as neither is counted and reported once per refresh rather than line by line, so a noisy feed does not flood the log.

Refresh, cache and failure

Sources are fetched by a background task, never on the request path. They are fetched one after another, merged into a single deduplicated list, and hot-swapped in once complete. There is no latency to save by parallelising a background job over large files, so it does not.

Every successful fetch is written to /etc/proxyauth/abuse/<name>.txt, one normalized entry per line, through a temp file and a rename. A file read mid-refresh never shows a half-written list.

When a fetch fails — unreachable URL, 404, garbled payload — the error is logged and the last good copy from the cache is used. A third-party outage never blanks your blocklist, and one broken source never blocks the others. At startup, a broken source is skipped with a warning: it can neither panic nor prevent the server from starting.

ip_blocklist_refresh_interval_secs: 0 fetches once at startup and keeps that result for the life of the process.

The cache is the diagnostic

When an address is being refused and you want to know which feed is responsible, grep the cache directory:

grep -l '198.51.100.' /etc/proxyauth/abuse/*.txt
cat /etc/proxyauth/abuse/spamhaus.txt | wc -l

That shows exactly what each source currently contributes, already normalized. It is faster than any log.

The line that makes it all work: trust_proxy_forward_for

The blocklist checks the resolved client IP. Directly exposed, that is the TCP peer, and everything works. Behind a load balancer or a CDN, the TCP peer is the load balancer, and the real client is in X-Forwarded-For — which ProxyAuth only honours when the peer is trusted:

{
  "trust_proxy_forward_for": ["10.0.0.10", "10.0.0.11"]
}

Without that entry, ProxyAuth checks your own load balancer’s address against Spamhaus, finds nothing, and lets everyone through. No error, no warning — the feature is configured and inert. This is the single most common way to get it wrong, and it also affects rate limiting and every IP allow check, which use the same resolved address.

The inverse matters too: never list a peer you do not control. A trusted peer can set X-Forwarded-For to anything.

Three IP mechanisms, three questions

ProxyAuth takes IP lists in three places, and they are not interchangeable:

MechanismScopeRunsOn a match
ip_blocklistsglobalbefore routingflat 403
allow_ips / deny_ipsone routeafter matchingrequest refused
redirect_protect.allow_ipvhost or routebefore authalternative content

The allow_url_ips and deny_url_ips of redirect_protect reuse exactly the same source object as ip_blocklists — same parsing, same cache behaviour — on their own interval, redirect_protect_refresh_interval_secs. A maintenance allow-list built from your VPN egress feed can therefore refresh on a different cadence from a general abuse feed.

Route-level allow_ips/deny_ips are parsed once at startup. An entry that is not a valid address or CIDR stops startup with the route, the field and the value named: a restriction is either in force or reported, never silently dropped.

A reasonable starting point

{
  "trust_proxy_forward_for": ["<your load balancer>"],
  "ip_blocklists": [
    { "source": "https://www.spamhaus.org/drop/drop.txt", "name": "spamhaus" },
    { "source": "https://iplists.firehol.org/files/firehol_level1.netset", "name": "firehol1" },
    { "source": "/etc/proxyauth/local-bans.txt", "name": "local" }
  ],
  "ip_blocklist_refresh_interval_secs": 3600
}

A local file gives you an instant manual ban list: add a line, and it is picked up on the next refresh.

Feeds fetched in the background, cached atomically, never allowed to go empty on a failure, and checked before anything else can run. The only thing it needs from you is to be told which proxy in front of it is allowed to say who the client really is.