OPNsense Forum

English Forums => General Discussion => Topic started by: grimelog on February 05, 2025, 10:52:23 AM

Title: Is Spamhaus publishing their block list in valid JSON?
Post by: grimelog on February 05, 2025, 10:52:23 AM
I've tried setting up a URL Table in JSON format for Spamhaus's blocklist (https://www.spamhaus.org/drop/drop_v4.json) using Path expressions. However, I cannot find any expression that can successfully parse it. The JSON validators I've checked claim it is invalid JSON. However, jq can still successfully parse the list. Is this a situation that's kind of like YAML, where it's possible to write valid YAML no parser can interpret? Is this a valid JSON file?
Title: Re: Is Spamhaus publishing their block list in valid JSON?
Post by: kryptto on April 29, 2025, 02:51:33 PM
Gotta add "Path Expression"  CIDR  found here:  https://docs.opnsense.org/manual/how-tos/drop.html

As long as the rule is working, I block in and out of my wall, try port 80 browsing to: http://(breaking on purpose)45.148.123.12
looking at your live firewall log, filter on "block" traffic should be there.
Title: Re: Is Spamhaus publishing their block list in valid JSON?
Post by: EricPerl on April 29, 2025, 09:44:29 PM
I'm not really sure what you are asking.
Per instructions, the alias contains an URL to a table in JSON format.

Looking at the first couple lines:
{"cidr":"1.10.16.0/20","sblid":"SBL256894","rir":"apnic"}
{"cidr":"1.19.0.0/16","sblid":"SBL434604","rir":"apnic"}
Each line is valid JSON.
The "table" name implies one record per line. The record is in JSON.

The resulting content may have a json extension but the content type is:
< Content-Type: text/html
It's not expected to be valid JSON.
Title: Re: Is Spamhaus publishing their block list in valid JSON?
Post by: kryptto on April 30, 2025, 10:00:43 PM
Check to make sure in the Alias field called your Path expression field has the following:  cidr

Under Step 1 of the instructions link I posted.  Does your Alias match exactly what they documented, if you are missing anything, it wont work.