OPNsense Forum

Archive => 20.7 Legacy Series => Topic started by: dasbrow on January 10, 2022, 05:17:55 pm

Title: [Solved] Using Api to toggle Firewall rules
Post by: dasbrow on January 10, 2022, 05:17:55 pm
I have a firewall rule under firewall->Rules->Lan to block Roblox while my kids are doing online schooling. Works great if I enable /disable it via the GUI. Unfortunately I can't see the rule via api calls, I want to automate blocking non school sites during class times.

Ie:
curl -k -u "YouKnowNothing":"JonSnow" https://192.168.254.249/api/firewall/searchRules
Returns:
{"rows":[],"rowCount":0,"total":0,"current":1}
or
curl -k -u "YouKnowNothing":"JonSnow" https://192.168.254.249/api/firewall/getRule/UUID
Returns:
[]

No idea what I am missing here. Please help my sanity and give me guidance.

Thanks in advance.

EDIT: I can't upgrade to 21.x until the weekend.
Title: Re: Using Api to toggle Firewall rules
Post by: Fright on January 10, 2022, 08:53:10 pm
https://forum.opnsense.org/index.php?topic=16943.0 ?
Title: Re: Using Api to toggle Firewall rules
Post by: dasbrow on January 11, 2022, 03:50:21 pm
This solved everything. Greatly appreciated.