External Pre and Post Scripts

External commands can be run before or after CSF sets up the iptables chains and rules (e.g. iptables rules not covered by CSF).

Pre Script

To run external commands before CSF configures iptables create the file:

/usr/local/csf/bin/csfpre.sh

Add an appropriate shebang interpreter line and then whatever external commands you wish to execute:

#!/bin/sh
/some/path/to/binary -a -b -c etc

Set that file as executable:

chmod +x /usr/local/csf/bin/csfpre.sh

Post Script

To run external commands after CSF configures iptables create the file:

/usr/local/csf/bin/csfpost.sh

Add an appropriate shebang interpreter line and then whatever external commands you wish to execute:

#!/bin/sh
/some/path/to/binary -a -b -c etc

Set that file as executable:

chmod +x /usr/local/csf/bin/csfpost.sh

Related Files

File Description
/usr/local/csf/bin/csfpre.sh Commands to run before CSF sets up the iptables chains and rules. (file must be created)
/usr/local/csf/bin/csfpost.sh Commands to run after CSF sets up the iptables chains and rules. (file must be created)