Perform GUI actions from the CLI

Is there a way to perform GUI actions from the CLI, specifically for use in a script? I simply want to enable custom firewall settings in Connectivity --> Firewall --> Advanced --> Advanced Settings --> Custom Firewall Rules. Or…I see a GET request (“GET /admin/ajax.php?command=updateadvanced&module=firewall&option=rejectpac kets&val=enabled HTTP/1.1” 200 91 “”) happens when I enable/disable that button - would anyone know how I could recreate that request for use with curl or wget? Any other ideas?

Does fwconsole have all the options you are looking for?


Not exactly… I want to enable Custom Rules so that they load whenever the firewall starts. The instructions are to create /etc/firewall-4.rules and then enable the custom rules in the GUI. I’d like to do the last part in a script.

Ahh, my apologies.
This is stored in the mysql table ‘kvstore_FreePBX_modules_Firewall’ as a json-array with the key ‘advancedsettings’. You could potentially change it there via a db query, though I don’t know if there is a hook involved (I would think there is) that is called after the DB write but you might be able to hack around that with a plain old fwconsole firewall reload. Would be worth a test, though.

Is the Custom Firewall Rules page not sufficient? In other words, are these custom rules static or dynamic?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.