annotate xml/syslog2iptables.in @ 56:73dd2daeaf8e stable-1-0-13-2

switch to auto requires
author Carl Byington <carl@five-ten-sg.com>
date Wed, 17 Aug 2011 10:12:16 -0700
parents d6fb7fca0394
children b45dddebe8fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
1 <reference>
50
75361069c6ef changes for fedora 10
Carl Byington <carl@five-ten-sg.com>
parents: 44
diff changeset
2 <title>@PACKAGE@ - Version @VERSION@</title>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
3 <partintro>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
4 <title>Packages</title>
44
9e9f09cf411c Add fixes for Solaris from sm-archive.
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
5
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
6 <para>The various source and binary packages are available at <ulink
19
13b2e663b553 add trailing / on http package directory reference
carl
parents: 16
diff changeset
7 url="http://www.five-ten-sg.com/@PACKAGE@/packages/">http://www.five-ten-sg.com/@PACKAGE@/packages/</ulink>
12
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
8 The most recent documentation is available at <ulink
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
9 url="http://www.five-ten-sg.com/@PACKAGE@/">http://www.five-ten-sg.com/@PACKAGE@/</ulink>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
10 </para>
44
9e9f09cf411c Add fixes for Solaris from sm-archive.
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
11
9e9f09cf411c Add fixes for Solaris from sm-archive.
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
12 <para>A <ulink
9e9f09cf411c Add fixes for Solaris from sm-archive.
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
13 url="http://www.selenic.com/mercurial/wiki/">Mercurial</ulink> source
9e9f09cf411c Add fixes for Solaris from sm-archive.
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
14 code repository for this project is available at <ulink
9e9f09cf411c Add fixes for Solaris from sm-archive.
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
15 url="http://hg.five-ten-sg.com/@PACKAGE@/">http://hg.five-ten-sg.com/@PACKAGE@/</ulink>.
9e9f09cf411c Add fixes for Solaris from sm-archive.
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
16 </para>
9e9f09cf411c Add fixes for Solaris from sm-archive.
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
17
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
18 </partintro>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
19
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
20 <refentry id="@PACKAGE@.1">
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
21 <refentryinfo>
53
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
22 <date>2009-01-25</date>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
23 </refentryinfo>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
24
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
25 <refmeta>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
26 <refentrytitle>@PACKAGE@</refentrytitle>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
27 <manvolnum>1</manvolnum>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
28 <refmiscinfo>@PACKAGE@ @VERSION@</refmiscinfo>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
29 </refmeta>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
30
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
31 <refnamediv id='name.1'>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
32 <refname>@PACKAGE@</refname>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
33 <refpurpose>a simple adaptive firewall</refpurpose>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
34 </refnamediv>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
35
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
36 <refsynopsisdiv id='synopsis.1'>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
37 <title>Synopsis</title>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
38 <cmdsynopsis>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
39 <command>@PACKAGE@</command>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
40 <arg><option>-c</option></arg>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
41 <arg><option>-d <replaceable class="parameter">n</replaceable></option></arg>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
42 </cmdsynopsis>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
43 </refsynopsisdiv>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
44
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
45 <refsect1 id='description.1'>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
46 <title>Description</title>
12
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
47
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
48 <para><command>@PACKAGE@</command> is a simple adaptive firewall. It
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
49 maintains the INPUT chain of the <citerefentry>
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
50 <refentrytitle>iptables</refentrytitle> <manvolnum>1</manvolnum>
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
51 </citerefentry> firewall set based on syslog entries. These syslog
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
52 entries are typically generated by your hardware firewall, but they
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
53 could come from any source. Any syslog entry that contains a host name
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
54 or ip address can be used as input to this package.</para>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
55
12
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
56 <para>The <citerefentry> <refentrytitle>@PACKAGE@.conf</refentrytitle>
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
57 <manvolnum>5</manvolnum> </citerefentry> file specifies the syslog files
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
58 to be monitored, and the regular expressions (<citerefentry>
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
59 <refentrytitle>regex</refentrytitle> <manvolnum>7</manvolnum>
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
60 </citerefentry>) to be applied to new lines in those files. Each
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
61 regular expression needs an index to specify the matching substring that
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
62 contains either an ip address or host name, and a bucket count which is
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
63 added to the leaky bucket for that ip address when a matching line is
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
64 read from that syslog file.</para>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
65
12
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
66 <para>Each ip address has an associated leaky bucket, which leaks one
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
67 token per second. Once the bucket contains more than a configurable
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
68 threshold number of tokens, that ip address is added to the INPUT chain
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
69 with a DROP target. When the bucket is drained to zero, that ip address
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
70 is removed from the INPUT chain.</para>
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
71
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
72 <para>The discussion has focused on syslog files, but any ascii text
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
73 file can be used, so long as some other process appends lines to that
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
74 file, and those lines containing hostname or ip addresses can be matched
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
75 with some regular expression.</para>
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
76
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
77 <para>Considering syslog files in particular, these are normally rotated
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
78 via logrotate. <command>@PACKAGE@</command> properly detects and
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
79 handles this case by closing the old file, and reopening the newly
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
80 created file.</para>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
81 </refsect1>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
82
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
83 <refsect1 id='options.1'>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
84 <title>Options</title>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
85 <variablelist>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
86 <varlistentry>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
87 <term>-c</term>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
88 <listitem>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
89 <para>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
90 Load the configuration file, print a cannonical form
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
91 of the configuration on stdout, and exit.
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
92 </para>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
93 </listitem>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
94 </varlistentry>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
95 <varlistentry>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
96 <term>-d <replaceable class="parameter">n</replaceable></term>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
97 <listitem>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
98 <para>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
99 Set the debug level to <replaceable class="parameter">n</replaceable>.
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
100 </para>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
101 </listitem>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
102 </varlistentry>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
103 </variablelist>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
104 </refsect1>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
105
16
ae2767aabdbc add id strings to all ref sections
carl
parents: 14
diff changeset
106 <refsect1 id='usage.1'>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
107 <title>Usage</title>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
108 <para><command>@PACKAGE@</command> -d 2</para>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
109 </refsect1>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
110
16
ae2767aabdbc add id strings to all ref sections
carl
parents: 14
diff changeset
111 <refsect1 id='configuration.1'>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
112 <title>Configuration</title>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
113 <para>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
114 The configuration file is documented in <citerefentry>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
115 <refentrytitle>@PACKAGE@.conf</refentrytitle> <manvolnum>5</manvolnum>
12
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
116 </citerefentry>. Any change to the config file will cause it to be
c2a2e35a85ac final documentation, rpm builds properly
carl
parents: 11
diff changeset
117 reloaded within three minutes.
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
118 </para>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
119 </refsect1>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
120
24
ec051169fdfd don't flush input chain, use -D option instead
carl
parents: 19
diff changeset
121 <refsect1 id='todo.1'>
ec051169fdfd don't flush input chain, use -D option instead
carl
parents: 19
diff changeset
122 <title>TODO</title>
ec051169fdfd don't flush input chain, use -D option instead
carl
parents: 19
diff changeset
123 <para>
ec051169fdfd don't flush input chain, use -D option instead
carl
parents: 19
diff changeset
124 The following ideas are under consideration.
ec051169fdfd don't flush input chain, use -D option instead
carl
parents: 19
diff changeset
125 </para>
ec051169fdfd don't flush input chain, use -D option instead
carl
parents: 19
diff changeset
126 <para>
ec051169fdfd don't flush input chain, use -D option instead
carl
parents: 19
diff changeset
127 Add a configuration option for the iptables table name in the
ec051169fdfd don't flush input chain, use -D option instead
carl
parents: 19
diff changeset
128 pattern statement. This implies handling multiple tables, so each
ec051169fdfd don't flush input chain, use -D option instead
carl
parents: 19
diff changeset
129 table needs its own map of ip addresses and bucket values.
ec051169fdfd don't flush input chain, use -D option instead
carl
parents: 19
diff changeset
130 </para>
ec051169fdfd don't flush input chain, use -D option instead
carl
parents: 19
diff changeset
131 </refsect1>
ec051169fdfd don't flush input chain, use -D option instead
carl
parents: 19
diff changeset
132
16
ae2767aabdbc add id strings to all ref sections
carl
parents: 14
diff changeset
133 <refsect1 id='copyright.1'>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
134 <title>Copyright</title>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
135 <para>
31
carl
parents: 30
diff changeset
136 Copyright (C) 2007 by 510 Software Group &lt;carl@five-ten-sg.com&gt;
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
137 </para>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
138 <para>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
139 This program is free software; you can redistribute it and/or modify it
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
140 under the terms of the GNU General Public License as published by the
31
carl
parents: 30
diff changeset
141 Free Software Foundation; either version 3, or (at your option) any
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
142 later version.
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
143 </para>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
144 <para>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
145 You should have received a copy of the GNU General Public License along
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
146 with this program; see the file COPYING. If not, please write to the
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
147 Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
148 </para>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
149 </refsect1>
31
carl
parents: 30
diff changeset
150
carl
parents: 30
diff changeset
151 <refsect1 id='version.1'>
42
d9ae11033b4b Add default config to firewall systems that send bounces to non-existant accounts.
Carl Byington <carl@five-ten-sg.com>
parents: 36
diff changeset
152 <title>Version</title>
31
carl
parents: 30
diff changeset
153 <para>
42
d9ae11033b4b Add default config to firewall systems that send bounces to non-existant accounts.
Carl Byington <carl@five-ten-sg.com>
parents: 36
diff changeset
154 @VERSION@
31
carl
parents: 30
diff changeset
155 </para>
carl
parents: 30
diff changeset
156 </refsect1>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
157 </refentry>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
158
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
159
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
160 <refentry id="@PACKAGE@.conf.5">
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
161 <refentryinfo>
53
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
162 <date>2009-01-25</date>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
163 </refentryinfo>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
164
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
165 <refmeta>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
166 <refentrytitle>@PACKAGE@.conf</refentrytitle>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
167 <manvolnum>5</manvolnum>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
168 <refmiscinfo>@PACKAGE@ @VERSION@</refmiscinfo>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
169 </refmeta>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
170
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
171 <refnamediv id='name.5'>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
172 <refname>@PACKAGE@.conf</refname>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
173 <refpurpose>configuration file for @PACKAGE@</refpurpose>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
174 </refnamediv>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
175
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
176 <refsynopsisdiv id='synopsis.5'>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
177 <title>Synopsis</title>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
178 <cmdsynopsis>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
179 <command>@PACKAGE@.conf</command>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
180 </cmdsynopsis>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
181 </refsynopsisdiv>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
182
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
183 <refsect1 id='description.5'>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
184 <title>Description</title>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
185 <para>The <command>@PACKAGE@.conf</command> configuration file is
27
28fec0c67646 make add/remove commands configureable
carl
parents: 24
diff changeset
186 specified by this partial bnf description. The entire config file
28fec0c67646 make add/remove commands configureable
carl
parents: 24
diff changeset
187 is case sensitive. All the keywords are lower case.
28fec0c67646 make add/remove commands configureable
carl
parents: 24
diff changeset
188 </para>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
189
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
190 <literallayout class="monospaced"><![CDATA[
53
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
191 CONFIG = {CONTEXT ";"}+
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
192 CONTEXT = "context" NAME "{" {STATEMENT}+ "}"
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
193 STATEMENT := (THRESHOLD | ADD-CMD | REM-CMD | IGNORE | FILE) ";"
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
194 THRESHOLD := "threshold" THRESHOLD-INTEGER-VALUE
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
195 ADD-CMD := "add_command" IPT-CMD
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
196 REM-CMD := "remove_command" IPT-CMD
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
197 IGNORE := "ignore" "{" IG-SINGLE+ "}"
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
198 IG-SINGLE := IP-ADDRESS "/" CIDR-BITS
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
199 FILE := "file" FILENAME "{" PATTERN+ "}"
35
d2ceebcf6595 add message description in patterns
carl
parents: 31
diff changeset
200 PATTERN := "pattern" REGULAR-EXPRESSION "{" {INDEX | BUCKET | MESSAGE}+ "};"
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
201 INDEX := "index" REGEX-INTEGER-VALUE ";"
29
e16a5fb390fa make add/remove commands configureable
carl
parents: 27
diff changeset
202 BUCKET := "bucket" BUCKET-ADD-INTEGER-VALUE ";"
35
d2ceebcf6595 add message description in patterns
carl
parents: 31
diff changeset
203 MESSAGE := "message" REASON ";"
d2ceebcf6595 add message description in patterns
carl
parents: 31
diff changeset
204 REASON := string to appear in syslog messages
27
28fec0c67646 make add/remove commands configureable
carl
parents: 24
diff changeset
205 IPT-CMD := string containing exactly one %s replacement token for
29
e16a5fb390fa make add/remove commands configureable
carl
parents: 27
diff changeset
206 the ip address]]></literallayout>
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
207 </refsect1>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
208
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
209 <refsect1 id='sample.5'>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
210 <title>Sample</title>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
211 <literallayout class="monospaced"><![CDATA[
53
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
212 context dns {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
213 threshold 1100;
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
214
53
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
215 add_command "/sbin/iptables -I INPUT --protocol udp --destination-port 53 --src %s --jump DROP";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
216 remove_command "/sbin/iptables -D INPUT --protocol udp --destination-port 53 --src %s --jump DROP";
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
217
53
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
218 ignore {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
219 127.0.0.0/8; // localhost
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
220 };
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
221
53
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
222 file "/var/log/messages" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
223 pattern "named.*client (.*)#.*query.*cache.*denied" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
224 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
225 bucket 400;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
226 message "DNS attack";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
227 };
35
d2ceebcf6595 add message description in patterns
carl
parents: 31
diff changeset
228 };
d2ceebcf6595 add message description in patterns
carl
parents: 31
diff changeset
229 };
d2ceebcf6595 add message description in patterns
carl
parents: 31
diff changeset
230
53
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
231
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
232 context general {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
233 threshold 550;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
234
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
235 add_command "/sbin/iptables -I INPUT --src %s --jump DROP";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
236 remove_command "/sbin/iptables -D INPUT --src %s --jump DROP";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
237
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
238 ignore {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
239 127.0.0.0/8; // localhost
35
d2ceebcf6595 add message description in patterns
carl
parents: 31
diff changeset
240 };
53
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
241
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
242 file "/var/log/secure" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
243 pattern "sshd.*Failed password .* from ::ffff:(.*) port" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
244 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
245 bucket 400;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
246 message "ssh failed password";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
247 };
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
248 pattern "sshd.*Failed password .* from (.*) port" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
249 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
250 bucket 400;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
251 message "ssh failed password";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
252 };
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
253 pattern "proftpd.*no such user found from (.*) \[" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
254 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
255 bucket 400;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
256 message "ftp failed password";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
257 };
35
d2ceebcf6595 add message description in patterns
carl
parents: 31
diff changeset
258 };
53
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
259
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
260 file "/var/log/messages" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
261 pattern "ipop3d.* Login failed .* \[(.*)\]" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
262 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
263 bucket 400;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
264 message "pop3 failed password";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
265 };
35
d2ceebcf6595 add message description in patterns
carl
parents: 31
diff changeset
266 };
d2ceebcf6595 add message description in patterns
carl
parents: 31
diff changeset
267
53
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
268 file "/var/log/httpd/access_log" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
269 // of course you cannot use this if you actually use cgi-bin directories
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
270 pattern "(.*) - - .* /cgi-bin" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
271 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
272 bucket 400;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
273 message "apache cgi-bin reference";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
274 };
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
275 // or if you actually have an index2.php script
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
276 pattern "(.*) - - .*/index2.php" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
277 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
278 bucket 400;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
279 message "apache index2.php reference";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
280 };
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
281 // or if you have a main.php script
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
282 pattern "(.*) - - .*/main.php" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
283 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
284 bucket 400;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
285 message "apache main.php reference";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
286 };
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
287 pattern "(.*) - - .*/awstats.pl" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
288 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
289 bucket 400;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
290 message "apache awstats.pl reference";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
291 };
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
292 pattern "(.*) - - .*/adxmlrpc" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
293 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
294 bucket 400;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
295 message "apache adxmlrpc reference";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
296 };
35
d2ceebcf6595 add message description in patterns
carl
parents: 31
diff changeset
297 };
d2ceebcf6595 add message description in patterns
carl
parents: 31
diff changeset
298
53
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
299 file "/var/log/maillog" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
300 pattern "lost input channel from .* \[(.*)\] .* after (mail|rcpt|auth)" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
301 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
302 bucket 200;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
303 message "sendmail spammer dropping connection";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
304 };
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
305 pattern " \[(.*)\]: possible SMTP attack" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
306 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
307 bucket 600;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
308 message "sendmail authentication attack";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
309 };
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
310 pattern "rejecting commands from .* \[(.*)\] due to pre-greeting traffic" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
311 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
312 bucket 200;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
313 message "sendmail pre-greeting";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
314 };
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
315 pattern "dovecot.*Aborted login.*rip=(.*)," {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
316 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
317 bucket 100;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
318 message "dovecot failed password";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
319 };
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
320 pattern "dovecot: pop3-login: Disconnected: Shutting down.*rip=(.*)," {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
321 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
322 bucket 100;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
323 message "dovecot failed password";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
324 };
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
325
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
326 // make sure your upstream MX servers are listed in the
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
327 // ignore block above, otherwise you will kill them off
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
328 // when they try to forward such mail to you.
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
329 pattern "sendmail.*from=<>,.*nrcpts=0,.*\[(.*)\]" {
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
330 index 1; // zero based
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
331 bucket 200;
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
332 message "sendmail rejected bounce";
d6fb7fca0394 Document multiple contexts
Carl Byington <carl@five-ten-sg.com>
parents: 50
diff changeset
333 };
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
334 };
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
335 };]]></literallayout>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
336 </refsect1>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
337
31
carl
parents: 30
diff changeset
338 <refsect1 id='version.5'>
42
d9ae11033b4b Add default config to firewall systems that send bounces to non-existant accounts.
Carl Byington <carl@five-ten-sg.com>
parents: 36
diff changeset
339 <title>Version</title>
31
carl
parents: 30
diff changeset
340 <para>
42
d9ae11033b4b Add default config to firewall systems that send bounces to non-existant accounts.
Carl Byington <carl@five-ten-sg.com>
parents: 36
diff changeset
341 @VERSION@
31
carl
parents: 30
diff changeset
342 </para>
carl
parents: 30
diff changeset
343 </refsect1>
carl
parents: 30
diff changeset
344
11
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
345 </refentry>
a9b52f657f08 finish coding 1.0 version
carl
parents:
diff changeset
346 </reference>