Send Shieldlist abuse reports through a relay of your own, so they leave from the address you choose.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Robin 424d6f16b3 README: open with the use case
Signed-off-by: Robin <git@lrob.net>
2026-12-01 16:18:43 +01:00
tests Report relay: send AbuseIPDB reports from this server's address 2026-12-01 14:53:31 +01:00
.gitignore Report relay: send AbuseIPDB reports from this server's address 2026-12-01 14:53:31 +01:00
.htaccess Let the relay's paths reach index.php under Apache 2026-12-01 15:03:58 +01:00
.user.ini Report relay: send AbuseIPDB reports from this server's address 2026-12-01 14:53:31 +01:00
config.example.php Report relay: send AbuseIPDB reports from this server's address 2026-12-01 14:53:31 +01:00
index.php Report relay: send AbuseIPDB reports from this server's address 2026-12-01 14:53:31 +01:00
LICENSE Report relay: send AbuseIPDB reports from this server's address 2026-12-01 14:53:31 +01:00
README.md README: open with the use case 2026-12-01 16:18:43 +01:00
relay.php Report relay: send AbuseIPDB reports from this server's address 2026-12-01 14:53:31 +01:00

Shieldlist report relay

Do you run servers in several countries? This relay sends all your AbuseIPDB reports from a single country, for example your main one. That country is the one shown next to your reports on your public AbuseIPDB profile.

It is a single PHP page that sends your abuse reports to AbuseIPDB from the address of the server it is installed on, instead of from the machine that wrote them: AbuseIPDB shows every report with the country of the address that submitted it. Install it on any web hosting in the country you want shown and point your reporting tool at it. Nothing else changes: the same reports, the same account, the same daily allowance.

It was written for Shieldlist, whose controller can send its reports through a relay, but it speaks AbuseIPDB's own API: any client that lets you change the AbuseIPDB address and add one header can use it.

An example

Your Shieldlist controller runs on a rented server in Germany; your company and your servers are in France. Every report AbuseIPDB publishes from you shows a German flag.

You install the relay on a small French web hosting at https://relay.example.com/, give it your AbuseIPDB key, the controller's addresses and a secret, and tell the controller:

# controller.yaml
abuseipdb:
  mode: bulk
  relay: https://relay.example.com

# secrets.yaml
abuseipdb:
  relay_secret: the-same-secret-as-the-relay

From then on the controller sends its reports to the relay, which sends them to AbuseIPDB: they show a French flag.

What it does, exactly

  • It accepts three requests, and nothing else — the AbuseIPDB requests a reporting tool makes:
    • POST /api/v2/report — one report;
    • POST /api/v2/bulk-report — a file of reports;
    • DELETE /api/v2/clear-address — withdraw what your account reported about an address.
  • It sends each one to https://api.abuseipdb.com with its own copy of your API key, and returns AbuseIPDB's answer as it came: the status, the body, and the rate-limit headers (X-RateLimit-*, Retry-After), so the client keeps counting its allowance.
  • Any other visit — a browser, a monitoring probe, a search engine — gets a short page saying what this is, with a 200 status.

Installation

Requirements: PHP 8.4 or later with the curl extension (standard on every hosting), HTTPS on the site.

  1. Create a site or a subdomain for the relay, with HTTPS. Make the folder of this repository its web root (or copy the files into it): index.php, relay.php, .htaccess, .user.ini.
  2. Copy config.example.php to config.php and fill it in:
    • key — your AbuseIPDB API key;
    • secret — a long random string, 32 characters or more (openssl rand -hex 32); the client sends the same one;
    • allow — the addresses allowed to send: your reporting tool's IPv4 and IPv6 addresses, single addresses or ranges (192.0.2.10, 2001:db8::/64). Add any machine that must test it, such as a monitoring server.
  3. Open the site's address in a browser: you see the short presentation page.
  4. Point the client at it: for Shieldlist, Settings → Reporting → AbuseIPDB → Relay and Relay secret, or the two lines above.

The bundled .user.ini raises PHP's upload size to 10 MB (a bulk report is a file of up to 8 MB) and its time limit to two minutes. It is read by PHP-FPM and CGI, which is how most hostings run PHP; if yours runs PHP otherwise, set upload_max_filesize, post_max_size and max_execution_time in its control panel.

On nginx without Apache

.htaccess is for Apache 2.4 with mod_rewrite. On nginx alone, send every address to index.php and serve nothing else:

location / {
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root/index.php;
    fastcgi_param SCRIPT_NAME /index.php;
    fastcgi_pass unix:/run/php/php8.4-fpm.sock;   # your PHP-FPM socket
}
client_max_body_size 10m;

Security

  • Only your senders. A request is relayed only when it comes from an address in allow and carries the secret in its X-Relay-Secret header, compared in constant time. Anyone else gets 403 and nothing leaves the server; the answer does not say which of the two failed.
  • Only AbuseIPDB. The three destinations are written in the code. Nothing in a request can name another address: the relay cannot be used to reach anything else.
  • The key stays on the relay. The client sends no key; the relay adds its own. config.php is never served (.htaccess), and as PHP it prints nothing if it were.
  • Nothing is logged but the relay's own failures (configuration missing, AbuseIPDB unreachable) — never a key, a secret or a report. Your web server's access log keeps its usual line per request.
  • The client's address is the one the web server sees. If your hosting sits behind a reverse proxy, the web server must give PHP the real client address (Apache's mod_remoteip, nginx's real_ip); the relay never reads X-Forwarded-For itself.
  • What the relay forwards is what AbuseIPDB publishes anyway: reported addresses, categories and comments.

Troubleshooting

  • A 403 without the X-Relay header comes from the web server, not from the relay: the request never reached index.php. Check that mod_rewrite is on and that the site allows .htaccess to use it (AllowOverride All, or at least FileInfo and Options), and look for the refusal in the web server's error log.
  • A web application firewall in front of the relay (ModSecurity and its rule sets, a hosting provider's own filter) may refuse what a reporting tool sends: a POST carrying a file, a DELETE, a client that is not a browser. Its log names the rule; exempt the relay's site from that rule, or from the firewall altogether — the relay already refuses every sender but yours.
  • A 413 means the request is larger than PHP accepts on this server: see .user.ini above.

What the client sees

Every answer of the relay carries an X-Relay: 1 header, so a client can tell the relay's answer from an error page of the web server in front of it. When the relay itself cannot do what was asked, it says so in X-Relay-Error with a JSON body in AbuseIPDB's error format:

Status X-Relay-Error Meaning
403 refused address not allowed, or wrong or missing secret
404 unknown destination not one of the three requests
413 too large larger than PHP accepts here (see .user.ini)
502 service unreachable AbuseIPDB did not answer
503 not configured config.php missing or incomplete (the error log says what)

Shieldlist's controller shows a warning on every page of its console while the relay does not answer, and keeps its bulk reports waiting until it does.

Tests

php tests/run.php

Logic only: no network, no web server, nothing sent to AbuseIPDB.

Licence

GNU Affero General Public License v3.0 only (LICENSE), like the rest of Shieldlist.

Report relay is published by LRob, the developer of Shieldlist.