blob: 02432bac20abf8638fb4ecbc05317b7948dc3c25 [file] [log] [blame]
Jonas Berlinf33c4612005-04-01 06:54:23 +00001Allows you to dynamically create a list of IP addresses and then match
2against that list in a few different ways.
3
4For example, you can create a `badguy' list out of people attempting
5to connect to port 139 on your firewall and then DROP all future
6packets from them without considering them.
7.TP
8.BI "--name " "name"
9Specify the list to use for the commands. If no name is given then 'DEFAULT'
10will be used.
11.TP
12[\fB!\fR] \fB--set\fR
13This will add the source address of the packet to the list. If the
14source address is already in the list, this will update the existing
15entry. This will always return success (or failure if `!' is passed
16in).
17.TP
Jan Engelhardtd91bd172008-08-13 14:44:30 +020018\fB--rsource\fP
19Match/save the source address of each packet in the recent list table. This
20is the default.
21.TP
22\fB--rdest\fP
23Match/save the destination address of each packet in the recent list table.
24.TP
Jonas Berlinf33c4612005-04-01 06:54:23 +000025[\fB!\fR] \fB--rcheck\fR
26Check if the source address of the packet is currently in
27the list.
28.TP
29[\fB!\fR] \fB--update\fR
30Like \fB--rcheck\fR, except it will update the "last seen" timestamp if it
31matches.
32.TP
33[\fB!\fR] \fB--remove\fR
34Check if the source address of the packet is currently in the list and
35if so that address will be removed from the list and the rule will
36return true. If the address is not found, false is returned.
37.TP
38[\fB!\fR] \fB--seconds \fIseconds\fR
39This option must be used in conjunction with one of \fB--rcheck\fR or
40\fB--update\fR. When used, this will narrow the match to only happen
41when the address is in the list and was seen within the last given
42number of seconds.
43.TP
44[\fB!\fR] \fB--hitcount \fIhits\fR
45This option must be used in conjunction with one of \fB--rcheck\fR or
46\fB--update\fR. When used, this will narrow the match to only happen
47when the address is in the list and packets had been received greater
48than or equal to the given value. This option may be used along with
49\fB--seconds\fR to create an even narrower match requiring a certain
50number of hits within a specific time frame.
51.TP
52\fB--rttl\fR
53This option must be used in conjunction with one of \fB--rcheck\fR or
54\fB--update\fR. When used, this will narrow the match to only happen
55when the address is in the list and the TTL of the current packet
56matches that of the packet which hit the \fB--set\fR rule. This may be
57useful if you have problems with people faking their source address in
58order to DoS you via this module by disallowing others access to your
59site by sending bogus packets to you.
60.P
61Examples:
62.IP
63# iptables -A FORWARD -m recent --name badguy --rcheck --seconds 60 -j DROP
64
65# iptables -A FORWARD -p tcp -i eth0 --dport 139 -m recent --name badguy --set -j DROP
66.P
67Official website (http://snowman.net/projects/ipt_recent/) also has
68some examples of usage.
69
70/proc/net/ipt_recent/* are the current lists of addresses and information
71about each entry of each list.
72
73Each file in /proc/net/ipt_recent/ can be read from to see the current list
74or written two using the following commands to modify the list:
75.TP
76echo xx.xx.xx.xx > /proc/net/ipt_recent/DEFAULT
77to Add to the DEFAULT list
78.TP
79echo -xx.xx.xx.xx > /proc/net/ipt_recent/DEFAULT
80to Remove from the DEFAULT list
81.TP
82echo clear > /proc/net/ipt_recent/DEFAULT
83to empty the DEFAULT list.
84.P
85The module itself accepts parameters, defaults shown:
86.TP
87.BI "ip_list_tot=" "100"
88Number of addresses remembered per table
89.TP
90.BI "ip_pkt_list_tot=" "20"
91Number of packets per address remembered
92.TP
93.BI "ip_list_hash_size=" "0"
94Hash table size. 0 means to calculate it based on ip_list_tot, default: 512
95.TP
96.BI "ip_list_perms=" "0644"
97Permissions for /proc/net/ipt_recent/* files
98.TP
99.BI "debug=" "0"
100Set to 1 to get lots of debugging info