suricata idps and linux kernel - netdev conf · 1 suricata introduction streaming performance 2...

46
Suricata IDPS and Linux kernel É. Leblond, G. Longo Stamus Networks February 10, 2016 É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 1 / 28 Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Upload: others

Post on 12-Jun-2020

40 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Suricata IDPS and Linux kernel

É. Leblond, G. Longo

Stamus Networks

February 10, 2016

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 1 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 2: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 1 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 3: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 1 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 4: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

What is Suricata

IDS and IPS engineGet it here:http://www.suricata-ids.org

Open Source (GPLv2)Initially publicly funded now funded byconsortium membersRun by Open Information SecurityFoundation (OISF)More information about OISF athttp://www.openinfosecfoundation.org/

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 2 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 5: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Suricata Features

High performance, scalable through multi threadingAdvanced Protocol handling

Protocol recognitionProtocol analysis: field extraction, filtering keywordsTransaction logging in extensible JSON format

File identification, extraction, on the fly MD5 calculationHTTPSMTP

TLS handshake analysis, detect/prevent things like DiginotarLua scripting for detectionHardware acceleration support:

EndaceNapatech,CUDAPF_RING

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 3 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 6: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Suricata capture modes

IDSpcap: multi OS captureaf_packet: Linux high performance on vanilla kernelnetmap: FreeBSD high performanceNFLOG: Netfilter logging

IPSNFQUEUE: Using Netfilter on Linuxipfw: Use divert socket on FreeBSDaf_packet: Level 2 software bridge

Offline analysisPcap: Analyse pcap filesUnix socket: Use Suricata for fast batch processing of pcap files

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 4 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 7: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 4 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 8: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Evasion technics

Fooling detectionGet your activity unnoticedComplete your attack and stay in place

PrincipleSignature-based IDS relay on packet contentModification of traffic could be used to avoid detectionWithout changing the impact of the attack

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 5 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 9: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Play on interpretation issue

OS-based evasionAll OS do not react the same

RFC are incomplete. Improvisations have been made.Variation of traffic for a same flow is possible

Overlapping Fragments

Application-based evasionDifferent servers can treat the same request differently.No web server are treating a twice used argument the same way.

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 6 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 10: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Personnality

PersonnalityIDS implements personnalityIt is possible to associate network and OS typeFor Suricata, HTTP servers can be personnified too.

Suricata configuration

host−os−p o l i c y :# Make the d e f a u l t p o l i c y windows .windows : [ 0 . 0 . 0 . 0 / 0 ]bsd : [ ]bsd−r i g h t : [ ]old−l i n u x : [ ]l i n u x : [ 1 0 . 0 . 0 . 0 / 8 ]

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 7 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 11: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Suricata reconstruction and normalization

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 8 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 12: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 8 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 13: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

A typical signature example

Signature example: Chat facebook

a l e r t h t t p $HOME_NET any −> $EXTERNAL_NET any \(msg : "ET CHAT Facebook Chat ( send message ) " ; \f l ow : es tab l ished , to_server ; content : "POST" ; http_method ; \content : " / a jax / chat / send . php " ; h t t p _ u r i ; content : " facebook . com" ; h t tp_hos t ; \content : " netdev " ; h t t p_c l i en t_body ;re ference : u r l ,www. emerg ingthreats . net / cgi−bin / cvsweb . cg i / s igs / POLICY / POLICY_Facebook_Chat ; \s i d :2010784; rev : 4 ; \

)

This signature tests:The HTTP method: POSTThe page: /ajax/chat/send.phpThe domain: facebook.comThe body content: netdev

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 9 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 14: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

No passthrough

All signatures are inspectedDifferent from a firewallMore than 15000 signatures in standard rulesets

Optimization on detection engineTree pre filtering approach to limit the set of signatures to testMulti pattern matching on some buffers

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 10 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 15: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

CPU intensive

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 11 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 16: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Perf top

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 12 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 17: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Scalability

Bandwith per core is limitedFrom 150Mb/sTo 500Mb/s

ScalingUsing RSSSplitting load on workers

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 13 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 18: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 13 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 19: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 13 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 20: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

AF_PACKET

Linux raw socketRaw packet capture methodSocket based or mmap based

Fanout modeLoad balancing over multiple socketsMultiple load balancing functions

Flow basedCPU basedRSS based

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 14 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 21: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

AF_PACKET

Linux raw socketRaw packet capture methodSocket based or mmap based

Fanout modeLoad balancing over multiple socketsMultiple load balancing functions

Flow basedCPU basedRSS based

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 14 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 22: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Suricata workers mode

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 15 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 23: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

The rollover option

ConceptRing buffer can fill in burst or single flowCapture would gain of splitting single intensive flowRollover mode switch to next socket when ring is full

Problem with Suricata

Suricata reconstructthe streamRollover mode causesreordering of streamMassive accuracy loss

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 16 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 24: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

The rollover option

ConceptRing buffer can fill in burst or single flowCapture would gain of splitting single intensive flowRollover mode switch to next socket when ring is full

Problem with Suricata

Suricata reconstructthe streamRollover mode causesreordering of streamMassive accuracy loss

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 16 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 25: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 16 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 26: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

