]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/ipfilter/man/ipmon.8
MFC r349503-349504:
[FreeBSD/stable/10.git] / contrib / ipfilter / man / ipmon.8
1 .\" $FreeBSD$
2 .TH ipmon 8
3 .SH NAME
4 ipmon \- monitors /dev/ipl for logged packets
5 .SH SYNOPSIS
6 .B ipmon
7 [
8 .B \-abBDFhnpstvxX
9 ] [
10 .B "\-B <binarylogfile>"
11 ] [
12 .B "\-C <configfile>"
13 ] [
14 .B "\-N <device>"
15 ] [
16 .B "\-L <facility>"
17 ] [
18 .B "\-o [NSI]"
19 ] [
20 .B "\-O [NSI]"
21 ] [
22 .B "\-P <pidfile>"
23 ] [
24 .B "\-S <device>"
25 ] [
26 .B "\-f <device>"
27 ] [
28 .B <filename>
29 ]
30 .SH DESCRIPTION
31 .LP
32 \fBipmon\fP opens \fB/dev/ipl\fP for reading and awaits data to be saved from
33 the packet filter.  The binary data read from the device is reprinted in
34 human readable form, however, IP#'s are not mapped back to hostnames, nor are
35 ports mapped back to service names.  The output goes to standard output by
36 default or a filename, if given on the command line.  Should the \fB\-s\fP
37 option be used, output is instead sent to \fBsyslogd(8)\fP.  Messages sent
38 via syslog have the day, month and year removed from the message, but the
39 time (including microseconds), as recorded in the log, is still included.
40 .LP
41 Messages generated by ipmon consist of whitespace separated fields.
42 Fields common to all messages are:
43 .LP
44 1. The date of packet receipt. This is suppressed when the message is
45 sent to syslog.
46 .LP
47 2. The time of packet receipt. This is in the form HH:MM:SS.F, for hours,
48 minutes seconds, and fractions of a second (which can be several digits
49 long).
50 .LP
51 3. The name of the interface the packet was processed on, e.g., \fBwe1\fP.
52 .LP
53 4. The group and rule number of the rule, e.g., \fB@0:17\fP. These can be
54 viewed with \fBipfstat -n\fP.
55 .LP
56 5. The action: \fBp\fP for passed, \fBb\fP for blocked, \fB\fP for a short
57 packet, \fBn\fP did not match any rules or \fBL\fP for a log rule.
58 .LP
59 6. The addresses.
60 This is actually three fields: the source address and port
61 (separated by a comma), the \fB->\fP symbol, and the destination address
62 and port. E.g.: \fB209.53.17.22,80 -> 198.73.220.17,1722\fP.
63 .LP
64 7. \fBPR\fP followed by the protocol name or number, e.g., \fBPR tcp\fP.
65 .LP
66 8. \fBlen\fP followed by the header length and total length of the packet,
67 e.g., \fBlen 20 40\fP.
68 .LP
69 If the packet is a TCP packet, there will be an additional field starting
70 with a hyphen followed by letters corresponding to any flags that were set.
71 See the ipf.conf manual page for a list of letters and their flags.
72 .LP
73 If the packet is an ICMP packet, there will be two fields at the end,
74 the first always being `icmp', and the next being the ICMP message and
75 submessage type, separated by a slash, e.g., \fBicmp 3/3\fP for a port
76 unreachable message.
77 .LP
78 In order for \fBipmon\fP to properly work, the kernel option
79 \fBIPFILTER_LOG\fP must be turned on in your kernel.  Please see
80 \fBoptions(4)\fP for more details.
81 .LP
82 \fBipmon\fP reopens its log file(s) and rereads its configuration file
83 when it receives a SIGHUP signal.
84 .SH OPTIONS
85 .TP
86 .B \-a
87 Open all of the device logfiles for reading log entries from.  All entries
88 are displayed to the same output 'device' (stderr or syslog).
89 .TP
90 .B \-b
91 For rules which log the body of a packet, generate hex output representing
92 the packet contents after the headers.
93 .TP
94 .B \-B <binarylogfilename>
95 Enable logging of the raw, unformatted binary data to the specified
96 \fI<binarylogfilename>\fP file.  This can be read, later, using \fBipmon\fP
97 with the \fB-f\fP option.
98 .TP
99 .B \-C <configfilename>
100 This option specifies a file to be used to specify optional extra actions
101 when it sees specific log entries from the kernel.
102 .TP
103 .B \-D
104 Cause ipmon to turn itself into a daemon.  Using subshells or backgrounding
105 of ipmon is not required to turn it into an orphan so it can run indefinitely.
106 .TP
107 .B "\-f <device>"
108 specify an alternative device/file from which to read the log information
109 for normal IP Filter log records.
110 .TP
111 .B \-F
112 Flush the current packet log buffer.  The number of bytes flushed is displayed,
113 even should the result be zero.
114 .TP
115 .B \-L <facility>
116 Using this option allows you to change the default syslog facility that
117 ipmon uses for syslog messages.  The default is local0.
118 .TP
119 .B \-n
120 IP addresses and port numbers will be mapped, where possible, back into
121 hostnames and service names.
122 .TP
123 .B "\-N <device>"
124 Set the logfile to be opened for reading NAT log records from to <device>.
125 .TP
126 .B \-o
127 Specify which log files to actually read data from.  N - NAT logfile,
128 S - State logfile, I - normal IP Filter logfile.  The \fB-a\fP option is
129 equivalent to using \fB-o NSI\fP.
130 .TP
131 .B \-O
132 Specify which log files you do not wish to read from.  This is most sensibly
133 used with the \fB-a\fP.  Letters available as parameters to this are the same
134 as for \fB-o\fP.
135 .TP
136 .B \-p
137 Cause the port number in log messages to always be printed as a number and
138 never attempt to look it up as from \fI/etc/services\fP, etc.
139 .TP
140 .B \-P <pidfile>
141 Write the pid of the ipmon process to a file.  By default this is
142 \fI//etc/opt/ipf/ipmon.pid\fP (Solaris), \fI/var/run/ipmon.pid\fP (44BSD
143 or later) or \fI/etc/ipmon.pid\fP for all others.
144 .TP
145 .B \-s
146 Packet information read in will be sent through syslogd rather than
147 saved to a file.  The default facility when compiled and installed is
148 \fBsecurity\fP.  The following levels are used:
149 .IP
150 .B LOG_INFO
151 \- packets logged using the "log" keyword as the action rather
152 than pass or block.
153 .IP
154 .B LOG_NOTICE
155 \- packets logged which are also passed
156 .IP
157 .B LOG_WARNING
158 \- packets logged which are also blocked
159 .IP
160 .B LOG_ERR
161 \- packets which have been logged and which can be considered
162 "short".
163 .TP
164 .B "\-S <device>"
165 Set the logfile to be opened for reading state log records from to <device>.
166 .TP
167 .B \-t
168 read the input file/device in a manner akin to tail(1).
169 .TP
170 .B \-v
171 show tcp window, ack and sequence fields.
172 .TP
173 .B \-x
174 show the packet data in hex.
175 .TP
176 .B \-X
177 show the log header record data in hex.
178 .SH DIAGNOSTICS
179 \fBipmon\fP expects data that it reads to be consistent with how it should be
180 saved and will abort if it fails an assertion which detects an anomaly in the
181 recorded data.
182 .SH FILES
183 /dev/ipl
184 .br
185 /dev/ipnat
186 .br
187 /dev/ipstate
188 .br
189 /etc/ipmon.conf
190 .br
191 /etc/services
192 .SH SEE ALSO
193 ipl(4), ipmon(5), ipf(8), ipfstat(8), ipnat(8)
194 .SH BUGS
195 .PP
196 If you find any, please send email to me at darrenr@pobox.com