xref: /dflybsd-src/share/man/man5/pf.os.5 (revision d27abe81872597163e3d797770ce9aaf71bbb6c7)
1*d27abe81SAaron LI.\"	$OpenBSD: pf.os.5,v 1.8 2007/05/31 19:19:58 jmc Exp $
2*d27abe81SAaron LI.\"
3*d27abe81SAaron LI.\" Copyright (c) 2003 Mike Frantzen <frantzen@w4g.org>
4*d27abe81SAaron LI.\"
5*d27abe81SAaron LI.\" Permission to use, copy, modify, and distribute this software for any
6*d27abe81SAaron LI.\" purpose with or without fee is hereby granted, provided that the above
7*d27abe81SAaron LI.\" copyright notice and this permission notice appear in all copies.
8*d27abe81SAaron LI.\"
9*d27abe81SAaron LI.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*d27abe81SAaron LI.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*d27abe81SAaron LI.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*d27abe81SAaron LI.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*d27abe81SAaron LI.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*d27abe81SAaron LI.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*d27abe81SAaron LI.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*d27abe81SAaron LI.Dd August 18, 2003
17*d27abe81SAaron LI.Dt PF.OS 5
18*d27abe81SAaron LI.Os
19*d27abe81SAaron LI.Sh NAME
20*d27abe81SAaron LI.Nm pf.os
21*d27abe81SAaron LI.Nd format of the operating system fingerprints file
22*d27abe81SAaron LI.Sh DESCRIPTION
23*d27abe81SAaron LIThe
24*d27abe81SAaron LI.Xr pf 4
25*d27abe81SAaron LIfirewall and the
26*d27abe81SAaron LI.Xr tcpdump 1
27*d27abe81SAaron LIprogram can both fingerprint the operating system of hosts that
28*d27abe81SAaron LIoriginate an IPv4 TCP connection.
29*d27abe81SAaron LIThe file consists of newline-separated records, one per fingerprint,
30*d27abe81SAaron LIcontaining nine colon
31*d27abe81SAaron LI.Pq Ql \&:
32*d27abe81SAaron LIseparated fields.
33*d27abe81SAaron LIThese fields are as follows:
34*d27abe81SAaron LI.Pp
35*d27abe81SAaron LI.Bl -tag -width Description -offset indent -compact
36*d27abe81SAaron LI.It window
37*d27abe81SAaron LIThe TCP window size.
38*d27abe81SAaron LI.It TTL
39*d27abe81SAaron LIThe IP time to live.
40*d27abe81SAaron LI.It df
41*d27abe81SAaron LIThe presence of the IPv4 don't fragment bit.
42*d27abe81SAaron LI.It packet size
43*d27abe81SAaron LIThe size of the initial TCP packet.
44*d27abe81SAaron LI.It TCP options
45*d27abe81SAaron LIAn ordered list of the TCP options.
46*d27abe81SAaron LI.It class
47*d27abe81SAaron LIThe class of operating system.
48*d27abe81SAaron LI.It version
49*d27abe81SAaron LIThe version of the operating system.
50*d27abe81SAaron LI.It subtype
51*d27abe81SAaron LIThe subtype of patchlevel of the operating system.
52*d27abe81SAaron LI.It description
53*d27abe81SAaron LIThe overall textual description of the operating system, version and subtype.
54*d27abe81SAaron LI.El
55*d27abe81SAaron LI.Pp
56*d27abe81SAaron LIThe
57*d27abe81SAaron LI.Ar window
58*d27abe81SAaron LIfield corresponds to the th->th_win field in the TCP header and is the
59*d27abe81SAaron LIsource host's advertised TCP window size.
60*d27abe81SAaron LIIt may be between zero and 65,535 inclusive.
61*d27abe81SAaron LIThe window size may be given as a multiple of a constant by prepending
62*d27abe81SAaron LIthe size with a percent sign
63*d27abe81SAaron LI.Sq %
64*d27abe81SAaron LIand the value will be used as a modulus.
65*d27abe81SAaron LIThree special values may be used for the window size:
66*d27abe81SAaron LI.Pp
67*d27abe81SAaron LI.Bl -tag -width xxx -offset indent -compact
68*d27abe81SAaron LI.It *
69*d27abe81SAaron LIAn asterisk will wildcard the value so any window size will match.
70*d27abe81SAaron LI.It S
71*d27abe81SAaron LIAllow any window size which is a multiple of the maximum segment size (MSS).
72*d27abe81SAaron LI.It T
73*d27abe81SAaron LIAllow any window size which is a multiple of the maximum transmission unit
74*d27abe81SAaron LI(MTU).
75*d27abe81SAaron LI.El
76*d27abe81SAaron LI.Pp
77*d27abe81SAaron LIThe
78*d27abe81SAaron LI.Ar ttl
79*d27abe81SAaron LIvalue is the initial time to live in the IP header.
80*d27abe81SAaron LIThe fingerprint code will account for the volatility of the packet's TTL
81*d27abe81SAaron LIas it traverses a network.
82*d27abe81SAaron LI.Pp
83*d27abe81SAaron LIThe
84*d27abe81SAaron LI.Ar df
85*d27abe81SAaron LIbit corresponds to the Don't Fragment bit in an IPv4 header.
86*d27abe81SAaron LIIt tells intermediate routers not to fragment the packet and is used for
87*d27abe81SAaron LIpath MTU discovery.
88*d27abe81SAaron LIIt may be either a zero or a one.
89*d27abe81SAaron LI.Pp
90*d27abe81SAaron LIThe
91*d27abe81SAaron LI.Ar packet size
92*d27abe81SAaron LIis the literal size of the full IP packet and is a function of all of
93*d27abe81SAaron LIthe IP and TCP options.
94*d27abe81SAaron LI.Pp
95*d27abe81SAaron LIThe
96*d27abe81SAaron LI.Ar TCP options
97*d27abe81SAaron LIfield is an ordered list of the individual TCP options that appear in the
98*d27abe81SAaron LISYN packet.
99*d27abe81SAaron LIEach option is described by a single character separated by a comma and
100*d27abe81SAaron LIcertain ones may include a value.
101*d27abe81SAaron LIThe options are:
102*d27abe81SAaron LI.Pp
103*d27abe81SAaron LI.Bl -tag -width Description -offset indent -compact
104*d27abe81SAaron LI.It Mnnn
105*d27abe81SAaron LImaximum segment size (MSS) option.
106*d27abe81SAaron LIThe value is the maximum packet size of the network link which may
107*d27abe81SAaron LIinclude the
108*d27abe81SAaron LI.Sq %
109*d27abe81SAaron LImodulus or match all MSSes with the
110*d27abe81SAaron LI.Sq *
111*d27abe81SAaron LIvalue.
112*d27abe81SAaron LI.It N
113*d27abe81SAaron LIthe NOP option (NO Operation).
114*d27abe81SAaron LI.It T[0]
115*d27abe81SAaron LIthe timestamp option.
116*d27abe81SAaron LICertain operating systems always start with a zero timestamp in which
117*d27abe81SAaron LIcase a zero value is added to the option; otherwise no value is appended.
118*d27abe81SAaron LI.It S
119*d27abe81SAaron LIthe Selective ACKnowledgement OK (SACKOK) option.
120*d27abe81SAaron LI.It Wnnn
121*d27abe81SAaron LIwindow scaling option.
122*d27abe81SAaron LIThe value is the size of the window scaling which may include the
123*d27abe81SAaron LI.Sq %
124*d27abe81SAaron LImodulus or match all window scalings with the
125*d27abe81SAaron LI.Sq *
126*d27abe81SAaron LIvalue.
127*d27abe81SAaron LI.El
128*d27abe81SAaron LI.Pp
129*d27abe81SAaron LINo TCP options in the fingerprint may be given with a single dot
130*d27abe81SAaron LI.Sq \&. .
131*d27abe81SAaron LI.Pp
132*d27abe81SAaron LIAn example of
133*d27abe81SAaron LI.Ox Ap s
134*d27abe81SAaron LITCP options are:
135*d27abe81SAaron LI.Pp
136*d27abe81SAaron LI.Dl M*,N,N,S,N,W0,N,N,T
137*d27abe81SAaron LI.Pp
138*d27abe81SAaron LIThe first option
139*d27abe81SAaron LI.Ar M*
140*d27abe81SAaron LIis the MSS option and will match all values.
141*d27abe81SAaron LIThe second and third options
142*d27abe81SAaron LI.Ar N
143*d27abe81SAaron LIwill match two NOPs.
144*d27abe81SAaron LIThe fourth option
145*d27abe81SAaron LI.Ar S
146*d27abe81SAaron LIwill match the SACKOK option.
147*d27abe81SAaron LIThe fifth
148*d27abe81SAaron LI.Ar N
149*d27abe81SAaron LIwill match another NOP.
150*d27abe81SAaron LIThe sixth
151*d27abe81SAaron LI.Ar W0
152*d27abe81SAaron LIwill match a window scaling option with a zero scaling size.
153*d27abe81SAaron LIThe seventh and eighth
154*d27abe81SAaron LI.Ar N
155*d27abe81SAaron LIoptions will match two NOPs.
156*d27abe81SAaron LIAnd the ninth and final option
157*d27abe81SAaron LI.Ar T
158*d27abe81SAaron LIwill match the timestamp option with any time value.
159*d27abe81SAaron LI.Pp
160*d27abe81SAaron LIThe TCP options in a fingerprint will only match packets with the
161*d27abe81SAaron LIexact same TCP options in the same order.
162*d27abe81SAaron LI.Pp
163*d27abe81SAaron LIThe
164*d27abe81SAaron LI.Ar class
165*d27abe81SAaron LIfield is the class, genre or vendor of the operating system.
166*d27abe81SAaron LI.Pp
167*d27abe81SAaron LIThe
168*d27abe81SAaron LI.Ar version
169*d27abe81SAaron LIis the version of the operating system.
170*d27abe81SAaron LIIt is used to distinguish between different fingerprints of operating
171*d27abe81SAaron LIsystems of the same class but different versions.
172*d27abe81SAaron LI.Pp
173*d27abe81SAaron LIThe
174*d27abe81SAaron LI.Ar subtype
175*d27abe81SAaron LIis the subtype or patch level of the operating system version.
176*d27abe81SAaron LIIt is used to distinguish between different fingerprints of operating
177*d27abe81SAaron LIsystems of the same class and same version but slightly different
178*d27abe81SAaron LIpatches or tweaking.
179*d27abe81SAaron LI.Pp
180*d27abe81SAaron LIThe
181*d27abe81SAaron LI.Ar description
182*d27abe81SAaron LIis a general description of the operating system, its version,
183*d27abe81SAaron LIpatchlevel and any further useful details.
184*d27abe81SAaron LI.Sh EXAMPLES
185*d27abe81SAaron LIThe fingerprint of a plain
186*d27abe81SAaron LI.Ox 3.3
187*d27abe81SAaron LIhost is:
188*d27abe81SAaron LI.Bd -literal
189*d27abe81SAaron LI  16384:64:1:64:M*,N,N,S,N,W0,N,N,T:OpenBSD:3.3::OpenBSD 3.3
190*d27abe81SAaron LI.Ed
191*d27abe81SAaron LI.Pp
192*d27abe81SAaron LIThe fingerprint of an
193*d27abe81SAaron LI.Ox 3.3
194*d27abe81SAaron LIhost behind a PF scrubbing firewall with a no-df rule would be:
195*d27abe81SAaron LI.Bd -literal
196*d27abe81SAaron LI  16384:64:0:64:M*,N,N,S,N,W0,N,N,T:OpenBSD:3.3:!df:OpenBSD 3.3 scrub no-df
197*d27abe81SAaron LI.Ed
198*d27abe81SAaron LI.Pp
199*d27abe81SAaron LIAn absolutely braindead embedded operating system fingerprint could be:
200*d27abe81SAaron LI.Bd -literal
201*d27abe81SAaron LI  65535:255:0:40:.:DUMMY:1.1:p3:Dummy embedded OS v1.1p3
202*d27abe81SAaron LI.Ed
203*d27abe81SAaron LI.Pp
204*d27abe81SAaron LIThe
205*d27abe81SAaron LI.Xr tcpdump 1
206*d27abe81SAaron LIoutput of
207*d27abe81SAaron LI.Bd -literal
208*d27abe81SAaron LI  # tcpdump -s128 -c1 -nv 'tcp[13] == 2'
209*d27abe81SAaron LI  03:13:48.118526 10.0.0.1.3377 > 10.0.0.2.80: S [tcp sum ok] \e
210*d27abe81SAaron LI      534596083:534596083(0) win 57344 <mss 1460> (DF) [tos 0x10] \e
211*d27abe81SAaron LI      (ttl 64, id 11315, len 44)
212*d27abe81SAaron LI.Ed
213*d27abe81SAaron LI.Pp
214*d27abe81SAaron LIalmost translates into the following fingerprint
215*d27abe81SAaron LI.Bd -literal
216*d27abe81SAaron LI  57344:64:1:44:M1460:	exampleOS:1.0::exampleOS 1.0
217*d27abe81SAaron LI.Ed
218*d27abe81SAaron LI.Sh SEE ALSO
219*d27abe81SAaron LI.Xr tcpdump 1 ,
220*d27abe81SAaron LI.Xr pf 4 ,
221*d27abe81SAaron LI.Xr pf.conf 5 ,
222*d27abe81SAaron LI.Xr pfctl 8
223