Blame extensions/libxt_recent.man

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