1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
|
<!DOCTYPE refentry PUBLIC "-//Davenport//DTD DocBook V3.0//EN">
<refentry>
<refmeta>
<refentrytitle>
<application>flow-nfilter</application>
</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>
<application>flow-nfilter</application>
</refname>
<refpurpose>
Filter flows.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>flow-nfilter</command>
<arg>-hk</arg>
<arg>-b<replaceable> big</replaceable>|<replaceable>little</replaceable></arg>
<arg>-C<replaceable> comment</replaceable></arg>
<arg>-d<replaceable> debug_level</replaceable></arg>
<arg>-f<replaceable> filter_fname</replaceable></arg>
<arg>-F<replaceable> filter_definition</replaceable></arg>
<arg>-v<replaceable> variable binding</replaceable></arg>
<arg>-z<replaceable> z_level</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>DESCRIPTION</title>
<para>
The <command>flow-nfilter</command> utility will filter flows based on
user selectable criteria. Filters are defined in a configuration file
and are composed of primitives and a definition. Definitions contain
match lines grouped to form logical AND and OR operations on the flow
using the selected primitives. A definition may contain the invert
command which will invert the result of the evaluation.
</para>
<para>
Words in the configuration file of the form @VAR or @{VAR:default} will be
expanded at run-time by setting variable names with the -v option.
</para>
<para>
Filter primitives begin with the filter-primitive keyword followed by
a symbolic name. Each primitive has a type defined below.
A list of permit and or deny keywords followed
by an argument are later evaulated to determine if the flow is permitted or
denied. The default action for a primitive is to deny which may be
changed with the default keyword. Symbolic substitutions are done where
appropriate.
</para>
<para>
</para>
<para>
The match keyword in a definition selects the criteria to match a primitive.
A match type may allow more than one type of primitive, for example the
src-ip-addr match type will accept any of {ip-address, ip-address-mask,
ip-address-prefix} primitive types.
</para>
<para>
<screen>
Primitive type Type Description/Example
-------------------------------------------------------------------
as Bucket Autonomous System Number.
600,159,3112
ip-address-prefix-len Numeric Integer from 0 to 32.
16-31
ip-protocol Bucket Integer from 0 to 255.
6,17,1
ip-tos Bucket Integer from 0 to 255 with mask.
0xA0/0xE0
ip-tcp-flags Bucket Integer from 0 to 255 with mask.
0x2/0x2
ifindex Bucket Integer from 0 to 65535
0,5,10
engine Bucket Integer from 0 to 255.
0
ip-port Bucket Integer from 0 to 65535.
80,8080,23,22
ip-address Hash List of IP Addresses.
10.0.0.1
ip-address-mask List List of IP address/mask pairs.
10.1.0.0 255.255.0.0
ip-address-prefix Trie List of IP address/mask pairs.
10.1/16
tag Hash List of tags.
0xFF00
tag-mask List List of tags.
0xF000/0xFF00
counter List List of Integers with qualifier.
lt 32
time List List of relative time specifiers.
gt 5:00
time-date List List of absolute time specifiers.
gt December 12, 2002 5:13:21
double List List of doubles with qualifier.
lt 32.0
rate Element Rate is calculated as 1/rate.
permit 100
Match type Description Primitives accepted
-------------------------------------------------------------------
source-as Source AS as
destination-as Destination AS as
ip-source-address Source IP Address ip-address,
ip-address-mask,
ip-address-prefix
ip-destination-address Destination IP Address ip-address,
ip-address-mask,
ip-address-prefix
ip-exporter-address Exporter IP Address ip-address,
ip-address-mask,
ip-address-prefix
ip-nexthop-address NextHop IP Address ip-address,
ip-address-mask,
ip-address-prefix
ip-shortcut-address Shortcut IP Address ip-address,
ip-address-mask,
ip-address-prefix
ip-protocol IP Protocol ip-protocol
ip-source-address-prefix-len
Source IP address ip-address-prefix-len
prefix length
ip-destination-address-prefix-len
Destination IP address ip-address-prefix-len
prefix length
ip-tos IP Type Of Service ip-tos
ip-marked-tos IP Type Of Service ip-tos
ip-tcp-flags IP/TCP Flags ip-tcp-flags
ip-source-port Source IP Port ip-port
eg TCP/UDP
ip-destination-port Destination IP Port ip-port
eg TCP/UDP
input-interface Source ifIndex ifindex
eg Input Interface
output-interface Destination ifIndex ifindex
eg Output Interface
start-time Start Time of flow time, time-date
end-time End Time of Flow time, time-date
flows Number of flows counter
octets Number of octets counter
packets Number of packets counter
duration Duration of flow in ms counter
engine-id Engine ID engine
engine-type Engine Type engine
source-tag Source Tag tag, tag-mask
destination-tag Destination Tag tag, tag-mask
pps Packets Per Second double
bps Bits Per Second double
random-sample Random Sample rate
</screen>
</para>
</refsect1>
<refsect1>
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>-b<replaceable> big</replaceable>|<replaceable>little</replaceable</term>
<listitem>
<para>
Byte order of output.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-C<replaceable> Comment</replaceable></term>
<listitem>
<para>
Add a comment.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-d<replaceable> debug_level</replaceable></term>
<listitem>
<para>
Enable debugging.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-f<replaceable> filter_fname</replaceable></term>
<listitem>
<para>
Filter list filename. Defaults to <filename>@localstatedir@/cfg/filter</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-F<replaceable> filter_definition</replaceable></term>
<listitem>
<para>
Select the active definition. Defaults to default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-h</term>
<listitem>
<para>
Display help.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-k</term>
<listitem>
<para>
Keep time from input.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-v<replaceable> variable binding</replaceable></term>
<listitem>
<para>
Set a variable FOO=bar.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-z<replaceable> z_level</replaceable></term>
<listitem>
<para>
Configure compression level to <replaceable> z_level</replaceable>. 0 is
disabled (no compression), 9 is highest compression.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>TIME/DATE parsing</title>
<para>
time-date parsing is implemented with <filename>getdate.y</filename>,
a commonly used function to process free-form time date specifications.
Example usage borrowed from <command>cvs</command>:
1 month ago
2 hours ago
400000 seconds ago
last year
last Monday
yesterday
a fortnight ago
3/31/92 10:00:07 PST
January 23, 1987 10:05pm
22:00 GMT
</para>
</refsect1>
<refsect1>
<title>EXAMPLES</title>
<informalexample>
<para>
An example of filter configuration file.
<screen>
filter-primitive srate
type rate
permit 100
filter-primitive test-as
type as
permit 600,159
filter-primitive test-prefix-len
type ip-address-prefix-len
permit 32
filter-primitive test-protocol
type ip-protocol
permit tcp
filter-primitive test-tos
type ip-tos
mask 0xA0
permit 0xE0
filter-primitive test-tcp-flags
type ip-tcp-flags
mask 0x2
permit 0x2
filter-primitive test-ifindex
type ifindex
permit 0,5,10
filter-primitive test-engine
type engine
permit 0
filter-primitive test-port
type ip-port
permit https
permit 80
default deny
filter-primitive test-address
type ip-address
permit 0.0.0.1
permit 0.0.0.2
default deny
filter-primitive test-address-mask
type ip-address-mask
permit 128.146.197.1 255.255.255.255
permit 128.146.197.2 255.255.255.255
filter-primitive test-prefix
type ip-address-prefix
permit 128.146.0.0/16
default deny
filter-primitive test-tag
type tag
permit 0x00
permit 0x01
permit 0xFF
filter-primitive test-tag-mask
type tag-mask
permit OSU 0xFF
permit 0xFF 0xFF
default deny
filter-primitive test-counter
type counter
permit lt 5
permit gt 10
default deny
filter-primitive test-time-date
type time-date
permit gt December 12, 2002 5:13:21
filter-primitive test-time
type time-date
permit gt 12:15:00
filter-definition sample-1-in-100
match random-sample srate
filter-definition t1
match engine-type test-engine
or
match destination-tag test-tag-mask
</screen>
</para>
</informalexample>
<informalexample>
<para>
Display all flows with a destination port of 80 or source port of 25 (smtp)
starting after Dec 12, 2001. The file <filename>test</filename> is
populated with the following:
<literallayout>
filter-primitive port80
type ip-port
permit 80
filter-primitive port25
type ip-port
permit smtp
filter-primitive dec12
type time-date
permit gt Dec 12, 2001
filter-definition foo
match ip-source-port port80
match start-time dec12
or
match ip-destination-port port25
match start-time dec12
</literallayout>
<command>flow-cat <filename>flows</filename> | flow-nfilter -ftest -Ffoo | flow-print</command>
</para>
</informalexample>
</refsect1>
<refsect1>
<title>FILES</title>
<para>
Configuration files:
Symbols - <filename>@localstatedir@/sym/*</filename>.
Tag - <filename>@localstatedir@/cfg/tag.cfg</filename>.
Filter - <filename>@localstatedir@/cfg/filter.cfg</filename>.
</para>
</refsect1>
<refsect1>
<title>BUGS</title>
<para>
None known.
</para>
</refsect1>
<refsect1>
<title>AUTHOR</title>
<para>
<author>
<firstname>Mark</firstname>
<surname>Fullmer</surname>
</author>
<email>maf@splintered.net</email>
</para>
</refsect1>
<refsect1>
<title>SEE ALSO</title>
<para>
<application>flow-tools</application>(1)
</para>
</refsect1>
</refentry>
|