1
.\" This file is part of tcpspy Debian package, a TCP/IP connection monitor.
2
.\" In truth this is just an snipped version of tcpspy manpage, which is
3
.\" copyrighted by Tim J. Robbins under the same terms below.
5
.\" Copyright (c) 2001 Pablo Lorenzzoni.
6
.\" All rights reserved.
8
.\" Redistribution and use in source and binary forms, with or without
9
.\" modification, are permitted provided that the following conditions
11
.\" 1. Redistributions of source code must retain the above copyright
12
.\" notice, this list of conditions and the following disclaimer.
13
.\" 2. Redistributions in binary form must reproduce the above copyright
14
.\" notice, this list of conditions and the following disclaimer in the
15
.\" documentation and/or other materials provided with the distribution.
16
.\" 3. The name of the author may not be used to endorse or promote products
17
.\" derived from this software without specific prior written permission.
19
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22
.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
.\" $Id: tcpspy.rules.5,v 1.33 2001/01/28 13:09:12 fyre Exp $
31
.TH TCPSPY.RULES 5 "April 2001" Spectra "tcpspy.rules"
33
tcpspy.rules \- configuration file for tcpspy
37
.IR /etc/tcpspy.rules ,
39
.IR /etc/init.d/tcpspy
40
script at init time in order to configure
41
tcpspy (see tcpspy(8)) logger filtering rules.
46
# /etc/tcpspt.rules example
47
user "joedoe" and rport 22 and raddr 192.168.1.10
50
(lport 23 and user "joedoe") or raddr 192.168.1.20
53
This rules file specifies that tcpspy logs tcp connections according
54
to 4 rules (line 1 to line 4 - one per each line) using the boolean
55
logic (see below) to evaluate each rule.
57
This particular example logs conections:
59
line 1 - for user "joedoe" connecting to 192.168.1.10:22 (remote)
61
line 2 - for user whose UID is 1003
63
line 3 - to localhost:22 or localhost:21
65
line 4 - for user "joedoe" to localhost:23 or to 192.168.1.20 (remote)
67
Everything from an "#" signal and the end of the line will not be evaluated.
70
.SS "Rule Syntax - just extracted from tcpspy(8)"
71
A rule may be specified with the following comparison operators:
74
True if the local user initiating or accepting the connection has the
79
.BI user " \N'34'username\N'34'"
80
Same as above, but using a username instead of a user id.
83
True if the local end of the connection has port number
86
.BI lport " [low] - [high]"
87
True if the local end of the connection has a port number
88
greater than or equal to
90
and less than or equal to
94
is used, high is assumed to be 65535.
97
is used, low is assumed to be 0. It is an error to omit both
98
.IR low " and " high .
100
.BI lport " \N'34'service\N'34'"
101
Same as above, but using a service name from
103
instead of a port number.
108
but compares the port number of the remote end of the connection.
110
.BI laddr " n.n.n.n[/m.m.m.m]"
111
Interpreted as a "net/mask" expression; true if "net" is equal to the bitwise
112
AND of the local address of the connection and "mask". If no mask is specified,
113
a default mask with all bits set (255.255.255.255) is used.
118
but compares the remote address.
120
.BI exe " \N'34'pattern\N'34'"
121
True if the full filename (including directory) of the executable that
122
created/accepted the connection matches
128
The pattern "" (an empty string) matches connections created/accepted by
129
processes whose executable filename is unknown.
133
option is not specified, a warning message will be printed, and the result of
134
this comparison will always be true.
136
Expressions (including the comparisons listed above) may be joined together
137
with the following logical operations:
139
.IB expr1 " or " expr2
144
are true (logical OR).
146
.IB expr1 " and " expr2
151
are true (logical AND).
156
is false (logical NOT).
158
Rules are evaluated from left to right. Whitespace (space, tab and newline)
159
characters are ignored between "words". Rules consisting of only whitespace
160
match no connections, but do not cause an error.
161
Parentheses, '(' and ')' may be placed around expressions to affect the order
166
These are some sample rules which further demonstrate how they are constructed:
169
user "joe" and rport "ssh"
171
Log connections made by user "joe" for the service "ssh".
175
not raddr 10.0.0.0/255.0.0.0 and rport 25 and (user "bob" or user "joe")
177
Log connections made by users "bob" and "joe" to remote port 25 on machines
178
not on a fictional "intranet".
181
Tim J. Robbins (tcpspy),
182
Pablo Lorenzzoni (this manpage)