SlideShare a Scribd company logo
Michael Ducy - @mfdii
Sysdig
Open Source Intro
The Container Intelligence Platform.
Loris Degioanni.
Co-creator of Wireshark, and former CTO at Riverbed.
Open source driven project.
Launched in 2013. 1M+ downloads.
Hundreds of thousands of users.
300+ +300 Enterprise customers.
Ecosystem partners
with OpenShift, Docker, Kubernetes, Mesos, and AWS.
Open by Design. Built for Modern Infrastructure.
Monitoring & Security Platform for Containers.
Open by Design. Built for Modern Infrastructure.
Sysdig: The Container Intelligence Platform
Commercial Sysdig Monitor Sysdig Secure
Open Source Sysdig Sysdig Inspect Sysdig Falco
@mfdii
Sysdig Projects & Products
Sysdig Open Source - https://www.sysdig.com/opensource/
- Sysdig - https://github.com/draios/sysdig
- sysdig
- csysdig
- Sysdig Inspect! https://github.com/draios/sysdig-inspect
- Falco - https://github.com/draios/falco
Sysdig Container Intelligence Platform - https://www.sysdig.com/
- Sysdig Monitor
- Sysdig Secure
Sysdig
- Troubleshooting and Forensics
- Powerful Filter Language ala tcpdump
- Real-time troubleshooting
- Offline troubleshooting
@mfdii
Sysdig Architecture
enter/exit glibc
probe: syscalls
@mfdii
Filtering
- the key for using Sysdig: similar to tcpdump
- filter events (system calls)
- filtering based on field classes
- mixed with operators:
=, !=, <, <=, >, >=, contains, and, or, not
@mfdii
Understanding Sysdig output
1 01:40:19.601363716 1 httpd (7513) > accept
2 01:40:19.601374197 1 httpd (7513) < accept fd=14(<4t>127.0.0.1:39175->127.0.0.1:80)
tuple=127.0.0.1:39175->127.0.0.1:80 queuepct=0
3 01:40:19.601506564 1 httpd (7513) > read fd=14(<4t>127.0.0.1:39175->127.0.0.1:80) size=8000
4 01:40:19.601512497 1 httpd (7513) < read res=85 data=GET /textfile.txt HTTP/1.1..User-Agent: curl/7.35.0..Host:
127.0.0.1..Accept: */
5 01:40:19.601516976 0 httpd (3750) > switch next=0 pgft_maj=0 pgft_min=522 vm_size=350196 vm_rss=9304 vm_swap=0
[...]
Driver Events:354756
Driver Drops:0
Elapsed time: 0.194, Captured Events: 27089, 139915.29 eps
Incremental event number, Event timestamp, CPU number (ID), Process name, Thread ID (as seen by gettid()),
Event direction: > means enter, < means exit, Event type, Event arguments (arguments)
@mfdii
$
What can we filter?
> syscall(SYSCALLID ID, UINT16 nativeID)
< syscall(SYSCALLID ID)
> open()
< open(FD fd, FSPATH name, FLAGS32 flags, UINT32 mode)
> close(FD fd)
< close(ERRNO res)
> read(FD fd, UINT32 size)
< read(ERRNO res, BYTEBUF data)
> write(FD fd, UINT32 size)
< write(ERRNO res, BYTEBUF data)
> socket(FLAGS32 domain, UINT32 type, UINT32 proto)
< socket(FD fd)
> bind(FD fd)
< bind(ERRNO res, SOCKADDR addr)
> connect(FD fd)
< connect(ERRNO res, SOCKTUPLE tuple)
> listen(FD fd, UINT32 backlog)
< listen(ERRNO res)
sysdig -L
@mfdii
$
How can we filter?
----------------------
Field Class: fd
fd.num the unique number identifying the file descriptor.
fd.type type of FD. Can be 'file', 'directory', 'ipv4', 'ipv6', 'unix',
'pipe', 'event', 'signalfd', 'eventpoll', 'inotify' or 'signal
fd'.
fd.typechar type of FD as a single character. Can be 'f' for file, 4 for IP
v4 socket, 6 for IPv6 socket, 'u' for unix socket, p for pipe,
'e' for eventfd, 's' for signalfd, 'l' for eventpoll, 'i' for i
notify, 'o' for unknown.
fd.name FD full name. If the fd is a file, this field contains the full
path. If the FD is a socket, this field contain the connection
tuple.
fd.directory If the fd is a file, the directory that contains it.
fd.filename If the fd is a file, the filename without the path.
fd.ip matches the ip address (client or server) of the fd.
sysdig -l
@mfdii
Field Classes
Based on “Field Classes”. Supported classes include:
fd - File Descriptors
process - Processes
evt - System Events
user - Users
group - Groups
syslog - Syslog messages
container - Container info
fdlist - FD poll events
k8s - Kubernetes events
mesos - Mesos events
span - Start/Stop markers
evtin - Filter based on Spans
@mfdii
File descriptors filters
- files
- network connections (sockets)
- standard input, standard output, and standard error
- pipes
- timers
- signals
Examples:
sysdig fd.type=ipv4
sysdig fd.l4proto=tcp
sysdig fd.sip=127.0.0.1
sysdig fd.sport=39157
@mfdii
Create Captures/Read Captures
Create capture:
sudo sysdig -w filename.scap
Read from capture:
sysdig -r filename.scap
- we can filter on capture time too
- we can read + filter + write again
- capture files contain entire process table but just filtered events:
- to remove it use --filter-proclist
- “-z” compresses the capture
@mfdii
Sysdig Inspect
@mfdii
Sysdig Chisels
- Scripts written in Lua
- Analyze, aggregate and
report on sequences of
events (in a similar fashion
to dtrace)
@mfdii
Sysdig Chisels
List all available chisels:
sysdig -cl
Usage information for a given chisel:
sysdig -i chisel_name
Running a chisel:
sysdig -c chisel_name
https://github.com/draios/sysdig/wiki/Sysdig-Chisel-API-Reference-Manual
@mfdii
$
List available Chisels
Category: Application
---------------------
httplog HTTP requests log
httptop Top HTTP requests
memcachelog memcached requests log
Category: CPU Usage
-------------------
spectrogram Visualize OS latency in real time.
subsecoffset Visualize subsecond offset execution time.
topcontainers_cpu
Top containers by CPU usage
topprocs_cpu Top processes by CPU usage
sysdig -cl
@mfdii
Sysdig Chisels
Application
httplog
- HTTP requests log
httptop
- Top HTTP requests
memcachelog
- memcached requests log
Errors
topcontainers_error
- Top containers by
number of errors
topfiles_errors
- Top files by number of
errors
topprocs_errors
- Top processes by
number of errors
CPU Usage
spectrogram
- Visualize OS latency in real
time.
subsecoffset
- Visualize subsecond offset
execution time.
topcontainers_cpu
- Top containers by CPU usage
topprocs_cpu
- Top processes by CPU usage
@mfdii
I/O
echo_fds
- Print the data read and written by
processes.
fdbytes_by
- I/O bytes, aggregated by an arbitrary filter
field
fdcount_by
- FD count, aggregated by an arbitrary filter
field
fdtime_by
- FD time group by
Sysdig Chisels
I/O
iobytes
- Sum of I/O bytes on any type of FD
iobytes_file
- Sum of file I/O bytes
spy_file
- Echo any read/write made by any process
to all files or a specific file passed as an
option.
@mfdii
I/O
stderr
- Print stderr of processes
stdin
- Print stdin of processes
stdout
- Print stdout of processes
Sysdig Chisels
I/O
topcontainers_file
- Top containers by R+W disk bytes
topfiles_bytes
- Top files by R+W bytes
topfiles_time
- Top files by time
topprocs_file
- Top processes by R+W disk bytes
@mfdii
Sysdig Chisels
Logs
spy_logs
- Echo any write made by any
process to a log file.
Optionally, export the events
around each log message to
file.
spy_syslog
- Print every message written
to syslog. Optionally, export
the events around each
syslog message to file.
Security
list_login_shells
- List the login shell IDs
shellshock_detect
- print shellshock attacks
spy_users
- Display interactive user
activity
Misc
around
- Export to file the events
around the time range where
the given filter matches.
@mfdii
Sysdig Chisels
Networking
iobytes_net
- Show total network I/O bytes
spy_ip
- Show the data exchanged with the
given IP address
spy_port
- Show the data exchanged using
the given IP port number
topconns
- Top network connections by total
bytes
topcontainers_net
- Top containers by network I/O
topports_server
- Top TCP/UDP server ports by R+W
bytes
topprocs_net
- Top processes by network I/O
@mfdii
Sysdig Chisels
Performance
bottlenecks
- Slowest system calls
fileslower
- Trace slow file I/O
netlower
- Trace slow network I/0
proc_exec_time
- Show process execution time
scallslower
- Trace slow syscalls
topscalls
- Top system calls by number of calls
topscalls_time
- Top system calls by time
@mfdii
Sysdig Chisels
System State
lscontainers
- List the running containers
lsof
- List (and optionally filter) the open file descriptors.
netstat
- List (and optionally filter) network connections.
ps
- List (and optionally filter) the machine processes.
@mfdii
Other useful Chisels
sudo sysdig -pc -c topcontainers_net
● Top containers by network I/O
sudo sysdig -pc -c topprocs_net
● Top processes by network I/O
sudo sysdig -c topcontainers_file
● Top containers by R+W disk bytes
sudo sysdig -pc -c topprocs_file
● Top processes by R+W disk bytes
@mfdii
What is Falco?
A behavioral activity monitor
•Detects suspicious activity defined by a set of rules
•Uses Sysdig’s flexible and powerful filtering expressions
With full support for containers/orchestration
•Utilizes sysdig’s container & orchestrator support
And flexible notification methods
•Alert to files, standard output, syslog, programs
Open Source
•Anyone can contribute rules or improvements
@mfdii
Quick examples
A shell is run in a container container.id != host and proc.name = bash
Overwrite system binaries
fd.directory in (/bin, /sbin, /usr/bin, /usr/sbin)
and write
Container namespace change
evt.type = setns and not proc.name in
(docker, sysdig)
Non-device files written in /dev
(evt.type = create or evt.arg.flags contains O_CREAT)
and proc.name != blkid and fd.directory = /dev and
fd.name != /dev/null
Process tries to access camera
evt.type = open and fd.name = /dev/video0
and not proc.name in (skype, webex)
@mfdii
Falco architecture
falco_probe
Kernel
Module
Kernel
User
Syscalls
Sysdig Libraries
`
Events
Alerting
Falco Rules
Suspicious
Events File
Syslog
Stdout
Filter Expression
Shell
@mfdii
Falco Rules
25 common rules available OOTB
Focused on common container best practices:
■ Writing files in bin or etc directories
■ Reading sensitive files
■ Binaries being executed other than CMD/ENTRYPOINT
@mfdii
Falco rules
.yaml file containing Macros, Lists, and Rules
- macro: bin_dir
condition: fd.directory in (/bin, /sbin, /usr/bin, /usr/sbin)
- list: shell_binaries
items: [bash, csh, ksh, sh, tcsh, zsh, dash]
- rule: write_binary_dir
desc: an attempt to write to any file below a set of binary directories
condition: bin_dir and evt.dir = < and open_write and not package_mgmt_procs
output: "File below a known binary directory opened for writing
(user=%user.name command=%proc.cmdline file=%fd.name)"
priority: WARNING
@mfdii
Falco rules
Rules
• name: used to identify rule
• desc: description of rule
• condition: filter expression, can contain macro
references
• output: message to emit when rule triggers,
can contain formatted info from event
• priority: severity of rule (WARNING, INFO, etc.)
Macros
• name: text to use in later rules
• condition: filter expression
snippet
Lists
• name: text to use later
• items: list of items
@mfdii
Sysdig Projects & Products
Sysdig Open Source - https://www.sysdig.com/opensource/
- Sysdig - https://github.com/draios/sysdig
- sysdig
- csysdig
- Sysdig Inspect! https://github.com/draios/sysdig-inspect
- Falco - https://github.com/draios/falco
Sysdig Container Intelligence Platform - https://www.sysdig.com/
- Sysdig Monitor
- Sysdig Secure
@mfdii
Thank You!
Michael Ducy - @mfdii

More Related Content

PPTX
Open source security tools for Kubernetes.
PDF
Securing your Container Environment with Open Source
PDF
Sysdig Tokyo Meetup 2018 02-27
PDF
Advanced Evasion Techniques by Win32/Gapz
PPTX
Find the Hacker
PDF
Veer's Container Security
PDF
5 Ways to Secure Your Containers for Docker and Beyond
PPTX
Rooted2020 roapt evil-mass_storage_-_tu-ya_aqui_-_david_reguera_-_abel_valero
Open source security tools for Kubernetes.
Securing your Container Environment with Open Source
Sysdig Tokyo Meetup 2018 02-27
Advanced Evasion Techniques by Win32/Gapz
Find the Hacker
Veer's Container Security
5 Ways to Secure Your Containers for Docker and Beyond
Rooted2020 roapt evil-mass_storage_-_tu-ya_aqui_-_david_reguera_-_abel_valero

What's hot (20)

PDF
Docker Security - Secure Container Deployment on Linux
PPTX
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
PPTX
Container security
PPTX
How to Secure Containers
PDF
Behavioural activity monitoring on CoreOS with Sysdig Falco
PDF
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru Otsuka
PDF
Security on a Container Platform
PDF
Inside the Matrix,How to Build Transparent Sandbox for Malware Analysis
PDF
Docker Runtime Security
PDF
Kali tools list with short description
PDF
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
PDF
Self Introduction & The Story that I Tried to Make Sayonara ROP Chain in Linux
PDF
Rooting Out Root: User namespaces in Docker
PDF
Mem forensic
PPTX
Injection on Steroids: Codeless code injection and 0-day techniques
PPTX
Code Injection in Windows
PDF
WTF my container just spawned a shell!
PDF
Kubernetes 101 for_penetration_testers_-_null_mumbai
PDF
Security of Linux containers in the cloud
PDF
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
Docker Security - Secure Container Deployment on Linux
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
Container security
How to Secure Containers
Behavioural activity monitoring on CoreOS with Sysdig Falco
Take a Jailbreak -Stunning Guards for iOS Jailbreak- by Kaoru Otsuka
Security on a Container Platform
Inside the Matrix,How to Build Transparent Sandbox for Malware Analysis
Docker Runtime Security
Kali tools list with short description
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Self Introduction & The Story that I Tried to Make Sayonara ROP Chain in Linux
Rooting Out Root: User namespaces in Docker
Mem forensic
Injection on Steroids: Codeless code injection and 0-day techniques
Code Injection in Windows
WTF my container just spawned a shell!
Kubernetes 101 for_penetration_testers_-_null_mumbai
Security of Linux containers in the cloud
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
Ad

Similar to Sysdig Open Source Intro (20)

PPTX
Sysdig - Introducing a new definition of Monitoring
PDF
Sysdig
PDF
Monitoring microservices: Docker, Mesos and Kubernetes visibility at scale
PPTX
Container Monitoring with Sysdig
PDF
Hotsos Advanced Linux Tools
PDF
Implementing Active Security with Sysdig Falco - Docker Meetup Barcelona
PDF
unixtoolbox
PDF
KCC_Final.pdf
PDF
Jana treek 4
PDF
Implementing Active Security with Sysdig Falco - Barcelona Software Crafters
PDF
2345014 unix-linux-bsd-cheat-sheets-i
PPT
Leveraging Open Source to Manage SAN Performance
PDF
Basic solaris 10 system administration commands
PDF
Inspection and maintenance tools (Linux / OpenStack)
PDF
INFINISTORE(tm) - Scalable Open Source Storage Arhcitecture
PDF
Image Scanning Best Practices for Containers and Kubernetes
PDF
Securing your Kubernetes applications
PDF
Falco docker barcelona
PPTX
Sysdig Meetup - San Francisco, December 2014
PPTX
You're monitoring Kubernetes Wrong
Sysdig - Introducing a new definition of Monitoring
Sysdig
Monitoring microservices: Docker, Mesos and Kubernetes visibility at scale
Container Monitoring with Sysdig
Hotsos Advanced Linux Tools
Implementing Active Security with Sysdig Falco - Docker Meetup Barcelona
unixtoolbox
KCC_Final.pdf
Jana treek 4
Implementing Active Security with Sysdig Falco - Barcelona Software Crafters
2345014 unix-linux-bsd-cheat-sheets-i
Leveraging Open Source to Manage SAN Performance
Basic solaris 10 system administration commands
Inspection and maintenance tools (Linux / OpenStack)
INFINISTORE(tm) - Scalable Open Source Storage Arhcitecture
Image Scanning Best Practices for Containers and Kubernetes
Securing your Kubernetes applications
Falco docker barcelona
Sysdig Meetup - San Francisco, December 2014
You're monitoring Kubernetes Wrong
Ad

More from Michael Ducy (20)

PDF
Automating Security Response with Serverless
PDF
Rethinking Open Source in the Age of Cloud
PDF
Container Runtime Security with Falco
PDF
DevOps in a Cloud Native World
PDF
Monitoring & Securing Microservices in Kubernetes
PDF
Principles of Monitoring Microservices
PDF
Survey of Container Build Tools
PDF
Monoliths, Myths, and Microservices - CfgMgmtCamp
PDF
Monoliths, Myths, and Microservices
PPTX
Why Pipelines Matter
PPTX
The Future of Everything
PPTX
Improving Goat Production
PDF
Changing the Way Development and Operations Works
PDF
CloudStack Day 14 - Automation: The Key to Hybrid Cloud
PPTX
The Road to Hybrid Cloud is Paved with Automation
PPTX
The Velocity of Bureaucracy
PPTX
The Goat and the Silo
PPTX
Little Tech, Big Impact - Monktoberfest 2013
PPT
Object, measure thyself
PPTX
DevOps Columbus Meetup Kickoff - Infrastructure as Code
Automating Security Response with Serverless
Rethinking Open Source in the Age of Cloud
Container Runtime Security with Falco
DevOps in a Cloud Native World
Monitoring & Securing Microservices in Kubernetes
Principles of Monitoring Microservices
Survey of Container Build Tools
Monoliths, Myths, and Microservices - CfgMgmtCamp
Monoliths, Myths, and Microservices
Why Pipelines Matter
The Future of Everything
Improving Goat Production
Changing the Way Development and Operations Works
CloudStack Day 14 - Automation: The Key to Hybrid Cloud
The Road to Hybrid Cloud is Paved with Automation
The Velocity of Bureaucracy
The Goat and the Silo
Little Tech, Big Impact - Monktoberfest 2013
Object, measure thyself
DevOps Columbus Meetup Kickoff - Infrastructure as Code

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Electronic commerce courselecture one. Pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Cloud computing and distributed systems.
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Encapsulation_ Review paper, used for researhc scholars
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
A Presentation on Artificial Intelligence
Electronic commerce courselecture one. Pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
“AI and Expert System Decision Support & Business Intelligence Systems”
20250228 LYD VKU AI Blended-Learning.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
Cloud computing and distributed systems.
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
cuic standard and advanced reporting.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Encapsulation_ Review paper, used for researhc scholars

Sysdig Open Source Intro

  • 1. Michael Ducy - @mfdii Sysdig Open Source Intro
  • 3. Loris Degioanni. Co-creator of Wireshark, and former CTO at Riverbed. Open source driven project. Launched in 2013. 1M+ downloads. Hundreds of thousands of users. 300+ +300 Enterprise customers. Ecosystem partners with OpenShift, Docker, Kubernetes, Mesos, and AWS. Open by Design. Built for Modern Infrastructure.
  • 4. Monitoring & Security Platform for Containers.
  • 5. Open by Design. Built for Modern Infrastructure. Sysdig: The Container Intelligence Platform Commercial Sysdig Monitor Sysdig Secure Open Source Sysdig Sysdig Inspect Sysdig Falco
  • 6. @mfdii Sysdig Projects & Products Sysdig Open Source - https://www.sysdig.com/opensource/ - Sysdig - https://github.com/draios/sysdig - sysdig - csysdig - Sysdig Inspect! https://github.com/draios/sysdig-inspect - Falco - https://github.com/draios/falco Sysdig Container Intelligence Platform - https://www.sysdig.com/ - Sysdig Monitor - Sysdig Secure
  • 7. Sysdig - Troubleshooting and Forensics - Powerful Filter Language ala tcpdump - Real-time troubleshooting - Offline troubleshooting
  • 9. @mfdii Filtering - the key for using Sysdig: similar to tcpdump - filter events (system calls) - filtering based on field classes - mixed with operators: =, !=, <, <=, >, >=, contains, and, or, not
  • 10. @mfdii Understanding Sysdig output 1 01:40:19.601363716 1 httpd (7513) > accept 2 01:40:19.601374197 1 httpd (7513) < accept fd=14(<4t>127.0.0.1:39175->127.0.0.1:80) tuple=127.0.0.1:39175->127.0.0.1:80 queuepct=0 3 01:40:19.601506564 1 httpd (7513) > read fd=14(<4t>127.0.0.1:39175->127.0.0.1:80) size=8000 4 01:40:19.601512497 1 httpd (7513) < read res=85 data=GET /textfile.txt HTTP/1.1..User-Agent: curl/7.35.0..Host: 127.0.0.1..Accept: */ 5 01:40:19.601516976 0 httpd (3750) > switch next=0 pgft_maj=0 pgft_min=522 vm_size=350196 vm_rss=9304 vm_swap=0 [...] Driver Events:354756 Driver Drops:0 Elapsed time: 0.194, Captured Events: 27089, 139915.29 eps Incremental event number, Event timestamp, CPU number (ID), Process name, Thread ID (as seen by gettid()), Event direction: > means enter, < means exit, Event type, Event arguments (arguments)
  • 11. @mfdii $ What can we filter? > syscall(SYSCALLID ID, UINT16 nativeID) < syscall(SYSCALLID ID) > open() < open(FD fd, FSPATH name, FLAGS32 flags, UINT32 mode) > close(FD fd) < close(ERRNO res) > read(FD fd, UINT32 size) < read(ERRNO res, BYTEBUF data) > write(FD fd, UINT32 size) < write(ERRNO res, BYTEBUF data) > socket(FLAGS32 domain, UINT32 type, UINT32 proto) < socket(FD fd) > bind(FD fd) < bind(ERRNO res, SOCKADDR addr) > connect(FD fd) < connect(ERRNO res, SOCKTUPLE tuple) > listen(FD fd, UINT32 backlog) < listen(ERRNO res) sysdig -L
  • 12. @mfdii $ How can we filter? ---------------------- Field Class: fd fd.num the unique number identifying the file descriptor. fd.type type of FD. Can be 'file', 'directory', 'ipv4', 'ipv6', 'unix', 'pipe', 'event', 'signalfd', 'eventpoll', 'inotify' or 'signal fd'. fd.typechar type of FD as a single character. Can be 'f' for file, 4 for IP v4 socket, 6 for IPv6 socket, 'u' for unix socket, p for pipe, 'e' for eventfd, 's' for signalfd, 'l' for eventpoll, 'i' for i notify, 'o' for unknown. fd.name FD full name. If the fd is a file, this field contains the full path. If the FD is a socket, this field contain the connection tuple. fd.directory If the fd is a file, the directory that contains it. fd.filename If the fd is a file, the filename without the path. fd.ip matches the ip address (client or server) of the fd. sysdig -l
  • 13. @mfdii Field Classes Based on “Field Classes”. Supported classes include: fd - File Descriptors process - Processes evt - System Events user - Users group - Groups syslog - Syslog messages container - Container info fdlist - FD poll events k8s - Kubernetes events mesos - Mesos events span - Start/Stop markers evtin - Filter based on Spans
  • 14. @mfdii File descriptors filters - files - network connections (sockets) - standard input, standard output, and standard error - pipes - timers - signals Examples: sysdig fd.type=ipv4 sysdig fd.l4proto=tcp sysdig fd.sip=127.0.0.1 sysdig fd.sport=39157
  • 15. @mfdii Create Captures/Read Captures Create capture: sudo sysdig -w filename.scap Read from capture: sysdig -r filename.scap - we can filter on capture time too - we can read + filter + write again - capture files contain entire process table but just filtered events: - to remove it use --filter-proclist - “-z” compresses the capture
  • 17. @mfdii Sysdig Chisels - Scripts written in Lua - Analyze, aggregate and report on sequences of events (in a similar fashion to dtrace)
  • 18. @mfdii Sysdig Chisels List all available chisels: sysdig -cl Usage information for a given chisel: sysdig -i chisel_name Running a chisel: sysdig -c chisel_name https://github.com/draios/sysdig/wiki/Sysdig-Chisel-API-Reference-Manual
  • 19. @mfdii $ List available Chisels Category: Application --------------------- httplog HTTP requests log httptop Top HTTP requests memcachelog memcached requests log Category: CPU Usage ------------------- spectrogram Visualize OS latency in real time. subsecoffset Visualize subsecond offset execution time. topcontainers_cpu Top containers by CPU usage topprocs_cpu Top processes by CPU usage sysdig -cl
  • 20. @mfdii Sysdig Chisels Application httplog - HTTP requests log httptop - Top HTTP requests memcachelog - memcached requests log Errors topcontainers_error - Top containers by number of errors topfiles_errors - Top files by number of errors topprocs_errors - Top processes by number of errors CPU Usage spectrogram - Visualize OS latency in real time. subsecoffset - Visualize subsecond offset execution time. topcontainers_cpu - Top containers by CPU usage topprocs_cpu - Top processes by CPU usage
  • 21. @mfdii I/O echo_fds - Print the data read and written by processes. fdbytes_by - I/O bytes, aggregated by an arbitrary filter field fdcount_by - FD count, aggregated by an arbitrary filter field fdtime_by - FD time group by Sysdig Chisels I/O iobytes - Sum of I/O bytes on any type of FD iobytes_file - Sum of file I/O bytes spy_file - Echo any read/write made by any process to all files or a specific file passed as an option.
  • 22. @mfdii I/O stderr - Print stderr of processes stdin - Print stdin of processes stdout - Print stdout of processes Sysdig Chisels I/O topcontainers_file - Top containers by R+W disk bytes topfiles_bytes - Top files by R+W bytes topfiles_time - Top files by time topprocs_file - Top processes by R+W disk bytes
  • 23. @mfdii Sysdig Chisels Logs spy_logs - Echo any write made by any process to a log file. Optionally, export the events around each log message to file. spy_syslog - Print every message written to syslog. Optionally, export the events around each syslog message to file. Security list_login_shells - List the login shell IDs shellshock_detect - print shellshock attacks spy_users - Display interactive user activity Misc around - Export to file the events around the time range where the given filter matches.
  • 24. @mfdii Sysdig Chisels Networking iobytes_net - Show total network I/O bytes spy_ip - Show the data exchanged with the given IP address spy_port - Show the data exchanged using the given IP port number topconns - Top network connections by total bytes topcontainers_net - Top containers by network I/O topports_server - Top TCP/UDP server ports by R+W bytes topprocs_net - Top processes by network I/O
  • 25. @mfdii Sysdig Chisels Performance bottlenecks - Slowest system calls fileslower - Trace slow file I/O netlower - Trace slow network I/0 proc_exec_time - Show process execution time scallslower - Trace slow syscalls topscalls - Top system calls by number of calls topscalls_time - Top system calls by time
  • 26. @mfdii Sysdig Chisels System State lscontainers - List the running containers lsof - List (and optionally filter) the open file descriptors. netstat - List (and optionally filter) network connections. ps - List (and optionally filter) the machine processes.
  • 27. @mfdii Other useful Chisels sudo sysdig -pc -c topcontainers_net ● Top containers by network I/O sudo sysdig -pc -c topprocs_net ● Top processes by network I/O sudo sysdig -c topcontainers_file ● Top containers by R+W disk bytes sudo sysdig -pc -c topprocs_file ● Top processes by R+W disk bytes
  • 28. @mfdii What is Falco? A behavioral activity monitor •Detects suspicious activity defined by a set of rules •Uses Sysdig’s flexible and powerful filtering expressions With full support for containers/orchestration •Utilizes sysdig’s container & orchestrator support And flexible notification methods •Alert to files, standard output, syslog, programs Open Source •Anyone can contribute rules or improvements
  • 29. @mfdii Quick examples A shell is run in a container container.id != host and proc.name = bash Overwrite system binaries fd.directory in (/bin, /sbin, /usr/bin, /usr/sbin) and write Container namespace change evt.type = setns and not proc.name in (docker, sysdig) Non-device files written in /dev (evt.type = create or evt.arg.flags contains O_CREAT) and proc.name != blkid and fd.directory = /dev and fd.name != /dev/null Process tries to access camera evt.type = open and fd.name = /dev/video0 and not proc.name in (skype, webex)
  • 31. @mfdii Falco Rules 25 common rules available OOTB Focused on common container best practices: ■ Writing files in bin or etc directories ■ Reading sensitive files ■ Binaries being executed other than CMD/ENTRYPOINT
  • 32. @mfdii Falco rules .yaml file containing Macros, Lists, and Rules - macro: bin_dir condition: fd.directory in (/bin, /sbin, /usr/bin, /usr/sbin) - list: shell_binaries items: [bash, csh, ksh, sh, tcsh, zsh, dash] - rule: write_binary_dir desc: an attempt to write to any file below a set of binary directories condition: bin_dir and evt.dir = < and open_write and not package_mgmt_procs output: "File below a known binary directory opened for writing (user=%user.name command=%proc.cmdline file=%fd.name)" priority: WARNING
  • 33. @mfdii Falco rules Rules • name: used to identify rule • desc: description of rule • condition: filter expression, can contain macro references • output: message to emit when rule triggers, can contain formatted info from event • priority: severity of rule (WARNING, INFO, etc.) Macros • name: text to use in later rules • condition: filter expression snippet Lists • name: text to use later • items: list of items
  • 34. @mfdii Sysdig Projects & Products Sysdig Open Source - https://www.sysdig.com/opensource/ - Sysdig - https://github.com/draios/sysdig - sysdig - csysdig - Sysdig Inspect! https://github.com/draios/sysdig-inspect - Falco - https://github.com/draios/falco Sysdig Container Intelligence Platform - https://www.sysdig.com/ - Sysdig Monitor - Sysdig Secure