Building a dynamic firewall with iptables

9
Building a dynamic firewall with iptables Andreas Herz [email protected] Linogate GmbH 29.06.2016

Transcript of Building a dynamic firewall with iptables

Page 1: Building a dynamic firewall with iptables

Building a dynamic firewall with iptables

Andreas [email protected]

Linogate GmbH

29.06.2016

Page 2: Building a dynamic firewall with iptables

Concept

Extend the stateful firewall with dynamic blocking of bad IPsblock malicious traffic and add penaltyseveral sensors detect suspicious behaviorWhitelist and Blacklistsdifferent blocking duration

Page 3: Building a dynamic firewall with iptables

Procedure

Sensor detects something -> srcip added to badset withtimeout X or increased timeout by YGood behavior -> srcip added to goodset with same logicAfterwards comparison between badset and goodsetThreshold of bad behavior reached -> srcip blocked for ZminutesFor longtime observation srcip added to xt_recent set aswellIncreased timeouts in blacklistset based on longtimebehavior

Page 4: Building a dynamic firewall with iptables

Sensors

Portscan/sweepDOStraceroutepingfakerestricted rules

Page 5: Building a dynamic firewall with iptables

ipset

Modifications made for ipset 6.16TARGET: –increaseMATCH: –compare-set –threshold

Examples:

iptables -A FOO -j SET –add-set badset src –exist –timeout300 –increase

iptables -A BAR -j CHECKING -m set –compare-set badset srcgoodset src –threshold 1000

Page 6: Building a dynamic firewall with iptables

portscan/portsweep

using xtables_addons psd with patches from Florianadded portsweep detection and syslog outputadding mixed mode in the future

Page 7: Building a dynamic firewall with iptables

traceroute and pingfake

detect traceroute with basic iptablesreply icmp requests instead of forwarding them

Page 8: Building a dynamic firewall with iptables

prospects

switch to nftablesget as much as possible into upstreamimprove IPv6 coverageconjunction with IDS/IPS Suricatalongtime analytics

Page 9: Building a dynamic firewall with iptables

Suggestions

Any suggestions?