• Skip to primary navigation
  • Skip to main content
  • Skip to footer

Cisco Umbrella

Enterprise network security

  • Free Trial
  • Contact us
  • Blog
  • Login
    • Umbrella Login
    • Cloudlock Login
  • Products
    • Product
      • Cisco Umbrella Cloud Security Service
      • Cisco Umbrella Investigate
      • Product Packages
      • Support Packages
    • Functionality
      • DNS-Layer Security
      • Secure Web Gateway
      • Cloud Access Security Broker (CASB)
      • Interactive Intelligence
      • Cloud-Delivered Firewall
    •  
    • Webinar signup
  • Solutions
    • By Need
      • Protect Mobile Users
      • Fast Incident Response
      • Web Content Filtering
      • Shadow IT Discovery & App Blocking
      • Unified Threat Enforcement
      • Reduce Security Infections
      • Secure Direct Internet Access
      • Securing Remote and Roaming Users
    • By Network
      • Protect Guest Wi-Fi
      • SD-WAN Security
      • Off-Network Endpoint Security
    • By Industry
      • Higher Education Security
      • K-12 Schools Security
      • Healthcare, Retail and Hospitality Security
      • Enterprise Cloud Security
      • Small Business Cybersecurity
      • Our Customers
      • Customer Stories
    • Ransomware Defense for Dummies book
  • Why Us
    • Fast Reliable Cloud
      • Cloud Security Infrastructure
      • Cloud Network Status
      • Cloud Network Activity
      • Recursive DNS Services
      • Top Reasons to Trial
      • Getting Started
    • Unmatched Intelligence
      • Cyber Attack Prevention
      • Interactive Intelligence
    • Extensive Integrations
      • IT Security Integrations
      • Hardware Integrations
      • Meraki Integration
      • Cisco SD-WAN
    • Navigation-dropdown-promo-free-trial_102820
  • Resources
    • Content Library
      • Top Resources
      • Analyst Reports
      • Case Studies
      • Customer Videos
      • Datasheets
      • eBooks
      • Infographics
      • Solution Briefs
    • International Documents
      • Deutsch/German
      • Español/Spanish
      • Français/French
      • Italiano/Italian
      • 日本語/Japanese
    • Cisco Umbrella Blog
      • Latest Posts
      • Security Posts
      • Research Posts
      • Threats Posts
      • Product Posts
      • Spotlight
    • For Customers
      • Support
      • Customer Success Hub
      • Umbrella Deployment Hub
      • Customer Success Webinars
      • What’s New
      • Cisco Umbrella Studio
  • Trends & Threats
    • Market Trends
      • Rise of Remote Workers
      • Secure Internet Gateway (SIG)
      • Secure Access Service Edge (SASE)
    • Security Threats
      • Ransomware
      • Cryptomining Malware Protection
      • Cybersecurity Threat Landscape
    •  
    • 2020 Cybersecurity trends
  • Partners
    • Channel Partners
      • Partner Program
      • Become a Partner
    • Service Providers
      • Secure Connectivity
      • Managed Security for MSSPs
      • Managed IT for MSPs
    •  
    • Become a partner
  • Free Trial Signup
  • Umbrella Login
  • Cloudlock Login
  • Contact Us
Product

Generating Iptables Rules With TrafficCop

By Chris Dorros
Posted on August 31, 2015
Updated on October 15, 2020

Share

Facebook0Tweet0LinkedIn0

Today the OpenDNS engineering team is releasing Traffic Cop, a simple, open source tool to uncover to where your host is communicating, and help you write iptables rules. In a nutshell, it does three things:

  • Configures and enables logging of all inbound and outbound connection attempts (by default it looks for TCP SYN packets).
  • Generates a report showing the IPs and services of the peers the host is communicating with.
  • Generates iptables rules for each connection type.

Motivation

Let’s start with a quick example:
You have a fresh host for your new project and want to “lock it down.” You know it needs to talk to your database server and a few backend services, and that it will need inbound access from admins over SSH, plus web access for your clients. Writing the rules is not very easy either, but there are a few good tools out there for helping with that. You finalize your ruleset and put them in place. Everything works good for a few days, until your users can’t login because you forgot to enable access to your NTP (time) server, and the auth components need to stay in sync with time!
This is just one simple example, but the big picture is that in today’s fast-paced development world, where we’re building widgets using libraries built on top of other libraries, we don’t always know what our dependency chains looks like. This can make allow lists for security difficult, and sometimes a bit scary, as we want to do the right thing but not break anything.

How TrafficCop Helps

Let’s redo our example. This time we configure Traffic cop to log all connections on our server in a development/test environment (you probably don’t want to experiment in production). We let it run for a few days to get a good sense of the traffic. At the end of the learning phase, we’ve captured a rough baseline for the host. We review the rules it generated, select the ones that make sense, tweak the IP ranges as we see fit, and put them in place.
Note that we’re not just talking about inbound firewall rules here. We’re putting outbound rules in place too. This is traditionally an uncommon practice on host-based firewalls, as outbound traffic is typically more painful to classify and understand per application, but we’re using live data to drive the configuration, therefore we can take advantage of outbound traffic filtering. A blanket allowance of outbound traffic is one of the big drivers for malware to be primarily outbound focused (connecting back to “the mothership”), rather than attempting to communicate with the target inbound.

Demo Time!

We spin up a fresh EC2 instance, in a public subnet, using the default security groups (allows port 22 inbound from anywhere and all outbound).

SSH into the instance:

$ ./tcop enable
$ curl google.com (to show outbound log)

(waited about 5 minutes)

$ ./tcop report

Screen Shot 2015-08-31 at 3.39.27 PM
Screen Shot 2015-08-31 at 3.40.02 PM
That first inbound IP is us logging into the instance. The others are not! Notice that within just a few minutes we’re already getting IPs from around the world hitting our SSH port.

Great, How do I get Started?

Head over to the GitHub page for instructions on setting it up and generating reports. Contributions definitely welcome! Feel free to fork & feature requests! Hope you find it useful.

Previous Post:

Previous Article

Next Post:

Next Article

Follow Us

  • Twitter
  • Facebook
  • LinkedIn
  • YouTube

Footer Sections

What we make

  • Cloud Security Service
  • DNS-Layer Network Security
  • Secure Web Gateway
  • Security Packages

Who we are

  • Cisco Umbrella Blog
  • Cloud Network Status
  • Cloud Network Activity
  • OpenDNS is now Cisco Umbrella

Learn more

  • Events
  • Careers
  • Support
  • Cisco Umbrella Live Demo
  • Contact Sales
Umbrella by Cisco
208.67.222.222+208.67.220.220
2620:119:35::35+2620:119:53::53
Sign up for a Free Trial
  • Cisco Online Privacy Statement
  • Terms of Service
  • Sitemap

© 2021 Cisco Umbrella