OPNsense Forum

Archive => 20.1 Legacy Series => Topic started by: Ulrar on May 10, 2020, 05:35:58 PM

Title: Remotely enable / disable a rule
Post by: Ulrar on May 10, 2020, 05:35:58 PM
Hi,

Is there any way, either through API or SSH or anything else, to have an external system enable or disable an existing firewall rule ?
I have a rule to send my TV's traffic through a VPN (for geo locked content) and I'd like to be able to quickly toggle it on or off from home assistant, I was thinking of just writing a script but it looks like the API doesn't expose anything outside of aliases for the firewall.

Is there any other way to get it to work ?

Thank you
Title: Re: Remotely enable / disable a rule
Post by: MrB on May 10, 2020, 07:08:34 PM
Haven't played with it myself, but looks like there's a os-firewall plugin "Firewall API supplemental package" and looking at the docs ( https://docs.opnsense.org/development/api/plugins/firewall.html  (https://docs.opnsense.org/development/api/plugins/firewall.html)) it seems that there's a command for toggling a rule.