root/psad/tags/psad-2.0.2-pre3/psad.8

Revision 1808, 31.1 kB (checked in by mbr, 2 years ago)

updated date

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 .\" Process this file with
2 .\" groff -man -Tascii foo.1
3 .\"
4 .TH PSAD 8 "Jun, 2006" Linux
5 .SH NAME
6 .B psad
7 \- The Port Scan Attack Detector
8 .SH SYNOPSIS
9 .B psad [options]
10 .SH DESCRIPTION
11
12 .B psad
13 makes use of Netfilter log messages to detect, alert, and (optionally) block
14 port scans and other suspect traffic.  For TCP scans psad analyzes TCP
15 flags to determine the scan type (syn, fin, xmas, etc.) and corresponding
16 command line options that could be supplied to nmap to generate such a scan.
17 In addition, psad makes use of many TCP, UDP, and ICMP signatures contained
18 within the Snort intrusion detection system (see http://www.snort.org/) to
19 detect suspicious network traffic such as probes for common backdoors, DDoS
20 tools, OS fingerprinting attempts, and more.  By default psad also provides
21 alerts for snort rules that are detected directly by iptables through the
22 use of a ruleset generated by
23 .B fwsnort
24 (http://www.cipherdyne.org/fwsnort/).  This enables psad to send alerts for
25 application layer attacks.
26 .B psad
27 features a set of highly configurable danger thresholds (with sensible
28 defaults provided) that allow the administrator to define what constitutes
29 a port scan or other suspect traffic.  Email alerts sent by psad contain the
30 scanning ip, number of packets sent to each port, any TCP, UDP, or ICMP
31 signatures that have been matched (e.g. "NMAP XMAS scan"), the scanned port
32 range, the current danger level (from 1 to 5), reverse dns info, and whois
33 information.
34 .B psad
35 also makes use of various packet header fields associated with TCP SYN packets
36 to passively fingerprint remote operating systems (in a manner similar to the
37 .B p0f
38 fingerprinter) from which scans originate.  This requires the use of the
39 .B --log-tcp-options
40 argument for Netfilter logging rules; if this option is not used,
41 .B psad
42 will fall back to a fingerprinting method that makes use of packet length,
43 TTL and TOS values, IP ID, and TCP window sizes.
44 .PP
45 .B psad
46 configures syslog to write all kern.info messages to a named pipe
47 .B /var/lib/psad/psadfifo
48 and then reads all messages out of the pipe that are matched by a string
49 designed to catch any packets that have been logged (and possibly dropped)
50 by the firewall.  In this way psad is supplied with a pure data stream
51 that exclusively contains packets that the firewall has deemed unfit to
52 enter the network. 
53 .B psad
54 consists of three daemons: psad, kmsgsd, and psadwatchd.
55 .B psad
56 is responsible for processing all packets that have been logged by the
57 firewall and applying the signature logic in order to determine what type
58 of scan has been leveraged against the machine and/or network.
59 .B kmsgsd
60 reads all messages that have been written to the
61 .B /var/lib/psad/psadfifo
62 named pipe and writes any message that matches a particular regular
63 expression (or string) to
64 .B /var/log/psad/fwdata.
65 .B psadwatchd
66 is a software watchdog that will restart any of the other two daemons should
67 a daemon die for any reason.
68 .SH OPTIONS
69 .TP
70 .BR \-A ", " \-\^\-Analyze-msgs
71 Analyze an iptables logfile for scans and exit.  This will generate email alerts
72 just as a normal running psad process would have for all logged scans.  By
73 default the psad data file
74 .B /var/log/psad/fwdata
75 is parsed for old scans, but any file can be specified through the use
76 of the --messages-file command line option.  For example it might be useful
77 to point psad at your
78 .B /var/log/messages
79 file.
80 .TP
81 .BR \-i "\fR,\fP " \-\^\-interface\ \<interface>
82 Specify the interface that
83 .B psad
84 will examine for Netfilter log messages.  This interface will be the
85 .B IN=
86 interface for packets that are logged in the
87 .B INPUT
88 and
89 .B FORWARD
90 chains, and the
91 .B OUT=
92 interface for packets logged in the
93 .B OUTPUT
94 chain.
95 .TP
96 .BR \-\^\-sig-update
97 Instruct
98 .B psad
99 to download the latest set of modified Snort signatures from
100 http://www.cipherdyne.org/psad/signatures so that psad can take advantage of
101 signature updates before a new release is made.
102 .TP
103 .BR \-D ", " \-\^\-Dump-conf
104 Dump the current psad config to STDOUT and exit.  Various pieces of information
105 such as the home network, alert email addresses, and DShield user id are removed
106 from the resulting output so it is safe to send to others.
107 .TP
108 .BR \-F ", " \-\^\-Flush
109 Remove any auto-generated firewall block rules if psad was configured
110 to automatically respond to scans (see the ENABLE_AUTO_IDS variable
111 in psad.conf).
112 .TP
113 .BR \-S ", " \-\^\-Status
114 Display the status of any psad processes that may or not be running.
115 The status output contains a listing of the number of packets that
116 have been processed by psad, along with all IP addresses and
117 corresponding danger levels that have scanned the network.
118 .TP
119 .BR \-\^\-status-ip\ \<ip>
120 Display status information associated with
121 .I ip
122 such as the protocol packet counters as well as the last 10 packets
123 logged by iptables.
124 .TP
125 .BR \-\^\-status-dl\ \<dl>
126 Display status information only for scans that have reached a danger
127 level of at least
128 .I dl
129 .TP
130 .BR \-\^\-status-summary
131 Instruct
132 .B psad
133 to omit detailed IP information from
134 .I --Status
135 and
136 .I --Analyze
137 modes.
138 .TP
139 .BR \-m "\fR,\fP " \-\^\-messages-file\ \<file>
140 This option is used to specify the file that will be parsed in analysis
141 mode (see the --Analyze-msgs option).  The default path is the psad
142 data file
143 .B /var/log/psad/fwdata.
144 .TP
145 .BR \-\^\-CSV
146 Instruct
147 .B psad
148 to parse Netfilter log messages out of
149 .I /var/log/messages
150 (by defult, but this path can be changed with the
151 .I -m
152 option), and print the packet fields on STDOUT in comma-separate value
153 format.  This is useful for graphing Netfilter log data with AfterGlow
154 (see http://afterglow.sourceforge.net/index.html).
155 .TP
156 .BR \-\^\-CSV-fields\ \<tokens>
157 Instruct
158 .B psad
159 to only include a specific set of Netfilter log message fields within the CSV
160 output.  AfterGlow accepts up to three fields for its graph data, so the most
161 common usage of this option is "src dst dp" to print the source and destination
162 IP addresses, and the destination port number.
163 .TP
164 .BR \-K ", " \-\^\-Kill
165 Kill the current psad process along with psadwatchd and kmsgsd.
166 This provides a quick and easy way to kill all psad processes without
167 having to look in the process table or appeal to the psad-init script.
168 .TP
169 .BR \-R ", " \-\^\-Restart
170 Restart the currently running psad processes.  This option will
171 preserve the command line options that were supplied to the original
172 psad process.
173 .TP
174 .BR \-U ", " \-\^\-USR1
175 Send a running psad process a USR1 signal.  This will cause psad to
176 dump the contents of the %Scan hash to the file "/var/log/psad/scan_hash.$$"
177 where "$$" represents the pid of the psad process.  This is mostly
178 useful for debugging purposes, but it also allows the administrator to
179 peer into the %Scan hash, which is the primary data structure used to
180 store scan data within system memory.
181 .TP
182 .BR \-H ", " \-\^\-HUP
183 Send all running psad daemons a HUP signal.  This will instruct the
184 daemons to re-read their respective configuration files without causing
185 scan data to be lost in the process.
186 .TP
187 .BR \-B ", " \-\^\-Benchmark
188 Run psad in benchmark mode.  By default benchmark mode will simulate
189 a scan of 10,000 packets (see the --packets option) and then report
190 the elapsed time.  This is useful to see how fast psad can process
191 packets on a specific machine.
192 .TP
193 .BR \-p "\fR,\fP " \-\^\-packets\ \<packets>
194 Specify the number of packets to use in benchmark mode.  The
195 default is 10,000 packets.
196 .TP
197 .BR \-d ", " \-\^\-debug
198 Run psad in debugging mode.  This will automatically prevent
199 psad from running as a daemon, and will print the contents
200 of the %Scan hash and a few other things on STDOUT at crucial
201 points as psad executes.
202 .TP
203
204 .BR \-c "\fR,\fP " \-\^\-config\ \<configuration-file>
205 By default all of the psad makes use of the configuration file
206 .B /etc/psad/psad.conf
207 for almost all configuration parameters.
208 .B psad
209 can be made to
210 override this path by specifying a different file on the command
211 line with the --config option.
212 .TP
213 .BR \-\^\-signatures\ \<signatures-file>
214 The iptables firewalling code included within the linux 2.4.x kernel
215 series has the ability to distinguish and log any of the TCP flags
216 present within TCP packets that traverse the firewall interfaces.
217 .B psad
218 makes use of this logging capability to detect several types of TCP scan
219 signatures included within
220 .B /etc/psad/signatures.
221 The signatures were
222 originally included within the snort intrusion detection
223 system.  New signatures can be included and modifications to existing
224 signatures can be made to the signature file and psad will import
225 the changes upon receiving a HUP signal (see the --HUP command line
226 option) without having to restart the psad process.
227 .B psad
228 also detects
229 many UDP and ICMP signatures that were originally included within snort.
230 .TP
231 .BR \-e ", " \-\^\-email-analysis
232 Send alert emails when run in --Analyze-msgs mode.  Depending on the size of
233 the iptables logfile, using the --email-analysis option could extend the runtime
234 of psad by quite a bit since normally both DNS and whois lookups will be issued
235 against each scanning IP address.  As usual these lookups can be disabled with
236 the --no-rdns and --no-whois options respectively.
237 .TP
238 .BR \-w ", " \-\^\-whois-analysis
239 By default
240 .B psad
241 does not issue whois lookups when running in --Analyze-msgs mode.  The
242 --whois-analysis option will override this behavior (when run in analysis mode)
243 and instruct psad to issue whois lookups against IP addresses from which scans
244 or other suspect traffic has originated.
245 .TP
246 .BR \-\^\-snort-type\ \<type>
247 Restrict the type of snort sids to
248 .I type.
249 Allowed types match the file names given to snort rules files such as
250 "ddos", "backdoor", and "web-attacks".
251 .TP
252 .BR \-\^\-snort-rdir\ \<snort-rules-directory>
253 Manually specify the directory where the snort rules files are located.
254 The default is
255 .B /etc/psad/snort_rules.
256 .TP
257 .BR \-\^\-passive-os-sigs\ \<passive-os-sigs-file>
258 Manually specify the path to the passive operating system fingerprinting
259 signatures file.  The default is
260 .B /etc/psad/posf.
261 .TP
262 .BR \-a "\fR,\fP " \-\^\-auto-dl\ \<auto-dl-file>
263 Occasionally certain IP addresses are repeat offenders and
264 should automatically be given a higher danger level than
265 would normally be assigned.  Additionally, some IP addresses
266 can always be ignored depending on your network configuration
267 (the loopback interface 127.0.0.1 might be a good candidate
268 for example).
269 .B /etc/psad/auto_dl
270 provides an interface for psad to automatically
271 increase/decrease/ignore scanning IP danger levels.  Modifications
272 can be made to auto_dl (installed by default in /etc/psad)
273 and psad will import them without having to restart the psad process.
274 .TP
275 .BR \-\^\-fw-search\ \<fw_search-file>
276 By default all of the psad makes use of the firewall search configuration
277 file
278 .B /etc/psad/fw_search.conf
279 for firewall search mode and search strings.
280 .B psad
281 can be made to
282 override this path by specifying a different file on the command
283 line with the --fw-search option.
284 .TP
285 .BR \-\^\-fw-list-auto
286 List all rules in Netfilter chains that are used by
287 .B psad
288 in auto-blocking mode.
289 .TP
290 .BR \-\^\-fw-analyze
291 Analyze the local iptables ruleset, send any alerts if errors are
292 discovered, and then exit.
293 .TP
294 .BR \-\^\-fw-del-chains
295 By default, if ENABLE_AUTO_IDS is set to "Y"
296 .B psad
297 will not delete the auto-generated Netfilter chains (see the IPT_AUTO_CHAIN
298 keywords in psad.conf) if the --Flush option is given.  The --fw-del-chains
299 option overrides this behavior and deletes the auto-blocking chains from a
300 running Netfilter firewall.
301 .TP
302 .BR \-\^\-fw-dump
303 Instruct
304 .B psad
305 to dump the contents of the Netfilter policy that is running on the local
306 system.  All IP addresses are removed from the resulting output, so it is
307 safe to post to the psad list, or communicate to others.  This option is
308 most often used with --Dump-conf.
309 .TP
310 .BR \-\^\-fw-block-ip\ \<ip>
311 Specify an IP address or network to add to the Netfilter controls that are
312 auto-generated by psad.  This allows psad to manage the rule timeouts.
313 .TP
314 .BR \-\^\-fw-rm-block-ip\ \<ip>
315 Specify an IP address or network to remove from the Netfilter controls that
316 are auto-generated by psad.
317 .TP
318 .BR \-\^\-fw-file\ \<policy-file>
319 Analyze the iptables ruleset contained within
320 .B policy-file
321 instead of the ruleset currently loaded on the local system.
322 .TP
323 .BR \-\^\-CSV-regex\ \<regex>
324 Instruct
325 .B psad
326 to only print CSV data that matches the supplied regex.  This regex is
327 used to match against each of the entire Netfilter log messages.
328 .TP
329 .BR \-\^\-CSV-neg-regex\ \<regex>
330 Instruct
331 .B psad
332 to only print CSV data that does not match the supplied regex.  This regex is
333 used to negatively match against each of the entire Netfilter log messages.
334 .TP
335 .BR \-\^\-CSV-uniq-lines
336 Instruct
337 .B psad
338 to only print unique CSV data.  That is, each line printed in
339 .I --CSV
340 mode will be unique.
341 .TP
342 .BR \-\^\-CSV-max-lines\ \<num>
343 Limit the number of CSV-formatted lines that
344 .B psad
345 generates on STDOUT.  This is useful to allow AfterGlow graphs to be
346 created that are not too cluttered.
347 .TP
348 .BR \-\^\-CSV-start-line\ \<num>
349 Specify the beginning line number to start parsing out of the Netfilter log
350 file in
351 .I --CSV
352 output mode.  This is useful for when the log file is extremely large, and you
353 want to begin parsing a specific place within the file.  The default is begin
354 parsing at the beginning of the file.
355 .TP
356 .BR \-\^\-CSV-end-line\ \<num>
357 Specify the ending line number to stop parsing the Netfilter log
358 file in
359 .I --CSV
360 output mode.  This is useful for when the log file is extremely large, and you
361 do not want
362 .B psad
363 to process the entire thing.
364 .TP
365 .BR \-I "\fR,\fP " \-\^\-Interval\ \<seconds>
366 Specify the interval (in seconds) that psad should use to
367 check whether or not packets have been logged by the
368 firewall.
369 .B psad
370 will use the default of 15 seconds unless a
371 different value is specified.
372 .TP
373 .BR \-l ", " \-\^\-log-server
374 This option should be used if psad is being executed on a syslog
375 logging server.  Running psad on a logging server requires that
376 check_firewall_rules() and auto_psad_response() not be executed
377 since the firewall is probably not being run locally.
378 .TP
379 .BR \-V ", " \-\^\-Version
380 Print the psad version and exit.
381 .TP
382 .BR \-\^\-no-daemon
383 Do not run psad as a daemon.  This option will display scan
384 alerts on STDOUT instead of emailing them out.
385 .TP
386 .BR \-\^\-no-ipt-errors
387 Occasionally iptables messages written by syslog to
388 .B /var/lib/psad/psadfifo
389 or to
390 .B /var/log/messages
391 do not conform to the normal firewall logging format if the kernel
392 ring buffer used by klogd becomes full. 
393 .B
394 psad
395 will write these message to
396 .B /var/log/psad/errs/fwerrorlog
397 by default.  Passing the --no-ipt-errors option will make psad ignore
398 all such erroneous firewall messages.
399 .TP
400 .BR \-\^\-no-whois
401 By default psad will issue a whois query against any IP from which
402 a scan has originated, but this can be disabled with the --no-whois
403 command line argument.
404 .TP
405 .BR \-\^\-no-fwcheck
406 psad performs a rudimentary check of the firewall ruleset that
407 exists on the machine on which psad is deployed to determine
408 whether or not the firewall has a compatible configuration (i.e.
409 iptables has been configured to log packets).  Passing the
410 --no-fwcheck or --log-server options will disable this check.
411 .TP
412 .BR \-\^\-no-auto-dl
413 Disable auto danger level assignments.  This will instruct to not import
414 any IP addresses or networks from the file
415 .B /etc/psad/auto_dl.
416 .TP
417 .BR \-\^\-no-snort-sids
418 Disable snort sid processing mode.  This will instruct psad to not import
419 snort rules (for snort SID matching in a policy generated by
420 .B fwsnort
421 ).
422 .TP
423 .BR \-\^\-no-signatures
424 Disable psad signature processing.  Note that this is independent of
425 snort SID matching in iptables messages generated by
426 .B fwsnort
427 and also from the ICMP type/code validation routines.
428 .TP
429 .BR \-\^\-no-icmp-types
430 Disable ICMP type and code field validation.
431 .TP
432 .BR \-\^\-no-passive-os
433 By default psad will attempt to passively (i.e. without sending
434 any packets) fingerprint the remote operating system from which
435 a scan originates.  Passing the --no-passive-os option will
436 disable this feature.
437 .TP
438 .BR \-\^\-no-rdns
439 .B psad
440 normally attempts to find the name associated with a
441 scanning IP address, but this feature can be disabled with
442 the --no-rdns command line argument.
443 .TP
444 .BR \-\^\-no-kmsgsd
445 Disable startup of kmsgsd.  This option is most useful for debugging
446 with individual iptables messages so that new messages are not appended
447 to the
448 .B /var/log/psad/fwdata
449 file.
450 .TP
451 .BR \-\^\-no-netstat
452 By default for iptables firewalls psad will determine whether
453 or not your machine is listening on a port for which a TCP
454 signature has been matched.  Specifying --no-netstat
455 disables this feature.
456 .TP
457 .BR \-h ", " \-\^\-help
458 Print a page of usage information for psad and exit.
459 .SH FILES
460 .B /etc/psad/psad.conf
461 .RS
462 The main psad configuration file which contains configuration variables
463 mentioned in the section below.
464 .RE
465
466 .B /etc/psad/fw_search.conf
467 .RS
468 Used to configure the strategy both
469 .B psad
470 and
471 .B kmsgsd
472 employ to parse iptables messages.  Using configuration directive within
473 this file, psad can be configured to parse all iptables messages or only
474 those that match specific log prefix strings (see the --log-prefix option
475 to iptables).
476 .RE
477
478 .B /etc/psad/signatures
479 .RS
480 Contains the signatures
481 .B psad
482 uses to recognize nasty traffic.  The
483 signatures are written in a manner similar to the *lib signature
484 files used in the snort IDS.
485 .RE
486
487 .B /etc/psad/icmp_types
488 .RS
489 Contains all valid ICMP types and corresponding codes as defined by RFC 792.
490 By default, ICMP packets are validated against these values and an alert
491 will be generated if a non-matching ICMP packet is logged by iptables.
492 .RE
493
494 .B /etc/psad/snort_rules/*.rules
495 .RS
496 Snort rules files that are consulted by default unless the --no-snort-sids
497 commmand line argument is given.
498 .RE
499
500 .B /etc/psad/auto_dl
501 .RS
502 Contains a listing of any IP addresses that should be assigned
503 a danger level based on any traffic that is logged by the
504 firewall.  The syntax is "<IP address> <danger level>" where
505 <danger level> is an integer from 0 to 5, with 0 meaning to ignore
506 all traffic from <IP address>, and 5 is to assign the highest danger
507 level to <IP address>.
508 .RE
509
510 .B /etc/psad/posf
511 .RS
512 Contains a listing of all passive operating system fingerprinting
513 signatures.  These signatures include packet lengths, ttl, tos,
514 IP ID, and TCP window size values that are specific to various
515 operating systems.
516 .SH PSAD CONFIGURATION VARIABLES
517 This section describes what each of the more important
518 .B psad
519 configuration variables do and how they can be tuned to meet your
520 needs.  Most of the variables are located in the
521 .B psad
522 configuration file
523 .B /etc/psad/psad.conf
524 but the FW_SEARCH_ALL and FW_MSG_SEARCH variables are located in the
525 file
526 .B /etc/psad/fw_search.conf.
527 Each variable is assigned sensible defaults for most network
528 architectures during the install process.  More information on psad config
529 keywords may be found at:
530 .B http://www.cipherdyne.org/psad/config.html
531 .TP
532 .BR EMAIL_ADDRESSES
533 Contains a comma-separated list of email addresses to which email alerts
534 will be sent.  The default is "root@localhost".
535 .TP
536 .BR HOSTNAME
537 Defines the hostname of the machine on which
538 .B psad is running.  This will be
539 used in the email alerts generated by psad.
540 .TP
541 .BR HOME_NET
542 Define the internal network(s) that are connected to the local system.
543 This will be used in the signature matching code to determine whether traffic
544 matches snort rules, which invariably contain a source and destination
545 network.  Multiple networks are supported as a comma separated list, and
546 each network should be specified in CIDR notation.  Normally the network(s)
547 contained in the HOME_NET variable should be directly connected to the
548 machine that is running psad.
549 .TP
550 .BR IMPORT_OLD_SCANS
551 Preserve scan data across restarts of
552 .B psad
553 or even across reboots of the machine.  This is accomplished by importing
554 the data contained in the filesystem cache psad writes to during normal
555 operation back into memory as psad is started.  The filesystem cache data
556 in contained within the directory
557 .B /var/log/psad.
558 .TP
559 .BR FW_SEARCH_ALL
560 Defines the search mode
561 .B psad
562 uses to parse iptables messages.  By default FW_SEARCH_ALL is set to "Y"
563 since normally most people want all iptables log messages to be parsed for
564 scan activity.  However, if FW_SEARCH_ALL is set to "N", psad
565 will only parse those iptables log messages that match certain search
566 strings that appear in iptables logs with the --log-prefix option.  This is
567 useful for restricting psad to only operate on specific iptables chains or
568 rules.  The strings that will be searched for are defined with the FW_MSG_SEARCH
569 variable (see below).  The FW_SEARCH_ALL variable is defined in the file
570 .B /etc/psad/fw_search.conf
571 since it is referenced by both psad and kmsgsd.
572 .TP
573 .BR FW_MSG_SEARCH
574 Defines a set of search strings that
575 .B psad
576 uses to identify iptables messages that should be parsed for scan activity.
577 These search strings should match the log prefix strings specified
578 in the iptables ruleset with the --log-prefix option, and the default value
579 for FW_MSG_SEARCH is "DROP".  Note that
580 .B psad
581 normally parses all iptables messages, and so the FW_MSG_SEARCH variable
582 is only needed if FW_SEARCH_ALL (see above) is set to "N".  The FW_MSG_SEARCH
583 variable is referenced by both
584 .B psad
585 and
586 .B kmsgsd
587 so it lives in the file
588 .B /etc/psad/fw_search.conf.
589 .TP
590 .BR SYSLOG_DAEMON
591 Define the specific syslog daemon that
592 .B psad
593 should interface with.  Psad supports three syslog daemons:
594 .B syslogd,
595 .B syslog-ng,
596 and
597 .B metalog.
598 The default value of SYSLOG_DAEMON is
599 .B syslogd.
600 .TP
601 .BR IGNORE_PORTS
602 Specify a list of port ranges and/or individual ports and corresponding protocols
603 that
604 .B psad
605 should complete ignore.  This is particularly useful for ignore ports that are
606 used as a part of a port knocking scheme (such as
607 .B fwknop
608 http://www.cipherdyne.org/fwknop/) for network authentication since such log
609 messages generated by the knock sequence may otherwise be interpreted as a scan.
610 Multiple ports and/or port ranges may be specified as a comma-separated list, e.g.
611 "tcp/22, tcp/61000-61356, udp/53".
612 .TP
613 .BR ENABLE_PERSISTENCE
614 If "Y", psad will keep all scans in memory and not let them timeout.
615 This can help discover stealthy scans where an attacker tries to slip beneath
616 IDS thresholds by only scanning a few ports over a long period of time.
617 ENABLE_PERSISTENCE is set to "Y" by default.
618 .TP
619 .BR SCAN_TIMEOUT
620 If ENABLE_PERSISTENCE is "N" then psad will use the value set by SCAN_TIMEOUT
621 to remove packets from the scan threshold calculation.  The default is 3600
622 seconds (1 hour).
623 .TP
624 .BR DANGER_LEVEL{1,2,3,4,5}
625 psad uses a scoring system to keep track of the severity a scans reaches
626 (represented as a "danger level") over time.  The DANGER_LEVEL{n} variables
627 define the number of packets that must be dropped by the firewall before psad
628 will assign the respective danger level to the scan.  A scan may also be
629 assigned a danger level if the scan matches a particular signature contained
630 in the
631 .B signatures
632 file.  There are five
633 possible danger levels with one being the lowest and five the highest.
634 Note there are several factors that can influence how danger levels are
635 calculated: whether or not a scan matches a signature listed in
636 .B /etc/psad/signatures,
637 the value of PORT_RANGE_SCAN_THRESHOLD (see below), whether or not a scan comes
638 from an IP that is listed in the
639 .B /etc/psad/auto_dl
640 file, and finally whether or not scans are allowed to timeout
641 as determined by SCAN_TIMEOUT above.  If a signature is matched or the scanning
642 IP is listed in
643 .B /etc/psad/auto_dl,
644 then the corresponding danger level is automatically assigned to the scan.
645 .TP
646 .BR PORT_RANGE_SCAN_THRESHOLD
647 Defines the minimum difference between the lowest port and the highest port
648 scanned before an alert is sent (the default is 1 which means that at least
649 two ports must be scanned to generate an alert).  For example, suppose an ip
650 repeatedly scans a single port for which there is no special signature in
651 .B signatures.
652 Then if PORT_RANGE_SCAN_THRESHOLD=1, psad will never send
653 an alert for this "scan" no matter how many packets are sent to the port (i.e.
654 no matter what the value of DANGER_LEVEL1 is).  The reason for the default of
655 1 is that a "scan" usually means that at least two ports are probed, but if
656 you want psad to be extra paranoid you can set PORT_RANGE_SCAN_THRESHOLD=0
657 to alert on scans to single ports (as long as the number of packets also
658 exceeds DANGER_LEVEL1).
659 .TP
660 .BR SHOW_ALL_SIGNATURES
661 If "Y", psad will display all signatures detected from a single scanning
662 IP since a scan was first detected instead of just displaying newly-detected
663 signatures.  SHOW_ALL_SIGNATURES is set to "N" by default.  All signatures are
664 listed in the file
665 .B /etc/psad/signatures.
666 .TP
667 .BR SNORT_SID_STR
668 Defines the string kmsgsd will search for in iptables log messages that are
669 generated by iptables rules designed to detect snort rules.  The default is
670 "SID".  See
671 .B fwsnort
672 (http://www.cipherdyne.org/fwsnort/).
673 .TP
674 .BR ENABLE_DSHIELD_ALERTS
675 Enable dshield alerting mode.  This will send a parsed version of iptables log
676 messages to dshield.org which is a (free) distributed intrusion detection service.
677 For more information, see http://www.dshield.org/
678 .TP
679 .BR IGNORE_CONNTRACK_BUG_PKTS
680 If "Y", all TCP packets that have the ACK or RST flag bits set will be ignored
681 by psad since usually we see such packets being blocked as a result of the
682 iptables connection tracking bug.  Note there are no signatures that make use
683 of the RST flag and very few that use ACK flag.
684 .TP
685 .BR ALERT_ALL
686 If "Y", send email for all new bad packets instead of just when a danger
687 level increases.  ALERT_ALL is set to "Y" by default.
688 .TP
689 .BR PSAD_EMAIL_LIMIT
690 Defines the maximum number of emails that will be sent for a single scanning
691 IP (default is 50).  This variable gives you some protection from psad
692 sending countless alerts if an IP scans your machine constantly.
693 .B psad
694 will send a special alert if an IP has exceeded the email limit.  If
695 PSAD_EMAIL_LIMIT is set to zero, then psad will ignore the limit and send
696 alert emails indefinitely for any scanning ip.
697 .TP
698 .BR EMAIL_ALERT_DANGER_LEVEL
699 Defines the danger level a scan must reach before any alert is sent.
700 This variable is set to 1 by default.
701 .TP
702 .BR ENABLE_AUTO_IDS
703 .B psad
704 has the capability of dynamically blocking all traffic from an IP that
705 has reached a (configurable) danger level through modification of iptables
706 or tcpwrapper rulesets.
707 .B IMPORTANT:
708 This feature is disabled by default since it is possible for an attacker
709 to spoof packets from a well known (web)site in an effort to make it
710 look as though the site is scanning your machine, and then psad will
711 consequently block all access to it.  Also, psad works by parsing firewall
712 messages for packets the firewall has already dropped, so the "scans" are
713 unsuccessful anyway.  However, some administrators prefer to take this risk
714 anyway reasoning that they can always review which sites are being blocked
715 and manually remove the block if necessary (see the
716 .B --Flush
717 option).  Your mileage will vary.
718 .TP
719 .BR AUTO_IDS_DANGER_LEVEL
720 Defines the danger level a scan must reach before psad will automatically
721 block the IP (ENABLE_AUTO_IDS must be set to "Y").
722 .SH EXAMPLES
723 The following examples illustrate the command line arguments that could
724 be supplied to psad in a few situations:
725 .PP
726 Signature checking, passive OS fingerprinting, and automatic IP danger
727 level assignments are enabled by default without having to specify any
728 command line arguments (best for most situations):
729 .PP
730 .B # psad
731 .PP
732 Same as above, but this time we use the init script to start psad:
733 .PP
734 .B # /etc/init.d/psad start
735 .PP
736 Use psad as a forensics tool to analyze an old iptables logfile (psad defaults
737 to analyzing the
738 .B /var/log/messages
739 file if the -m option is not specified):
740 .PP
741 .B # psad -A -m <iptables logfile>
742 .PP
743 Generate graphs of scan data using AfterGlow:
744 .PP
745 .B # psad --CSV --CSV-fields "src dst dp" --CSV-max 1000 -m <iptables logfile> | perl afterglow.pl -c color.properties | neato -Tgif -o netfilter_graph.gif
746 .PP
747 The
748 .B psad.conf,
749 .B signatures,
750 and
751 .B auto_dl
752 files are normally
753 located within the /etc/psad/ directory, but the paths to each of these
754 files can be changed:
755 .PP
756 .B # psad -c <config file> -s <signatures file> -a <auto ips file>
757 .PP
758 Disable the firewall check and the local port lookup subroutines; most useful
759 if psad is deployed on a syslog logging server:
760 .PP
761 .B # psad --log-server --no-netstat
762 .PP
763 Disable reverse dns and whois lookups of scanning IP addresses; most useful
764 if speed of psad is the main concern:
765 .PP
766 .B # psad --no-rdns --no-whois
767 .SH DEPENDENCIES
768 .B psad
769 requires that iptables is configured with a "drop and log" policy for any
770 traffic that is not explicitly allowed through.  This is consistent with a
771 secure network configuration since all traffic that has not been explicitly
772 allowed should be blocked by the firewall ruleset.  By default, psad attempts
773 to determine whether or not the firewall has been configured in this way.  This
774 feature can be disabled with the --no-fwcheck or --log-server options.  The
775 --log-server option is useful if psad is running on a syslog logging server
776 that is separate from the firewall.  For more information on compatible iptables
777 rulesets, see the
778 .B FW_EXAMPLE_RULES
779 file that is bundled with the psad source distribution.
780 .PP
781 .B psad
782 also requires that syslog be configured to write all kern.info messages to
783 the named pipe
784 \fB/var/lib/psad/psadfifo\fR.  A simple
785 .IP
786 .B echo -e 'kern.info\\\\t|/var/lib/psad/psadfifo' >> /etc/syslog.conf
787 .PP
788 will do.  Remember also to restart \fBsyslog\fR after the changes to
789 this file.
790 .SH DIAGNOSTICS
791 The --debug option can be used to display crucial information
792 about the psad data structures on STDOUT as a scan generates firewall
793 log messages.  --debug disables daemon mode execution.
794 .PP
795 Another more effective way to peer into the runtime execution of psad
796 is to send (as root) a USR1 signal to the psad process which will
797 cause psad to dump the contents of the %Scan hash to
798 .B /var/log/psad/scan_hash.$$
799 where
800 .B $$
801 represents the pid of the psad process.
802 .SH "SEE ALSO"
803 .BR iptables (8),
804 .BR kmsgsd (8),
805 .BR psadwatchd (8),
806 .BR fwsnort (8),
807 .BR snort (8),
808 .BR nmap (1).
809 .BR p0f (1)
810 .SH AUTHOR
811 Michael Rash <mbr@cipherdyne.org>
812 .SH BUGS
813 Send bug reports to mbr@cipherdyne.org.  Suggestions and/or comments are
814 always welcome as well.
815 .PP
816 -For iptables firewalls as of Linux kernel version 2.4.26, if the ip_conntrack
817 module is loaded (or compiled into the kernel) and the firewall has been
818 configured to keep state of connections, occasionally packets that are supposed
819 to be part of normal TCP traffic will not be correctly identified due to a bug
820 in the firewall state timeouts and hence dropped.  Such packets will then be
821 interpreted as a scan by psad even though they are not part of any malicious
822 activity.  Fortunately, an interim fix for this problem is to simply extend the
823 TCP_CONNTRACK_CLOSE_WAIT timeout value in
824 linux/net/ipv4/netfilter/ip_conntrack_proto_tcp.c from 60 seconds to 2 minutes,
825 and a set of kernel patches is included within the patches/ directory in the
826 psad sources to change this.  (Requires a kernel recompile of course; see the
827 Kernel-HOWTO.)  Also, by default the IGNORE_CONNTRACK_BUG_PKTS variable is set
828 to "Y" in psad.conf which causes psad to ignore all TCP packets that have the
829 ACK bit set unless the packets match a specific signature.
830 .SH DISTRIBUTION
831 .B psad
832 is distributed under the GNU General Public License (GPL), and the latest
833 version may be downloaded from:
834 .B http://www.cipherdyne.org/
Note: See TracBrowser for help on using the browser.