iptables trace utility
1.0.0
modprobe ipt_LOG
sysctl net.netfilter.nf_log.2 = ipt_LOG
sudoers rules:
USER ALL=(root) NOPASSWD: /sbin/iptables-save ""
USER ALL=(root) NOPASSWD: /sbin/iptables -t raw -F *
USER ALL=(root) NOPASSWD: /sbin/iptables -t raw -A * -j TRACE
USER ALL=(root) NOPASSWD: /sbin/sysctl net.netfilter.nf_log.2=ipt_LOG
Where USER is unix user running ajax.php script (eg. www-data when using apache)
backend component:
you need a php-enabled webserver to run ajax.php, or
use php 5.4 embeded webserver by invoking this command in folder where you have unpacked files:
sudo -u USER php -S localhost:8080 -t .
$logfile in ajax.php to point to file iptables is logging in (eg. /var/log/kern.log)
you can setup rsyslog to separate iptables' log messages:
:msg, regex, "^[[ ]*[0-9]*.[0-9]*] Firewall: " -/var/log/iptables.log
& ~
:msg, regex, "^[[ ]*[0-9]*.[0-9]*] TRACE: " -/var/log/iptables.log
& ~
read access to $logfile for USER (eg. chmod +r $logfile)
frontend component:
do not modify firewall while tracing
Please submit issues via PR to some file <TITLE>.txt or <TITLE>.md on issues branch.