NFQUEUE

It is used in Suricata to work in IPS mode, performing action likeDROP or ACCEPT on the packets, permitting us to delegate theverdict on the packets.

With NFQUEUE we are able to delegate the verdict on the packetto a userspace software.

The following rules will ask a userspace software connected toqueue 0 for a decision.

nft add filter forward queue num 0iptables -A FORWARD -j NFQUEUE –queue-num 0

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 17 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 27: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

NFQUEUE

The following steps explains how NFQUEUEworks with Suricata in IPS mode:

Incoming packet matched by a rule issent to Suricata through nfnetlinkSuricata receives the packet and issuesa verdict depending on our rulesetThe packet is either trasmitted or rejectedby kernel

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 18 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 28: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

NFQUEUE

NFQUEUE number of packets per second on a single queue islimited due to the nature of nfnetlink communication.

Batching verdict can help but without an efficient improvement.

Starting Suricata with multiple queue could improve it:

s u r i c a t a −c / e tc / s u r i c a t a / s u r i c a t a . yaml −q 0 −q 1

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 19 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 29: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 19 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 30: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 19 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 31: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Stream depth

Attacks characteristicIn most cases attack is done at start of TCP sessionGeneration of requests prior to attack is not commonMultiple requests are often not even possible on same TCPsession

Stream reassembly depthSuricata reassemble TCP sessions tillstream.reassembly.depth bytes.Stream is not analyzed once limit is reached

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 20 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 32: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Introducing offloading

PrincipleNo need to get packet from kernel after stream depth is reachedIf there is

no file storeor other operation

UsageSet stream.offloading option to yes in suricata config file tooffload

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 21 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 33: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 21 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 34: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Implementation

Suricata updateAdd callback functionCapture method register itself and provide a callbackSuricata calls callback when it wants to offload

Coded for NFQUpdate capture register functionWritten callback function

Set a mark with respect to a mask on packetMark is set on packet when issuing the verdict

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 22 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 35: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Implementation

Suricata updateAdd callback functionCapture method register itself and provide a callbackSuricata calls callback when it wants to offload

Coded for NFQUpdate capture register functionWritten callback function

Set a mark with respect to a mask on packetMark is set on packet when issuing the verdict

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 22 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 36: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 22 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 37: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

nftables ruleset

t ab l e i p f i l t e r {chain forward {

type f i l t e r hook forward p r i o r i t y 0 ;# usual r u l e s e t

}

chain ips {type f i l t e r hook forward p r i o r i t y 10;meta mark set c t markmark 0x00000001 acceptqueue num 0

}

chain connmark_save {type f i l t e r hook forward p r i o r i t y 20;c t mark set mark

}}

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 23 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 38: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Results of iperf3 tests

Local testing

<marketing>Local testing with offload is 90 times faster</marketing>

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 24 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 39: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Results of iperf3 tests

Local testing

<marketing>Local testing with offload is 90 times faster</marketing>

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 24 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 40: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Selective offloading

Ignore some trafficIgnore intensive traffic like NetflixCan be done independently of stream depthCan be done using generic or custom signatures

The offload keywordA new offload signature keywordTrigger offloading when signature matchExample of signature

a l e r t h t t p any any −> any any ( content : " netdevconf . org " ; \ \h t tp_hos t ; o f f l o a d ; s id :6666; rev : 1 ; )

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 25 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 41: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Selective offloading

Ignore some trafficIgnore intensive traffic like NetflixCan be done independently of stream depthCan be done using generic or custom signatures

The offload keywordA new offload signature keywordTrigger offloading when signature matchExample of signature

a l e r t h t t p any any −> any any ( content : " netdevconf . org " ; \ \h t tp_hos t ; o f f l o a d ; s id :6666; rev : 1 ; )

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 25 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 42: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 25 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 43: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Implementation for other captures

PossibilitiesAF_PACKETSignaling OpenvswitchCustom HW. . .

ConstraintMethod needs to be fastIt needs to handle

Huge amount of flow/itemsRapid change rate

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 26 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 44: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

1 SuricataIntroductionStreamingPerformance

2 Suricata and Linux kernelAF_PACKETNFQUEUE

3 Suricata and offloadingInterest of offloadingImplementation of frameworkUse it with NFQOther Methods

4 Conclusion

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 26 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 45: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Conclusion

Suricata and LinuxA deep imbricationIDS constraint causes some generic features to failOffloading looks promising

More informationSuricata: http://www.suricata-ids.org/Netfilter: http://www.netfilter.org/Stamus Networks: https://www.stamus-networks.com/

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 27 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)

Page 46: Suricata IDPS and Linux kernel - NetDev conf · 1 Suricata Introduction Streaming Performance 2 Suricata and Linux kernel AF_PACKET NFQUEUE 3 Suricata and offloading Interest of

Questions ?

Contact usÉric Leblond:[email protected] Longo:[email protected]: @regiteric and@theglongohttps://www.stamus-networks.com/

É. Leblond, G. Longo (Stamus Networks) Suricata IDPS and Linux kernel February 10, 2016 28 / 28

Proceedings of NetDev 1.1: The Technical Conference on Linux Networking (February 10th-12th 2016. Seville, Spain)