From bdad4e046872e054ec7783b2f04b73a8a690a045 Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Wed, 20 Sep 2023 11:46:42 +0000 Subject: T5217: Add firewall synproxy Add ability to SYNPROXY connections It is useful to protect against TCP SYN flood attacks and port-scanners set firewall global-options syn-cookies 'enable' set firewall ipv4 input filter rule 10 action 'synproxy' set firewall ipv4 input filter rule 10 destination port '22' set firewall ipv4 input filter rule 10 inbound-interface interface-name 'eth1' set firewall ipv4 input filter rule 10 protocol 'tcp' set firewall ipv4 input filter rule 10 synproxy tcp mss '1460' set firewall ipv4 input filter rule 10 synproxy tcp window-scale '7' --- .../include/firewall/action-forward.xml.i | 8 +++-- .../include/firewall/action.xml.i | 8 +++-- .../include/firewall/common-rule-inet.xml.i | 3 +- .../include/firewall/synproxy.xml.i | 40 ++++++++++++++++++++++ 4 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 interface-definitions/include/firewall/synproxy.xml.i (limited to 'interface-definitions/include/firewall') diff --git a/interface-definitions/include/firewall/action-forward.xml.i b/interface-definitions/include/firewall/action-forward.xml.i index f61e51887..4e59f3c6f 100644 --- a/interface-definitions/include/firewall/action-forward.xml.i +++ b/interface-definitions/include/firewall/action-forward.xml.i @@ -3,7 +3,7 @@ Rule action - accept continue jump reject return drop queue offload + accept continue jump reject return drop queue offload synproxy accept @@ -37,8 +37,12 @@ offload Offload packet via flowtable + + synproxy + Synproxy connections + - (accept|continue|jump|reject|return|drop|queue|offload) + (accept|continue|jump|reject|return|drop|queue|offload|synproxy) diff --git a/interface-definitions/include/firewall/action.xml.i b/interface-definitions/include/firewall/action.xml.i index 9391a7bee..954e4f23e 100644 --- a/interface-definitions/include/firewall/action.xml.i +++ b/interface-definitions/include/firewall/action.xml.i @@ -3,7 +3,7 @@ Rule action - accept continue jump reject return drop queue + accept continue jump reject return drop queue synproxy accept @@ -33,8 +33,12 @@ queue Enqueue packet to userspace + + synproxy + Synproxy connections + - (accept|continue|jump|reject|return|drop|queue) + (accept|continue|jump|reject|return|drop|queue|synproxy) diff --git a/interface-definitions/include/firewall/common-rule-inet.xml.i b/interface-definitions/include/firewall/common-rule-inet.xml.i index e51dd0056..b04e40fa0 100644 --- a/interface-definitions/include/firewall/common-rule-inet.xml.i +++ b/interface-definitions/include/firewall/common-rule-inet.xml.i @@ -219,6 +219,7 @@ +#include Session state @@ -372,4 +373,4 @@ - \ No newline at end of file + diff --git a/interface-definitions/include/firewall/synproxy.xml.i b/interface-definitions/include/firewall/synproxy.xml.i new file mode 100644 index 000000000..a65126ea9 --- /dev/null +++ b/interface-definitions/include/firewall/synproxy.xml.i @@ -0,0 +1,40 @@ + + + + Synproxy options + + + + + TCP synproxy options + + + + + TCP Maximum segment size + + u32:501-65535 + Maximum segment size for synproxy connections + + + + + + + + + TCP window scale for synproxy connections + + u32:1-14 + TCP window scale + + + + + + + + + + + -- cgit v1.2.3