Go to the table of contents Go to the previous page Go to the next page View or print as PDF
Content Gateway v7.x: Frequently Asked Questions : How do I configure IPTables to harden the Content Gateway host system?
How do I configure IPTables to harden the Content Gateway host system?
Topic 60067 | Content Gateway FAQs | Updated: 22-October-2013
When Content Gateway is deployed on a stand-alone server, it is strongly recommended that an IPTables firewall be configured to provide maximum security and efficiency with Content Gateway.
 
Warning 
As an aid to understanding the IPTables configuration required for Content Gateway, a sample IPTables configuration script is installed in the Content Gateway bin directory (/opt/WCG/bin, by default). The sample script is named example_iptables.sh.
*
*
*
To view a text file version of the v7.6.x sample script, click here
To view a text file version of the v7.7.x sample script, click here.
To view a text file version of the v7.8.x sample script, click here.
Configuration
The following list of rules is organized into groups that address different deployments. Be sure the /etc/sysconfig/iptables file contains all the rules that apply to your network from each section.
If the proxy is configured to use multiple NICs, for each rule that applies to an interface specify the appropriate NIC with the "-i" option ("-i" means match only if the incoming packet is on the specified interface). Typically, multiple interfaces are divided into these roles:
*
Management interface (MGMT_NIC) - The physical interface used by the system administrator to manage the computer.
*
Internet-facing interface (WAN_NIC) - The physical interface used to request pages from the Internet (usually the most secure interface).
*
Client-facing interface (CLIENT_NIC) - The physical interface used by the clients to request data from the proxy.
*
Cluster interface (CLUSTER_NIC) - The physical interface used by the proxy to communicate with members of the cluster.
 
