<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head runat="server">
    <!-- PageID 382 - published by RedDot 7.5 - 7.5.1.69 - 22111 -->
    <META name="PublicArticle" content="True" />
    <META http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <META name="keywords" />
    <META name="summary" />
    <META name="product" content="fp_web" />
    <META name="version" content="v85" />
    <META name="book" content="Content Gateway Frequently Asked Questions" />
    <title>How do I configure IPTables to harden the Content Gateway host system?</title>
    <!--Loading the 2016 fonts.-->
    <script type="text/javascript" src="//fast.fonts.net/jsapi/c504d579-e135-4f75-8335-4906f6c6ce67.js"></script>
    <!--Library content styles.-->
    <link rel="StyleSheet" href="https://help.forcepoint.com/docs/ni/assets/css/epub2016.css" type="text/css" media="all" />
    <!--2016 font support -->
    <link type="text/css" rel="stylesheet" href="//fast.fonts.net/cssapi/c504d579-e135-4f75-8335-4906f6c6ce67.css" />
  </head>
  <body>
    <!--googleoff: all-->
    <a href="https://www.forcepoint.com">
      <img class="logo" alt="Forcepoint logo" src="https://help.forcepoint.com/docs/ni/assets/logo1.png" />
    </a>
    <div class="extLinksContainer">
      <a class="extLinks" href="//support.forcepoint.com/documentation">Documentation</a> | <a class="extLinks" href="//support.forcepoint.com">Support</a></div>
    <!--
		<wsApp:UserAccess ID="useraccess1" runat="server" IsSecure="False" />
		-->
    <div class="spacer1"></div>
    <br />
    <!-- Top navigation with breadcrumbs starts here -->
    <div class="TL_nav" style="text-align: left;">
      <table cellspacing="0" class="toolBarTable" summary="">
        <!-- End New Navigation DIV -->
        <tr>
          <td>
            <!-- New Go To TOC -->
            <a href="toc.aspx"><img src="images/toc.png" alt="Go to the table of contents" border="0" /></a>
            <!-- End Go To TOC -->
          </td>
          <td>
            <!-- New Previous -->
            <a href="first.aspx"><img src="images/prev.png" alt="Go to the previous page" border="0" /></a>
            <!-- End New Previous -->
          </td>
          <td>
            <!-- New Next (Active) -->
            <a href="faq_wcg_id.aspx"><img src="images/next.png" alt="Go to the next page" border="0" /></a>
            <!-- End New Next (Active) -->
          </td>
          <td>
            <!-- New PDF -->
            <a href="content_gateway_faq.pdf"><img src="images/pdf.png" alt="View or print as PDF" border="0" /></a>
            <!-- End New PDF -->
          </td>
          <!--Start JR breadcrumbs -->
          <td width="20px"></td>
          <td>
            <div class="WebWorks_Breadcrumbs" style="text-align: left;">
              <a class="WebWorks_Breadcrumb_Link" href="first.aspx">Content Gateway: Frequently Asked Questions</a> : How do I configure IPTables to harden the Content Gateway host system?</div>
          </td>
          <!--End JR breadcrumbs -->
        </tr>
      </table>
    </div>
    <!--googleon: all-->
    <div>
      <div class="TT-TopicTitle"><a name="604305">How do I configure IPTables to harden the Content Gateway host system?</a></div>
      <div class="IN-TopicInfo"><a name="616109">Content Gateway FAQs&nbsp;| Forcepoint Web Security&nbsp;| v8.5.x&nbsp;| 29-Apr-2022</a></div>
      <div class="B-Body"><a name="604322">When Content Gateway is deployed on a stand-alone Linux server (not an appliance), it is strongly recommended that an IPTables firewall be configured to provide maximum security and efficiency with Content Gateway. </a></div>
      <div class="F-Frame"><a name="607141">&nbsp;</a></div>
      <table class="WarnTable" cellspacing="0" summary="">
        <caption></caption>
        <tr>
          <td style="border-bottom-color: #000000; border-bottom-style: solid; border-bottom-width: 0.25pt; border-top-color: #000000; border-top-style: solid; border-top-width: 0.25pt; padding-bottom: 3.5pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4.5pt; vertical-align: top">
            <div class="WI-WarnIcon">
              <img src="caution_icon.gif" alt="*" border="0" width="38" height="34" /><a name="607152">&nbsp;</a></div>
          </td>
          <td style="border-bottom-color: #000000; border-bottom-style: solid; border-bottom-width: 0.25pt; border-top-color: #000000; border-top-style: solid; border-top-width: 0.25pt; padding-bottom: 3.5pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4.5pt; vertical-align: top">
            <div class="W-Warning">Warning<a name="607154">&nbsp;</a></div>
            <div class="NT-NoteText"><a name="607166">Only qualified system administrators should modify the IPTables firewall.</a></div>
          </td>
        </tr>
      </table>
      <div class="B-Body"><a name="611244">Content Gateway now utilizes iptables, configured during product installation or upgrade, to facilitate interception and redirection of traffic.</a></div>
      <div class="B2-Bullet2_outer" style="margin-left: 18pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="B2-Bullet2_inner" style="width: 18pt; white-space: nowrap">
                <img src="b2.png" alt="*" border="0" width="8" height="7" />
              </div>
            </td>
            <td width="100%">
              <div class="B2-Bullet2_inner"><a name="616996">IPTables rules configured outside of Content Gateway Manager must </a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="B3-Bullet3_outer" style="margin-left: 36pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="B3-Bullet3_inner" style="width: 18pt; white-space: nowrap">
                <img src="b3.png" alt="*" border="0" width="7" height="7" />
              </div>
            </td>
            <td width="100%">
              <div class="B3-Bullet3_inner"><a name="616997">Be inserted </a><span class="EM-Emphasis">after</span> Forcepoint rules.</div>
            </td>
          </tr>
        </table>
      </div>
      <div class="B3-Bullet3_outer" style="margin-left: 36pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="B3-Bullet3_inner" style="width: 18pt; white-space: nowrap">
                <img src="b3.png" alt="*" border="0" width="7" height="7" />
              </div>
            </td>
            <td width="100%">
              <div class="B3-Bullet3_inner"><a name="616998">Never be added to Forcepoint chains.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="B2-Bullet2_outer" style="margin-left: 18pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="B2-Bullet2_inner" style="width: 18pt; white-space: nowrap">
                <img src="b2.png" alt="*" border="0" width="8" height="7" />
              </div>
            </td>
            <td width="100%">
              <div class="B2-Bullet2_inner"><a name="616999">Forcepoint chains and rules should never be edited.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="B2-Bullet2_outer" style="margin-left: 18pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="B2-Bullet2_inner" style="width: 18pt; white-space: nowrap">
                <img src="b2.png" alt="*" border="0" width="8" height="7" />
              </div>
            </td>
            <td width="100%">
              <div class="B2-Bullet2_inner"><a name="617000">If customized chains or rules impact the Forcepoint configuration, navigate to /opt/wcg/bin and execute the following to re-establish the Forcepoint IPTables chains and rules:</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="CO2-CodeIndent2"><a name="617001">netcontrol.sh -r</a></div>
      <div class="B-Body"><a name="616954">While hardening the system is allowed, caution should be taken to avoid interfering with general Content Gateway functionality.</a></div>
      <div class="N1H-Heading1"><a name="616955">Configuration</a></div>
      <div class="B-Body"><a name="604323">The following list of rules is organized into groups that address different deployments. Be sure the /etc/sysconfig/iptables file contains all the rules from each section that apply to your network. </a></div>
      <div class="B-Body"><a name="604419">If the proxy is configured to use multiple NICs, use the -i option (which means "match only if the incoming packet is on the specified interface") to specify the appropriate NIC for each rule that applies to an interface. Typically, multiple interfaces are divided into these roles:</a></div>
      <div class="B1-Bullet1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="B1-Bullet1_inner" style="width: 18pt; white-space: nowrap">
                <img src="b1.png" alt="*" border="0" width="8" height="8" />
              </div>
            </td>
            <td width="100%">
              <div class="B1-Bullet1_inner"><span class="B-Bold"><a name="604434">Management interface</a></span> (MGMT_NIC) &ndash; The physical interface used by the system administrator to manage the computer. </div>
            </td>
          </tr>
        </table>
      </div>
      <div class="B1-Bullet1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="B1-Bullet1_inner" style="width: 18pt; white-space: nowrap">
                <img src="b1.png" alt="*" border="0" width="8" height="8" />
              </div>
            </td>
            <td width="100%">
              <div class="B1-Bullet1_inner"><span class="B-Bold"><a name="604435">Internet-facing interface</a></span> (WAN_NIC) &ndash; The physical interface used to request pages from the Internet (usually the most secure interface). </div>
            </td>
          </tr>
        </table>
      </div>
      <div class="B1-Bullet1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="B1-Bullet1_inner" style="width: 18pt; white-space: nowrap">
                <img src="b1.png" alt="*" border="0" width="8" height="8" />
              </div>
            </td>
            <td width="100%">
              <div class="B1-Bullet1_inner"><span class="B-Bold"><a name="604436">Client-facing interface</a></span> (CLIENT_NIC) &ndash; The physical interface used by the clients to request data from the proxy. </div>
            </td>
          </tr>
        </table>
      </div>
      <div class="B1-Bullet1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="B1-Bullet1_inner" style="width: 18pt; white-space: nowrap">
                <img src="b1.png" alt="*" border="0" width="8" height="8" />
              </div>
            </td>
            <td width="100%">
              <div class="B1-Bullet1_inner"><span class="B-Bold"><a name="604437">Cluster interface</a></span> (CLUSTER_NIC) &ndash; The physical interface used by the proxy to communicate with members of the cluster.</div>
            </td>
          </tr>
        </table>
      </div>
      <div class="F-Frame"><a name="604457">&nbsp;</a></div>
      <table class="NoteTable" cellspacing="0" summary="">
        <caption></caption>
        <tr>
          <td style="border-bottom-color: #000000; border-bottom-style: solid; border-bottom-width: 0.25pt; border-top-color: #000000; border-top-style: solid; border-top-width: 0.25pt; padding-bottom: 3.5pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4.5pt; vertical-align: top">
            <div class="NI-NoteIcon">
              <img src="note.gif" alt="*" border="0" width="33" height="33" /><a name="607197">&nbsp;</a></div>
          </td>
          <td style="border-bottom-color: #000000; border-bottom-style: solid; border-bottom-width: 0.25pt; border-top-color: #000000; border-top-style: solid; border-top-width: 0.25pt; padding-bottom: 3.5pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4.5pt; vertical-align: top">
            <div class="N-Note">Note<a name="607199">&nbsp;</a></div>
            <div class="NT-NoteText"><a name="607212">If you customized any ports that Forcepoint Web Security uses for communication, replace the default port shown in the following rules with the custom port you implemented.</a></div>
          </td>
        </tr>
      </table>
      <div class="N1H-Heading1"><a name="604465">All deployments</a></div>
      <div class="B-Body"><a name="604466">The following rules are optional and can be used to enhance the security of your Content Gateway deployment. </a></div>
      <div class="CO-Code"><a name="609237">iptables --policy INPUT DROP</a></div>
      <div class="CO-Code"><a name="609251">iptables --policy OUTPUT ACCEPT</a></div>
      <div class="CO-Code"><a name="609252">iptables --policy FORWARD DROP</a></div>
      <div class="CO-Code"><a name="617540">iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT</a></div>
      <div class="B-Body"><a name="604492">In addition to the above rules, it is a best practice to increase the size of </a><span class="B-Bold">nf_conntrack_max</span> to 100000 to improve performance. Set the size after iptables is started.</div>
      <div class="B2-Bullet2_outer" style="margin-left: 18pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="B2-Bullet2_inner" style="width: 18pt; white-space: nowrap">
                <img src="b2.png" alt="*" border="0" width="8" height="7" />
              </div>
            </td>
            <td width="100%">
              <div class="B2-Bullet2_inner"><a name="612839">To check the setting, use: </a><span class="B-Bold">/sbin/sysctl -p</span></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="B2-Bullet2_outer" style="margin-left: 18pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="B2-Bullet2_inner" style="width: 18pt; white-space: nowrap">
                <img src="b2.png" alt="*" border="0" width="8" height="7" />
              </div>
            </td>
            <td width="100%">
              <div class="B2-Bullet2_inner"><a name="612845">To set the value, use: </a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="I2-IndentedText2"><span class="B-Bold"><a name="612875">/sbin/sysctl net.nf_conntrack_max=100000</a></span></div>
      <div class="B2-Bullet2_outer" style="margin-left: 18pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="B2-Bullet2_inner" style="width: 18pt; white-space: nowrap">
                <img src="b2.png" alt="*" border="0" width="8" height="7" />
              </div>
            </td>
            <td width="100%">
              <div class="B2-Bullet2_inner"><a name="612913">If you get the error </a><span class="B-Bold">"net.nf_conntrack_max" is an unknown key</span>, you need to add the <span class="B-Bold">ip_conntrack</span> module to the kernel. Use the command: </div>
            </td>
          </tr>
        </table>
      </div>
      <div class="I2-IndentedText2"><span class="B-Bold"><a name="617652">modprobe ip_conntrack</a></span> </div>
      <div class="I-IndentedText"><a name="612915">The </a><span class="B-Bold">nf_conntrack_max</span> value is not be preserved after reboot unless you configure your system to set the value at startup. To do so, add the following line to<span class="B-Bold"> /etc/sysctl.conf</span>: </div>
      <div class="CO-Code"><a name="613120">net.nf_conntrack_max=100000</a></div>
      <div class="B-Body"><a name="604509">The next group of rules are important for general system security and should be entered immediately after the above rules:</a></div>
      <div class="CO-Code"><a name="604540">iptables -I INPUT -i lo -j ACCEPT </a></div>
      <div class="CO-Code"><a name="613256">iptables -I INPUT -i internal -j ACCEPT</a></div>
      <div class="CO-Code"><a name="604546">iptables -i &lt;MGMT_NIC&gt; -I INPUT -p tcp --dport 22 -j ACCEPT </a></div>
      <div class="CO-Code"><a name="617865">iptables -i &lt;MGMT_NIC&gt; -I INPUT -p ICMP -j ACCEPT</a></div>
      <div class="N1H-Heading1"><a name="617866">Policy Server</a></div>
      <div class="B-Body"><a name="617816">All ports needed for communication with a Policy Server are handled internally by the software.</a></div>
      <div class="N1H-Heading1"><a name="604660">Filtering Service</a></div>
      <div class="B-Body"><a name="618128">All ports needed for communication with a Filtering Server machine are handled internally by the software.</a></div>
      <div class="N1H-Heading1"><a name="604704">Forcepoint Web Security</a></div>
      <div class="B-Body"><a name="618201">All ports needed for communication with Forcepoint Web Security are handled internally by the software.</a></div>
      <div class="N1H-Heading1"><a name="604708">Cluster</a></div>
      <div class="B-Body"><a name="604709">Include the following rules if you have multiple instances of Content Gateway in a cluster. </a></div>
      <div class="CO-Code"><a name="604711">iptables -i &lt;CLUSTER_NIC&gt; -I INPUT -p udp --dport 8086 -j ACCEPT</a></div>
      <div class="CO-Code"><a name="604754">iptables -i &lt;CLUSTER_NIC&gt; -I INPUT -p udp -d &lt;Multicast_IP_Address&gt; -j ACCEPT</a></div>
      <div class="B-Body"><a name="618296">All other ports needed for communication between instanced of Content Gateway are handled internally by the software.</a></div>
      <div class="N1H-Heading1"><a name="604712">Cache hierarchy</a></div>
      <div class="B-Body"><a name="604713">Include the following rule if you have multiple instances of Content Gateway in a cache hierarchy.</a></div>
      <div class="CO-Code"><a name="604715">iptables -i &lt;MGMT_NIC&gt; -I INPUT -p udp --dport 3130 -j ACCEPT</a></div>
      <div class="N1H-Heading1"><a name="604769">Transparent proxy</a></div>
      <div class="B-Body"><a name="618568">All ports needed for transparent proxying are handled internally by the software.</a></div>
      <div class="B-Body"><a name="604773">If you proxy DNS, configure port 53 to redirect to port 5353 using Content Gateway Manager.</a></div>
      <div class="N1H-Heading1"><a name="604776">FTP</a></div>
      <div class="B-Body"><a name="618613">All ports needed for FTP proxying are handled internally by the software when FTP is enabled in Content Gateway Manager.</a></div>
      <div class="N1H-Heading1"><a name="604780">Other features</a></div>
      <div class="B-Body"><a name="604781">Communication ports for gathering of statistics over the overseer port, to allow PAC file distribution from the proxy, and for collation of logs for multiple proxies are handled internally by the software.</a></div>
      <div class="B-Body"><a name="618700">For information on SIEM integration, see </a><span class="URL-URL"><a href="https://help.forcepoint.com/docs/web/v85/siem/siem.pdf" target="external_window">Security Information Event Management (SIEM) Solutions</a></span>. </div>
      <div class="N1H-Heading1"><a name="608243">Configuring IP6tables</a></div>
      <div class="B-Body"><a name="608287">Content Gateway can be configured to support IPv6. </a></div>
      <div class="B-Body"><a name="608278">To configure IP6tables firewall, Content Gateway requires that an IPv6 port be open for each protocol that is used for IPv4. </a></div>
      <div class="B-Body"><a name="618982">All IPv4 ports that are handed internally by the software are also handled when IPv6 is enabled. Any configurable IPv4 port should be added to IP6tables when IPv6 is enabled in Content Gateway Manager.</a></div>
      <div class="B-Body"><a name="619259">For example, include the following rule if you have multiple instances of Content Gateway in a cache hierarchy:</a></div>
      <div class="CO-Code"><a name="619260">ip6tables -i &lt;MGMT_NIC&gt; -I INPUT -p udp --dport 3130 -j ACCEPT</a></div>
      <div class="B-Body"><a name="619380">Also, the following rules are optional and can be used to enhance the security of your Content Gateway deployment when IPv6 is enabled. </a></div>
      <div class="CO-Code"><a name="619381">ip6tables --policy INPUT DROP</a></div>
      <div class="CO-Code"><a name="619382">ip6tables --policy OUTPUT ACCEPT</a></div>
      <div class="CO-Code"><a name="619383">ip6tables --policy FORWARD DROP</a></div>
      <div class="CO-Code"><a name="619384">ip6tables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT</a></div>
      <div class="B-Body"><a name="619233">&nbsp;</a></div>
    </div>
    <!--googleoff: all-->
    <div class="library_search">
      <form class="support_search" action="/content/kb-search.aspx" method="get">
        <label></label>
        <label></label>
        <input type="text" name="q" value=" Search Support" onfocus="if (this.value == ' Search eSupport') {this.value = '';}" onblur="if (this.value == '') {this.value = ' Search eSupport';}"></input>
        <input type="submit" value=" "></input>
      </form>
    </div>
    <br class="clear" />
    <!-- Navigation bar at the bottom of the page -->
    <div class="TL_nav" style="text-align: left;">
      <table cellspacing="0" class="toolBarTable" summary="">
        <!-- End New Navigation DIV -->
        <tr>
          <td>
            <!-- New Go To TOC -->
            <a href="toc.aspx"><img src="images/toc.png" alt="Go to the table of contents" border="0" /></a>
            <!-- End Go To TOC -->
          </td>
          <td>
            <!-- New Previous -->
            <a href="first.aspx"><img src="images/prev.png" alt="Go to the previous page" border="0" /></a>
            <!-- End New Previous -->
          </td>
          <td>
            <!-- New Next (Active) -->
            <a href="faq_wcg_id.aspx"><img src="images/next.png" alt="Go to the next page" border="0" /></a>
            <!-- End New Next (Active) -->
          </td>
          <td>
            <!-- New PDF -->
            <a href="content_gateway_faq.pdf"><img src="images/pdf.png" alt="View or print as PDF" border="0" /></a>
            <!-- End New PDF -->
          </td>
          <!--Start JR breadcrumbs -->
          <td width="20px"></td>
          <td>
            <div class="WebWorks_Breadcrumbs" style="text-align: left;">
              <a class="WebWorks_Breadcrumb_Link" href="first.aspx">Content Gateway: Frequently Asked Questions</a> : How do I configure IPTables to harden the Content Gateway host system?</div>
          </td>
          <!--End JR breadcrumbs -->
        </tr>
      </table>
    </div>
    <div class="extFooterContainer">
      <div class="extFooter">
        <div align="center">Copyright 2022 Forcepoint. All rights reserved.</div>
      </div>
    </div>
    <SCRIPT>
   function getFileName() {
      //this gets the full url
      var url = document.location.href;
      //this removes the anchor at the end, if there is one
      url = url.substring(0, (url.indexOf("#") == -1) ? url.length : url.indexOf("#"));
      //this removes the query after the file name, if there is one
      url = url.substring(0, (url.indexOf("?") == -1) ? url.length : url.indexOf("?"));
      //this removes everything before the last slash in the path
      url = url.substring(url.lastIndexOf("/") + 1, url.length);
      //return
      return url;
   }

   var url = document.URL;
   var Docname = getFileName()
   s.pageName = "enu:support:technical library:wcgfaqv85x:" + Docname;
   s.prop1 = "enu:support";
   s.prop2 = "enu:support:technical library";
   s.channel = "support";
   // <!--
   s.server = "<%= System.Environment.MachineName %>";
   //--></SCRIPT>
    <script language="javascript1.1" type="text/javascript">
   /********Do Not alter below this line ***********/
   var s_code = s.t(); if (s_code) document.write(s_code)
   //--&gt;</script>
  </body>
  <!--"GENERALQUARTERSALLHANDSMANYOURSTATIONS"-->
</html>