SCANLOGD(8)
π SCANLOGD β the manual page, but make it make sense
okay bestie so real talk, scanlogd lives in section 8 of the manual (that's the "system administration" girlies, the root-only zone π₯) and it's genuinely iconic. let's get into it.
β¨ NAME β¨
scanlogd β she detects and logs TCP port scans π΅οΈβοΈπ
π SYNOPSIS π
scanlogd
that's it. no flags, no args, no drama. she just is. periodt.
π¦ DESCRIPTION π¦
so like. scanlogd detects port scans and writes one line per scan via the syslog(3) mechanism. that's her whole thing and she eats every time π
if a single source address sends multiple packets to different ports in a short time, the event gets logged. like, she notices. she always notices π
the format of the messages is:
saddr[:sport] to daddr [and others,] ports port[, port...], ..., flags[, TOS TOS][, TTL TTL] @HH:MM:SS
the fields in square brackets are optional β that's the "only if she feels like it" section π. specifically, sport, TOS, and TTL will only be displayed if they were constant during the scan. if they were jumping around the whole time, no shade, they just don't get a spot in the lineup.
the flags field represents TCP control bits seen in packets coming to the system from the address of the scan. it's a combination of eight characters, each one corresponding to one of the six defined and two reserved TCP control bits (see RFC 793, she's old but she's famous).
here's the encoding tea β:
- control bits that were always set β an uppercase letter
- a lowercase letter β the bit was always clear
- a question mark β the bit changed from packet to packet (flaky behavior, we've all been there π)
π INTERFACES π
to do her job, scanlogd needs a way to obtain raw IP packets that either:
- come to the system
scanlogdis running on, or - travel across a network segment that is directly connected to the system
current versions of scanlogd can be built with support for one of several packet capture interfaces. pick your fighter π
scanlogd is aware of:
- the raw socket interface on Linux
libnidslibpcap
the use oflibpcapalone is discouraged. if you're on a system other than Linux and/or want to monitor the traffic of an entire network at once, you should be usinglibnidsin order to handle fragmented IP packets. don't be stubborn bestie, just use libnids.
β COMPILE-TIME DEFAULTS β
these are the numbers she was built with, no cap:
- at least 7 different privileged ports or 21 non-privileged ports, or a weighted combination of those, have to be accessed with no longer than 3 seconds between the accesses to be treated as a scan. three seconds. that's the window. be quick about it.
- if more than 5 scans are detected within 20 seconds, that event will be logged and logging will be stopped temporarily. she needs a lil break, she's only human π«Ά
- logging is done with a facility of
daemonand a priority levelalert. scanlogdshould be started as root since it needs access to a packet capture interface.- by default, it chroots to
/var/emptyand switches to running as userscanlogdafter the packet capture interface is initialized. queen of security hygiene, honestly π
π EXIT STATUS π
if the daemon couldn't start up successfully, it will exit with a status of 1. that's the "nope, not today" code.
π USAGE π
you're expected to create a dummy user for scanlogd to run as. make sure you allocate unique UID and GID to the user β don't be reusing IDs, that's messy π
in most cases, scanlogd should be started from a rc.d script on system startup. set it and forget it, she'll be there π¦
in /etc/syslog.conf you may use something like:
daemon.alert /var/log/alert
and boom, alerts go to that file. iconic.
π₯ SECURITY NOTES π₯
as the name indicates, scanlogd only logs port scans. it does not prevent them. so don't come for her when the scan still happens β she's a journalist, not a bouncer π
you will only receive summarized information in the system's log. that's the deal.
obviously, the source address of port scans can be spoofed. don't take any action against the source of attacks unless other evidence is available. seriously. do not. i'm not kidding π
sometimes IP addresses are shared between many people β this is the case for:
- ISP shell servers
- dynamic dialup pools
- corporate networks behind NAT (masquerading)
so like, that "attacker" might be a whole office building of innocent people. vibe check before you act, bestie π
π BUGS π
due to the nature of port scans, both are possible:
- false positives β detecting a scan when there isn't one
- false negatives β not detecting a scan when there's one
in particular, false positives occur when many small files are transferred rapidly with passive mode FTP. so if your FTP is going feral, that's why she's yelling. it's not you. it's kind of you, actually. but it's fine π
π AUTHORS π
- Solar Designer
<solar at openwall.com> - Steffen Dettmer
<steffen at dett.de>wrote the initial version of this manual page π
πΈ SEE ALSO πΈ
syslog(3)syslog.conf(5)libnids(3)pcap(3)- scanlogd home page:
http://www.openwall.com/scanlogd/ - Phrack Magazine, issue 53, article 13
and that's the whole page, bestie!! this one came straight from the Openwall Project and it's dated 2 June 2004 β old but absolutely still serving looks β¨ go log some scans, stay safe, don't chroot-shame, and remember: she logs, she doesn't prevent. mwah π
π¦ where this page comes from
- debian bookworm: scanlogd 2.2.8-0.1 Β· BSD~cut-down
- debian trixie: scanlogd 2.2.8-0.1 Β· BSD~cut-down
- ubuntu jammy: scanlogd 2.2.8-0.1 Β· BSD~cut-down
- ubuntu noble: scanlogd 2.2.8-0.1 Β· BSD~cut-down
- ubuntu resolute: scanlogd 2.2.8-0.1build1 Β· BSD~cut-down
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms