Page tree

Contents

Overview

The goal of this document is to walk you through the configuration of your IPTables firewall and the setup of your management server using ThreatSTOP provided scripts. Once this setup has been completed your environment will begin receiving target list updates every two hours, and will be protected by ThreatSTOP.


We have written some shell scripts to prepare iptables, get your block lists, and use the results to create rules for iptables. You can download the scripts here. If this is a new device, please allow up to 15 minutes for our systems to be updated.

Prerequisites

Recommended Versions

ThreatSTOP is certified to be compatible with the following versions of iptables:

Minimum1.4
Recommended1.4.10

Quick Setup

Cut and paste the following line into your CLI. Your device will then setup files and run the script to begin protecting your network.

curl ftp://ftp.threatstop.com/pub/ts-iptables.tar.gz -o ts-iptables.tar.gz ; tar xzvf ts-iptables.tar.gz ; sudo dpkg -i ts-iptables_4.15-02_all.deb; cd /opt/threatstop; sudo ./setup.pl --blocklist <block list name>..threatstop.local --allowlist <allow list name>..threatstop.local

As with any Linux configuration the first step in configuring the management appliance is to apply the latest patches for the distribution. You will also need to gather any missing library files for the setup Perl script. To do this:

  1. Connect to the new virtual machine and login with your chosen credentials.
  2. At the command prompt enter the following commands, pressing ENTER between each command.

    sudo apt-get update

    sudo apt-get upgrade

    sudo apt-get install libswitch-perl libtest-lwp-useragent-perl ipset libnet-dns-perl rsyslog

    Caution:

    rsyslog will need to be installed, Ubuntu seems to install syslog-ng by default which is not compatible with the ThreatSTOP Shield Platform.

    Once the management appliance has been patched you will need to setup the device in the Portal using the setup steps provided in ThreatSTOP Portal Introduction. Once the device has been configured in the portal we can proceed with the installation of the ThreatSTOP application.

  3. Test the connection from your management appliance to our network using the command:

    curl https://www.threatstop.com/cgi-bin/validip.pl

    Verify that the IP address is in the list of authorized hosts.

Testing the Connection

To test that a connection can be made successfully between your VM and ThreatSTOP enter:

ping www.threatstop.com

Installing ThreatSTOP for iptables

ThreatSTOP can interface with a large number of management devices. One of the most readily available of these is built into Linux itself: iptables is a strong, prolific, and free, firewall software that is available in every Linux distro. To make use of this powerful utility you will need to perform the following steps:

  1. Login to the Virtual Machine.
  2. FTP to  ftp.threatstop.com and enter the following commands:

    cd /pub

    get ts-iptables.tar.gz

    1. After the download completes enter:

      close

  3. If you do not have the file where you want the installation files to appear move them to your preferred spot and decompress them using the command:

    sudo dpkg -i ts-iptables_4.15-02_all.deb

    Note:

    This will install the ThreatSTOP IP firewall software, and setup a user with the name threatstop with no ability to login. You may either set a password on this account and login as the threatstop user, or sudo su threatstop and run commands as the threatstop user.

  4. As the threatstop user, begin the setup process by entering:

    cd /opt/threatstop

    ./setup.pl

    An introduction screen will appear and a few brief checks will be run to verify that various settings are in place to allow the script to run. After which, you will begin configuring the System utilities. Unless you have specifically installed these utilities elsewhere, use the provided defaults for file locations. The utilities mentioned are a mix of what we downloaded above, and standard utilities distributed with most Linux based distributions. After the System Utilities are configured, the User required parameters will be configured.

  5. Accept the default for the ThreatSTOP IP set prefix.

    Please enter the ThreatSTOP ipset prefix
    [TS]

  6. Provided that your connection to ThreatSTOP is open via port 80, the following parameters will be automatically populated with data from your account. Both fields may be accepted without issue. If your connection is blocked you will need to contact support for the correct values to enter.
    • ThreatSTOP Block list parameter: default
    • ThreatSTOP Allow list parameter: default

    Please enter the ThreatSTOP block list parameter
    [basic.threatstop.local] <block list name>..threatstop.local

    Please enter the ThreatSTOP allow list parameter
    [dns.threatstop.local] <allow list name>..threatstop.local

  7. Set the maximum policy size your system is able to handle. The default is likely to be OK so tap ENTER.

    Please enter the ThreatSTOP max policy size parameter
    [25000]

  8. Accept the default location for the ThreatSTOP log file by tapping ENTER.

    Please enter ThreatSTOP logfile location
    [/var/log/threatstop.log]

  9. Use the provided URL to submit your logs by tapping ENTER.

    Please enter the URL parameter for submitting logs
    [https://threatstop.com:443/cgi-bin/logupload.pl]

  10. Enter the log upload IP address, this is may be automatically configured for you, so you only need to change this if you know the Device IP address does not match the external IP address of the device.

    Please enter the log upload IP address
           (optional, and only needed if this system's public IP
           is different than that configured in the corresponding
           device on the ThreatSTOP portal)
           []<Device IP>

  11. The value for Please enter the DNS PORT setting (0 - 65535) will depend on your being set as a DNS server:
    • If your configuration is set as a DNS server, accept the default of 53.
    • If your configuration is not set as a DNS server the default will fail and you will need to change the port. For a standard configuration this should be set to: 5353

    Please enter the DNS PORT setting (0 - 65535)
    [53]

  12. This controls how often fresh Threat Intelligence is piped into your firewall. It's safe to leave this at 2 hours by tapping ENTER.

    Please enter how often to update the device with ThreatSTOP addresses (5m, 15m, 30m, 1h, 2h, 4h)
    [2h]

  13. Unless you specifically need the logs uploaded at a rate different than normal accept the default of every hour by tapping ENTER.

    Please enter how often to upload the log files (5m, 15m, 30m, 1h, 2h, 4h)
    [1h]

  14. Accept these settings by entering Y (or accepting the default) at the Use these settings prompt.

    Use these settings : (Y/N) [Y] ?

  15. Information about the actions performed, and the results of connections tests will be displayed. After which a confirmation to enable the new Allow and Block list will be displayed. Tap ENTER to continue.

    Ready to run get Allow/Block list for the first time
    Proceed (Y/N) [Y] :

  16. Finally you will be prompted with Ready to run get Allow/Block list for the first time. Accept the default of Y and the scripts will pull the latest information for your policy.

From here you'll be able to use this device as a firewall in your network.

Testing the Configuration

You can verify that your policy has been loaded into iptables by running the following command:

sudo iptables -L

This will list all of the rules currently employed by IP Tables. After setting this you can verify the firewall's behavior by visiting the following URIs from a device behind the firewall:

  1. example.com – This should appear which will verify that you are able to connect.
  2. bad.threatstop.com – Your connection to this should time out.

Removing ThreatSTOP

To stop and remove ThreatSTOP from your firewall device:

  • Use the following command to remove ThreatSTOP and leave the configuration files:

    sudo dpkg -r ts-iptables

  • Use the following command to remove ThreatSTOP and the configuration files:

    sudo dpkg -P ts-iptables

Note:

In both uninstallation cases, your log files will not be removed. Additionally, the threatstop user will be left on the system.