Helper Script
-
Hello,
Here in the forum I have read that some people have even written scripts to automate tasks. I would like to add and remove rules, but I do not know how to begin. Some people looked at the php code and other edit the config.xml. Can someone perhaps give me a script or some code to start building my own script?
Greetings
BJ
-
Have you looked at the PHP shell?
http://doc.pfsense.org/index.php/Using_the_PHP_pfSense_ShellSteve
-
Yes, but i want something to call from remote. I have no idea howto call this automatical via ssh. I want to use something over HTTP or a script diretcly called via ssh. For example on google I found a user who wrote this
I don't have a pfSense box right now, but you can do something like:
ssh r…@192.51.100.20 /my/script.php blocklist 198.51.100.20 comment
ssh r...@192.51.100.20 rm -f /tmp/config.cache ; /etc/rc.reload_something2xWhere /my/script.php is a script that modifies /conf/config.xml.
Hacking that script would only take a minute. You can modify
/tmp/rules.debug too, but the rules would be removed on next reload.
:)Anyway, you can try this sed trick if you don't want to use PHP:
sed 's/<rules>$/<rules><entry1>insert here</entry>/g'
/conf/config.xml > /conf/config.xml.new</entry1></rules></rules>So I though somebody has allready a script which modify the config.xml or some code which could help my writting my own script.
BJ
-
You can playback php shell recording directly from the normal shell if that helps.
Steve
-
Okay thanks. I will try this.