Blame extensions/libxt_recent.man

Packit 7b22a4
Allows you to dynamically create a list of IP addresses and then match against
Packit 7b22a4
that list in a few different ways.
Packit 7b22a4
.PP
Packit 7b22a4
For example, you can create a "badguy" list out of people attempting to connect
Packit 7b22a4
to port 139 on your firewall and then DROP all future packets from them without
Packit 7b22a4
considering them.
Packit 7b22a4
.PP
Packit 7b22a4
\fB\-\-set\fP, \fB\-\-rcheck\fP, \fB\-\-update\fP and \fB\-\-remove\fP are
Packit 7b22a4
mutually exclusive.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-name\fP \fIname\fP
Packit 7b22a4
Specify the list to use for the commands. If no name is given then
Packit 7b22a4
\fBDEFAULT\fP will be used.
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-\-set\fP
Packit 7b22a4
This will add the source address of the packet to the list. If the source
Packit 7b22a4
address is already in the list, this will update the existing entry. This will
Packit 7b22a4
always return success (or failure if \fB!\fP is passed in).
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rsource\fP
Packit 7b22a4
Match/save the source address of each packet in the recent list table. This
Packit 7b22a4
is the default.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rdest\fP
Packit 7b22a4
Match/save the destination address of each packet in the recent list table.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-mask\fP \fInetmask\fP
Packit 7b22a4
Netmask that will be applied to this recent list.
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-\-rcheck\fP
Packit 7b22a4
Check if the source address of the packet is currently in the list.
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-\-update\fP
Packit 7b22a4
Like \fB\-\-rcheck\fP, except it will update the "last seen" timestamp if it
Packit 7b22a4
matches.
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-\-remove\fP
Packit 7b22a4
Check if the source address of the packet is currently in the list and if so
Packit 7b22a4
that address will be removed from the list and the rule will return true. If
Packit 7b22a4
the address is not found, false is returned.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-seconds\fP \fIseconds\fP
Packit 7b22a4
This option must be used in conjunction with one of \fB\-\-rcheck\fP or
Packit 7b22a4
\fB\-\-update\fP. When used, this will narrow the match to only happen when the
Packit 7b22a4
address is in the list and was seen within the last given number of seconds.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-reap\fP
Packit 7b22a4
This option can only be used in conjunction with \fB\-\-seconds\fP.
Packit 7b22a4
When used, this will cause entries older than the last given number of seconds
Packit 7b22a4
to be purged.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hitcount\fP \fIhits\fP
Packit 7b22a4
This option must be used in conjunction with one of \fB\-\-rcheck\fP or
Packit 7b22a4
\fB\-\-update\fP. When used, this will narrow the match to only happen when the
Packit 7b22a4
address is in the list and packets had been received greater than or equal to
Packit 7b22a4
the given value. This option may be used along with \fB\-\-seconds\fP to create
Packit 7b22a4
an even narrower match requiring a certain number of hits within a specific
Packit 7b22a4
time frame. The maximum value for the hitcount parameter is given by the
Packit 7b22a4
"ip_pkt_list_tot" parameter of the xt_recent kernel module. Exceeding this
Packit 7b22a4
value on the command line will cause the rule to be rejected.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rttl\fP
Packit 7b22a4
This option may only be used in conjunction with one of \fB\-\-rcheck\fP or
Packit 7b22a4
\fB\-\-update\fP. When used, this will narrow the match to only happen when the
Packit 7b22a4
address is in the list and the TTL of the current packet matches that of the
Packit 7b22a4
packet which hit the \fB\-\-set\fP rule. This may be useful if you have problems
Packit 7b22a4
with people faking their source address in order to DoS you via this module by
Packit 7b22a4
disallowing others access to your site by sending bogus packets to you.
Packit 7b22a4
.PP
Packit 7b22a4
Examples:
Packit 7b22a4
.IP
Packit 7b22a4
iptables \-A FORWARD \-m recent \-\-name badguy \-\-rcheck \-\-seconds 60 \-j DROP
Packit 7b22a4
.IP
Packit 7b22a4
iptables \-A FORWARD \-p tcp \-i eth0 \-\-dport 139 \-m recent \-\-name badguy \-\-set \-j DROP
Packit 7b22a4
.PP
Packit 7b22a4
\fB/proc/net/xt_recent/*\fP are the current lists of addresses and information
Packit 7b22a4
about each entry of each list.
Packit 7b22a4
.PP
Packit 7b22a4
Each file in \fB/proc/net/xt_recent/\fP can be read from to see the current
Packit 7b22a4
list or written two using the following commands to modify the list:
Packit 7b22a4
.TP
Packit 7b22a4
\fBecho +\fP\fIaddr\fP\fB >/proc/net/xt_recent/DEFAULT\fP
Packit 7b22a4
to add \fIaddr\fP to the DEFAULT list
Packit 7b22a4
.TP
Packit 7b22a4
\fBecho \-\fP\fIaddr\fP\fB >/proc/net/xt_recent/DEFAULT\fP
Packit 7b22a4
to remove \fIaddr\fP from the DEFAULT list
Packit 7b22a4
.TP
Packit 7b22a4
\fBecho / >/proc/net/xt_recent/DEFAULT\fP
Packit 7b22a4
to flush the DEFAULT list (remove all entries).
Packit 7b22a4
.PP
Packit 7b22a4
The module itself accepts parameters, defaults shown:
Packit 7b22a4
.TP
Packit 7b22a4
\fBip_list_tot\fP=\fI100\fP
Packit 7b22a4
Number of addresses remembered per table.
Packit 7b22a4
.TP
Packit 7b22a4
\fBip_pkt_list_tot\fP=\fI20\fP
Packit 7b22a4
Number of packets per address remembered.
Packit 7b22a4
.TP
Packit 7b22a4
\fBip_list_hash_size\fP=\fI0\fP
Packit 7b22a4
Hash table size. 0 means to calculate it based on ip_list_tot, default: 512.
Packit 7b22a4
.TP
Packit 7b22a4
\fBip_list_perms\fP=\fI0644\fP
Packit 7b22a4
Permissions for /proc/net/xt_recent/* files.
Packit 7b22a4
.TP
Packit 7b22a4
\fBip_list_uid\fP=\fI0\fP
Packit 7b22a4
Numerical UID for ownership of /proc/net/xt_recent/* files.
Packit 7b22a4
.TP
Packit 7b22a4
\fBip_list_gid\fP=\fI0\fP
Packit 7b22a4
Numerical GID for ownership of /proc/net/xt_recent/* files.