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