OPNsense Forum

Archive => 21.7 Legacy Series => Topic started by: ckishappy on August 12, 2021, 11:01:50 PM

Title: Error deleting states with the API killStates function?
Post by: ckishappy on August 12, 2021, 11:01:50 PM
Hi, I try to kill states after enabling some filter rules to stop the (established) connections immediately. This is to turn-off the internet / TV for the kids immediately. I integrate this an on-off switch in HomeKit (via node-red)...

I use the below curl Post killStates command:

curl -k -u "$KEY":"$SECRET" -X POST "https://opnsenseIP/api/diagnostics/firewall/killStates" -d ""


Error message I get is as following:
{"result":"failed"}%     

The question is: How can I kill the states (via the API) for a specific destination or source ip/alias?



Title: Re: Error deleting states with the API killStates function?
Post by: ckishappy on August 13, 2021, 04:07:36 PM
hmm, the only thing that I got to work is the following one:

have a shell script logging to the firewall with SSH in and execute in the CLI:

sudo pfctl -k 192.168.1.0/24

Seems to be the brute force method to kill all states for the LAN (in the above case 192.168.1.0/24). 

Perhaps someone in the forum knows more on the killStates API, and how to include Alias?
Title: Re: Error deleting states with the API killStates function?
Post by: chemlud on August 13, 2021, 05:23:49 PM
...no idea of API, but I use a cron job (killing all states...)

https://forum.opnsense.org/index.php?topic=10740.0
Title: Re: Error deleting states with the API killStates function?
Post by: ckishappy on August 21, 2021, 10:02:21 AM
thanks!