Tumbleweed 20190708 x86_64
firewall-config 0.6.3
Linux xxx 5.1.16-1-default #1 SMP Wed Jul 3 12:37:47 UTC 2019 (2af8a22) x86_64 x86_64 x86_64 GNU/Linux
Because my openVPN configuration kills off my SIP softphone I need to reconfigure my local firewall.
For this I decided to mark all packets pertaining to the SIP service and route them with a rule through an alternative routing table.
However, I need to configure my local softphone to work on port 5160 instead of 5060.
Hence, I set off with firewall-config 0.6.3 in permanent mode and
- created a new helper “sip-5160”, port 5160/udp, port 5160/tcp, module “nf_conntrack_sip”
- created a new service “sip-5160”, port 5160/udp, port 5160/tcp, modules “sip-5160”
- included service “sip-5160” in my device’s “zone”.
- rcfirewalld restart
Alas, iptables-save|less did no render the expected result.
After some digging I realized, that the GUI did not generate the respective XML-files correctly:
This is the sip.xml from /usr/lib/firewalld/services/sip.xml:
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>SIP</short>
<description>The Session Initiation Protocol (SIP) is a communications protocol for signaling and controlling multimedia communication sessions.
The most common applications of SIP are in Internet telephony for voice and video calls, as well as instant messaging, over Internet Protocol (IP)
networks.</description>
<port protocol="tcp" port="5060"/>
<port protocol="udp" port="5060"/>
<module name="nf_conntrack_sip"/>
</service>
This is the sip-5160.xml file from /etc/firewalld/services I generated with the GUI’s help:
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>SIP</short>
<description>The Session Initiation Protocol (SIP) is a communications protocol for signaling and controlling multimedia communication sessions.
The most common applications of SIP are in Internet telephony for voice and video calls, as well as instant messaging, over Internet Protocol (IP)
networks. like SIP but for port 5160 (the sipgate port)</description>
<port port="5160" protocol="tcp"/>
<port port="5160" protocol="udp"/>
<module name="sip-5160"/>
</service>
Obviously, in the last line it says “nf_conntrack_sip” in the “original”, and “sip-5160” in the GUI-generated service.
With module name=“sip-5160” the iptables-entries are not generated.
Even if I manually change the XML-file to contain the nf_conntrack_sip entry the corresponding iptables commands are not issued, apparently the logic seeks the first “helper” being connected to the module and applies its port settings.
That means the connection between services and modules/helpers in the XML logic is broken! Beware! Not even manually generating the correct XML-files would help!
This is an excerpt from the correctly generated iptables list:
*raw
...
-A PREROUTING_ZONES -i enp3s0 -g PRE_internal
-A PREROUTING_ZONES -g PRE_public
-A PRE_internal -j PRE_internal_log
-A PRE_internal -j PRE_internal_deny
-A PRE_internal -j PRE_internal_allow
-A PRE_internal_allow -p tcp -m tcp --dport 5160 -j CT --helper sip
-A PRE_internal_allow -p udp -m udp --dport 5160 -j CT --helper sip
...
*filter
...
-A IN_internal_allow -p tcp -m tcp --dport 5160 -m conntrack --ctstate NEW,UNTRACKED -j ACCEPT
-A IN_internal_allow -p udp -m udp --dport 5160 -m conntrack --ctstate NEW,UNTRACKED -j ACCEPT
...
This result I could only accomplish by changing the port settings of the original entry in the GUI.
Is this a known bug? Am I missing something here?