mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-10 19:15:54 +02:00
firewall: Make conntrack helpers configurable
This commit is contained in:
@@ -135,6 +135,11 @@ $(TARGET) :
|
||||
echo "POLICY=MODE2" >> $(CONFIG_ROOT)/firewall/settings
|
||||
echo "POLICY1=MODE2" >> $(CONFIG_ROOT)/firewall/settings
|
||||
|
||||
# Add conntrack helper default settings
|
||||
for proto in FTP PPTP SIP TFTP; do \
|
||||
echo "CONNTRACK_$${proto}=on" >> $(CONFIG_ROOT)/optionsfw/settings; \
|
||||
done
|
||||
|
||||
# set converters executable
|
||||
chmod 755 /usr/sbin/convert-*
|
||||
|
||||
|
||||
@@ -97,26 +97,34 @@ iptables_init() {
|
||||
# Conntrack helpers (https://home.regit.org/netfilter-en/secure-use-of-helpers/)
|
||||
|
||||
# SIP
|
||||
iptables -A CONNTRACK -m conntrack --ctstate RELATED \
|
||||
-m helper --helper sip -j ACCEPT
|
||||
for proto in udp tcp; do
|
||||
iptables -t raw -A CONNTRACK -p "${proto}" --dport 5060 -j CT --helper sip
|
||||
done
|
||||
if [ "${CONNTRACK_SIP}" = "on" ]; then
|
||||
iptables -A CONNTRACK -m conntrack --ctstate RELATED \
|
||||
-m helper --helper sip -j ACCEPT
|
||||
for proto in udp tcp; do
|
||||
iptables -t raw -A CONNTRACK -p "${proto}" --dport 5060 -j CT --helper sip
|
||||
done
|
||||
fi
|
||||
|
||||
# FTP
|
||||
iptables -A CONNTRACK -m conntrack --ctstate RELATED \
|
||||
-m helper --helper ftp -p tcp --dport 1024: -j ACCEPT
|
||||
iptables -t raw -A CONNTRACK -p tcp --dport 21 -j CT --helper ftp
|
||||
if [ "${CONNTRACK_FTP}" = "on" ]; then
|
||||
iptables -A CONNTRACK -m conntrack --ctstate RELATED \
|
||||
-m helper --helper ftp -p tcp --dport 1024: -j ACCEPT
|
||||
iptables -t raw -A CONNTRACK -p tcp --dport 21 -j CT --helper ftp
|
||||
fi
|
||||
|
||||
# PPTP
|
||||
iptables -A CONNTRACK -m conntrack --ctstate RELATED \
|
||||
-m helper --helper pptp -j ACCEPT
|
||||
iptables -t raw -A CONNTRACK -p udp --dport 1723 -j CT --helper pptp
|
||||
if [ "${CONNTRACK_PPTP}" = "on" ]; then
|
||||
iptables -A CONNTRACK -m conntrack --ctstate RELATED \
|
||||
-m helper --helper pptp -j ACCEPT
|
||||
iptables -t raw -A CONNTRACK -p udp --dport 1723 -j CT --helper pptp
|
||||
fi
|
||||
|
||||
# TFTP
|
||||
iptables -A CONNTRACK -m conntrack --ctstate RELATED \
|
||||
-m helper --helper tftp -j ACCEPT
|
||||
iptables -t raw -A CONNTRACK -p udp --dport 69 -j CT --helper tftp
|
||||
if [ "${CONNTRACK_TFTP}" = "on" ]; then
|
||||
iptables -A CONNTRACK -m conntrack --ctstate RELATED \
|
||||
-m helper --helper tftp -j ACCEPT
|
||||
iptables -t raw -A CONNTRACK -p udp --dport 69 -j CT --helper tftp
|
||||
fi
|
||||
|
||||
# Fix for braindead ISP's
|
||||
iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
|
||||
|
||||
Reference in New Issue
Block a user