ndejong / pfsense_fauxapi

REST based API interface for pfSense 2.3.x and 2.4.x to facilitate devops
Apache License 2.0
354 stars 61 forks source link

enable/disable firewall rule #40

Closed lblabr closed 5 years ago

lblabr commented 5 years ago

i'd like to enable/disable or toggle a firewall rule through your rest api, do you think thats possible ?

ndejong commented 5 years ago

Yes - I'd recommend you take a look into functions rule_get and then use a config_patch to achieve this - once you get something going it would be nice to add this as an example, rule management requests are fairly common here - N

ndejong commented 5 years ago

Perhaps also take a look at the Python example code here to give you some ideas:- https://github.com/ndejong/pfsense_fauxapi/tree/master/extras/examples

JetLaggedJackal commented 5 years ago

I believe this python script is what you are looking for https://github.com/EpaL/kindercontrol.

lblabr commented 5 years ago

great, i may have a look

ndejong commented 5 years ago

@lblabr would be good to hear back if you managed to address your requirement.

I'd suggest also taking a look at the new Python based interface which also happens to provide a command-line interface as well

Regardless, you'll want to use the FauxAPI rule_get and config_patch functions to achieve what you are looking for.