1 Allows you to dynamically create a list of IP addresses and then match against 2 that list in a few different ways. 3 .PP 4 For example, you can create a "badguy" list out of people attempting to connect 5 to port 139 on your firewall and then DROP all future packets from them without 6 considering them. 7 .PP 8 \fB\-\-set\fP, \fB\-\-rcheck\fP, \fB\-\-update\fP and \fB\-\-remove\fP are 9 mutually exclusive. 10 .TP 11 \fB\-\-name\fP \fIname\fP 12 Specify the list to use for the commands. If no name is given then 13 \fBDEFAULT\fP will be used. 14 .TP 15 [\fB!\fP] \fB\-\-set\fP 16 This will add the source address of the packet to the list. If the source 17 address is already in the list, this will update the existing entry. This will 18 always return success (or failure if \fB!\fP is passed in). 19 .TP 20 \fB\-\-rsource\fP 21 Match/save the source address of each packet in the recent list table. This 22 is the default. 23 .TP 24 \fB\-\-rdest\fP 25 Match/save the destination address of each packet in the recent list table. 26 .TP 27 \fB\-\-mask\fP \fInetmask\fP 28 Netmask that will be applied to this recent list. 29 .TP 30 [\fB!\fP] \fB\-\-rcheck\fP 31 Check if the source address of the packet is currently in the list. 32 .TP 33 [\fB!\fP] \fB\-\-update\fP 34 Like \fB\-\-rcheck\fP, except it will update the "last seen" timestamp if it 35 matches. 36 .TP 37 [\fB!\fP] \fB\-\-remove\fP 38 Check if the source address of the packet is currently in the list and if so 39 that address will be removed from the list and the rule will return true. If 40 the address is not found, false is returned. 41 .TP 42 \fB\-\-seconds\fP \fIseconds\fP 43 This option must be used in conjunction with one of \fB\-\-rcheck\fP or 44 \fB\-\-update\fP. When used, this will narrow the match to only happen when the 45 address is in the list and was seen within the last given number of seconds. 46 .TP 47 \fB\-\-reap\fP 48 This option can only be used in conjunction with \fB\-\-seconds\fP. 49 When used, this will cause entries older than the last given number of seconds 50 to be purged. 51 .TP 52 \fB\-\-hitcount\fP \fIhits\fP 53 This option must be used in conjunction with one of \fB\-\-rcheck\fP or 54 \fB\-\-update\fP. When used, this will narrow the match to only happen when the 55 address is in the list and packets had been received greater than or equal to 56 the given value. This option may be used along with \fB\-\-seconds\fP to create 57 an even narrower match requiring a certain number of hits within a specific 58 time frame. The maximum value for the hitcount parameter is given by the 59 "ip_pkt_list_tot" parameter of the xt_recent kernel module. Exceeding this 60 value on the command line will cause the rule to be rejected. 61 .TP 62 \fB\-\-rttl\fP 63 This option may only be used in conjunction with one of \fB\-\-rcheck\fP or 64 \fB\-\-update\fP. When used, this will narrow the match to only happen when the 65 address is in the list and the TTL of the current packet matches that of the 66 packet which hit the \fB\-\-set\fP rule. This may be useful if you have problems 67 with people faking their source address in order to DoS you via this module by 68 disallowing others access to your site by sending bogus packets to you. 69 .PP 70 Examples: 71 .IP 72 iptables \-A FORWARD \-m recent \-\-name badguy \-\-rcheck \-\-seconds 60 \-j DROP 73 .IP 74 iptables \-A FORWARD \-p tcp \-i eth0 \-\-dport 139 \-m recent \-\-name badguy \-\-set \-j DROP 75 .PP 76 Steve's ipt_recent website (http://snowman.net/projects/ipt_recent/) also has 77 some examples of usage. 78 .PP 79 \fB/proc/net/xt_recent/*\fP are the current lists of addresses and information 80 about each entry of each list. 81 .PP 82 Each file in \fB/proc/net/xt_recent/\fP can be read from to see the current 83 list or written two using the following commands to modify the list: 84 .TP 85 \fBecho +\fP\fIaddr\fP\fB >/proc/net/xt_recent/DEFAULT\fP 86 to add \fIaddr\fP to the DEFAULT list 87 .TP 88 \fBecho \-\fP\fIaddr\fP\fB >/proc/net/xt_recent/DEFAULT\fP 89 to remove \fIaddr\fP from the DEFAULT list 90 .TP 91 \fBecho / >/proc/net/xt_recent/DEFAULT\fP 92 to flush the DEFAULT list (remove all entries). 93 .PP 94 The module itself accepts parameters, defaults shown: 95 .TP 96 \fBip_list_tot\fP=\fI100\fP 97 Number of addresses remembered per table. 98 .TP 99 \fBip_pkt_list_tot\fP=\fI20\fP 100 Number of packets per address remembered. 101 .TP 102 \fBip_list_hash_size\fP=\fI0\fP 103 Hash table size. 0 means to calculate it based on ip_list_tot, default: 512. 104 .TP 105 \fBip_list_perms\fP=\fI0644\fP 106 Permissions for /proc/net/xt_recent/* files. 107 .TP 108 \fBip_list_uid\fP=\fI0\fP 109 Numerical UID for ownership of /proc/net/xt_recent/* files. 110 .TP 111 \fBip_list_gid\fP=\fI0\fP 112 Numerical GID for ownership of /proc/net/xt_recent/* files. 113