Note 
All deployments
These rules are required to enable Content Gateway communications, regardless of the deployment.
The following rules should be first.
iptables --policy INPUT DROP
iptables --policy OUTPUT ACCEPT
iptables --policy FORWARD DROP
iptables -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables --I OUTPUT -o lo -t raw -j NOTRACK
In addition to the above rules, it is a best practice to increase the size of ip_conntrack_max to 100000 to improve performance. Typically, this can be done using the following command: /sbin/sysctl net.ipv4.ip_conntrack_max=100000. Note that this should be done after iptables is invoked. Also, this change in value will not be preserved after reboot unless you configure your system to set this value at startup. To do so, add the following line to /etc/sysctl.conf:
net.ipv4.ip_conntrack_max=100000
The next group of rules are important for general system security and should be entered immediately after the above rules:
iptables -I INPUT -i lo -j ACCEPT
iptables -i <MGMT_NIC> -I INPUT -p tcp --dport 22 -j ACCEPT
iptables -i <MGMT_NIC> -I INPUT -p ICMP -j ACCEPT
Include these rules in v7.7.x deployments to support proxying of HTTPS traffic and access to the SSL Manager:
iptables -i $CLIENT_NIC -I INPUT -p tcp --dport 8070 -j ACCEPT
iptables -i <MGMT_NIC> -I INPUT -p tcp --dport 8071 -j ACCEPT
Include these rules to support proxying of HTTP traffic and access to the Content Gateway manager:
iptables -i <CLIENT_NIC> -I INPUT -p tcp --dport 8080 -j ACCEPT
iptables -i <MGMT_NIC> -I INPUT -p tcp --dport 8081 -j ACCEPT
Local Policy Server
Include these rules if the Websense Policy Server runs on the Content Gateway machine.
iptables -i <MGMT_NIC> -I INPUT -p tcp --dport 40000 -j ACCEPT
iptables -i <MGMT_NIC> -I INPUT -p tcp --dport 55806 -j ACCEPT
iptables -i <MGMT_NIC> -I INPUT -p tcp --dport 55880 -j ACCEPT
iptables -i <MGMT_NIC> -I INPUT -p udp --dport 55905 -j ACCEPT
Remote Policy Server
Include this rule if the Websense Policy Server does not run on the Content Gateway machine. This is required because Content Gateway has bidirectional communication over ephemeral ports.
Be sure to replace <POLICY Server IP> in the command with the actual IP address of the Policy Server machine.
iptables -i <MGMT_NIC> -I INPUT -p tcp -s <POLICY Server IP> --dport 1024:65535 -j ACCEPT
Local Filtering Service
Include these rules if the Websense Filtering Service runs on the Content Gateway machine.
iptables -i <MGMT_NIC> -I INPUT -p tcp --dport 55807 -j ACCEPT
iptables -i <MGMT_NIC> -I INPUT -p tcp --dport 15868 -j ACCEPT
Remote Filtering Service
Include this rule if the Websense Filtering Service does not run on the Content Gateway machine. This is required because Content Gateway has bidirectional communication over ephemeral ports.
Be sure to replace in the command with the actual IP address of the Filtering Service machine.
iptables -i <MGMT_NIC> -I INPUT -s <FILTERING IP Service> -p tcp --dport 1024:65535 -j ACCEPT
Websense Data Security
Include the following rules if Content Gateway is installed as part of Websense Web Security Gateway Anywhere or deployed with Websense Data Security.
iptables -i <MGMT_NIC> -I INPUT -p tcp --dport 17500:17514 -j ACCEPT
Cluster
Include the following rules if you have multiple instances of Content Gateway in a cluster.
iptables -i <CLUSTER_NIC> -I INPUT -p tcp --dport 8086 -j ACCEPT
iptables -i <CLUSTER_NIC> -I INPUT -p udp --dport 8086 -j ACCEPT
iptables -i <CLUSTER_NIC> -I INPUT -p tcp --dport 8087 -j ACCEPT
iptables -i <CLUSTER_NIC> -I INPUT -p udp --dport 8088 -j ACCEPT
iptables -i <CLUSTER_NIC> -I INPUT -p udp -d <Multicast_IP_Address> -j ACCEPT
Cache hierarchy
Include the following rule if you have multiple instances of Content Gateway in a cache hierarchy.
iptables -i <MGMT_NIC> -I INPUT -p udp --dport 3130 -j ACCEPT
Transparent proxy
Include the following rule if your network uses transparent proxy.
Include the rule for port 2048 only if your network uses WCCP for transparent proxy.
Include the rule for port 53 and 5353 only if you proxy DNS.
iptables -i <CLIENT_NIC> -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -i <CLIENT_NIC> -I INPUT -p tcp --dport 443 -j ACCEPT
iptables -i <CLIENT_NIC> -I INPUT -p udp --dport 2048 -j ACCEPT
iptables -i <CLIENT_NIC> -I INPUT -p udp --dport 53 -j ACCEPT
iptables -i <CLIENT_NIC> -I INPUT -p udp --dport 5353 -j ACCEPT
FTP
Include the appropriate rules, below, if you plan to proxy FTP traffic (optional).
iptables -i <CLIENT_NIC> -I INPUT -p tcp --dport 21 -j ACCEPT
iptables -i <CLIENT_NIC> -I INPUT -p tcp --dport 2121 -j ACCEPT
Optional features
Include the rule for port 8082, below, to allow gathering of statistics over the overseer port.
Include the rule for port 8083, below, to allow PAC file distribution from the proxy.
Include the rule for port 8085, below, to allow collation of logs for multiple proxies.
iptables -i <MGMT_NIC> -I INPUT -p tcp --dport 8082 -j ACCEPT
iptables -i <CLIENT_NIC> -I INPUT -p tcp --dport 8083 -j ACCEPT
iptables -i <MGMT_NIC> -I INPUT -p tcp --dport 8085 -j ACCEPT
For information on SNMP configuration, see Using SNMP with Content Gateway.
Configuring IP6tables
Content Gateway does not rely on IPv6, but can be configured to meet your other security requirements.
Support is provided for explicit proxy deployments only.
To configure IP6tables firewall, Content Gateway requires that an IPv6 port be open for each protocol that is used (HTTP, HTTPS, FTP, DNS).
Port 8080 is required for Content Gateway to receive and proxy explicit HTTP and HTTPS traffic.
ip6tables -i <CLIENT_NIC> -I INPUT -p tcp --dport 8080 -j ACCEPT
Include the rule below if you plan to proxy FTP traffic (optional).
ip6tables -i <CLIENT_NIC> -I INPUT -p tcp --dport 2121 -j ACCEPT
Include the rule for port 53 and 5353 only if you proxy DNS.
ip6tables -i <CLIENT_NIC> -I INPUT -p udp --dport 53 -j ACCEPT
ip6tables -i <CLIENT_NIC> -I INPUT -p udp --dport 5353 -j ACCEPT

Go to the table of contents Go to the previous page Go to the next page View or print as PDF
Content Gateway v7.x: Frequently Asked Questions : How do I configure IPTables to harden the Content Gateway host system?
Copyright 2016 Forcepoint LLC. All rights reserved.