
Ich habe versucht, Regeln zu erstellen, iptables
um zu verhindern, dass mein Serververbindungslimit durch unvollständige SYN-Pakete aufgefüllt wird, für die vom Client kein ACK-Paket zurückgegeben wird (SYN-Flood-Angriff).
Ich habe die Dokumente [RFC 4987 TCP SYN Flooding Attacks and Common Mitigations][1] und [Mitigate TCP SYN Flood Attacks with Red Hat Enterprise Linux 7 Beta][2] gelesen und schließlich versucht, die Anweisungen [hier][3] zu befolgen:https://javapipe.com/blog/iptables-ddos-protection/
Allerdings kann meine Site immer noch problemlos durch einen DOS-Angriff mit dem folgenden Befehl lahmgelegt werden:
hping -S --flood -V -p 443 www.mydomain.com
Am Ende des oben verlinkten Tutorials von Javapipe.com wird der Befehl erwähnt, der erkennt, ob SYNPROXY aktiv ist oder nicht.
Um zu überprüfen, ob SYNPROXY funktioniert, können Sie watch -n1 cat /proc/net/stat/synproxy ausführen. Wenn sich die Werte ändern, wenn Sie eine neue TCP-Verbindung zu dem Port herstellen, auf dem Sie SYNPROXY verwenden, funktioniert es.
Der Befehl lautet:
watch -n1 cat /proc/net/stat/synproxy
Wenn ich diesen Befehl auf meinem Server verwende und versuche, eine Seite zu laden, ändern sich die Daten nicht und bestehen nur aus Nullen.
Every 1.0s: cat /proc/net/stat/synproxy Thu Jul 25 19:57:00 2019
entries syn_received cookie_invalid cookie_valid cookie_retrans conn_reopened
00000000 00000000 00000000 00000000 00000000 00000000
Hier ist die Ausgabe von iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
INPUT_direct all -- anywhere anywhere
INPUT_ZONES_SOURCE all -- anywhere anywhere
INPUT_ZONES all -- anywhere anywhere
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
REJECT tcp -- anywhere anywhere #conn src/32 > 80 reject-with tcp-reset
ACCEPT tcp -- anywhere anywhere ctstate NEW limit: avg 20/sec burst 20
DROP tcp -- anywhere anywhere ctstate NEW
ACCEPT tcp -- anywhere anywhere tcp flags:RST/RST limit: avg 2/sec burst 2
DROP tcp -- anywhere anywhere tcp flags:RST/RST
DROP all -- anywhere anywhere ctstate INVALID
SYNPROXY tcp -- anywhere anywhere tcp ctstate INVALID,UNTRACKED SYNPROXY sack-perm timestamp wscale 7 mss 1460
DROP all -- anywhere anywhere ctstate INVALID
DROP all -- anywhere anywhere state INVALID
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
FORWARD_direct all -- anywhere anywhere
FORWARD_IN_ZONES_SOURCE all -- anywhere anywhere
FORWARD_IN_ZONES all -- anywhere anywhere
FORWARD_OUT_ZONES_SOURCE all -- anywhere anywhere
FORWARD_OUT_ZONES all -- anywhere anywhere
DROP all -- anywhere anywhere ctstate INVALID
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
OUTPUT_direct all -- anywhere anywhere
Chain FORWARD_IN_ZONES (1 references)
target prot opt source destination
FWDI_public all -- anywhere anywhere [goto]
Chain FORWARD_IN_ZONES_SOURCE (1 references)
target prot opt source destination
Chain FORWARD_OUT_ZONES (1 references)
target prot opt source destination
FWDO_public all -- anywhere anywhere [goto]
Chain FORWARD_OUT_ZONES_SOURCE (1 references)
target prot opt source destination
Chain FORWARD_direct (1 references)
target prot opt source destination
Chain FWDI_public (1 references)
target prot opt source destination
FWDI_public_log all -- anywhere anywhere
FWDI_public_deny all -- anywhere anywhere
FWDI_public_allow all -- anywhere anywhere
REJECT icmp -- anywhere anywhere reject-with icmp-host-prohibited
Chain FWDI_public_allow (1 references)
target prot opt source destination
Chain FWDI_public_deny (1 references)
target prot opt source destination
Chain FWDI_public_log (1 references)
target prot opt source destination
Chain FWDO_public (1 references)
target prot opt source destination
FWDO_public_log all -- anywhere anywhere
FWDO_public_deny all -- anywhere anywhere
FWDO_public_allow all -- anywhere anywhere
Chain FWDO_public_allow (1 references)
target prot opt source destination
Chain FWDO_public_deny (1 references)
target prot opt source destination
Chain FWDO_public_log (1 references)
target prot opt source destination
Chain INPUT_ZONES (1 references)
target prot opt source destination
IN_public all -- anywhere anywhere [goto]
Chain INPUT_ZONES_SOURCE (1 references)
target prot opt source destination
Chain INPUT_direct (1 references)
target prot opt source destination
Chain IN_public (1 references)
target prot opt source destination
IN_public_log all -- anywhere anywhere
IN_public_deny all -- anywhere anywhere
IN_public_allow all -- anywhere anywhere
REJECT icmp -- anywhere anywhere reject-with icmp-host-prohibited
Chain IN_public_allow (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ctstate NEW
ACCEPT tcp -- anywhere anywhere tcp dpt:http ctstate NEW
ACCEPT tcp -- anywhere anywhere tcp dpt:https ctstate NEW
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp ctstate NEW
Chain IN_public_deny (1 references)
target prot opt source destination
Chain IN_public_log (1 references)
target prot opt source destination
Chain OUTPUT_direct (1 references)
target prot opt source destination
Der Server ist ein VPS mit Digital Ocean unter Centos 7.6, Kernel: 3.10.0-862.2.3.el7.x86_64
Kann mir jemand erklären, warum SYNPROXY möglicherweise nicht läuft, bzw. warum bzw. wie ich meinen Server vor SYN-Flooding schützen kann?