-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHeader.sh
executable file
·62 lines (56 loc) · 1.61 KB
/
Header.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env sh
#
# Luca Cappelletti 2013
#
# GNU/GPL
#
# header iptable per mitigare questioni torride
#
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
wait
printf .
iptables -A INPUT -f -j DROP
wait
printf .
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
wait
printf .
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
wait
printf .
# la seguente sequenza svolge un throttling a 60 secondi
iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set
wait
printf .
iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 6 -j DROP
wait
printf .
# sulla 22 dallo stesso IP ci lavoriamo in 4 gatti quindi:
iptables -A INPUT -p tcp --syn --dport 22 -m connlimit --connlimit-above 4 -j REJECT
wait
printf .
# limita sulla 80
iptables -A INPUT -p tcp --dport 80 -i eth0 -m state --state NEW -m recent --set
wait
printf .
iptables -A INPUT -p tcp --dport 80 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 6 -j DROP
wait
printf .
# massimo 20 per IP sulla 80
iptables -A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 20 -j REJECT --reject-with tcp-reset
wait
printf .
## CRIMSON HEADERS
iptables -A INPUT -p icmp -m icmp --icmp-type 8 -j DROP
wait
printf .
iptables -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
wait
printf .
iptables -A INPUT -f -j DROP
wait
printf .
iptables -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,PSH,ACK,URG -j DROP
wait
printf .
iptables -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP