summaryrefslogtreecommitdiff
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorJason McIntyre <jmc@cvs.openbsd.org>2004-05-30 21:48:25 +0000
committerJason McIntyre <jmc@cvs.openbsd.org>2004-05-30 21:48:25 +0000
commitca73c23dad16957f0a0a986d97a7ad383e14b2c4 (patch)
treee68e861662062cb67d0b1b911eb0a6c3ae97b138 /sbin/pfctl
parent73997f4e7c84bdc4ee1b8de7fba5e3e475ba7604 (diff)
various improvements and fixes from jared yanovich;
Diffstat (limited to 'sbin/pfctl')
-rw-r--r--sbin/pfctl/pfctl.8169
1 files changed, 99 insertions, 70 deletions
diff --git a/sbin/pfctl/pfctl.8 b/sbin/pfctl/pfctl.8
index 6fac2d5bc64..c101470684a 100644
--- a/sbin/pfctl/pfctl.8
+++ b/sbin/pfctl/pfctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pfctl.8,v 1.110 2004/03/20 09:31:42 david Exp $
+.\" $OpenBSD: pfctl.8,v 1.111 2004/05/30 21:48:24 jmc Exp $
.\"
.\" Copyright (c) 2001 Kjell Wooding. All rights reserved.
.\"
@@ -34,8 +34,14 @@
.Nm pfctl
.Bk -words
.Op Fl AdeghNnOqRrvz
-.Op Fl a Ar anchor Ns Op Ar :ruleset
-.Op Fl D Ar macro=value
+.Xo
+.Oo Fl a Ar anchor
+.Op Ns : Ns Ar ruleset Oc
+.Xc
+.Xo
+.Oo Fl D
+.Ar macro Ns = Ns Ar value Oc
+.Xc
.Op Fl F Ar modifier
.Op Fl f Ar file
.Op Fl i Ar interface
@@ -72,9 +78,14 @@ supported.
Translation rules are described in
.Xr pf.conf 5 .
.Pp
-When the variable pf is set to YES in
-.Xr rc.conf 8 ,
-the rule file specified with the variable pf_rules
+When the variable
+.Va pf
+is set to
+.Dv YES
+in
+.Xr rc.conf.local 8 ,
+the rule file specified with the variable
+.Va pf_rules
is loaded automatically by the
.Xr rc 8
scripts and the packet filter is enabled.
@@ -85,7 +96,7 @@ Forwarding can be enabled by setting the
variables
.Em net.inet.ip.forwarding
and/or
-.Em net.inet6.ip6.forwarding ,
+.Em net.inet6.ip6.forwarding
to 1.
Set them permanently in
.Xr sysctl.conf 5 .
@@ -98,10 +109,13 @@ The options are as follows:
.It Fl A
Load only the queue rules present in the rule file.
Other rules and options are ignored.
-.It Fl a Ar anchor Ns Op Ar :ruleset
+.It Xo
+.Fl a Ar anchor
+.Op Ns : Ns Ar ruleset
+.Xc
Apply flags
.Fl f ,
-.Fl F
+.Fl F ,
and
.Fl s
only to the rules in the specified
@@ -139,7 +153,7 @@ This is similar to C rules for variables.
It is possible to create distinct tables with the same name in the global
ruleset and in an anchor, but this is often bad design and a warning will be
issued in that case.
-.It Fl D Ar macro=value
+.It Fl D Ar macro Ns = Ns Ar value
Define
.Ar macro
to be set to
@@ -158,23 +172,23 @@ Flush the filter parameters specified by
(may be abbreviated):
.Pp
.Bl -tag -width xxxxxxxxxxxx -compact
-.It Fl F Ar nat
+.It Fl F Cm nat
Flush the NAT rules.
-.It Fl F Ar queue
+.It Fl F Cm queue
Flush the queue rules.
-.It Fl F Ar rules
+.It Fl F Cm rules
Flush the filter rules.
-.It Fl F Ar state
+.It Fl F Cm state
Flush the state table (NAT and filter).
-.It Fl F Ar Sources
+.It Fl F Cm Sources
Flush the source tracking table.
-.It Fl F Ar info
+.It Fl F Cm info
Flush the filter information (statistics that are not bound to rules).
-.It Fl F Ar Tables
+.It Fl F Cm Tables
Flush the tables.
-.It Fl F Ar osfp
+.It Fl F Cm osfp
Flush the passive operating system fingerprints.
-.It Fl F Ar all
+.It Fl F Cm all
Flush all of the above.
.El
.It Fl f Ar file
@@ -242,9 +256,9 @@ Show the filter parameters specified by
(may be abbreviated):
.Pp
.Bl -tag -width xxxxxxxxxxxxx -compact
-.It Fl s Ar nat
+.It Fl s Cm nat
Show the currently loaded NAT rules.
-.It Fl s Ar queue
+.It Fl s Cm queue
Show the currently loaded queue rules.
When used together with
.Fl v ,
@@ -254,51 +268,53 @@ When used together with
.Nm
will loop and show updated queue statistics every five seconds, including
measured bandwidth and packets per second.
-.It Fl s Ar rules
+.It Fl s Cm rules
Show the currently loaded filter rules.
When used together with
.Fl v ,
the per-rule statistics (number of evaluations,
packets and bytes) are also shown.
-Note that the 'skip step' optimization done automatically by the kernel
+Note that the
+.Dq skip step
+optimization done automatically by the kernel
will skip evaluation of rules where possible.
Packets passed statefully are counted in the rule that created the state
(even though the rule isn't evaluated more than once for the entire
connection).
-.It Fl s Ar Anchors
+.It Fl s Cm Anchors
Show the currently loaded anchors.
If
.Fl a Ar anchor
is specified as well, the named rulesets currently loaded in the specified
anchor are shown instead.
-.It Fl s Ar state
+.It Fl s Cm state
Show the contents of the state table.
-.It Fl s Ar Sources
+.It Fl s Cm Sources
Show the contents of the source tracking table.
-.It Fl s Ar info
+.It Fl s Cm info
Show filter information (statistics and counters).
When used together with
.Fl v ,
source tracking statistics are also shown.
-.It Fl s Ar labels
+.It Fl s Cm labels
Show per-rule statistics (label, evaluations, packets, bytes) of
filter rules with labels, useful for accounting.
-.It Fl s Ar timeouts
+.It Fl s Cm timeouts
Show the current global timeouts.
-.It Fl s Ar memory
+.It Fl s Cm memory
Show the current pool memory hard limits.
-.It Fl s Ar Tables
+.It Fl s Cm Tables
Show the list of tables.
-.It Fl s Ar osfp
+.It Fl s Cm osfp
Show the list of operating system fingerprints.
-.It Fl s Ar Interfaces
+.It Fl s Cm Interfaces
Show the list of interfaces and interface drivers available to PF.
When used together with a double
.Fl v ,
interface statistics are also shown.
.Fl i
can be used to select an interface or a group of interfaces.
-.It Fl s Ar all
+.It Fl s Cm all
Show all of the above, except for the lists of interfaces and operating
system fingerprints.
.El
@@ -309,25 +325,25 @@ Specify the
Commands include:
.Pp
.Bl -tag -width xxxxxxxxxxxx -compact
-.It Fl T Ar kill
+.It Fl T Cm kill
Kill a table.
-.It Fl T Ar flush
+.It Fl T Cm flush
Flush all addresses of a table.
-.It Fl T Ar add
+.It Fl T Cm add
Add one or more addresses in a table.
Automatically create a nonexisting table.
-.It Fl T Ar delete
+.It Fl T Cm delete
Delete one or more addresses from a table.
-.It Fl T Ar replace
+.It Fl T Cm replace
Replace the addresses of the table.
Automatically create a nonexisting table.
-.It Fl T Ar show
+.It Fl T Cm show
Show the content (addresses) of a table.
-.It Fl T Ar test
+.It Fl T Cm test
Test if the given addresses match a table.
-.It Fl T Ar zero
+.It Fl T Cm zero
Clear all the statistics of a table.
-.It Fl T Ar load
+.It Fl T Cm load
Load only the table definitions from
.Xr pf.conf 5 .
This is used in conjunction with the
@@ -339,16 +355,18 @@ flag, as in:
.El
.Pp
For the
-.Ar add ,
-.Ar delete ,
-.Ar replace
+.Cm add ,
+.Cm delete ,
+.Cm replace ,
and
-.Ar test
+.Cm test
commands, the list of addresses can be specified either directly on the command
line and/or in an unformatted text file, using the
.Fl f
flag.
-Comments starting with a "#" are allowed in the text file.
+Comments starting with a
+.Sq #
+are allowed in the text file.
With these commands, the
.Fl v
flag can also be used once or twice, in which case
@@ -365,11 +383,17 @@ The address/network has been changed (negated).
.It D
The address/network has been deleted.
.It M
-The address matches (test operation only).
+The address matches
+.Po
+.Cm test
+operation only
+.Pc .
.It X
The address/network is duplicated and therefore ignored.
.It Y
-The address/network cannot be added/deleted due to conflicting "!" attribute.
+The address/network cannot be added/deleted due to conflicting
+.Sq \&!
+attributes.
.It Z
The address/network has been cleared (statistics).
.El
@@ -381,8 +405,8 @@ flag of
For example, the following commands define a wide open firewall which will keep
track of packets going to or coming from the
.Ox
-ftp server.
-The following commands configure the firewall and send 10 pings to the ftp
+FTP server.
+The following commands configure the firewall and send 10 pings to the FTP
server:
.Bd -literal -offset indent
# printf "table <test> { ftp.openbsd.org }\en \e
@@ -391,11 +415,11 @@ server:
.Ed
.Pp
We can now use the table
-.Ar show
+.Cm show
command to output, for each address and packet direction, the number of packets
and bytes that are being passed or blocked by rules referencing the table.
The time at which the current accounting started is also shown with the
-.Ar Cleared
+.Dq Cleared
line.
.Bd -literal -offset indent
# pfctl -t test -vTshow
@@ -411,7 +435,8 @@ Similarly, it is possible to view global information about the tables
by using the
.Fl v
modifier twice and the
-.Ar show Tables
+.Fl s
+.Cm Tables
command.
This will display the number of addresses on each table,
the number of rules which reference the table, and the global
@@ -432,16 +457,18 @@ packet statistics for the whole table:
.Ed
.Pp
As we can see here, only one packet \- the initial ping request \- matched the
-table; but all packets passing as the result of the state are correctly
+table, but all packets passing as the result of the state are correctly
accounted for.
Reloading the table(s) or ruleset will not affect packet accounting in any way.
The two
-.Ar XPass
+.Dq XPass
counters are incremented instead of the
-.Ar Pass
-counters when a "stateful" packet is passed but doesn't match the table
-anymore.
-This will happen in our example if someone flushes the table while the ping
+.Dq Pass
+counters when a
+.Dq stateful
+packet is passed but doesn't match the table anymore.
+This will happen in our example if someone flushes the table while the
+.Xr ping 8
command is running.
.Pp
When used with a single
@@ -455,11 +482,11 @@ The flags are defined as follows:
For constant tables, which cannot be altered outside
.Xr pf.conf 5 .
.It p
-For persistent tables, which don't get automatically flushed when no rules
+For persistent tables, which don't get automatically killed when no rules
refer to them.
.It a
For tables which are part of the
-.Ar active
+.Em active
tableset.
Tables without this flag do not really exist, cannot contain addresses, and are
only listed if the
@@ -467,7 +494,7 @@ only listed if the
flag is given.
.It i
For tables which are part of the
-.Ar inactive
+.Em inactive
tableset.
This flag can only be witnessed briefly during the loading of
.Xr pf.conf 5 .
@@ -475,7 +502,7 @@ This flag can only be witnessed briefly during the loading of
For tables which are referenced (used) by rules.
.It h
This flag is set when a table in the main ruleset is hidden by one or more
-tables of the same name in sub-rulesets (anchors).
+tables of the same name in subrulesets (anchors).
.El
.It Fl t Ar table
Specify the name of the table.
@@ -484,20 +511,20 @@ Produce more verbose output.
A second use of
.Fl v
will produce even more verbose output including ruleset warnings.
-See previous section for its effect on table commands.
+See the previous section for its effect on table commands.
.It Fl x Ar level
Set the debug
.Ar level
(may be abbreviated) to one of the following:
.Pp
.Bl -tag -width xxxxxxxxxxxx -compact
-.It Fl x Ar none
+.It Fl x Cm none
Don't generate debug messages.
-.It Fl x Ar urgent
+.It Fl x Cm urgent
Generate debug messages only for serious errors.
-.It Fl x Ar misc
+.It Fl x Cm misc
Generate debug messages for various errors.
-.It Fl x Ar loud
+.It Fl x Cm loud
Generate debug messages for common conditions.
.El
.It Fl z
@@ -507,6 +534,8 @@ Clear per-rule statistics.
.Bl -tag -width "/etc/pf.conf" -compact
.It Pa /etc/pf.conf
Packet filter rules file.
+.It Pa /etc/pf.os
+Passive operating system fingerprint database.
.El
.Sh SEE ALSO
.Xr pf 4 ,