Unbound adblocking enable & disable using API - curl command ?

Started by gspannu, April 16, 2026, 10:37:08 AM

Previous topic - Next topic
Help needed....

Does anyone know as to how to use the API to enable & disable Unbound Blocklists using an API?

I have Unbound setup with a few blocklists and combination of source nets; so most of the time Unbound Blocklists can keep running.

However, there are times when other family members use laptops/machines (that are a part of the blocklists) but just need Ad-Unblocking for a short duration. Expecting them to login into the GUI in OPNsense to disable this is a bridge too far.


Q: Is there a global API (or some mechanism without having to log into OPNsense GUI) to temporarily disable all blocklists and then enable them later.

Q: Is there a quick way to do this via a simple curl command that can execute a preformed API call?  I can then create a shortcut on these machines that can be used to turn on/off Unbound blocking.

I have tried reading into the API docs, but unable to figure it out...

May I suggest considering to use AdGuard Home instead for DNS blocking? There are nice mobile apps that let you disable filtering with a single tap - for 1 minute, 5 minutes, 1 hour ... etc.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Quote from: Patrick M. Hausen on April 16, 2026, 12:44:44 PMThere are nice mobile apps that let you disable filtering with a single tap - for 1 minute, 5 minutes, 1 hour ... etc.
To be honest : People should really avoid needing such a feature!

Is it really that hard to simply check your Pi-Hole Query Log (or the same in AdGuard) and figure out what is being blocked and solve the issue once and for all ?!
Nothing personal by the way. Talking about people in general!

And in the worst case you even have the option to use some kind of DoH/DoT feature in Mozilla Firefox for example to check if your adblocker is the issue at all :)
Weird guy who likes everything Linux and *BSD on PC/Laptop/Tablet/Mobile and funny little ARM based boards :)

Quote from: Patrick M. Hausen on April 16, 2026, 12:44:44 PMMay I suggest considering to use AdGuard Home instead for DNS blocking? There are nice mobile apps that let you disable filtering with a single tap - for 1 minute, 5 minutes, 1 hour ... etc.

I have been using AGH for a long time, but was keen to start using Unbound and remove all (non-native components from OPNsense). hence, the query...

Quote from: nero355 on April 16, 2026, 03:14:40 PMTo be honest : People should really avoid needing such a feature!

Is it really that hard to simply check your Pi-Hole Query Log (or the same in AdGuard) and figure out what is being blocked and solve the issue once and for all ?!
Nothing personal by the way. Talking about people in general!

And in the worst case you even have the option to use some kind of DoH/DoT feature in Mozilla Firefox for example to check if your adblocker is the issue at all :)

It is not about whether I can analyse and check what websites are being blocked and then whitelist these permanently, its about other users in the home who are not that tech-savvy... and for the times that I am not available to do the same.

Hence, my request for a API call (I know that it exists, as the OPNsense API documentation does refer to adblocking... I just haven't been able to get my head around it to make it work !) - if anyone who understands API can help; then it would be much appreciated.


Quote from: gspannu on April 16, 2026, 04:11:42 PM
Quote from: nero355 on April 16, 2026, 03:14:40 PMTo be honest : People should really avoid needing such a feature!

Is it really that hard to simply check your Pi-Hole Query Log (or the same in AdGuard) and figure out what is being blocked and solve the issue once and for all ?!
Nothing personal by the way. Talking about people in general!

And in the worst case you even have the option to use some kind of DoH/DoT feature in Mozilla Firefox for example to check if your adblocker is the issue at all :)

It is not about whether I can analyse and check what websites are being blocked and then whitelist these permanently, its about other users in the home who are not that tech-savvy... and for the times that I am not available to do the same.

Hence, my request for a API call (I know that it exists, as the OPNsense API documentation does refer to adblocking... I just haven't been able to get my head around it to make it work !) - if anyone who understands API can help; then it would be much appreciated.



i started making PR for a unbound dashboard widget that used the API to enable/disable blocking (there isn't a timer mechanism though like PiHole or Adguard). the main issue i had was that the act of enable/disable in opnsense and its custom blocklist implementation it that if you have decent sized lists, the operation can take seconds, like 5 or more on modern CPU, 10+ on smaller embedded cpus. its just not built with quick enable/disable/reloading in mind.

i gave adguard a try and i am currently using that and working on adguard plugin, the 3rd party repo adguard home plugin doesn't really have a native interface...
Deciso DEC3920, Protectli VP2440

Quote from: dirtyfreebooter on April 16, 2026, 06:31:29 PMi gave adguard a try and i am currently using that and working on adguard plugin, the 3rd party repo adguard home plugin doesn't really have a native interface...


That is some effort that you are putting in... AGH has a ton of options and to capture them all into an OPNsense GUI and then ensure that future updates also work.... Hats off to your effort.

I very much look forward to your plugin... Is there a GitHub link for it?

Quote from: gspannu on April 16, 2026, 09:36:59 PM
Quote from: dirtyfreebooter on April 16, 2026, 06:31:29 PMi gave adguard a try and i am currently using that and working on adguard plugin, the 3rd party repo adguard home plugin doesn't really have a native interface...


That is some effort that you are putting in... AGH has a ton of options and to capture them all into an OPNsense GUI and then ensure that future updates also work.... Hats off to your effort.

I very much look forward to your plugin... Is there a GitHub link for it?

its not ready yet, plus i am still sort-of on the fence about adguard home myself, so just giving adguard home more time and if i decide to stick with it, i'll finish the work and make the PR, because yes, i probably won't want to maintain a plugin i wasn't using myself
Deciso DEC3920, Protectli VP2440