1 diff -N -u -r iptables-1.3.8-20070817/extensions/libipt_TARPIT.c iptables-1.3.8-20070817-nf/extensions/libipt_TARPIT.c
2 --- iptables-1.3.8-20070817/extensions/libipt_TARPIT.c 1969-12-31 19:00:00.000000000 -0500
3 +++ iptables-1.3.8-20070817-nf/extensions/libipt_TARPIT.c 2007-08-18 14:49:25.000000000 -0400
5 +/* Shared library add-on to iptables for TARPIT support */
14 +"TARPIT takes no options\n"
18 +static struct option opts[] = {
23 +parse(int c, char **argv, int invert, unsigned int *flags,
24 + const struct ipt_entry *entry,
25 + struct ipt_entry_target **target)
30 +static void final_check(unsigned int flags)
35 +print(const struct ipt_ip *ip,
36 + const struct ipt_entry_target *target,
41 +static void save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
45 +static struct iptables_target tarpit = {
48 + .version = IPTABLES_VERSION,
49 + .size = IPT_ALIGN(0),
50 + .userspacesize = IPT_ALIGN(0),
53 + .final_check = &final_check,
61 + register_target(&tarpit);
63 diff -N -u -r iptables-1.3.8-20070817/extensions/libipt_TARPIT.man iptables-1.3.8-20070817-nf/extensions/libipt_TARPIT.man
64 --- iptables-1.3.8-20070817/extensions/libipt_TARPIT.man 1969-12-31 19:00:00.000000000 -0500
65 +++ iptables-1.3.8-20070817-nf/extensions/libipt_TARPIT.man 2007-08-18 14:49:25.000000000 -0400
67 +Captures and holds incoming TCP connections using no local
68 +per-connection resources. Connections are accepted, but immediately
69 +switched to the persist state (0 byte window), in which the remote
70 +side stops sending data and asks to continue every 60-240 seconds.
71 +Attempts to close the connection are ignored, forcing the remote side
72 +to time out the connection in 12-24 minutes.
74 +This offers similar functionality to LaBrea
75 +<http://www.hackbusters.net/LaBrea/> but doesn't require dedicated
76 +hardware or IPs. Any TCP port that you would normally DROP or REJECT
77 +can instead become a tarpit.
79 +To tarpit connections to TCP port 80 destined for the current machine:
81 +iptables -A INPUT -p tcp -m tcp --dport 80 -j TARPIT
83 +To significantly slow down Code Red/Nimda-style scans of unused address
84 +space, forward unused ip addresses to a Linux box not acting as a router
85 +(e.g. "ip route 10.0.0.0 255.0.0.0 ip.of.linux.box" on a Cisco), enable IP
86 +forwarding on the Linux box, and add:
88 +iptables -A FORWARD -p tcp -j TARPIT
90 +iptables -A FORWARD -j DROP
93 +If you use the conntrack module while you are using TARPIT, you should
94 +also use the NOTRACK target, or the kernel will unnecessarily allocate
95 +resources for each TARPITted connection. To TARPIT incoming
96 +connections to the standard IRC port while using conntrack, you could:
98 +iptables -t raw -A PREROUTING -p tcp --dport 6667 -j NOTRACK
100 +iptables -A INPUT -p tcp --dport 6667 -j TARPIT
101 diff -N -u -r iptables-1.3.8-20070817/extensions/.TARPIT-test iptables-1.3.8-20070817-nf/extensions/.TARPIT-test
102 --- iptables-1.3.8-20070817/extensions/.TARPIT-test 1969-12-31 19:00:00.000000000 -0500
103 +++ iptables-1.3.8-20070817-nf/extensions/.TARPIT-test 2007-08-18 14:49:25.000000000 -0400
106 +[ -f $KERNEL_DIR/net/netfilter/xt_TARPIT.c ] && echo TARPIT