How can iptables run a command or script on a new connection attempt?
Requirement:
External packet to (server interface eth0) ---> (Server interface eth0) input table detects new packet received on port 22 --> iptables runs a command or script
Me thinks, so far, for example:
iptables -A INPUT -i eth0 -p tcp --dport 22 -s xxx.xxx.xxx.xxx/24 -d xxx.xxx.xxx.xxx/32 -m state --state NEW (then do something here like run a script or command (but how?) ) -j ACCEPT
Further reading from a similar question with two answers: