1

The solution to your problem is very old, but doesn't involve iptables. It's called the inetd super-server. Its configuration - /etc/inetd.conf - lets you define the port and protocol to listen for - the "service", defined in /etc/services - and the program to execute in case of a connection - which could be your logging script. The service would ...


1

You can't start programs or scripts from IPtables, but you can log traffic that comes to some port in IPtables. This will log entry in system log (/var/log/syslog on Debian) every time something comes to udp or tcp port 445 with log prefix and details about the connection (timestamp, source port, source IP, ...) iptables -I INPUT -p tcp --dport 445 -j LOG --...


Only top voted, non community-wiki answers of a minimum length are eligible