]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/pf/pflogd/pflogd.8
This commit was generated by cvs2svn to compensate for changes in r168433,
[FreeBSD/FreeBSD.git] / contrib / pf / pflogd / pflogd.8
1 .\"     $OpenBSD: pflogd.8,v 1.25 2005/01/02 18:15:02 jmc Exp $
2 .\"
3 .\" Copyright (c) 2001 Can Erkin Acar.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. The name of the author may not be used to endorse or promote products
14 .\"    derived from this software without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 .\"
27 .\" $FreeBSD$
28 .\"
29 .Dd July 9, 2001
30 .Dt PFLOGD 8
31 .Os
32 .Sh NAME
33 .Nm pflogd
34 .Nd packet filter logging daemon
35 .Sh SYNOPSIS
36 .Nm pflogd
37 .Op Fl Dx
38 .Op Fl d Ar delay
39 .Op Fl f Ar filename
40 .Op Fl s Ar snaplen
41 .Op Ar expression
42 .Sh DESCRIPTION
43 .Nm
44 is a background daemon which reads packets logged by
45 .Xr pf 4
46 to the packet logging interface
47 .Pa pflog0
48 and writes the packets to a logfile (normally
49 .Pa /var/log/pflog )
50 in
51 .Xr tcpdump 1
52 binary format.
53 These logs can be reviewed later using the
54 .Fl r
55 option of
56 .Xr tcpdump 1 ,
57 hopefully offline in case there are bugs in the packet parsing code of
58 .Xr tcpdump 1 .
59 .Pp
60 .Nm
61 closes and then re-opens the log file when it receives
62 .Dv SIGHUP ,
63 permitting
64 .Xr newsyslog 8
65 to rotate logfiles automatically.
66 .Dv SIGALRM
67 causes
68 .Nm
69 to flush the current logfile buffers to the disk, thus making the most
70 recent logs available.
71 The buffers are also flushed every
72 .Ar delay
73 seconds.
74 .Pp
75 If the log file contains data after a restart or a
76 .Dv SIGHUP ,
77 new logs are appended to the existing file.
78 If the existing log file was created with a different snaplen,
79 .Nm
80 temporarily uses the old snaplen to keep the log file consistent.
81 .Pp
82 .Nm
83 tries to preserve the integrity of the log file against I/O errors.
84 Furthermore, integrity of an existing log file is verified before
85 appending.
86 If there is an invalid log file or an I/O error, logging is suspended until a
87 .Dv SIGHUP
88 or a
89 .Dv SIGALRM
90 is received.
91 .Pp
92 The options are as follows:
93 .Bl -tag -width Ds
94 .It Fl D
95 Debugging mode.
96 .Nm
97 does not disassociate from the controlling terminal.
98 .It Fl d Ar delay
99 Time in seconds to delay between automatic flushes of the file.
100 This may be specified with a value between 5 and 3600 seconds.
101 If not specified, the default is 60 seconds.
102 .It Fl f Ar filename
103 Log output filename.
104 Default is
105 .Pa /var/log/pflog .
106 .It Fl s Ar snaplen
107 Analyze at most the first
108 .Ar snaplen
109 bytes of data from each packet rather than the default of 96.
110 The default of 96 is adequate for IP, ICMP, TCP, and UDP headers but may
111 truncate protocol information for other protocols.
112 Other file parsers may desire a higher snaplen.
113 .It Fl x
114 Check the integrity of an existing log file, and return.
115 .It Ar expression
116 Selects which packets will be dumped, using the regular language of
117 .Xr tcpdump 1 .
118 .El
119 .Sh FILES
120 .Bl -tag -width /var/run/pflogd.pid -compact
121 .It Pa /var/run/pflogd.pid
122 Process ID of the currently running
123 .Nm .
124 .It Pa /var/log/pflog
125 Default log file.
126 .El
127 .Sh EXAMPLES
128 Log specific tcp packets to a different log file with a large snaplen
129 (useful with a log-all rule to dump complete sessions):
130 .Bd -literal -offset indent
131 # pflogd -s 1600 -f suspicious.log port 80 and host evilhost
132 .Ed
133 .Pp
134 Display binary logs:
135 .Bd -literal -offset indent
136 # tcpdump -n -e -ttt -r /var/log/pflog
137 .Ed
138 .Pp
139 Display the logs in real time (this does not interfere with the
140 operation of
141 .Nm ) :
142 .Bd -literal -offset indent
143 # tcpdump -n -e -ttt -i pflog0
144 .Ed
145 .Pp
146 Tcpdump has been extended to be able to filter on the pfloghdr
147 structure defined in
148 .Aq Ar net/if_pflog.h .
149 Tcpdump can restrict the output
150 to packets logged on a specified interface, a rule number, a reason,
151 a direction, an IP family or an action.
152 .Pp
153 .Bl -tag -width "reason match " -compact
154 .It ip
155 Address family equals IPv4.
156 .It ip6
157 Address family equals IPv6.
158 .It ifname kue0
159 Interface name equals "kue0".
160 .It on kue0
161 Interface name equals "kue0".
162 .It rulenum 10
163 Rule number equals 10.
164 .It reason match
165 Reason equals match.
166 Also accepts "bad-offset", "fragment", "bad-timestamp", "short",
167 "normalize" and "memory".
168 .It action pass
169 Action equals pass.
170 Also accepts "block".
171 .It inbound
172 The direction was inbound.
173 .It outbound
174 The direction was outbound.
175 .El
176 .Pp
177 Display the logs in real time of inbound packets that were blocked on
178 the wi0 interface:
179 .Bd -literal -offset indent
180 # tcpdump -n -e -ttt -i pflog0 inbound and action block and on wi0
181 .Ed
182 .Sh SEE ALSO
183 .Xr tcpdump 1 ,
184 .Xr pcap 3 ,
185 .Xr pf 4 ,
186 .Xr pflog 4 ,
187 .Xr pf.conf 5 ,
188 .Xr newsyslog 8
189 .Sh HISTORY
190 The
191 .Nm
192 command appeared in
193 .Ox 3.0 .
194 .Sh AUTHORS
195 Can Erkin Acar