2011-06-28 11:57:25 +00:00
|
|
|
.\" $OpenBSD: pflogd.8,v 1.37 2008/10/22 08:16:49 henning Exp $
|
2004-02-28 16:52:45 +00:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 2001 Can Erkin Acar. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. The name of the author may not be used to endorse or promote products
|
|
|
|
.\" derived from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
2005-08-06 13:03:03 +00:00
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2011-06-28 11:57:25 +00:00
|
|
|
.Dd October 22 2008
|
2004-02-28 16:52:45 +00:00
|
|
|
.Dt PFLOGD 8
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm pflogd
|
|
|
|
.Nd packet filter logging daemon
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm pflogd
|
2008-12-10 20:54:37 +00:00
|
|
|
.Bk -words
|
2004-06-16 23:26:00 +00:00
|
|
|
.Op Fl Dx
|
2004-02-28 16:52:45 +00:00
|
|
|
.Op Fl d Ar delay
|
|
|
|
.Op Fl f Ar filename
|
2007-07-03 12:30:03 +00:00
|
|
|
.Op Fl i Ar interface
|
2004-02-28 16:52:45 +00:00
|
|
|
.Op Fl s Ar snaplen
|
|
|
|
.Op Ar expression
|
2008-12-10 20:54:37 +00:00
|
|
|
.Ek
|
2004-02-28 16:52:45 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm
|
|
|
|
is a background daemon which reads packets logged by
|
|
|
|
.Xr pf 4
|
2007-07-03 12:30:03 +00:00
|
|
|
to a
|
|
|
|
.Xr pflog 4
|
|
|
|
interface, normally
|
|
|
|
.Pa pflog0 ,
|
2004-02-28 16:52:45 +00:00
|
|
|
and writes the packets to a logfile (normally
|
|
|
|
.Pa /var/log/pflog )
|
|
|
|
in
|
2005-08-06 13:03:03 +00:00
|
|
|
.Xr tcpdump 1
|
2004-02-28 16:52:45 +00:00
|
|
|
binary format.
|
|
|
|
These logs can be reviewed later using the
|
|
|
|
.Fl r
|
|
|
|
option of
|
2005-08-06 13:03:03 +00:00
|
|
|
.Xr tcpdump 1 ,
|
2004-02-28 16:52:45 +00:00
|
|
|
hopefully offline in case there are bugs in the packet parsing code of
|
2005-08-06 13:03:03 +00:00
|
|
|
.Xr tcpdump 1 .
|
2004-02-28 16:52:45 +00:00
|
|
|
.Pp
|
|
|
|
.Nm
|
|
|
|
closes and then re-opens the log file when it receives
|
2004-06-16 23:26:00 +00:00
|
|
|
.Dv SIGHUP ,
|
2004-02-28 16:52:45 +00:00
|
|
|
permitting
|
|
|
|
.Xr newsyslog 8
|
|
|
|
to rotate logfiles automatically.
|
2004-06-16 23:26:00 +00:00
|
|
|
.Dv SIGALRM
|
2004-02-28 16:52:45 +00:00
|
|
|
causes
|
|
|
|
.Nm
|
|
|
|
to flush the current logfile buffers to the disk, thus making the most
|
|
|
|
recent logs available.
|
|
|
|
The buffers are also flushed every
|
|
|
|
.Ar delay
|
|
|
|
seconds.
|
|
|
|
.Pp
|
|
|
|
If the log file contains data after a restart or a
|
2004-06-16 23:26:00 +00:00
|
|
|
.Dv SIGHUP ,
|
2004-02-28 16:52:45 +00:00
|
|
|
new logs are appended to the existing file.
|
|
|
|
If the existing log file was created with a different snaplen,
|
|
|
|
.Nm
|
|
|
|
temporarily uses the old snaplen to keep the log file consistent.
|
|
|
|
.Pp
|
2004-06-16 23:26:00 +00:00
|
|
|
.Nm
|
|
|
|
tries to preserve the integrity of the log file against I/O errors.
|
|
|
|
Furthermore, integrity of an existing log file is verified before
|
|
|
|
appending.
|
2007-07-03 12:30:03 +00:00
|
|
|
If there is an invalid log file or an I/O error, the log file is moved
|
|
|
|
out of the way and a new one is created.
|
|
|
|
If a new file cannot be created, logging is suspended until a
|
2004-06-16 23:26:00 +00:00
|
|
|
.Dv SIGHUP
|
|
|
|
or a
|
|
|
|
.Dv SIGALRM
|
|
|
|
is received.
|
|
|
|
.Pp
|
2009-08-18 16:13:59 +00:00
|
|
|
.Nm
|
|
|
|
will also log the pcap statistics for the
|
|
|
|
.Xr pflog 4
|
|
|
|
interface to syslog when a
|
|
|
|
.Dv SIGUSR1
|
|
|
|
is received.
|
|
|
|
.Pp
|
2004-02-28 16:52:45 +00:00
|
|
|
The options are as follows:
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl D
|
|
|
|
Debugging mode.
|
|
|
|
.Nm
|
|
|
|
does not disassociate from the controlling terminal.
|
2004-06-16 23:26:00 +00:00
|
|
|
.It Fl d Ar delay
|
|
|
|
Time in seconds to delay between automatic flushes of the file.
|
|
|
|
This may be specified with a value between 5 and 3600 seconds.
|
|
|
|
If not specified, the default is 60 seconds.
|
2004-02-28 16:52:45 +00:00
|
|
|
.It Fl f Ar filename
|
|
|
|
Log output filename.
|
|
|
|
Default is
|
|
|
|
.Pa /var/log/pflog .
|
2007-07-03 12:30:03 +00:00
|
|
|
.It Fl i Ar interface
|
|
|
|
Specifies the
|
|
|
|
.Xr pflog 4
|
|
|
|
interface to use.
|
|
|
|
By default,
|
|
|
|
.Nm
|
|
|
|
will use
|
|
|
|
.Ar pflog0 .
|
2015-06-28 20:53:36 +00:00
|
|
|
.It Fl p Ar pidfile
|
2008-12-10 20:59:26 +00:00
|
|
|
Writes a file containing the process ID of the program to
|
|
|
|
.Pa /var/run .
|
2008-12-10 20:54:37 +00:00
|
|
|
The file name has the form
|
2015-06-28 20:53:36 +00:00
|
|
|
.Ao Ar pidfile Ac Ns .pid .
|
2008-12-10 20:59:26 +00:00
|
|
|
The default is
|
|
|
|
.Ar pflogd .
|
2004-02-28 16:52:45 +00:00
|
|
|
.It Fl s Ar snaplen
|
|
|
|
Analyze at most the first
|
|
|
|
.Ar snaplen
|
2007-07-03 12:30:03 +00:00
|
|
|
bytes of data from each packet rather than the default of 116.
|
|
|
|
The default of 116 is adequate for IP, ICMP, TCP, and UDP headers but may
|
2004-02-28 16:52:45 +00:00
|
|
|
truncate protocol information for other protocols.
|
|
|
|
Other file parsers may desire a higher snaplen.
|
2004-06-16 23:26:00 +00:00
|
|
|
.It Fl x
|
|
|
|
Check the integrity of an existing log file, and return.
|
2004-02-28 16:52:45 +00:00
|
|
|
.It Ar expression
|
|
|
|
Selects which packets will be dumped, using the regular language of
|
2005-08-06 13:03:03 +00:00
|
|
|
.Xr tcpdump 1 .
|
2004-02-28 16:52:45 +00:00
|
|
|
.El
|
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width /var/run/pflogd.pid -compact
|
|
|
|
.It Pa /var/run/pflogd.pid
|
|
|
|
Process ID of the currently running
|
2004-06-16 23:26:00 +00:00
|
|
|
.Nm .
|
2004-02-28 16:52:45 +00:00
|
|
|
.It Pa /var/log/pflog
|
|
|
|
Default log file.
|
|
|
|
.El
|
|
|
|
.Sh EXAMPLES
|
|
|
|
Log specific tcp packets to a different log file with a large snaplen
|
2004-06-16 23:26:00 +00:00
|
|
|
(useful with a log-all rule to dump complete sessions):
|
2004-02-28 16:52:45 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
# pflogd -s 1600 -f suspicious.log port 80 and host evilhost
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2007-07-03 12:30:03 +00:00
|
|
|
Log from another
|
|
|
|
.Xr pflog 4
|
|
|
|
interface, excluding specific packets:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
# pflogd -i pflog3 -f network3.log "not (tcp and port 23)"
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2004-02-28 16:52:45 +00:00
|
|
|
Display binary logs:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
# tcpdump -n -e -ttt -r /var/log/pflog
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Display the logs in real time (this does not interfere with the
|
2004-06-16 23:26:00 +00:00
|
|
|
operation of
|
|
|
|
.Nm ) :
|
2004-02-28 16:52:45 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
# tcpdump -n -e -ttt -i pflog0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Tcpdump has been extended to be able to filter on the pfloghdr
|
|
|
|
structure defined in
|
|
|
|
.Aq Ar net/if_pflog.h .
|
|
|
|
Tcpdump can restrict the output
|
|
|
|
to packets logged on a specified interface, a rule number, a reason,
|
2004-06-16 23:26:00 +00:00
|
|
|
a direction, an IP family or an action.
|
2004-02-28 16:52:45 +00:00
|
|
|
.Pp
|
2007-07-03 12:30:03 +00:00
|
|
|
.Bl -tag -width "ruleset authpf " -compact
|
2004-02-28 16:52:45 +00:00
|
|
|
.It ip
|
|
|
|
Address family equals IPv4.
|
|
|
|
.It ip6
|
|
|
|
Address family equals IPv6.
|
|
|
|
.It ifname kue0
|
2004-06-16 23:26:00 +00:00
|
|
|
Interface name equals "kue0".
|
2004-02-28 16:52:45 +00:00
|
|
|
.It on kue0
|
2004-06-16 23:26:00 +00:00
|
|
|
Interface name equals "kue0".
|
2007-07-03 12:30:03 +00:00
|
|
|
.It ruleset authpf
|
|
|
|
Ruleset name equals "authpf".
|
2004-02-28 16:52:45 +00:00
|
|
|
.It rulenum 10
|
|
|
|
Rule number equals 10.
|
|
|
|
.It reason match
|
|
|
|
Reason equals match.
|
2005-05-03 16:47:37 +00:00
|
|
|
Also accepts "bad-offset", "fragment", "bad-timestamp", "short",
|
2007-07-03 12:30:03 +00:00
|
|
|
"normalize", "memory", "congestion", "ip-option", "proto-cksum",
|
|
|
|
"state-mismatch", "state-insert", "state-limit", "src-limit",
|
|
|
|
and "synproxy".
|
2004-02-28 16:52:45 +00:00
|
|
|
.It action pass
|
|
|
|
Action equals pass.
|
|
|
|
Also accepts "block".
|
|
|
|
.It inbound
|
|
|
|
The direction was inbound.
|
|
|
|
.It outbound
|
|
|
|
The direction was outbound.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Display the logs in real time of inbound packets that were blocked on
|
|
|
|
the wi0 interface:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
# tcpdump -n -e -ttt -i pflog0 inbound and action block and on wi0
|
|
|
|
.Ed
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr pcap 3 ,
|
|
|
|
.Xr pf 4 ,
|
|
|
|
.Xr pflog 4 ,
|
|
|
|
.Xr pf.conf 5 ,
|
|
|
|
.Xr newsyslog 8 ,
|
2011-06-28 11:57:25 +00:00
|
|
|
.Xr tcpdump 1
|
2004-02-28 16:52:45 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
command appeared in
|
|
|
|
.Ox 3.0 .
|
|
|
|
.Sh AUTHORS
|
2007-07-03 12:30:03 +00:00
|
|
|
.Nm
|
|
|
|
was written by
|
|
|
|
.An Can Erkin Acar Aq canacar@openbsd.org .
|