Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: describe how firewall works in 4.6; add section for adding a custom rule

A sipXecs 4.6 manages the local iptables firewall on the server it's installed on. You can control some settings, or switch to Unmanaged mode, through the web interface (System -> Firewall).

Adding Custom Rules to the Firewall Configuration

If you install third-party software onto the sipXecs server, you may need to open up additional firewall ports that sipXecs does not know about. In this case, you will either need to tell sipXecs not to manage the firewall configuration, or create a cfengine script to add the rule you need.

Here is a hint of how the latter might be accomplished- http://list.sipfoundry.org/archive/sipx-dev/msg27891.html

Disabling the Firewall (Redhat-based systems)

If you have a dedicated SIP-aware firewall is , then you may find that to be a better choice for firewall protection so there is no need to run a then the firewall on the sipXpbx host machine.

Disabling Firewall on Redhat-based systems

To disable the firewall after the installation finished either of these commands for on Redhat systems:

...

  • firewall_gateway - Opens SIP ports 5060, 5070, 5080 (and optionally their TLS versions). Not sure if all these are needed for a gateway – 5070 could maybe be moved to user & admin only.
  • firewall user - All of the above + provisioning ports (ftp/tftp), 5110 (status/MWI), http, and voicemail web interface.
  • firewall_admin - All of the above + ports 8443 (admin web interface) and ssh.
Code Block

<nowiki>
#!/bin/sh
#
# Set this to YES for open a TLS hole. Anything else to close it.
secure="YES"
#
#
# First initialize the basic rules to block all with
# /usr/bin/system-config-securitylevel-tui


# Purge the old generated rules
iptables --delete INPUT --jump voip 2> /dev/null
iptables --flush voip 2> /dev/null
iptables --delete-chain voip 2> /dev/null

# Create the new ones
iptables --new-chain voip
iptables -I INPUT 1 --jump voip

# Open admin ports
cat /root/firewall_admin | while read IP;
do
    iptables -A voip --source ${IP} --protocol tcp --destination-port 8443 -j ACCEPT # Admin web interface
    iptables -A voip --source ${IP} --protocol tcp --destination-port 22 -j ACCEPT
done;

# Open gateway ports
cat /root/firewall_admin /root/firewall_user /root/firewall_gateway| while read IP;
do
    # Allow sip over TCP
    iptables -A voip --source ${IP} --protocol tcp --destination-port 5060 -j ACCEPT  # Calls
    iptables -A voip --source ${IP} --protocol tcp --destination-port 5070 -j ACCEPT  # Reg
    iptables -A voip --source ${IP} --protocol tcp --destination-port 5080 -j ACCEPT  # Auth

    # Allow sip over UDP
    iptables -A voip --source ${IP} --protocol udp --destination-port 5060 -j ACCEPT  # Calls
    iptables -A voip --source ${IP} --protocol udp --destination-port 5070 -j ACCEPT  # Reg
    iptables -A voip --source ${IP} --protocol udp --destination-port 5080 -j ACCEPT  # Auth

    if [ "$secure" == "YES" ]
    then
        # Allow sip TLS over TCP
        iptables -A voip --source ${IP} --protocol tcp --destination-port 5061 -j ACCEPT # Calls
        iptables -A voip --source ${IP} --protocol tcp --destination-port 5071 -j ACCEPT # Reg
        iptables -A voip --source ${IP} --protocol tcp --destination-port 5081 -j ACCEPT # Auth
    fi
done;

# Open user ports
cat /root/firewall_admin /root/firewall_user | while read IP;
do
    # Allow provisioning
    iptables -A voip --source ${IP} --protocol udp --destination-port tftp -j ACCEPT
    iptables -A voip --source ${IP} --protocol tcp --destination-port ftp -j ACCEPT

    # MWI
    iptables -A voip --source ${IP} --protocol tcp --destination-port 5110 -j ACCEPT  # Status/MWI
    iptables -A voip --source ${IP} --protocol udp --destination-port 5110 -j ACCEPT  # Status/MWI

    if [ "$secure" == "YES" ]
    then
        iptables -A voip --source ${IP} --protocol tcp --destination-port 5111 -j ACCEPT # Status/MWI
    fi

    # Allow Web
    iptables -A voip --source ${IP} --protocol tcp --destination-port http -j ACCEPT
    iptables -A voip --source ${IP} --protocol tcp --destination-port 8091 -j ACCEPT # Voicemail web interface
done;

# Save
/sbin/service iptables save
</nowiki>