SlideShare uma empresa Scribd logo
1 de 25
Advanced
      Netfilter
          &
      Iptables
Understand the Linux Firewall and make it
           do magical tricks

   Julien Vehent - Fosscon - July 2012
Who am I ?
 • Julien Vehent http://jve.linuxwall.info
 • Security Engineer, Linux
   Sysadmin, and a bit of a Dev
 • Love Networks, Packets,
   Routers, Firewalls, etc...



• I work for                                                       in the Philly suburb
• I write and publish at http://wiki.linuxwall.info
 •   http://wiki.linuxwall.info/doku.php/en:ressources:dossiers:networking:traffic_control

 •   http://wiki.linuxwall.info/doku.php/en:ressources:dossiers:dspam
 •   http://wiki.linuxwall.info/doku.php/en:ressources:dossiers:postfix:dkimproxy


                                                          Julien Vehent - jve.linuxwall.info - 2012
So you want to use                                                 ?
• linux/net/netfilter: 154 files, 1870710 characters (as of last night)

               On the Menu today ...
-1 Things you already know: packets, sk_buff and iptables basics
0 Cloud & Firewalls
1 Chains: INPUT, OUTPUT, FORWARD
2 Tables: raw, nat, mangle and filter
3 Connections state: xt-conntrack & /proc/net/ip_conntrack
4 Modules: owner, string, time, connbytes, geoip,....
5 Playing with packets and connections marks
6 Large sets of IPs: first iptables-restore, then IPset
7 Netfilter Hooks: example with nfqueue_recorder
8, 9 & 10 Cloud again, and how to maintain tight control over your
(inbound *and* outbound) firewall using Chef and AFW
                            Julien Vehent - jve.linuxwall.info - 2012
App                   Everything is packet
               T +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               R |                Source Port                              |        Destination Port      |
               A +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               N |                                                  Sequence Number                       |
TCP/IP Model   S +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               P |                                        Acknowledgment Number                           |
               O +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               R P| Data |                             |U|A|P|R|S|F|                                      |
               T R| Offset| Reserved |R|C|S|S|Y|I|                                       Window           |
  Transport      O|       |                            |G|K|H|T|N|N|                                      |
               C T+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               O O|                Checksum                                |          Urgent Pointer      |
               N C+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               T O|                                       Options                           |     Padding |
               R L+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               O |                                                       data                             |
               L +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               I +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               N |Version| IHL |Type of Service|                                       Total Length       |
               T +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               E |             Identification                              |Flags|       Fragment Offset  |
               R +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               N | Time to Live |                         Protocol         |          Header Checksum     |
  Network      E +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               T |                                               Source Address                           |
                  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               P |                                        Destination Address                             |
               R +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               O |                                        Options                           |     Padding |
               T +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               E +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  Data Link    T |                            DESTINATION                     MAC
               H +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                                                                              ADDRESS     |

               E | DEST MAC                   |                SOURCE         MAC             ADDRESS     |
               R +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               N | SRC       MAC              ADDRESS                      |             T Y P E          |
  Physical     E +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
               T          Julien Vehent - jve.linuxwall.info - 2012
Linux and sk_buff

struct sk_buff {
   /* These two members must be first. */
                                                                                  Linux stores each
   struct sk_buff    *next;                                                       ingress and egress
   struct sk_buff    *prev;
   struct sock    *sk;                                                            packet into an
   struct net_device *dev;
   struct nf_conntrack *nfct;                                                     instance of the
   struct nf_bridge_info *nf_bridge;
   union {                                                                        sk_buff structure.
      __u32    mark;
      __u32    dropcount;

   };
      __u32    avail_size;                                                        Netfilter applies
   __u16       vlan_tci;                                                          packet filters on the
   sk_buff_data_t    transport_header;
   sk_buff_data_t    network_header;                                              sk_buff structures.
   sk_buff_data_t    mac_header;
   sk_buff_data_t    tail;
   sk_buff_data_t    end;

};   sample from <include/linux/skbuff.h>
                                      Julien Vehent - jve.linuxwall.info - 2012
Netfilter Packet Flow
                      (sane version)

                   application
                read          write
                     Socket


      INPUT                                                      OUTPUT



                    FORWARD



    PREROUTING                                                 POSTROUTING


              Network Interface
P                                                                            P
                   Julien Vehent - jve.linuxwall.info - 2012
Iptables 101

Stateless firewall
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT

Stateful version
iptables -I INPUT -p tcp -m conntrack 
    --ctstate ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -m conntrack 
    --ctstate NEW -j ACCEPT

Logging
iptables -A INPUT -p tcp --dport 80 -m conntrack 
    --ctstate NEW -j LOG --log-prefix “In HTTP ”

                      Julien Vehent - jve.linuxwall.info - 2012
Firewall vs Cloud
                                                “I like VMs, they are cheap
 90s model: “I bought 4                          and I can have MANY !”
servers , $25k each, and a
firewall and it does it all”



                     Versus


                                                        Of course I have a firewall, it does:
                                           iptables -A INPUT -p tcp --dport 80 -j ACCEPT
                         Julien Vehent - jve.linuxwall.info - 2012
Netfilter Packet Flow
                          (for real men)




http://upload.wikimedia.org/wikipedia/commons/3/37/Netfilter-packet-flow.svg
                             Julien Vehent - jve.linuxwall.info - 2012
Introducing Tables




filter: default                           mangle: for packet
nat: only traversed on                    alteration
state==NEW                                raw: to disable conntrack
                     Julien Vehent - jve.linuxwall.info - 2012
Tables

FILTER: implied when nothing specified
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -t filter -A INPUT -p tcp ...

RAW: don’t waste ressources on conntrack
iptables -t raw -I PREROUTING -i lo -j NOTRACK
iptables -t raw -I OUTPUT -o lo -j NOTRACK
iptables -t raw -I PREROUTING -p udp --sport 53 
-s 8.8.8.8 -j NOTRACK

MANGLE: manipulate packets right before transmit
iptables -t mangle -A POSTROUTING -o eth0 
-p tcp --tcp-flags SYN SYN --dport 443 
-j CONNMARK --set-mark 300

                     Julien Vehent - jve.linuxwall.info - 2012
Stateful (conntrack) vs Stateless
 • Conntrack knows the state of each TCP & UDP
   connection on the system
 • When a new packet arrive, conntrack can tell if it is part
   of an existing connection
 • Downside: maintaining state information can be
   expensive for very high traffic system (start worrying
   around 10,000 packets per second)
# grep "dport=22 " /proc/net/ip_conntrack

tcp      6 299 ESTABLISHED src=10.1.0.145 dst=10.1.0.25
sport=54656 dport=22 packets=819 bytes=62669
src=10.1.0.25 dst=10.1.0.145 sport=22 dport=54656
packets=436 bytes=251335 [ASSURED] mark=0 secmark=0 use=2
         see linux/net/netfilter/nf_conntrack_proto_tcp.c
                         Julien Vehent - jve.linuxwall.info - 2012
Some fun with modules
   • Mangle connection based on their “size”
 iptables -t mangle -A POSTROUTING -o eth1 -p tcp 
 -m connbytes --connbytes 10000000: --connbytes-mode bytes 
 --connbytes-dir both -j CONNMARK --set-mark 999

 $ nc -l 1664 < /dev/zero                        $ nc 192.168.1.222 1664 > /dev/null

     # iptables -t mangle -L POSTROUTING -v
     Chain POSTROUTING (policy ACCEPT 115K packets, 4715K bytes)
     pkts bytes target   prot opt in out source     destination

     111K 4452K CONNMARK tcp -- any eth0 anywhere anywhere     connbytes
     10000000:18446744073709551615 connbytes mode bytes connbytes direction
     both CONNMARK set 0x3e7

# grep mark=999 /proc/net/ip_conntrack
tcp      6 299 ESTABLISHED src=10.0.2.15 dst=192.168.1.222 sport=45234
dport=1664 packets=371355 bytes=14854220 src=192.168.1.222
dst=10.0.2.15 sport=1664 dport=45234 packets=415324 bytes=606265294
[ASSURED] mark=999 use=2

                                 Julien Vehent - jve.linuxwall.info - 2012
Some fun with modules
  • Mangle packets based on ASCII strings in the payloads

iptables -t filter -A INPUT -i eth1 -p tcp --dport 80 
-m string --string "get /admin http/1.1" --icase --algo bm 
-m conntrack --ctstate ESTABLISHED -j DROP


  $ nc -l 80                                                         $ nc 192.168.1.222 1664
  get /hello+world http/1.1                                          get /hello+world http/1.1
                          X                                          get /admin http/1.1


 # iptables -t filter -L INPUT -v
 Chain INPUT (policy ACCEPT 93 packets, 6531 bytes)
 pkts bytes target prot opt in    out source   destination
 13   936   DROP   tcp -- eth1 any anywhere anywhere
 tcp dpt:http STRING match "get /admin http/1.1" ALGO name bm TO
 65535 ICASE ctstate ESTABLISHED




                              Julien Vehent - jve.linuxwall.info - 2012
Some fun with modules
  • Filter SSH on Christmas
iptables -t filter -A INPUT -p tcp 
--dport 22 -m time 
--datestart "2012-12-25T00:00:00" 
--datestop "2012-12-25T23:59:59" 
--utc -j DROP


  • Mark the packets of a particular user, and Log
            iptables -t filter -o eth0 -A OUTPUT -p tcp 
            --tcp-flags SYN SYN -m owner --uid-owner 1000 
            -j CONNMARK --set-mark 1664

            iptables -t filter -A OUTPUT -p tcp 
            --tcp-flags SYN SYN -m connmark --mark 1664 
            -j LOG --log-prefix "Mark 1664 trigerred "
    Aug 11 04:29:15 firewall1 kernel: [ 9895.696205] Mark 1664 trigerred IN= OUT=eth0 SRC=10.0.2.15
DST=173.194.75.106 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=7270 DF PROTO=TCP SPT=50940 DPT=443
                               WINDOW=14600 RES=0x00 SYN URGP=0
                                        Julien Vehent - jve.linuxwall.info - 2012
Hooks Magic
  • libnetfilter_queue provides hooks to divert packets from
    the normal Netfilter flow, into Userland
  • Use case: record outbound traffic from suspicious user
    “spongebob” (using https://github.com/jvehent/)
iptables -I OUTPUT -m owner --uid-owner $(id -u spongebob) -j NFQUEUE
   root@ossec:~# ./nfqueue_recorder -o spongebob_record.pcap
   pcap recording into spongebob_record.pcap
   opening pcap file at spongebob_record.pcap
   opening library handle
   unbinding existing nf_queue handler for AF_INET (if any)
   binding nfnetlink_queue as nf_queue handler for AF_INET
   binding this socket to queue '0'
   setting copy_packet mode
   -- New packet received --
   hw_protocol=0x0000 hook=3 id=0 outdev=2 payload_len=60 bytes
   IP{v=4; ihl=20; tos=0; tot_len=60; id=15388; ttl=64; protocol=17; saddr=10.0.2.15;
   daddr=10.0.2.2}
   UDP{sport=45374; dport=53; len=10240}

   -- New packet received --
   hw_protocol=0x0000 hook=3 id=1 outdev=2 payload_len=60 bytes
   IP{v=4; ihl=20; tos=0; tot_len=60; id=15391; ttl=64; protocol=17; saddr=10.0.2.15;
   daddr=10.0.2.2}
   UDP{sport=47435; dport=53; len=10240}
                                    Julien Vehent - jve.linuxwall.info - 2012
Hooks Magic



application
                                                               nfqueue
           write
                                                               recorder
  Socket


                      OUTPUT
                                                                      spongebob_
                                                                      record.pcap


                                  POSTROUTING


               Network Interface
                                                                  P
                   Julien Vehent - jve.linuxwall.info - 2012
Better than TCPDump
• TCPDump duplicates traffic at the NIC level.
• Dump incoming traffic and see packets entering but
  never reach the application
• Place your hook anywhere within you ruleset to verify
  that packets are coming through
                                application

                               Socket
                                                                        nfqueue    display:
                                                                        recorder   nothing !
                    INPUT
                                   DROP


                  PREROUTING


                                                                              display:
                   NIC                duplicates
                                                                  tcpdump
                                                                              packet packet packet .....

    P    P    P
                            Julien Vehent - jve.linuxwall.info - 2012
Recording traffic on /admin at night
# ./nfqueue_recorder -o night_admin.pcap
pcap recording into night_admin.pcap
opening pcap file at night_admin.pcap
opening library handle
unbinding existing nf_queue handler for AF_INET (if any)
binding nfnetlink_queue as nf_queue handler for AF_INET
binding this socket to queue '0'
setting copy_packet mode

iptables -t filter -A INPUT -i eth1 -p tcp --dport 80 
-m string --string "get /admin http/1.1" --icase --algo bm 
-m time --timestart "18:00" --timestop "10:00" --utc 
-m conntrack --ctstate ESTABLISHED -j CONNMARK --set-mark 666
iptables -t filter -A INPUT 
-m connmark --mark 666 -j NFQUEUE
                                                      $ nc 10.16.64.11 80
     # nc -l 80
                                                      get /spongebobsquarepants http/1.1
                                                      get /admin http/1.1
                                                      get /spongebob
                                                      blaaaahhh fooo
                                 Julien Vehent - jve.linuxwall.info - 2012
IPSets
 • Netfilter uses linear lookups. Each rule is tested against
   each packet, until a terminal rule matches the packet.
 • Lookup time grows linearily.
 • IPSets provides constant time hash lookup in Netfilter.
apt-get install ipset && modprobe ip_set
ipset -N droplist nethash
ipset --add droplist 192.168.1.0/24
iptables -A INPUT -m set --match-set droplist src 
-j DROP
#! /bin/bash
ipset -N droplist nethash
wget -q http://www.spamhaus.org/drop/drop.txt -O drop.lasso.$(date +%s)
if [ -e drop.lasso.$(date +%s) ]; then
   ipset --flush droplist
   for i in $(grep -v -E "^;|^$" drop.lasso.$(date +%s) | awk {'print $1'}); do
     echo "insert $i to droplist"
     ipset --add droplist $i
   done
fi                                Julien Vehent - jve.linuxwall.info - 2012
Ipsets: accounting per country
• Get the list of IP blocks for each country from https://
  www.countryipblocks.net/country_selection.php
• Load each country blocks into a separate Ipset




        Chain INPUT (policy DROP 20 packets, 5942 bytes)
         pkts bytes target
            0     0 COUNTRIES [...] match-set nigeria src
          367 25797 COUNTRIES [...] match-set france src
           10   440 COUNTRIES [...] match-set china src
                            Julien Vehent - jve.linuxwall.info - 2012
Atomic (and fast) Restore
• Most people write their firewall rules in a Bash script. It’s
  the best way to start, until you have thousands of rules.
•              [ USE IPTABLES-RESTORE ]

# iptables -L INPUT -v -n |grep ACCEPT|wc -l
62511   <= that’s 62,511 individual INPUT rules

# time iptables-restore < iptables-rules.saved
real 0m1.204s
user 0m0.450s
sys 0m0.720s

# time bash rules.iptables.sh
real 41m28.277s <= 42 minutes
user 12m55.300s
sys 32m17.290s <= 32 minutes spent in the kernel
                         Julien Vehent - jve.linuxwall.info - 2012
Aweber FireWall
• Moving away from the massive entry gate logic




• To something a lot more modular
       node   node                                                      node   node

                     node                                                             node

       node   node                                                      node   node

                            Julien Vehent - jve.linuxwall.info - 2012
Aweber FireWall
 • Completely dynamic. Chef creates inbound/outbound
   rules for nodes automatically. Convergence takes time.
 • Whitelist for outbound connections per system user.
 • Rules are stored in /etc/firewall/rules.iptables
-A INPUT -i eth0   -p tcp --dport 80 -s provision -m state --state NEW -j ACCEPT
-A INPUT -i eth0   -p tcp --dport 80 -s 10.1.0.228 -m state --state NEW -j ACCEPT
-A INPUT -i eth0   -p tcp --dport 80 -s 10.1.0.229 -m state --state NEW -j ACCEPT

:www-data - [0:0]
-A OUTPUT -m owner --uid-owner 33 -m state --state NEW -j www-data
-A www-data -j LOG --log-prefix "AFW_www-data_OUTPUT_DROP " --log-uid
-A www-data -j DROP

:ntp - [0:0]
-A OUTPUT -m owner --uid-owner 104 -m state --state NEW -j ntp
-A ntp -o eth0 -p udp --dport 123 -d ntp1 -m state --state NEW -j ACCEPT
-A ntp -o eth0 -p udp --dport 123 -d ntp2 -m state --state NEW -j ACCEPT
-A ntp -j LOG --log-prefix "DROP_AFW_OUTPUT_ntp " --log-uid --log-tcp-sequence
-A ntp -j DROP



                                  Julien Vehent - jve.linuxwall.info - 2012
Any
Question ?




             Julien Vehent - jve.linuxwall.info - 2012

Mais conteúdo relacionado

Mais procurados

Simulation and Performance Analysis of AODV using NS 2.34 by Ashok Panwar
Simulation and Performance Analysis of AODV using NS 2.34 by Ashok PanwarSimulation and Performance Analysis of AODV using NS 2.34 by Ashok Panwar
Simulation and Performance Analysis of AODV using NS 2.34 by Ashok PanwarAshok Panwar
 
Network Mapper (NMAP)
Network Mapper (NMAP)Network Mapper (NMAP)
Network Mapper (NMAP)KHNOG
 
Kernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
Kernel Recipes 2017 - Modern Key Management with GPG - Werner KochKernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
Kernel Recipes 2017 - Modern Key Management with GPG - Werner KochAnne Nicolas
 
BPF - in-kernel virtual machine
BPF - in-kernel virtual machineBPF - in-kernel virtual machine
BPF - in-kernel virtual machineAlexei Starovoitov
 
BPF - All your packets belong to me
BPF - All your packets belong to meBPF - All your packets belong to me
BPF - All your packets belong to me_xhr_
 
Debugging Ruby
Debugging RubyDebugging Ruby
Debugging RubyAman Gupta
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby SystemsEngine Yard
 
Midterm Presentation
Midterm PresentationMidterm Presentation
Midterm PresentationZhongzhi Yu
 
3 scanning-ger paoctes-pub
3  scanning-ger paoctes-pub3  scanning-ger paoctes-pub
3 scanning-ger paoctes-pubCassio Ramos
 
BPF / XDP 8월 세미나 KossLab
BPF / XDP 8월 세미나 KossLabBPF / XDP 8월 세미나 KossLab
BPF / XDP 8월 세미나 KossLabTaeung Song
 
The Next Generation Firewall for Red Hat Enterprise Linux 7 RC
The Next Generation Firewall for Red Hat Enterprise Linux 7 RCThe Next Generation Firewall for Red Hat Enterprise Linux 7 RC
The Next Generation Firewall for Red Hat Enterprise Linux 7 RCThomas Graf
 
Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Tom Paulus
 
Kernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2017: Performance Analysis with BPFKernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2017: Performance Analysis with BPFBrendan Gregg
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerMarina Kolpakova
 
[嵌入式系統] MCS-51 實驗 - 使用 IAR (2)
[嵌入式系統] MCS-51 實驗 - 使用 IAR (2)[嵌入式系統] MCS-51 實驗 - 使用 IAR (2)
[嵌入式系統] MCS-51 實驗 - 使用 IAR (2)Simen Li
 

Mais procurados (20)

Simulation and Performance Analysis of AODV using NS 2.34 by Ashok Panwar
Simulation and Performance Analysis of AODV using NS 2.34 by Ashok PanwarSimulation and Performance Analysis of AODV using NS 2.34 by Ashok Panwar
Simulation and Performance Analysis of AODV using NS 2.34 by Ashok Panwar
 
Network Mapper (NMAP)
Network Mapper (NMAP)Network Mapper (NMAP)
Network Mapper (NMAP)
 
Kernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
Kernel Recipes 2017 - Modern Key Management with GPG - Werner KochKernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
Kernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
 
BPF - in-kernel virtual machine
BPF - in-kernel virtual machineBPF - in-kernel virtual machine
BPF - in-kernel virtual machine
 
BPF - All your packets belong to me
BPF - All your packets belong to meBPF - All your packets belong to me
BPF - All your packets belong to me
 
Debugging Ruby
Debugging RubyDebugging Ruby
Debugging Ruby
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby Systems
 
Commands...
Commands...Commands...
Commands...
 
Midterm Presentation
Midterm PresentationMidterm Presentation
Midterm Presentation
 
CARACTERES ASCII ENSAMBLADOR
CARACTERES ASCII ENSAMBLADORCARACTERES ASCII ENSAMBLADOR
CARACTERES ASCII ENSAMBLADOR
 
3 scanning-ger paoctes-pub
3  scanning-ger paoctes-pub3  scanning-ger paoctes-pub
3 scanning-ger paoctes-pub
 
BPF / XDP 8월 세미나 KossLab
BPF / XDP 8월 세미나 KossLabBPF / XDP 8월 세미나 KossLab
BPF / XDP 8월 세미나 KossLab
 
The Next Generation Firewall for Red Hat Enterprise Linux 7 RC
The Next Generation Firewall for Red Hat Enterprise Linux 7 RCThe Next Generation Firewall for Red Hat Enterprise Linux 7 RC
The Next Generation Firewall for Red Hat Enterprise Linux 7 RC
 
Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1
 
Kernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2017: Performance Analysis with BPFKernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2017: Performance Analysis with BPF
 
2 netcat enum-pub
2 netcat enum-pub2 netcat enum-pub
2 netcat enum-pub
 
Nxll24 i pv6
Nxll24 i pv6Nxll24 i pv6
Nxll24 i pv6
 
Amos command
Amos commandAmos command
Amos command
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
 
[嵌入式系統] MCS-51 實驗 - 使用 IAR (2)
[嵌入式系統] MCS-51 實驗 - 使用 IAR (2)[嵌入式系統] MCS-51 實驗 - 使用 IAR (2)
[嵌入式系統] MCS-51 實驗 - 使用 IAR (2)
 

Destaque

25 most frequently used linux ip tables rules examples
25 most frequently used linux ip tables rules examples25 most frequently used linux ip tables rules examples
25 most frequently used linux ip tables rules examplesTeja Bheemanapally
 
Iptablesrocks
IptablesrocksIptablesrocks
Iptablesrocksqwer_asdf
 
Stupid iptables tricks
Stupid iptables tricksStupid iptables tricks
Stupid iptables tricksJim MacLeod
 
Introduction to firewalls through Iptables
Introduction to firewalls through IptablesIntroduction to firewalls through Iptables
Introduction to firewalls through IptablesBud Siddhisena
 
Packet Filtering Using Iptables
Packet Filtering Using IptablesPacket Filtering Using Iptables
Packet Filtering Using IptablesAhmed Mekkawy
 
Pc i 2010-11 150m msp
Pc i 2010-11 150m mspPc i 2010-11 150m msp
Pc i 2010-11 150m msphayat alishah
 
Session 6-1-john-laidlow-responsible-investment-as-a-tool-to-guide-sustainabl...
Session 6-1-john-laidlow-responsible-investment-as-a-tool-to-guide-sustainabl...Session 6-1-john-laidlow-responsible-investment-as-a-tool-to-guide-sustainabl...
Session 6-1-john-laidlow-responsible-investment-as-a-tool-to-guide-sustainabl...ZSL Biodiversity & Palm Oil Platform
 
Chews-4-Health Relief Efforts in Manila
Chews-4-Health Relief Efforts in ManilaChews-4-Health Relief Efforts in Manila
Chews-4-Health Relief Efforts in ManilaChews4Health
 
New programme (corrected)
New programme (corrected)New programme (corrected)
New programme (corrected)hayat alishah
 
Q2 adp 2015-16 sectoral format for sports
Q2 adp 2015-16 sectoral format for sportsQ2 adp 2015-16 sectoral format for sports
Q2 adp 2015-16 sectoral format for sportshayat alishah
 
To rs for consultancy environment firm tourism projects
To rs for consultancy environment firm tourism projectsTo rs for consultancy environment firm tourism projects
To rs for consultancy environment firm tourism projectshayat alishah
 

Destaque (20)

25 most frequently used linux ip tables rules examples
25 most frequently used linux ip tables rules examples25 most frequently used linux ip tables rules examples
25 most frequently used linux ip tables rules examples
 
Logs
LogsLogs
Logs
 
Iptables
IptablesIptables
Iptables
 
Iptablesrocks
IptablesrocksIptablesrocks
Iptablesrocks
 
Stupid iptables tricks
Stupid iptables tricksStupid iptables tricks
Stupid iptables tricks
 
Introduction to firewalls through Iptables
Introduction to firewalls through IptablesIntroduction to firewalls through Iptables
Introduction to firewalls through Iptables
 
netfilter programming
netfilter programmingnetfilter programming
netfilter programming
 
Packet Filtering Using Iptables
Packet Filtering Using IptablesPacket Filtering Using Iptables
Packet Filtering Using Iptables
 
Iptables presentation
Iptables presentationIptables presentation
Iptables presentation
 
Iptables
IptablesIptables
Iptables
 
Vagrant
VagrantVagrant
Vagrant
 
Pc i 2010-11 150m msp
Pc i 2010-11 150m mspPc i 2010-11 150m msp
Pc i 2010-11 150m msp
 
Session 6-1-john-laidlow-responsible-investment-as-a-tool-to-guide-sustainabl...
Session 6-1-john-laidlow-responsible-investment-as-a-tool-to-guide-sustainabl...Session 6-1-john-laidlow-responsible-investment-as-a-tool-to-guide-sustainabl...
Session 6-1-john-laidlow-responsible-investment-as-a-tool-to-guide-sustainabl...
 
Chews-4-Health Relief Efforts in Manila
Chews-4-Health Relief Efforts in ManilaChews-4-Health Relief Efforts in Manila
Chews-4-Health Relief Efforts in Manila
 
New programme (corrected)
New programme (corrected)New programme (corrected)
New programme (corrected)
 
Истоки (2008 год)
Истоки (2008 год)Истоки (2008 год)
Истоки (2008 год)
 
Q2 adp 2015-16 sectoral format for sports
Q2 adp 2015-16 sectoral format for sportsQ2 adp 2015-16 sectoral format for sports
Q2 adp 2015-16 sectoral format for sports
 
Social media revolution
Social media revolutionSocial media revolution
Social media revolution
 
To rs for consultancy environment firm tourism projects
To rs for consultancy environment firm tourism projectsTo rs for consultancy environment firm tourism projects
To rs for consultancy environment firm tourism projects
 
Ped brochure
Ped brochurePed brochure
Ped brochure
 

Semelhante a Fosscon 2012 firewall workshop

L2 over l3 ecnaspsulations (english)
L2 over l3 ecnaspsulations (english)L2 over l3 ecnaspsulations (english)
L2 over l3 ecnaspsulations (english)Motonori Shindo
 
JCSA2013 06 Luigi Iannone - Le protocole LISP ("Locator/Identifier Sepration ...
JCSA2013 06 Luigi Iannone - Le protocole LISP ("Locator/Identifier Sepration ...JCSA2013 06 Luigi Iannone - Le protocole LISP ("Locator/Identifier Sepration ...
JCSA2013 06 Luigi Iannone - Le protocole LISP ("Locator/Identifier Sepration ...Afnic
 
Cloudy with a Chance of Fireballs: Provisioning and Certificate Management in...
Cloudy with a Chance of Fireballs: Provisioning and Certificate Management in...Cloudy with a Chance of Fireballs: Provisioning and Certificate Management in...
Cloudy with a Chance of Fireballs: Provisioning and Certificate Management in...Puppet
 
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster Shaun Domingo
 
The Road to End-to-End Encryption in Jitsi Meet
The Road to End-to-End Encryption in Jitsi MeetThe Road to End-to-End Encryption in Jitsi Meet
The Road to End-to-End Encryption in Jitsi MeetSaúl Ibarra Corretgé
 
codecentric AG: Using Cassandra and Clojure for Data Crunching backends
codecentric AG: Using Cassandra and Clojure for Data Crunching backendscodecentric AG: Using Cassandra and Clojure for Data Crunching backends
codecentric AG: Using Cassandra and Clojure for Data Crunching backendsDataStax Academy
 
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp KrennA tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenndistributed matters
 
(NET301) New Capabilities for Amazon Virtual Private Cloud
(NET301) New Capabilities for Amazon Virtual Private Cloud(NET301) New Capabilities for Amazon Virtual Private Cloud
(NET301) New Capabilities for Amazon Virtual Private CloudAmazon Web Services
 

Semelhante a Fosscon 2012 firewall workshop (20)

L2 over l3 ecnaspsulations (english)
L2 over l3 ecnaspsulations (english)L2 over l3 ecnaspsulations (english)
L2 over l3 ecnaspsulations (english)
 
8 congestion-ipv6
8 congestion-ipv68 congestion-ipv6
8 congestion-ipv6
 
7. protocols
7. protocols7. protocols
7. protocols
 
JCSA2013 06 Luigi Iannone - Le protocole LISP ("Locator/Identifier Sepration ...
JCSA2013 06 Luigi Iannone - Le protocole LISP ("Locator/Identifier Sepration ...JCSA2013 06 Luigi Iannone - Le protocole LISP ("Locator/Identifier Sepration ...
JCSA2013 06 Luigi Iannone - Le protocole LISP ("Locator/Identifier Sepration ...
 
Networking
NetworkingNetworking
Networking
 
BRKSPG-3001.pdf
BRKSPG-3001.pdfBRKSPG-3001.pdf
BRKSPG-3001.pdf
 
Ipv6 internetdagen-print
Ipv6 internetdagen-printIpv6 internetdagen-print
Ipv6 internetdagen-print
 
flow mgmt
flow mgmtflow mgmt
flow mgmt
 
flowing mgmt.ppt
flowing mgmt.pptflowing mgmt.ppt
flowing mgmt.ppt
 
6 tsch orlando
6 tsch orlando6 tsch orlando
6 tsch orlando
 
Cloudy with a Chance of Fireballs: Provisioning and Certificate Management in...
Cloudy with a Chance of Fireballs: Provisioning and Certificate Management in...Cloudy with a Chance of Fireballs: Provisioning and Certificate Management in...
Cloudy with a Chance of Fireballs: Provisioning and Certificate Management in...
 
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
CoreOS in anger : firing up wordpress across a 3 machine CoreOS cluster
 
The Road to End-to-End Encryption in Jitsi Meet
The Road to End-to-End Encryption in Jitsi MeetThe Road to End-to-End Encryption in Jitsi Meet
The Road to End-to-End Encryption in Jitsi Meet
 
IPv6 introduction
IPv6 introductionIPv6 introduction
IPv6 introduction
 
Rfc 3412
Rfc 3412Rfc 3412
Rfc 3412
 
codecentric AG: Using Cassandra and Clojure for Data Crunching backends
codecentric AG: Using Cassandra and Clojure for Data Crunching backendscodecentric AG: Using Cassandra and Clojure for Data Crunching backends
codecentric AG: Using Cassandra and Clojure for Data Crunching backends
 
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp KrennA tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
A tale of queues — from ActiveMQ over Hazelcast to Disque - Philipp Krenn
 
(NET301) New Capabilities for Amazon Virtual Private Cloud
(NET301) New Capabilities for Amazon Virtual Private Cloud(NET301) New Capabilities for Amazon Virtual Private Cloud
(NET301) New Capabilities for Amazon Virtual Private Cloud
 
What is new in neutron QoS?
What is new in neutron QoS?What is new in neutron QoS?
What is new in neutron QoS?
 
201901-SRv6.pdf
201901-SRv6.pdf201901-SRv6.pdf
201901-SRv6.pdf
 

Último

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Último (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

Fosscon 2012 firewall workshop

  • 1. Advanced Netfilter & Iptables Understand the Linux Firewall and make it do magical tricks Julien Vehent - Fosscon - July 2012
  • 2. Who am I ? • Julien Vehent http://jve.linuxwall.info • Security Engineer, Linux Sysadmin, and a bit of a Dev • Love Networks, Packets, Routers, Firewalls, etc... • I work for in the Philly suburb • I write and publish at http://wiki.linuxwall.info • http://wiki.linuxwall.info/doku.php/en:ressources:dossiers:networking:traffic_control • http://wiki.linuxwall.info/doku.php/en:ressources:dossiers:dspam • http://wiki.linuxwall.info/doku.php/en:ressources:dossiers:postfix:dkimproxy Julien Vehent - jve.linuxwall.info - 2012
  • 3. So you want to use ? • linux/net/netfilter: 154 files, 1870710 characters (as of last night) On the Menu today ... -1 Things you already know: packets, sk_buff and iptables basics 0 Cloud & Firewalls 1 Chains: INPUT, OUTPUT, FORWARD 2 Tables: raw, nat, mangle and filter 3 Connections state: xt-conntrack & /proc/net/ip_conntrack 4 Modules: owner, string, time, connbytes, geoip,.... 5 Playing with packets and connections marks 6 Large sets of IPs: first iptables-restore, then IPset 7 Netfilter Hooks: example with nfqueue_recorder 8, 9 & 10 Cloud again, and how to maintain tight control over your (inbound *and* outbound) firewall using Chef and AFW Julien Vehent - jve.linuxwall.info - 2012
  • 4. App Everything is packet T +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ R | Source Port | Destination Port | A +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ N | Sequence Number | TCP/IP Model S +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ P | Acknowledgment Number | O +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ R P| Data | |U|A|P|R|S|F| | T R| Offset| Reserved |R|C|S|S|Y|I| Window | Transport O| | |G|K|H|T|N|N| | C T+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ O O| Checksum | Urgent Pointer | N C+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ T O| Options | Padding | R L+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ O | data | L +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ I +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ N |Version| IHL |Type of Service| Total Length | T +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ E | Identification |Flags| Fragment Offset | R +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ N | Time to Live | Protocol | Header Checksum | Network E +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ T | Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ P | Destination Address | R +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ O | Options | Padding | T +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ E +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Data Link T | DESTINATION MAC H +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ADDRESS | E | DEST MAC | SOURCE MAC ADDRESS | R +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ N | SRC MAC ADDRESS | T Y P E | Physical E +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ T Julien Vehent - jve.linuxwall.info - 2012
  • 5. Linux and sk_buff struct sk_buff { /* These two members must be first. */ Linux stores each struct sk_buff *next; ingress and egress struct sk_buff *prev; struct sock *sk; packet into an struct net_device *dev; struct nf_conntrack *nfct; instance of the struct nf_bridge_info *nf_bridge; union { sk_buff structure. __u32 mark; __u32 dropcount; }; __u32 avail_size; Netfilter applies __u16 vlan_tci; packet filters on the sk_buff_data_t transport_header; sk_buff_data_t network_header; sk_buff structures. sk_buff_data_t mac_header; sk_buff_data_t tail; sk_buff_data_t end; }; sample from <include/linux/skbuff.h> Julien Vehent - jve.linuxwall.info - 2012
  • 6. Netfilter Packet Flow (sane version) application read write Socket INPUT OUTPUT FORWARD PREROUTING POSTROUTING Network Interface P P Julien Vehent - jve.linuxwall.info - 2012
  • 7. Iptables 101 Stateless firewall iptables -A INPUT -p tcp --dport 80 -j ACCEPT iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT Stateful version iptables -I INPUT -p tcp -m conntrack --ctstate ESTABLISHED -j ACCEPT iptables -A INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT Logging iptables -A INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -j LOG --log-prefix “In HTTP ” Julien Vehent - jve.linuxwall.info - 2012
  • 8. Firewall vs Cloud “I like VMs, they are cheap 90s model: “I bought 4 and I can have MANY !” servers , $25k each, and a firewall and it does it all” Versus Of course I have a firewall, it does: iptables -A INPUT -p tcp --dport 80 -j ACCEPT Julien Vehent - jve.linuxwall.info - 2012
  • 9. Netfilter Packet Flow (for real men) http://upload.wikimedia.org/wikipedia/commons/3/37/Netfilter-packet-flow.svg Julien Vehent - jve.linuxwall.info - 2012
  • 10. Introducing Tables filter: default mangle: for packet nat: only traversed on alteration state==NEW raw: to disable conntrack Julien Vehent - jve.linuxwall.info - 2012
  • 11. Tables FILTER: implied when nothing specified iptables -A INPUT -p tcp --dport 80 -j ACCEPT iptables -t filter -A INPUT -p tcp ... RAW: don’t waste ressources on conntrack iptables -t raw -I PREROUTING -i lo -j NOTRACK iptables -t raw -I OUTPUT -o lo -j NOTRACK iptables -t raw -I PREROUTING -p udp --sport 53 -s 8.8.8.8 -j NOTRACK MANGLE: manipulate packets right before transmit iptables -t mangle -A POSTROUTING -o eth0 -p tcp --tcp-flags SYN SYN --dport 443 -j CONNMARK --set-mark 300 Julien Vehent - jve.linuxwall.info - 2012
  • 12. Stateful (conntrack) vs Stateless • Conntrack knows the state of each TCP & UDP connection on the system • When a new packet arrive, conntrack can tell if it is part of an existing connection • Downside: maintaining state information can be expensive for very high traffic system (start worrying around 10,000 packets per second) # grep "dport=22 " /proc/net/ip_conntrack tcp 6 299 ESTABLISHED src=10.1.0.145 dst=10.1.0.25 sport=54656 dport=22 packets=819 bytes=62669 src=10.1.0.25 dst=10.1.0.145 sport=22 dport=54656 packets=436 bytes=251335 [ASSURED] mark=0 secmark=0 use=2 see linux/net/netfilter/nf_conntrack_proto_tcp.c Julien Vehent - jve.linuxwall.info - 2012
  • 13. Some fun with modules • Mangle connection based on their “size” iptables -t mangle -A POSTROUTING -o eth1 -p tcp -m connbytes --connbytes 10000000: --connbytes-mode bytes --connbytes-dir both -j CONNMARK --set-mark 999 $ nc -l 1664 < /dev/zero $ nc 192.168.1.222 1664 > /dev/null # iptables -t mangle -L POSTROUTING -v Chain POSTROUTING (policy ACCEPT 115K packets, 4715K bytes) pkts bytes target prot opt in out source destination 111K 4452K CONNMARK tcp -- any eth0 anywhere anywhere connbytes 10000000:18446744073709551615 connbytes mode bytes connbytes direction both CONNMARK set 0x3e7 # grep mark=999 /proc/net/ip_conntrack tcp 6 299 ESTABLISHED src=10.0.2.15 dst=192.168.1.222 sport=45234 dport=1664 packets=371355 bytes=14854220 src=192.168.1.222 dst=10.0.2.15 sport=1664 dport=45234 packets=415324 bytes=606265294 [ASSURED] mark=999 use=2 Julien Vehent - jve.linuxwall.info - 2012
  • 14. Some fun with modules • Mangle packets based on ASCII strings in the payloads iptables -t filter -A INPUT -i eth1 -p tcp --dport 80 -m string --string "get /admin http/1.1" --icase --algo bm -m conntrack --ctstate ESTABLISHED -j DROP $ nc -l 80 $ nc 192.168.1.222 1664 get /hello+world http/1.1 get /hello+world http/1.1 X get /admin http/1.1 # iptables -t filter -L INPUT -v Chain INPUT (policy ACCEPT 93 packets, 6531 bytes) pkts bytes target prot opt in out source destination 13 936 DROP tcp -- eth1 any anywhere anywhere tcp dpt:http STRING match "get /admin http/1.1" ALGO name bm TO 65535 ICASE ctstate ESTABLISHED Julien Vehent - jve.linuxwall.info - 2012
  • 15. Some fun with modules • Filter SSH on Christmas iptables -t filter -A INPUT -p tcp --dport 22 -m time --datestart "2012-12-25T00:00:00" --datestop "2012-12-25T23:59:59" --utc -j DROP • Mark the packets of a particular user, and Log iptables -t filter -o eth0 -A OUTPUT -p tcp --tcp-flags SYN SYN -m owner --uid-owner 1000 -j CONNMARK --set-mark 1664 iptables -t filter -A OUTPUT -p tcp --tcp-flags SYN SYN -m connmark --mark 1664 -j LOG --log-prefix "Mark 1664 trigerred " Aug 11 04:29:15 firewall1 kernel: [ 9895.696205] Mark 1664 trigerred IN= OUT=eth0 SRC=10.0.2.15 DST=173.194.75.106 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=7270 DF PROTO=TCP SPT=50940 DPT=443 WINDOW=14600 RES=0x00 SYN URGP=0 Julien Vehent - jve.linuxwall.info - 2012
  • 16. Hooks Magic • libnetfilter_queue provides hooks to divert packets from the normal Netfilter flow, into Userland • Use case: record outbound traffic from suspicious user “spongebob” (using https://github.com/jvehent/) iptables -I OUTPUT -m owner --uid-owner $(id -u spongebob) -j NFQUEUE root@ossec:~# ./nfqueue_recorder -o spongebob_record.pcap pcap recording into spongebob_record.pcap opening pcap file at spongebob_record.pcap opening library handle unbinding existing nf_queue handler for AF_INET (if any) binding nfnetlink_queue as nf_queue handler for AF_INET binding this socket to queue '0' setting copy_packet mode -- New packet received -- hw_protocol=0x0000 hook=3 id=0 outdev=2 payload_len=60 bytes IP{v=4; ihl=20; tos=0; tot_len=60; id=15388; ttl=64; protocol=17; saddr=10.0.2.15; daddr=10.0.2.2} UDP{sport=45374; dport=53; len=10240} -- New packet received -- hw_protocol=0x0000 hook=3 id=1 outdev=2 payload_len=60 bytes IP{v=4; ihl=20; tos=0; tot_len=60; id=15391; ttl=64; protocol=17; saddr=10.0.2.15; daddr=10.0.2.2} UDP{sport=47435; dport=53; len=10240} Julien Vehent - jve.linuxwall.info - 2012
  • 17. Hooks Magic application nfqueue write recorder Socket OUTPUT spongebob_ record.pcap POSTROUTING Network Interface P Julien Vehent - jve.linuxwall.info - 2012
  • 18. Better than TCPDump • TCPDump duplicates traffic at the NIC level. • Dump incoming traffic and see packets entering but never reach the application • Place your hook anywhere within you ruleset to verify that packets are coming through application Socket nfqueue display: recorder nothing ! INPUT DROP PREROUTING display: NIC duplicates tcpdump packet packet packet ..... P P P Julien Vehent - jve.linuxwall.info - 2012
  • 19. Recording traffic on /admin at night # ./nfqueue_recorder -o night_admin.pcap pcap recording into night_admin.pcap opening pcap file at night_admin.pcap opening library handle unbinding existing nf_queue handler for AF_INET (if any) binding nfnetlink_queue as nf_queue handler for AF_INET binding this socket to queue '0' setting copy_packet mode iptables -t filter -A INPUT -i eth1 -p tcp --dport 80 -m string --string "get /admin http/1.1" --icase --algo bm -m time --timestart "18:00" --timestop "10:00" --utc -m conntrack --ctstate ESTABLISHED -j CONNMARK --set-mark 666 iptables -t filter -A INPUT -m connmark --mark 666 -j NFQUEUE $ nc 10.16.64.11 80 # nc -l 80 get /spongebobsquarepants http/1.1 get /admin http/1.1 get /spongebob blaaaahhh fooo Julien Vehent - jve.linuxwall.info - 2012
  • 20. IPSets • Netfilter uses linear lookups. Each rule is tested against each packet, until a terminal rule matches the packet. • Lookup time grows linearily. • IPSets provides constant time hash lookup in Netfilter. apt-get install ipset && modprobe ip_set ipset -N droplist nethash ipset --add droplist 192.168.1.0/24 iptables -A INPUT -m set --match-set droplist src -j DROP #! /bin/bash ipset -N droplist nethash wget -q http://www.spamhaus.org/drop/drop.txt -O drop.lasso.$(date +%s) if [ -e drop.lasso.$(date +%s) ]; then ipset --flush droplist for i in $(grep -v -E "^;|^$" drop.lasso.$(date +%s) | awk {'print $1'}); do echo "insert $i to droplist" ipset --add droplist $i done fi Julien Vehent - jve.linuxwall.info - 2012
  • 21. Ipsets: accounting per country • Get the list of IP blocks for each country from https:// www.countryipblocks.net/country_selection.php • Load each country blocks into a separate Ipset Chain INPUT (policy DROP 20 packets, 5942 bytes) pkts bytes target 0 0 COUNTRIES [...] match-set nigeria src 367 25797 COUNTRIES [...] match-set france src 10 440 COUNTRIES [...] match-set china src Julien Vehent - jve.linuxwall.info - 2012
  • 22. Atomic (and fast) Restore • Most people write their firewall rules in a Bash script. It’s the best way to start, until you have thousands of rules. • [ USE IPTABLES-RESTORE ] # iptables -L INPUT -v -n |grep ACCEPT|wc -l 62511 <= that’s 62,511 individual INPUT rules # time iptables-restore < iptables-rules.saved real 0m1.204s user 0m0.450s sys 0m0.720s # time bash rules.iptables.sh real 41m28.277s <= 42 minutes user 12m55.300s sys 32m17.290s <= 32 minutes spent in the kernel Julien Vehent - jve.linuxwall.info - 2012
  • 23. Aweber FireWall • Moving away from the massive entry gate logic • To something a lot more modular node node node node node node node node node node Julien Vehent - jve.linuxwall.info - 2012
  • 24. Aweber FireWall • Completely dynamic. Chef creates inbound/outbound rules for nodes automatically. Convergence takes time. • Whitelist for outbound connections per system user. • Rules are stored in /etc/firewall/rules.iptables -A INPUT -i eth0 -p tcp --dport 80 -s provision -m state --state NEW -j ACCEPT -A INPUT -i eth0 -p tcp --dport 80 -s 10.1.0.228 -m state --state NEW -j ACCEPT -A INPUT -i eth0 -p tcp --dport 80 -s 10.1.0.229 -m state --state NEW -j ACCEPT :www-data - [0:0] -A OUTPUT -m owner --uid-owner 33 -m state --state NEW -j www-data -A www-data -j LOG --log-prefix "AFW_www-data_OUTPUT_DROP " --log-uid -A www-data -j DROP :ntp - [0:0] -A OUTPUT -m owner --uid-owner 104 -m state --state NEW -j ntp -A ntp -o eth0 -p udp --dport 123 -d ntp1 -m state --state NEW -j ACCEPT -A ntp -o eth0 -p udp --dport 123 -d ntp2 -m state --state NEW -j ACCEPT -A ntp -j LOG --log-prefix "DROP_AFW_OUTPUT_ntp " --log-uid --log-tcp-sequence -A ntp -j DROP Julien Vehent - jve.linuxwall.info - 2012
  • 25. Any Question ? Julien Vehent - jve.linuxwall.info - 2012

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n