]> git.proxmox.com Git - pve-firewall.git/commit - src/PVE/Firewall.pm
add synflood protection
authorAlexandre Derumier <aderumier@odiso.com>
Tue, 12 Nov 2019 12:59:04 +0000 (13:59 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 18 Nov 2019 12:48:09 +0000 (13:48 +0100)
commitac5dd88e976e565fef44f068ac9644666615f5e4
treedeee5a3d22c14a63a34c93846d8c059f6773b72c
parent64e0adf411ca322516fbf96a0ef2fbcb54881209
add synflood protection

Currently, a virtio-net + vhost-net can handle between 200-300 kpps for each vm (with 1core/queue=1).
That mean than a vm can easily overloaded with a simple synflood (hping3 --flood -p 80 -S targetip).
Also the conntrack of the host can be saturated easily.

This patch introduce a new option, enable rate limiting of syn/s by src ip (protection_synflood:1).

rate limit can be set with : protection_synflood_rate  (default 200 syn/s)
with an extra burst: protection_synflood_rate (default 1000).

It's also possible to reduce conntrack syn timeout: nf_conntrack_tcp_timeout_syn_recv (default 60).

with default values, a src ip can take around (60 * 200 = 12000 conntrack entries).

The iptables rules are done in raw table, before reaching the conntrack.

This protection works fine for non-spoofed src ip.
For spoofed src ip, the only way could be to implement SYNPROXY,
but this only works for routed/nat setup. (The host need to be able to reply
with the src ip the vm)

Some good information about synflood protections
https://2014.rmll.info/slides/356/day_1-1400-Jesper_Brouer-DDoS_protection_using_Netfilter_iptables.pdf

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/Firewall.pm