Blocking Known Bad IPs on OPNsense with the AbuseIPDB Free Tier
Block known abusive IPs on OPNsense with the AbuseIPDB free tier. URL table aliases, header auth, API limits, rule placement and the gotchas I ran into.
I spend more time than I should in the OPNsense live log. Not because I expect to find something, but because the volume of background noise on a home WAN connection is strangely fascinating. Port scans against ports I do not even run, SSH brute force attempts against a box that has no SSH exposed, and the occasional crawler that tries the same WordPress path forty times in a row.
All of that is blocked already. OPNsense drops everything inbound on WAN by default, so the log is basically a museum of failed attempts. That is the correct behaviour and I do not want to change it.
What bothered me was something different. A handful of those source addresses come back every single day. The same netblocks, the same scanner ranges, hammering away for weeks. Blocking them individually is pointless, and my port forwards for a couple of self-hosted services were the only place where an inbound packet from those addresses could still get somewhere interesting.
So I wanted a small, automatically maintained list of known-bad source addresses that sits above my port forward rules. Not a giant threat feed, not a router-side IDS. Just a short list of addresses that have already been reported by thousands of other people.
That is exactly what AbuseIPDB’s blacklist endpoint gives you, and it works fine on the free tier. The setup is shorter than most guides suggest, mostly because a lot of those guides are older than the features they are missing.
What the AbuseIPDB Free Tier Actually Gives You
AbuseIPDB is a community project where administrators report abusive source addresses. Every address gets an abuse confidence score, and the platform publishes an aggregated blacklist through its API.
The important part for a firewall is the /api/v2/blacklist endpoint. It returns a plain list of addresses, one per line, and OPNsense can consume that directly as an alias.
Here is where most tutorials go wrong. You will find the same URL copied around the internet, always with confidenceMinimum=90&limit=10000 appended. On a free account, those parameters do nothing. Free accounts get the top 10,000 addresses from the database, and the customization parameters are a paid feature. AbuseIPDB says so plainly on their own integration pages: free plans get up to 10,000 IPs with no customization, Basic and Premium plans get the filters.
That is not a limitation I mind. The top 10,000 addresses in the database are the ones with extremely high confidence scores, often 100 percent, and they are the ones that generate the noise in my log anyway. If you want to filter down to a specific confidence threshold or a specific country, you need a paid plan, and then the parameters start to matter.
The quota is the second thing that matters. A free account gets five blacklist requests per day. That is the number the entire refresh strategy has to fit into, and it counts every single fetch, including the ones you trigger by hand while testing.
The quota applies to the blacklist endpoint. Lookups (
/check) and reports (/report) have their own, much larger limits. Do not mix the numbers up.
How the Pieces Fit Together
There are only three moving parts on the OPNsense side, and all of them are built in.
flowchart LR
A[AbuseIPDB API<br/>blacklist endpoint] -->|plain text,<br/>one IP per line| B[OPNsense<br/>URL Table alias]
B -->|refreshed every 6h| C[Firewall rules<br/>WAN and LAN]
C --> D[Blocked traffic<br/>plus log entries]
OPNsense has an alias type called URL Table (IPs). It fetches a URL on a schedule, validates whatever looks like an address, and loads the result into a pf table. That table can then be used as a source or destination in firewall rules, exactly like a manually maintained list.
Authentication Without the Key in the URL
The pattern you find everywhere is to append the API key as a GET parameter:
1
https://api.abuseipdb.com/api/v2/blacklist?plaintext=true&key=YOUR_API_KEY
That works. AbuseIPDB documents it for appliances that can only be handed a single URL, so it is not an undocumented trick. But a URL is the wrong place for a credential. It ends up in backups, in screenshots of the alias page, and in anything that records request URIs.
OPNsense does not force you into that anymore. URL aliases have an Authorization section with three modes:
| Authorization | Fields you fill in | Header OPNsense sends |
|---|---|---|
Basic |
Username, Password | Authorization: Basic ... |
Bearer |
API token | Authorization: Bearer <token> |
Header |
HTTP Header, API token | <your header name>: <token> |
AbuseIPDB wants a header literally named Key, and the third mode maps onto it exactly. Put Key in the HTTP Header field, paste the API key into the API token field, and the URL stays clean while the credential travels where it belongs, in the request header.
The
Headermode is the one that matters here, and it arrived in OPNsense 26.1. On 25.1 through 25.7 the dropdown only offersBasicandBearer, and AbuseIPDB accepts neither. On those releases the GET parameter is the only option.
The key still lives in your OPNsense configuration, in the password field of the alias. That is unavoidable, but it is a far smaller surface than a URL that gets copied into forum posts and config exports. Use a dedicated key for the firewall rather than the one another tool reports with, and treat your configuration backups as credentials.
Prerequisites
Not much, which is part of the appeal:
- A running OPNsense. I am on 26.1, and 26.1 or newer is what you need for header-based authorization
- An AbuseIPDB account, the free one is enough
- Optional but recommended: shell access to the firewall, so you can test the API response before OPNsense does
I would not skip the shell test. If the URL or the credential is wrong, OPNsense will accept the alias, fail the fetch, and quietly keep an empty table.
Step 1: Get the Key and Test the Query First
Log in to AbuseIPDB, open your account page, and go to the API section. You will find your API key there, an 80 character hex string. You can regenerate it at any time, which is useful to know before you paste it into a config file.
Now test the exact request OPNsense is going to make. On the firewall itself:
1
2
3
export ABUSE_KEY="your-80-char-key"
curl -i -s -H "Key: ${ABUSE_KEY}" \
"https://api.abuseipdb.com/api/v2/blacklist?plaintext=true" | head -5
A working response starts with HTTP 200 and then goes straight into addresses:
1
2
3
4
5
6
7
8
9
HTTP/2 200
content-type: text/plain; charset=UTF-8
x-ratelimit-limit: 5
x-ratelimit-remaining: 4
x-ratelimit-reset: 1795916400
45.155.205.233
193.32.162.157
...
The x-ratelimit-* headers are the part I actually care about. They tell you the daily limit, how many requests are left, and when the counter resets. That is the honest answer to “am I about to break my refresh schedule”, and it beats guessing from documentation that may lag behind the plan you are on.
A failing response looks completely different. When you are over quota you get HTTP 429 with a JSON body:
1
{"errors":[{"detail":"Too many requests","status":429}]}
A wrong key returns 401 in the same JSON shape. Keep that in mind, because it explains the failure mode I describe further down.
If you are on an OPNsense release without the Header authorization mode, this is the equivalent test with everything crammed into the URL:
1
curl -i -s "https://api.abuseipdb.com/api/v2/blacklist?plaintext=true&key=${ABUSE_KEY}" | head -5
Also check the line count once, so you know what “working” looks like on your account:
1
2
curl -s -H "Key: ${ABUSE_KEY}" \
"https://api.abuseipdb.com/api/v2/blacklist?plaintext=true" | wc -l
With a free account I see 10,000 lines, which is the cap. If you see an HTML error page instead, stop and fix that before going anywhere near the alias page.
Step 2: Create the URL Table Alias
Go to Firewall -> Aliases and add a new one. The fields I use:
| Field | Value |
|---|---|
| Enabled | checked |
| Name | AbuseIPDB_Blacklist |
| Type | URL Table (IPs) |
| Refresh Frequency |
0 Days 6 Hours |
| Content | https://api.abuseipdb.com/api/v2/blacklist?plaintext=true |
| Authorization | Header |
| HTTP Header | Key |
| API token | your 80 character API key |
| Description | AbuseIPDB top 10k blacklist |
The Authorization fields only show up for the URL alias types, so if you cannot find them, check that you actually selected URL Table (IPs) and not something else.
Two things about the refresh frequency, because the UI is easy to misread.
The field is split into days and hours, and it is a duration, not a time of day. 0 days 6 hours means the alias is refetched every six hours, which works out to four fetches per day. That leaves one request of headroom out of the five, which is exactly the kind of margin I want on something that can burn through a quota without asking me first.
Do not set it to something aggressive like one hour because the API updates hourly anyway. You would blow through the quota in five hours, spend the remaining nineteen with a stale table, and the API would have told you the same thing either way. Six hours is the sweet spot for a free account, and it also matches the recommendation AbuseIPDB gives for free-tier firewalls in their Fortinet guide.
Every manual refresh counts against the same five daily requests. If you click around in the diagnostics page while tuning, you can absolutely starve your own schedule.
Save, then click Apply.
Now be patient for a moment. OPNsense does not necessarily fetch the table the instant you save it. You can force it, which is what I do:
1
configctl filter refresh_aliases
That is the same backend call the system uses for its periodic alias refresh, and it updates URL tables along with the other alias types. If you prefer staying in the GUI, there is a refresh action on the alias itself.
Step 3: Verify the Table Actually Filled
Go to Firewall -> Diagnostics -> Aliases, pick AbuseIPDB_Blacklist from the dropdown, and look at the content. On a working setup you get a long scrollable list of IPv4 addresses.
Older OPNsense versions label this page pfTables, so do not be confused if the menu name differs slightly.
Two things are worth checking here beyond “there are entries”:
- The Loaded counter in the alias overview should be around 10,000. If it shows a handful of entries, your fetch is probably parsing an error page.
- The Last updated timestamp should be recent. If it is stuck at the moment you created the alias, the refresh is not happening.
From the shell you can check the table directly:
1
pfctl -t AbuseIPDB_Blacklist -T show | wc -l
pf table names are case sensitive, so if pfctl claims the table does not exist, try the lowercase variant before assuming something is broken. The GUI is the more reliable indicator here, but the shell is faster when you are checking whether the number moves between refreshes.
Step 4: Firewall Rules That Do Something Useful
This is the part where I want to be more honest than the average guide. OPNsense blocks everything inbound on WAN by default. If you add a block rule for this alias at the top of the WAN rule set, you have not closed a hole, because there was no general hole to close. You have added logging.
That does not mean the rule is useless. It means you should know where the actual value is.
Protect Your Port Forwards
The place where a WAN block rule genuinely earns its keep is above your port forward and NAT rules. If you expose a service to the internet, you almost certainly have an allow rule that lets traffic from anywhere reach it on a specific port. That rule is your real attack surface, and it does not care where the packet came from.
A block rule for AbuseIPDB_Blacklist placed above those allow rules drops the known-bad sources before they ever reach the service. For a self-hosted setup where you cannot put a WAF or a reverse proxy in front of everything, that is a cheap first filter.
Create it under Firewall -> Rules -> WAN:
| Field | Value |
|---|---|
| Action | Block |
| Interface | WAN |
| Direction | in |
| TCP/IP Version | IPv4 |
| Protocol | any |
| Source | AbuseIPDB_Blacklist |
| Destination | any |
| Log | checked, see below |
| Description | Block AbuseIPDB blacklist |
Then drag it to the top of the list, above your port forward rules, and apply the changes.
Rule order is everything here. A block rule below an allow rule for the same traffic never matches, because the first matching rule wins. This is the single most common reason “the blocklist does not work”.
I start with IPv4 only, since the free blacklist endpoint returns IPv4 addresses. Adding IPv6 to the rule does no harm, it just does nothing yet. There is more on that below.
Decide About Logging Deliberately
I enable logging on this rule, but I do not leave it on forever. During the first week it tells me something useful: whether the blacklist is hitting anything real on my connection, and whether any of my own traffic is being caught by a false positive.
While logging is on, Firewall -> Log Files -> Live View is the place to confirm the rule actually fires. The rule’s description shows up on every matching entry, which makes it obvious within a minute whether the alias is doing work or just sitting there looking tidy.
After that I turn logging off. A rule that matches thousands of packets a day produces a log that is mostly noise, and I would rather spend the disk and the attention on rules where a hit means something.
The LAN Rule Is a Different Thing
Blocking outbound traffic from LAN clients to blacklisted addresses is a common suggestion, and it is a reasonable one if you want to stop an already infected machine from calling home to a known controller. But be clear about what it changes:
| Rule position | Blocks | Real-world effect |
|---|---|---|
| WAN, source = alias | Inbound packets from listed addresses | Hardens port forwards against known scanners |
| LAN, destination = alias | Outbound packets to listed addresses | Limits outbound chatter from compromised hosts |
For the LAN rule, create a rule on the LAN interface with Direction: in, Source: any, Destination: AbuseIPDB_Blacklist, action Block. That blocks clients on that interface from initiating connections to listed addresses.
I would think twice before rolling this out broadly. Ten thousand addresses out of the entire IPv4 space is a very small sample, and a false positive on the outbound side means a user’s application simply stops working with no obvious explanation. If you do it, add an exception rule above it for your own trusted sources and monitor for a few days.
Exceptions Belong Above the Block Rule
If you find an address in the list that you actually need, do not edit the alias, because the next refresh overwrites it. Put a pass rule for that address above the block rule instead. It survives every refresh and it documents itself.
That is also the cleanest way to protect a monitoring service, a partner network, or a relay used by a remote support tool.
Step 5: IPv6, and the Quota Arithmetic
The blacklist endpoint takes an ipVersion parameter, so you can ask for IPv6 instead of the default IPv4 list. The catch is that it is a second request. Two aliases, each refreshing every six hours, means eight requests per day against a budget of five.
So you have to choose, and I think the choice is obvious for most home setups:
| Approach | Requests per day | Coverage |
|---|---|---|
| IPv4 only, every 6 hours | 4 | IPv4 addresses |
| IPv4 + IPv6, both every 12 hours | 4 | Both families |
| IPv4 every 6h, IPv6 every 12h | 6 | Over budget, do not |
My own setup is the first row. IPv4 still carries the overwhelming majority of drive-by scanning, and my exposed services are reached over IPv4. If you run IPv6-only services, take the second row and accept a slower refresh on both lists.
I would not build the third row. It looks fine on paper until you refresh an alias by hand, and then the fetch that fails is the one you were not watching.
What Breaks, and How It Breaks Quietly
This is the section I would have wanted before setting this up, because the failure modes here are boring but silent.
A Bad Credential Looks Like a Healthy Alias
When the API answers with 429, 401, or any other non-200 status, OPNsense does not touch the table. It only parses the body when the fetch succeeded, so an error means the previous content is kept and the update is skipped.
That is the right design, and it is also why a broken setup can look fine for days. The rules are there, the alias still has ten thousand entries, and nothing on the dashboard turns red. The only evidence is in the system log:
1
grep -i "alias resolve error" /var/log/system/latest.log | tail
The messages to look for are error fetching alias url ... [http_code:429] and alias resolve error AbuseIPDB_Blacklist. If those show up and the Last updated column is still moving, the fetch is working and something else failed. If they show up and the timestamp is frozen, your key or your quota is the problem.
A Frozen Timestamp Is the Real Signal
Because errors preserve the old list, the timestamp is more useful than the entry count. A table with 10,000 entries that has not been updated in three days looks perfectly healthy and is completely useless.
That is also what you get when the firewall cannot resolve api.abuseipdb.com, or when the WAN link was down over a refresh window. A firewall that cannot resolve names is a firewall that cannot refresh any feed, and DNS breakage is exactly the kind of thing you discover three weeks later.
An Empty Table Is a Parsing Problem
The one case that does empty the table is a successful fetch that contains no addresses. OPNsense validates every line, keeps what parses as an address or network, and treats everything else as a hostname to resolve. If a captive portal or an intercepting proxy hands back an HTML page with a 200 status, you end up with an empty table and a pile of failed DNS lookups in the log.
If the count drops to zero right after a network change, check the response with curl before you start rewriting rules. The alias is probably telling the truth about what it received.
Key Rotation Is a Two Minute Job
Rotating the key means generating a new one on AbuseIPDB and pasting it into the alias, which is one field. OPNsense includes the authorization settings in the alias fingerprint, so saving a new key forces a refetch instead of waiting for the next cycle. That is a small detail I only noticed because I rotated a key while testing and the table updated immediately.
Do it anyway if a configuration export ever leaves your control. A read-only feed credential with a five-a-day quota is not catastrophic in the wrong hands, but it is still someone else’s quota and your account’s reputation.
Is This Actually Worth Doing?
For my setup, yes, with modest expectations. The blacklist is a list of addresses that thousands of other administrators have already reported. It is not a threat intelligence platform, it does not know anything about targeted attacks against me specifically, and ten thousand addresses is a rounding error in the IPv4 space.
What it does well is take the loudest, most persistent background noise out of the picture before it reaches a port forward. It costs nothing, it needs no maintenance, and it fails in a way I can reason about.
If you want something with more depth, there is a community plugin, os-abuseipdb, that goes considerably further: it pulls the blacklist into a pf table, optionally reports your own blocked attackers back to AbuseIPDB, and adds local block lists with TTLs. It is in public beta and it is a much bigger piece of software than an alias. I looked at it, decided I did not want a third-party plugin in the packet path of my firewall, and stayed with the built-in alias. That is a preference, not a verdict.
Either way, this is a supplement. It does not replace patching, it does not replace the default block policy on WAN, and it certainly does not replace having a clue about what you expose to the internet in the first place.
🔗 References
- AbuseIPDB APIv2 documentation
- AbuseIPDB blacklist endpoint reference
- AbuseIPDB FortiGate integration guide (documents the single-URL fallback)
- AbuseIPDB pricing and plan limits
- OPNsense aliases documentation
- OPNsense firewall rules documentation
- OPNsense alias URI parser (how the Authorization modes are applied)
- OPNsense community plugin os-abuseipdb
Final Thoughts
The thing I like about this setup is how little of it there is. One alias, one URL, one or two rules, and a refresh interval that was chosen by doing subtraction against a quota instead of by guessing.
The part that surprised me is that the two pieces of advice I kept running into are outdated in opposite directions. The confidenceMinimum parameter gets copied from paid-plan examples into free-tier guides, where it is silently ignored. The key-in-URL pattern gets presented as the only option long after OPNsense grew a proper Authorization section for URL aliases. Reading the vendor documentation and the release notes took ten minutes and saved me from debugging a parameter that was never going to work, and from parking a credential in a place it did not need to be.
I also learned to distrust the word “blocked” in firewall guides. A block rule that sits below an allow rule blocks nothing, and a rule that points at a stale alias blocks nothing either. Both look perfectly healthy in the rule list. Checking the alias content, the last update timestamp and the rule order, not the rule count, is what actually tells you whether this is working.
If I were starting over, I would test the API request from the shell first, set the refresh to six hours from the beginning, use the header-based authorization instead of the URL parameter, and enable logging on the WAN rule for exactly one week before turning it off again. That is roughly the sequence that took me a couple of iterations to arrive at anyway.
