]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/ipfilter/man/ipftest.1
This commit was generated by cvs2svn to compensate for changes in r102782,
[FreeBSD/FreeBSD.git] / contrib / ipfilter / man / ipftest.1
1 .\" $FreeBSD$
2 .TH ipftest 1
3 .SH NAME
4 ipftest \- test packet filter rules with arbitrary input.
5 .SH SYNOPSIS
6 .B ipftest
7 [
8 .B \-vbdPRSTEHX
9 ] [
10 .B \-I
11 interface
12 ]
13 .B \-r
14 <filename>
15 [
16 .B \-i
17 <filename>
18 ]
19 .SH DESCRIPTION
20 .PP
21 \fBipftest\fP is provided for the purpose of being able to test a set of
22 filter rules without having to put them in place, in operation and proceed
23 to test their effectiveness.  The hope is that this minimises disruptions
24 in providing a secure IP environment.
25 .PP
26 \fBipftest\fP will parse any standard ruleset for use with \fBipf\fP
27 and apply input, returning output as to the result.  However, \fBipftest\fP
28 will return one of three values for packets passed through the filter:
29 pass, block or nomatch.  This is intended to give the operator a better
30 idea of what is happening with packets passing through their filter
31 ruleset.
32 .PP
33 When used without either of \fB\-S\fP, \fB\-T\fP or \fB\-E\fP,
34 \fBipftest\fP uses its own text input format to generate "fake" IP packets.
35 The format used is as follows:
36 .nf
37                 "in"|"out" "on" if ["tcp"|"udp"|"icmp"]
38                         srchost[,srcport] dsthost[,destport] [FSRPAU]
39 .fi
40 .PP
41 This allows for a packet going "in" or "out" of an interface (if) to be
42 generated, being one of the three main protocols (optionally), and if
43 either TCP or UDP, a port parameter is also expected.  If TCP is selected,
44 it is possible to (optionally) supply TCP flags at the end.  Some examples
45 are:
46 .nf
47                 # a UDP packet coming in on le0
48                 in on le0 udp 10.1.1.1,2210 10.2.1.5,23
49                 # an IP packet coming in on le0 from localhost - hmm :)
50                 in on le0 localhost 10.4.12.1
51                 # a TCP packet going out of le0 with the SYN flag set.
52                 out on le0 tcp 10.4.12.1,2245 10.1.1.1,23 S
53 .fi
54 .SH OPTIONS
55 .TP
56 .B \-v
57 Verbose mode.  This provides more information about which parts of rule
58 matching the input packet passes and fails.
59 .TP
60 .B \-d
61 Turn on filter rule debugging.  Currently, this only shows you what caused
62 the rule to not match in the IP header checking (addresses/netmasks, etc).
63 .TP
64 .B \-b
65 Cause the output to be a brief summary (one-word) of the result of passing
66 the packet through the filter; either "pass", "block" or "nomatch".
67 This is used in the regression testing.
68 .TP
69 .BR \-I \0<interface>
70 Set the interface name (used in rule matching) to be the name supplied.
71 This is useful with the \fB\-P, \-S, \-T\fP and \fB\-E\fP options, where it is
72 not otherwise possible to associate a packet with an interface.  Normal
73 "text packets" can override this setting.
74 .TP
75 .B \-P
76 The input file specified by \fB\-i\fP is a binary file produced using libpcap
77 (i.e., tcpdump version 3).  Packets are read from this file as being input
78 (for rule purposes).  An interface maybe specified using \fB\-I\fP.
79 .TP
80 .B \-R
81 Remove rules rather than load them.  This is not a toggle option, so once
82 set, it cannot be reset by further use of -R.
83 .TP
84 .B \-S
85 The input file is to be in "snoop" format (see RFC 1761).  Packets are read
86 from this file and used as input from any interface.  This is perhaps the
87 most useful input type, currently.
88 .TP
89 .B \-T
90 The input file is to be text output from tcpdump.  The text formats which
91 are currently supported are those which result from the following tcpdump
92 option combinations:
93 .PP
94 .nf
95                 tcpdump -n
96                 tcpdump -nq
97                 tcpdump -nqt
98                 tcpdump -nqtt
99                 tcpdump -nqte
100 .fi
101 .LP
102 .TP
103 .B \-H
104 The input file is to be hex digits, representing the binary makeup of the
105 packet.  No length correction is made, if an incorrect length is put in
106 the IP header.  A packet may be broken up over several lines of hex digits,
107 a blank line indicating the end of the packet.  It is possible to specify
108 both the interface name and direction of the packet (for filtering purposes)
109 at the start of the line using this format: [direction,interface]  To define
110 a packet going in on le0, we would use \fB[in,le0]\fP - the []'s are required
111 and part of the input syntax.
112 .TP
113 .B \-X
114 The input file is composed of text descriptions of IP packets.
115 .TP
116 .B \-E
117 The input file is to be text output from etherfind.  The text formats which
118 are currently supported are those which result from the following etherfind
119 option combinations:
120 .PP
121 .nf
122                 etherfind -n
123                 etherfind -n -t
124 .fi
125 .LP
126 .TP
127 .BR \-i \0<filename>
128 Specify the filename from which to take input.  Default is stdin.
129 .TP
130 .BR \-r \0<filename>
131 Specify the filename from which to read filter rules.
132 .SH SEE ALSO
133 ipf(5), ipf(8), snoop(1m), tcpdump(8), etherfind(8c)
134 .SH BUGS
135 Not all of the input formats are sufficiently capable of introducing a
136 wide enough variety of packets for them to be all useful in testing.