PSAD or Port Scan Attack Detector is a collection of three lightweight system daemons (two main daemons and one helper daemon) that run on Linux machines and analyze iptables log messages to detect port scans and other suspicious traffic. A typical deployment is to run psad on the iptables firewall where it has the fastest access to log data.
PSAD information is
here including Download, Documentation, Features, Source Code, and Mailing List links.
PSAD is designed to work with ipchains Linux kernels 2.2.x, and iptables in Linux kernels 2.4.x and later to detect port scans.
PSAD features a set of highly configurable danger thresholds (with sensible defaults provided), verbose alert messages that include the source, destination, scanned port range, begin and end times, tcp flags and corresponding nmap options (Linux 2.4.x kernels only), reverse DNS info, email alerting, and automatic blocking of offending ip addresses via dynamic configuration of ipchains/iptables firewall rulesets. In addition, for the 2.4.x kernels psad incorporates many of the tcp signatures included in Snort to detect highly suspect scans.
Note the Linux Firewalls book
here which can be purchased there at a 30% discount.
-- Tom
P.S. I highly recommend consulting the Widpedia Netfilter/iptables webpage
here for more information about iptables, esp. diagrams at the bottom of the webpage.