SNORT(8)
π SNORT π β System Manager's Manual (Snort(8))
okay bestie, sit down, hydrate, because we're about to read the manual page for Snort together and honestly? it's giving legend behavior. π·β¨
πΈ NAME πΈ
Snort β open source network intrusion detection system
β¨ SYNOPSIS β¨
snort [-bCdDeEfHIMNOpqQsTUvVwWxXy?] [-A alert-mode ] [-B address-
conversion-mask ] [-c rules-file ] [-F bpf-file ] [-g group-name ] [-G
id ] [-h home-net ] [-i interface ] [-k checksum-mode ] [-K logging-mode
] [-l log-dir ] [-L bin-log-file ] [-m umask ] [-n packet-count ] [-P
snap-length ] [-r tcpdump-file ] [-R name ] [-S variable=value ] [-t
chroot_directory ] [-u user-name ] [-Z pathname ] [--logid id ]
[--perfmon-file pathname ] [--pid-path pathname ] [--snaplen snap-length
] [--help ] [--version ] [--dynamic-engine-lib file ] [--dynamic-engine-
lib-dir directory ] [--dynamic-detection-lib file ] [--dynamic-
detection-lib-dir directory ] [--dump-dynamic-rules directory ]
[--dynamic-preprocessor-lib file ] [--dynamic-preprocessor-lib-dir
directory ] [--dynamic-output-lib file ] [--dynamic-output-lib-dir
directory ] [--alert-before-pass ] [--treat-drop-as-alert ] [--treat-
drop-as-ignore ] [--process-all-events ] [--enable-inline-test ]
[--create-pidfile ] [--nolock-pidfile ] [--no-interface-pidfile ]
[--disable-attribute-reload-thread ] [--pcap-single= tcpdump-file ]
[--pcap-filter= filter ] [--pcap-list= list ] [--pcap-dir= directory ]
[--pcap-file= file ] [--pcap-no-filter ] [--pcap-reset ] [--pcap-reload
] [--pcap-show ] [--exit-check count ] [--conf-error-out ] [--enable-
mpls-multicast ] [--enable-mpls-overlapping-ip ] [--max-mpls-labelchain-
len ] [--mpls-payload-type ] [--require-rule-sid ] [--daq type ] [--daq-
mode mode ] [--daq-var name=value ] [--daq-dir dir ] [--daq-list [dir] ]
[--dirty-pig ] [--cs-dir dir ] [--ha-peer ] [--ha-out file ] [--ha-in
file ] expression
like. that's a LOT of flags and we love that for us. π
π¦ DESCRIPTION π¦
Snort is an open source network intrusion detection system, and no cap it can do real-time traffic analysis and packet logging on IP networks. it can perform protocol analysis, content searching/matching, and it can be used to detect a whole variety of attacks and probes β think buffer overflows, stealth port scans, CGI attacks, SMB probes, OS fingerprinting attempts, and much much more. it's giving main character energy on your network. π
Snort uses a flexible rules language to describe traffic that it should collect or pass, plus a detection engine that utilizes a modular plugin architecture. and it also has a modular real-time alerting capability, incorporating alerting and logging plugins for syslog, a ASCII text files, UNIX sockets or XML. obsessed. π
Snort has three primary uses, bestie:
- it can be a straight packet sniffer like
tcpdump(1) - it can be a packet logger (useful for network traffic debugging, etc)
- or it can be a full blown network intrusion detection system π
Snort logs packets in tcpdump(1) binary format or in Snort's decoded ASCII format, into a hierarchy of logging directories that are named based on the IP address of the "foreign" host.
π OPTIONS π
-A alert-modeβ Alert using the specified alert-mode. valid alert modes includefast,full,none, andunsock.fastwrites alerts to the default "alert" file in a single-line, syslog style alert message.fullwrites the alert to the "alert" file with the full decoded header as well as the alert message.noneturns off alerting. andunsockis an experimental mode that sends the alert information out over a UNIX socket to another process that attaches to that socket. π§¦-bβ Log packets in atcpdump(1)formatted file. all packets are logged in their native binary state to a tcpdump formatted log file named with the snort start timestamp and "snort.log". this option results in much faster operation of the program, since it doesn't have to spend time in the packet binary->text converters. Snort can keep up pretty well with 100Mbps networks in-bmode. to choose an alternate name for the binary log file, use the-Lswitch. β‘-B address-conversion-maskβ Convert all IP addresses in home-net to addresses specified by address-conversion-mask. used to obfuscate IP addresses within binary logs. specify home-net with the-hswitch. Note: this is not the same as$HOME_NET. π-c config-fileβ Use the rules located in file config-file.-Cβ Print the character data from the packet payload only (no hex).-dβ Dump the application layer data when displaying packets in verbose or packet logging mode.-Dβ Run Snort in daemon mode. Alerts are sent to/var/log/snort/alertunless otherwise specified.-eβ Display/log the link layer packet headers.-Eβ *WIN32 ONLY* Log alerts to the Windows Event Log.-fβ Activate PCAP line buffering-F bpf-fileβ Read BPF filters from bpf-file. this is handy for people running Snort as a SHADOW replacement or with a love Of super complex BPF filters. see the "expressions" section of this man page for more info on writing BPF filters. π«Ά-g groupβ Change the group/GID Snort runs under to group after initialization. this switch allows Snort to drop root privileges after its initialization phase has completed, as a security measure. π-G idβ Use id as a base event ID when logging events.-h home-netβ Set the "home network" to home-net. the format of this address variable is a network prefix plus a CIDR block, such as192.168.1.0/24. once this variable is set, all decoded packet logging will be done relative to the home network address space. this is useful because of the way that Snort formats its ASCII log data. with this value set to the local network, all decoded output will be logged into decode directories with the address of the foreign computer as the directory name, which is very useful during traffic analysis. this option does not change$HOME_NETin IDS mode. π«-Hβ Force hash tables to be deterministic instead of using a random number generator for the seed & scale. useful for testing and generating repeatable results with the same traffic. π―-i interfaceβ Sniff packets on interface.-Iβ Print out the receiving interface name in alerts.-k checksum-modeβ Tune the internal checksum verification functionality with checksum-mode. valid checksum modes includeall,noip,notcp,noudp,noicmp, andnone.allactivates checksum verification for all supported protocols.noipturns off IP checksum verification, which is handy if the gateway router is already dropping packets that fail their IP checksum checks.notcpturns off TCP checksum verification, all other checksum modes are on.noudpturns off UDP checksum verification.noicmpturns off ICMP checksum verification.noneturns off the entire checksum verification subsystem. π-K logging-modeβ Select a packet logging mode. the default ispcap. logging-mode. valid logging modes includepcap,ascii, andnone.pcaplogs packets through the pcap library into pcap (tcpdump) format.asciilogs packets in the old "directories and files" format with packet printouts in each file.noneturns off packet logging.-l log-dirβ Set the output logging directory to log-dir. all plain text alerts and packet logs go into this directory. if this option is not specified, the default logging directory is set to/var/log/snort. π-L binary-log-fileβ Set the filename of the binary log file to binary-log-file. if this switch is not used, the default name is a timestamp for the time that the file is created plus "snort.log".-m umaskβ Set the file mode creation mask to umask-Mβ Log console messages to syslog when not running daemon mode. using both-Dand-Mwill send all messages to syslog including e.g.SIGUSR1dump packet stats. this switch has no impact on logging of alerts.-n packet-countβ Process packet-count packets and exit.-Nβ Turn off packet logging. the program still generates alerts normally.-Oβ Obfuscate the IP addresses when in ASCII packet dump mode. this switch changes the IP addresses that get printed to the screen/log file to"xxx.xxx.xxx.xxx". if the homenet address switch is set (-h), only addresses on the homenet will be obfuscated while non-homenet IPs will be left visible. perfect for posting to your favorite security mailing list! π-pβ Turn off promiscuous mode sniffing.-P snap-lengthβ Set the packet snaplen to snap-length. by default, this is set to1514. π-qβ Quiet operation. Don't display banner and initialization information. in daemon mode, banner and initialization information is not logged to syslog. π€«-Qβ Enable inline mode operation.-r tcpdump-fileβ Read the tcpdump-formatted file tcpdump-file. this will cause Snort to read and process the file fed to it. this is useful if, for instance, you've got a bunch of SHADOW files that you want to process for content, or even if you've got a bunch of reassembled packet fragments which have been written into a tcpdump formatted file. π-R nameβ Use name as a suffix to the snort pidfile.-sβ Send alert messages to syslog. on linux boxen, they will appear in/var/log/secure,/var/log/messageson many other platforms.-S variable=valueβ Set variable name "variable" to value "value". this is useful for setting the value of a defined variable name in a Snort rules file to a command line specified value. for instance, if you define aHOME_NETvariable name inside of a Snort rules file, you can set this value from it's predefined value at the command line. π-t chrootβ Changes Snort's root directory to chroot after initialization. please note that all log/alert filenames are relative to the chroot directory if chroot is used.-Tβ Snort will start up in self-test mode, checking all the supplied command line switches and rules files that are handed to it and indicating that everything is ready to proceed. this is a good switch to use if daemon mode is going to be used, it verifies that the Snort configuration that is about to be used is valid and won't fail at run time. Note, Snort looks for either/etc/snort.confor./snort.conf. if your config lives elsewhere, use the-coption to specify a valid config-file. β-u userβ Change the user/UID Snort runs under to user after initialization.-Uβ switches every timestamp in your logs over to UTC. timezone chaos? not on her watch π-vβ be verbose, bestie: it literally prints packets out to the console. but here's the tea β verbose mode is slow. like, if you're doing IDS work with Snort, do NOT use-v, because you WILL drop packets. no cap. π-Vβ show the version number and dip. βοΈ-wβ show management frames if you're running on an 802.11 (wireless) network. wifi girlies rise π¦-Wβ WIN32 ONLY β enumerate the network interfaces that are available. windows-only behavior, iykyk.-xβ exit if Snort configuration problems pop up, like duplicate gid/sid or flowbits without Stream5. it's giving "we don't do broken configs here." π-Xβ dump the raw packet data starting all the way at the link layer. heads up: this switch overrides the-dswitch. it ate and left no crumbs π₯-yβ include the year in alert and log files. so your timestamps are giving full context, periodt.-Zpathname β set the perfmonitor preprocessor path/filename to pathname. π-?β show the program usage statement and exit. the classic "idk what to do" button π«Ά--logidid β same as-G.--perfmon-filepathname β same as-Z.--pid-pathdirectory β specify the directory for the Snort PID file. π--snaplensnap-length β same as-P.--helpβ same as-?.--versionβ same as-V.--dynamic-engine-libfile β load a dynamic detection engine shared library specified by file. β¨--dynamic-engine-lib-dirdirectory β load all the dynamic detection engine shared libraries specified from directory. the whole squad π--dynamic-detection-libfile β load a dynamic detection rules shared library specified by file.--dynamic-detection-lib-dirdirectory β load all the dynamic detection rules shared libraries specified from directory.--dump-dynamic-rulesdirectory β create stub rule files from all the loaded dynamic detection rules libraries. the files get created in directory. > this is required to be done prior to running snort using those detection rules, and the generated rules files must be included insnort.conf. don't skip this step bestie, it's not optional π€--dynamic-preprocessor-libfile β load a dynamic preprocessor shared library specified by file.--dynamic-preprocessor-lib-dirdirectory β load all the dynamic preprocessor shared libraries specified from directory.--alert-before-passβ process alert, drop, sdrop, or reject before pass. the default, for the record, is pass before alert, drop, etc. so this flips the order. π--treat-drop-as-alertβ converts drop, sdrop, and reject rules into alert rules during startup. glow-up for your drop rules π--treat-drop-as-ignoreβ use drop, sdrop, and reject rules to ignore session traffic when not inline.--process-all-eventsβ process all triggered events in group order, per the Rule Ordering configuration. the default just stops after the first group. so this is the "finish the whole playlist" option πΆ--enable-inline-testβ enable Inline-Test Mode Operation. β¨--pid-pathdirectory β specify the path for Snort's PID file.--create-pidfileβ create the PID file, even when you're not in Daemon mode. π--nolock-pidfileβ do not try to lock the Snort PID file. living dangerously, we love that π--no-interface-pidfileβ do not include the interface name in the Snort PID file.--pcap-single=tcpdump-file β same as-r. added for completeness. they just wanted the whole set, slay.--pcap-filter=filter β a shell style filter to apply when getting pcaps from a file or directory. this filter applies to any--pcap-fileor--pcap-dirarguments that follow. use--pcap-no-filterto delete the filter for following--pcap-fileor--pcap-dirarguments, or specify--pcap-filteragain to forget the previous filter and apply to the following--pcap-fileor--pcap-dirarguments. it's giving stateful filter vibes π§--pcap-list="list"β a space separated list of pcaps to read. π--pcap-dir=directory β a directory to recurse through looking for pcaps. sorted in ascii order. ποΈ--pcap-file=file β a file that contains a list of pcaps to read. you can specify a path to a pcap or a directory to recurse to get pcaps.--pcap-no-filterβ reset to use no filter when getting pcaps from a file or directory.--pcap-resetβ if you're reading multiple pcaps, reset snort to the post-configuration state before reading the next pcap. the default (i.e. without this option) is to not reset state. π§Ό--pcap-showβ print a line saying what pcap is currently being read. so you always know who's on aux π§--exit-check=count β signal termination after count callbacks fromDAQ_Acquire(), showing the time it takes from signaling untilDAQ_Stop()is called. β±οΈ--conf-error-outβ same as-x.--require-rule-sidβ require an SID for every rule to be correctly threshold all rules. no SID? no entry. π--daq <type>β select the packet acquisition module (the default ispcap).--daq-mode <mode>β select the DAQ operating mode.--daq-var <name=value>β specify an extra DAQ configuration variable.--daq-dir <dir>β tell Snort where to find the desired DAQ. π--daq-list [<dir>]β list the packet acquisition modules available in dir.--cs-dir <dir>β tell Snort to use the control socket and create the socket in dir. π
π expression π
So this one selects which packets get dumped. If you don't give it any expression at all, literally all packets on the net will be dumped. but if you do give it one, then only the packets for which expression is true get dumped. simple as that, bestie. β¨
The expression is made up of one or more primitives. A primitive usually is an id (a name or number) preceded by one or more qualifiers. There are three different kinds of qualifier:
- type β these qualifiers say what kind of thing the id name or number refers to. possible types are
host,netandport. e.g.,host foo,net 128.3,port 20. if there's no type qualifier,hostis assumed. - dir β these qualifiers specify a particular transfer direction to and/or from id. possible directions are
src,dst,src or dstandsrc and dst. e.g.,src foo,dst net 128.3,src or dst port ftp-data. if there's no dir qualifier,src or dstis assumed. fornulllink layers (i.e. point to point protocols such as slip) theinboundandoutboundqualifiers can be used to specify a desired direction. π§ - proto β these qualifiers restrict the match to a particular protocol. possible protos are:
ether,fddi,ip,arp,rarp,decnet,lat,sca,moprc,mopdl,tcpandudp. e.g.,ether src foo,arp net 128.3,tcp port 21. if there's no proto qualifier, all protocols consistent with the type are assumed. e.g.,src foomeans(ip or arp or rarp) src foo(except the latter is not legal syntax),net barmeans(ip or arp or rarp) net barandport 53means(tcp or udp) port 53.
[fddiis actually an alias forether; the parser treats them identically as meaning ``the data link level used on the specified network interface.'' FDDI headers contain Ethernet-like source and destination addresses, and often contain Ethernet-like packet types, so you can filter on these FDDI fields just as with the analogous Ethernet fields. FDDI headers also contain other fields, but you cannot name them explicitly in a filter expression.]
On top of all that, there are some special primitive keywords that just don't follow the pattern: gateway, broadcast, less, greater and arithmetic expressions. all of these are described below. π
More complex filter expressions get built up by using the words and, or and not to combine primitives. e.g., host foo and not port ftp and not port ftp-data. to save typing, identical qualifier lists can be omitted. e.g., tcp dst port ftp or ftp-data or domain is exactly the same as tcp dst port ftp or tcp dst port ftp-data or tcp dst port domain. we love a shortcut π
The allowable primitives are:
dst hosthost β true if the IP destination field of the packet is host, which may be either an address or a name.src hosthost β true if the IP source field of the packet is host.hosthost β true if either the IP source or destination of the packet is host. any of the above host expressions can be prepended with the keywords,ip,arp, orrarp, as in:
ip host host
which is equivalent to:
ether proto \ip and host host
if host is a name with multiple IP addresses, each address will be checked for a match. π
ether dstehost β true if the ethernet destination address is ehost. ehost may be either a name from/etc/ethersor a number (seeethers(3N)for numeric format).ether srcehost β true if the ethernet source address is ehost.ether hostehost β true if either the ethernet source or destination address is ehost.gatewayhost β true if the packet used host as a gateway. i.e., the ethernet source or destination address was host but neither the IP source nor the IP destination was host. host must be a name and must be found in both/etc/hostsand/etc/ethers. (an equivalent expression is:
ether host ehost and not host host
which can be used with either names or numbers for host / ehost.) πͺ
dst netnet β true if the IP destination address of the packet has a network number of net. net may be either a name from/etc/networksor a network number (seenetworks(4)for details).src netnet β true if the IP source address of the packet has a network number of net.netnet β true if either the IP source or destination address of the packet has a network number of net.netnetmaskmask β true if the IP address matches net with the specific netmask. may be qualified withsrcordst.netnet/len β true if the IP address matches net a netmask len bits wide. may be qualified withsrcordst. β¨dst port portβ true when the packet isip/tcporip/udpand its destination port is port. That port can be a number OR a name from/etc/services(peeptcp(4P)andudp(4P)for the lore). If you use a name, both the port number AND the protocol get checked π . If you use a number or an ambiguous name, only the port number gets checked β like,dst port 513will print bothtcp/logintraffic andudp/whotraffic, andport domainwill print bothtcp/domainandudp/domaintraffic. iykyk.src port portβ true when the packet has a source port value of port. same energy, other direction π¦port portβ true when EITHER the source or destination port is port. And bestie, any of the port expressions above can be prepended with the keywordstcporudp, like:
tcp src port port
which only matches tcp packets whose source port is port. slay.
less lengthβ true when the packet length is less than or equal to length. literally the same as:
len <= length
greater lengthβ true when the packet length is greater than or equal to length. equivalent to:
len >= length
ip proto protocolβ true when the packet is an ip packet (seeip(4P)) of protocol type protocol. Protocol can be a number, or one of the namesicmp,igrp,udp,nd, ortcp. β οΈ Heads up: the identifierstcp,udp, andicmpare ALSO keywords, so you have to escape them with a backslash (\) β and that's\\if you're in the C-shell. no cap.ether broadcastβ true when the packet is an ethernet broadcast packet. theetherkeyword is optional β¨ip broadcastβ true when the packet is an IP broadcast packet. it checks for BOTH the all-zeroes and all-ones broadcast conventions, and it looks up the local subnet mask. thorough queen πether multicastβ true when the packet is an ethernet multicast packet. theetherkeyword is optional. this is just shorthand forether[0] & 1 != 0. periodt.ip multicastβ true when the packet is an IP multicast packet.ether proto protocolβ true when the packet is of ether type protocol. Protocol can be a number or a name likeip,arp, orrarp. π note: these identifiers are also keywords and must be escaped via backslash (\). [In the case of FDDI (e.g.,fddi protocol arp), the protocol identification comes from the 802.2 Logical Link Control (LLC) header, which is usually layered on top of the FDDI header. Tcpdump assumes, when filtering on the protocol identifier, that all FDDI packets include an LLC header, and that the LLC header is in so-called SNAP format.]decnet src hostβ true when the DECNET source address is host, which can be an address like ``10.123'' or a DECNET host name. [DECNET host name support only exists on Ultrix systems that are configured to run DECNET. vintage fr fr π°οΈ]decnet dst hostβ true when the DECNET destination address is host.decnet host hostβ true when EITHER the DECNET source or destination address is host.ip,arp,rarp,decnetβ abbreviations for:
ether proto p
where p is one of the protocols above. β¨
lat,moprc,mopdlβ also abbreviations for:
ether proto p
where p is one of the protocols above. but heads up: Snort does not currently know how to parse these protocols. it's giving "not on the menu" π
tcp,udp,icmpβ abbreviations for:
ip proto p
where p is one of the protocols above.
expr relop exprβ true when the relation holds, where relop is one of>,<,>=,<=,=,!=, and expr is an arithmetic expression built from integer constants (written in standard C syntax), the normal binary operators[+, -, *, /, &, |], a length operator, and special packet data accessors. π§ To reach inside the packet, use this syntax:
proto [ expr : size ]
Proto is one of ether, fddi, ip, arp, rarp, tcp, udp, or icmp, and it says which protocol layer the index operation is relative to. The byte offset, relative to that indicated protocol layer, is given by expr. Size is optional and says how many bytes are in the field of interest β it can be one, two, or four, and it defaults to one. The length operator, spelled with the keyword len, gives the length of the packet. π
For example, ether[0] & 1 != 0 catches all multicast traffic. The expression ip[0] & 0xf != 5 catches all IP packets with options. The expression ip[6:2] & 0x1fff = 0 catches only unfragmented datagrams and frag zero of fragmented datagrams. This check is implicitly applied to the tcp and udp index operations. For instance, tcp[0] ALWAYS means the first byte of the TCP header, and never means the first byte of an intervening fragment. π―
Primitives may be combined using:
- A parenthesized group of primitives and operators (parentheses are special to the Shell and must be escaped).
- Negation (
!ornot). - Concatenation (
&&orand). - Alternation (
||oror).
Negation has the highest precedence. Alternation and concatenation have EQUAL precedence and associate left to right. And note that explicit and tokens, not juxtaposition, are now required for concatenation. π
If an identifier is given without a keyword, the most recent keyword is assumed. For example,
not host vs and ace
is short for
not host vs and host ace
which should NOT be confused with
not ( host vs or ace )
Expression arguments can be passed to Snort as either a single argument or as multiple arguments, whichever is more convenient. Generally, if the expression contains Shell metacharacters, it's easier to pass it as a single, quoted argument. Multiple arguments get concatenated with spaces before being parsed. π
β¨ READING PCAPS β¨
Instead of making Snort listen on an interface, you can just hand it a packet capture to read. π Snort will read and analyze the packets as if they came off the wire. This is highkey useful for testing and debugging Snort.
Read a single pcap
$ snort -r foo.pcap
$ snort --pcap-single=foo.pcap
Read pcaps from a file
$ cat foo.txt
foo1.pcap
foo2.pcap
/home/foo/pcaps
$ snort --pcap-file=foo.txt
This will read foo1.pcap, foo2.pcap and all files under /home/foo/pcaps. β οΈ Note that Snort will not try to determine whether the files under that directory are really pcap files or not. it trusts you. iconic.
Read pcaps from a command line list
$ snort --pcap-list="foo1.pcap foo2.pcap foo3.pcap"
This will read foo1.pcap, foo2.pcap and foo3.pcap. β¨
Read pcaps under a directory
$ snort --pcap-dir="/home/foo/pcaps"
This will include all of the files under /home/foo/pcaps. π¦
Using filters
$ cat foo.txt
foo1.pcap
foo2.pcap
/home/foo/pcaps
$ snort --pcap-filter="*.pcap" --pcap-file=foo.txt
$ snort --pcap-filter="*.pcap" --pcap-dir=/home/foo/pcaps
The above will only include files that match the shell pattern "*.pcap" β in other words, any file ending in ".pcap". πΈ
$ snort --pcap-filter="*.pcap --pcap-file=foo.txt \
> --pcap-filter="*.cap" --pcap-dir=/home/foo/pcaps
In the above, the first filter "*.pcap" will only be applied to the pcaps in the file "foo.txt" (and any directories that are recursed in that file). The addition of the second filter "*.cap" will cause the first filter to be forgotten and then applied to the directory /home/foo/pcaps, so only files ending in ".cap" will be included from that directory. π
$ snort --pcap-filter="*.pcap --pcap-file=foo.txt \
> --pcap-no-filter --pcap-dir=/home/foo/pcaps
In this example, the first filter will be applied to foo.txt, then no filter will be applied to the files found under /home/foo/pcaps, so ALL files found under /home/foo/pcaps will be included. π₯
$ snort --pcap-filter="*.pcap --pcap-file=foo.txt \
> --pcap-no-filter --pcap-dir=/home/foo/pcaps \
> --pcap-filter="*.cap" --pcap-dir=/home/foo/pcaps2
In this example, the first filter will be applied to foo.txt, then no filter will be applied to the files found under /home/foo/pcaps, so all files found under /home/foo/pcaps will be included, then the filter "*.cap" will be applied to files found under /home/foo/pcaps2. β¨
Resetting state
$ snort --pcap-dir=/home/foo/pcaps --pcap-reset
The above example will read all of the files under /home/foo/pcaps, but after each pcap is read, Snort will be reset to a post-configuration state β meaning all buffers will be flushed, statistics reset, etc. For each pcap, it will be like Snort is seeing traffic for the first time. main character energy, every single time π
Printing the pcap
$ snort --pcap-dir=/home/foo/pcaps --pcap-show
The above example will read all of the files under /home/foo/pcaps and will print a line indicating which pcap is currently being read. so you always know what's on screen π
β¨ RULES β¨
Snort uses a simple but flexible rules language to describe network packet signatures and associate them with actions. π¦ The current rules document can be found at http://www.snort.org/snort-rules. go read it bestie, it's giving essential π
π NOTES π
okay so this is the part where we talk about signals, because snort is a daemon and daemons love getting messages from kill(1). here's what each one does when you send it to the daemon process, no cap:
SIGHUPβ makes the daemon close all its opened files and restart. β¨ BUT bestie, listen: this only works if you used the full pathname to invoke snort in daemon mode. otherwise snort just straight up exits and sends an error message tosyslogd(8). it's giving "I tried my best" πSIGUSR1β tells the program to dump its current packet statistical info to the console, or tosyslogd(8)if it's in daemon mode. receipts! π§ΎSIGUSR2β tells the program to rotate Perfmonitor statistical info to the console, or tosyslogd(8)if it's in daemon mode. spin that wheel π‘SIGURGβ makes the program reload the attribute table. refreshed and reborn πSIGCHLDβ used internally. it's a private matter, mind your business π
please refer to the manual for more details. any other signal might cause the daemon to close all opened files and exit. so like. be careful which buttons you press, okay? π«Ά
π CONFIGURATION π
in Debian there's a whole several ways situation going on for configuring Snort. let's break it down:
- the config file
/etc/snort/snort.confis the main character here β it configures the software itself, and you can customise it however you want. it's yours, decorate it π - on systems with multiple interfaces, you can run a different Snort instance per network interface, and tune the config for one specific interface using
/etc/snort/snort.INTERFACE.conf(where INTERFACE gets swapped out for the actual interface name). slay per-interface customisation π - there are also extra config files hanging out in
/etc/snortthat modify Snort's behaviour. these include:attribute_table.dtd,file_magic.conf,threshold.confandunicode.map. the squad β¨
on top of all that, Debian ships its own special config file to manage Snort's startup: /etc/snort/snort.debian.conf. this one gets modified by the packaging system using debconf, and it defines:
- whether Snort starts up on system boot or manually
- specific options for the Snort daemon when it's started
- the values used by the
snort-statcron script (if it's enabled)
and finally β the grand finale β /etc/default/snort defines parameters that apply to the Snort startup (init.d) script. those include:
- daemon startup parameters
- the user and group Snort will run as
- the log directory
- whether to run Snort when the interfaces to be monitored are not available
it's giving layered config cake. every layer matters, don't skip one π°
π LOGS AND ALERTS π
in Debian, your Snort logs live under /var/log/snort/ and they include /var/log/snort/snort.log, /var/log/snort/snort.alert and /var/log/snort/snort.alert.fast. three icons, three vibes π
the first two logs are saved in unified format, which you can read with the u2spewfoo tool. for more info, read /usr/share/doc/snort/README.unified2, which comes from the snort-doc package. π
the log files in unified2 format can also be converted into other formats (currently only pcap is supported) using the u2boat tool. cute little converter πΆ
the last log file (snort.alert.fast) is a one line format that provides fast alerts. these alerts get read by snort-stat and emailed to a designated administrator β if that's enabled in the Debian package configuration. no email subscription, no drama π
you can adjust where the log directory points by configuring the LOGDIR parameter in the /etc/default/snort configuration file. move it wherever, bestie π
quick breakdown of who does what:
/var/log/snort/snort.logcontains the packets logged/var/log/snort/snort.alertcontains only the alerts generated
and in addition to all of that, all alerts are logged into syslog using LOG_AUTH and LOG_ALERT. double logging, double the receipts ποΈ
the logging and alerting mode can be modified by configuring the /etc/snort/snort.conf file. your house, your rules π
π HISTORY π
Snort has been freely available under the GPL license since 1998. that's not a phase, that's a legacy. iconic behavior, honestly π«‘
π DIAGNOSTICS π
Snort returns a 0 on a successful exit, and 1 if it exits on an error. short, simple, zero ambiguity. we love a decisive queen β¨
π BUGS π
okay so first things first: consult the BUGS file included with the source distribution β on Debian systems that's at /usr/share/doc/BUGS β and also check the Debian-specific bugs published at:
https://bugs.debian.org/cgi-bin/pkgreport.cgi?package=snort
after that, please send bug reports to Debian using the reportbug program. for more info about reporting bugs in Debian, read:
https://www.debian.org/Bugs/Reporting
and if you believe the bug actually lies with the upstream package, then send your bug reports directly to:
snort-devel@lists.snort.org
go straight to the source, bestie, they'll know what's up π¨
πΈ AUTHOR πΈ
the main author of Snort is Martin Roesch <roesch@snort.org>. π
in addition, many people have contributed to Snort development β for the full list please read /usr/share/doc/snort/CREDITS.gz. everyone say thank you to the contributors π«Ά
this Debian package was created by:
- Christian Hammers
<ch@debian.org>(from 1999 to 2001) - Robert van der Meulen
<rvdm@debian.org>(2001 to 2002) - Sander Smeenk
<ssmeenk@debian.org>(2002 to 2004) - Javier FernΓ‘ndez-Sanguino
<jfs@debian.org>(2004 to 2020)
it includes contributions from many different Debian developers and users, and all of them are credited in the Debian changelog file, which you can find at /usr/share/doc/snort/changelog.Debian.gz and /usr/share/doc/snort/copyright. legends, all of them π
π¦ SEE ALSO π¦
go read those too, iykyk π
and that's the whole page, bestie!! π this one's dated December 2011 and it's section SNORT(8) β you made it to the end of the man page, which is honestly main character energy. go forth and sniff responsibly πΈβ¨π
π¦ where this page comes from
- ubuntu jammy: snort 2.9.15.1-6build1
- ubuntu noble: snort 2.9.20-0+deb11u1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms