Developer Shell Usage and Commands
I am looking to automate a number of tasks through the developer shell such as adding/removing aliases, rules, etc. I have the basic process down and have been able to modify basic settings. Does anyone have an example of adding/modifying a firewall rule or deleting objects such as aliases or rules?
Any help would be appreciated.
Here is an example of what I have so far to add/modify an alias. I use this command:" ssh firstname.lastname@example.org '/usr/local/sbin/pfSsh.php' < cmds.txt " to feed the below commands to the shell so they become active. What I can't figure out is how to add a rule or delete an object.
$config['aliases']['alias'] = array(
"name" => "GoogleDNS",
"address" => "184.108.40.206",
"descr" => "GoogleDNS",
"type" => "host",
"detail" => "Added via script");
basically you "unset" the variable and write the config again
see how the webgui does it here:
adding&deleting fw rules can also be found in the webgui sources but are somewhat more complex
to add/edit https://github.com/pfsense/pfsense/blob/master/src/usr/local/www/firewall_rules_edit.php (you probably need to understand most of this file, to safely add rules)
to delete https://github.com/pfsense/pfsense/blob/master/src/usr/local/www/firewall_rules.php#L224-L244
Has anyone actually done this before and can provide an example of a rule addition from the developer shell?