how to enable iptables tarpit?

2,272

Clean all rules:

iptables -F
iptables -X

Use these default parameters:

iptables -P INPUT    DROP
iptables -P OUTPUT   DROP
iptables -P FORWARD  ACCEPT

Then do the following:

 iptables-save > /etc/network/iptables
 iptables-restore < /etc/network/iptables

Then enter:

iptables -A INPUT -p tcp -m tcp -dport 80 -j TARPIT

Or you can set a trap for ALL ports, except for your own:

   iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
   iptables -A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
   iptables -A INPUT -p tcp -m tcp -j TARPIT
Share:
2,272

Related videos on Youtube

sleepsort
Author by

sleepsort

Updated on September 18, 2022

Comments

  • sleepsort
    sleepsort over 1 year

    I hope to record the result of stderr & stdout to different files, while watching both outputs from the terminal.

    So I use tee, and found a solution in this page.

    But the sad thing is, it can't work when put into a makefile:

    all:
        @command > >(tee stdout.log) 2> >(tee stderr.log >&2)
    

    It seems that make will use sh -c to execute this line, which doesn't understand well about the syntax.

    Can we have another solution for this?

    • chepner
      chepner almost 11 years
      tee works; it's the process substitution that the shell used by make doesn't understand.
    • Anya Shenanigans
      Anya Shenanigans almost 11 years
      a workaround is to set the variable SHELL in make to /bin/bash using make SHELL=/bin/bash, or putting SHELL:=/bin/bash at the start of the Makefile.
    • sleepsort
      sleepsort almost 11 years
      Thanks @Petesh, can you post the answer so I can mark this as solved?