Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for container metaevent to detect container spawning #405

Closed
wants to merge 1 commit into from

Conversation

mattpag
Copy link
Contributor

@mattpag mattpag commented Aug 10, 2018

A new macro container_started contains both the new and the old check.
Also, returns true only for execve enter events with vpid=1, not for both directions.

This depends on draios/sysdig#1190.

Create a new macro "container_started" to check both the old and
the new check.
Also, only look for execve exit events with vpid=1.
@mattpag mattpag requested a review from mstemm August 10, 2018 21:40
Copy link
Contributor

@mstemm mstemm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. As we discussed, this could lead to multiple events as both conditions for container_started can occur for different events, based on the timing between the execve with pid=1 and the container event. Once draios/sysdig#1190 is merged, I'd like to try it out a bit to see if I can eliminate the double event in some way in the falco engine. I'll keep this open for a bit first.

@@ -299,6 +299,9 @@
- macro: container
condition: container.id != host

- macro: container_started
condition: (evt.type = container or (evt.type=execve and evt.dir=< and proc.vpid=1))
Copy link
Contributor

@Kaizhe Kaizhe Nov 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to drop a note here, if the container is brought up with flag --pid=host or --pid=<container id or name>, the vpid wont be equal to 1. For more reference: https://docs.docker.com/engine/reference/run/#imagedigest

Or is container.id != host good enough to determine whether it is a container?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah container.id = host allows you to know that you're in a container. proc.vpid=1 was the best way we had to denote that a container was started. Now we'll have a more reliable way using the container event.

@mfdii
Copy link
Member

mfdii commented Feb 2, 2019

@mattpag @mstemm What's the status on this? Can we merge?

@mstemm
Copy link
Contributor

mstemm commented Feb 4, 2019

We need to wait, the related sysdig code wasn't ever merged and now there's a new approach for emitting container events: draios/sysdig#1283. That work needs to complete and we also need to change sysdig to emit "container" events when containers are created.

@mstemm
Copy link
Contributor

mstemm commented Mar 7, 2019

Closing in favor of #550. I cherry-picked the commit from this PR to #550.

@mstemm mstemm closed this Mar 7, 2019
@fntlnz fntlnz deleted the support-cont-metaevent branch April 7, 2020 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants