mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-05-11 09:48:24 +02:00
firewall: add firewall bridge mode
add firewall bridge mode so it can be used as layer 2 inline bridge for either DDoS protection or firewall filter by iptable rules configured in netfilter filter table forward chain. Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
This commit is contained in:
@@ -122,6 +122,9 @@ case "${POLICY}" in
|
||||
fi
|
||||
iptables -A POLICYFWD -j REJECT --reject-with icmp-host-unreachable -m comment --comment "DROP_FORWARD"
|
||||
;;
|
||||
ACCEPT) # ACCEPT for firewall bridge mode
|
||||
iptables -A POLICYFWD -j ACCEPT -m comment --comment "ACCEPT_FORWARD"
|
||||
;;
|
||||
*) # DROP
|
||||
if [ "${DROPFORWARD}" = "on" ]; then
|
||||
iptables -A POLICYFWD -m limit --limit 10/second -j LOG --log-prefix "DROP_FORWARD "
|
||||
@@ -162,7 +165,15 @@ case "${POLICY}" in
|
||||
if [ "${DROPFORWARD}" = "on" ]; then
|
||||
iptables -A POLICYFWD -m limit --limit 10/second -j LOG --log-prefix "DROP_FORWARD "
|
||||
fi
|
||||
iptables -A POLICYFWD -m comment --comment "DROP_FORWARD" -j DROP
|
||||
|
||||
case "${FWPOLICY}" in
|
||||
ACCEPT) # ACCEPT for firewall bridge mode
|
||||
iptables -A POLICYFWD -j ACCEPT -m comment --comment "ACCEPT_FORWARD"
|
||||
;;
|
||||
*) # DROP
|
||||
iptables -A POLICYFWD -j DROP -m comment --comment "DROP_FORWARD"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user