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

Clean up privileged/sens mount container rules #651

Merged
merged 4 commits into from
Jun 11, 2019

Conversation

mstemm
Copy link
Contributor

@mstemm mstemm commented Jun 6, 2019

Previously, the exceptions for Launch Privileged Container/Launch
Sensitive Mount Container came from a list of "trusted" images and/or a
macro that defined "trusted" containers. We want more fine-grained
control over the exceptions for these rules, so split them into
exception lists/macros that are specific to each rule. This defines:

  • privileged_images: only those images that are known to require
    privileged=true
  • privileged_containers: uses privileged_images and (for now) still
    allows all openshift images
  • user_privileged_containers: allows user exceptions
  • sensitive_mount_images: only those images that are known to perform
    sensitive mounts
  • sensitive_mount_containers: uses sensitive_mount_images
  • user_sensitive_mount_containers: allows user exceptions

For backwards compatibility purposes only, we keep the trusted_images
list and user_trusted_containers macro and they are still used as
exceptions for both rules. Comments recommend using the more
fine-grained alternatives, though.

While defining these lists, also do another survey to see if they still
require these permissions and remove them if they didn't.

Removed:

  • quay.io/coreos/flannel
  • consul

Moved to sensitive mount only:

  • gcr.io/google_containers/hyperkube
  • datadog
  • gliderlabs/logspout

Finally, get rid of the k8s audit-specific lists of privileged/sensitive
mount images, relying on the ones in falco_rules.yaml.

Refactor rules/exception lists for sensitive mount, privileged, hostnetwork images to have separate lists for each instead of a combined "trusted" list that was used for all three.

@mstemm mstemm requested review from Kaizhe and fntlnz June 6, 2019 18:22
rules/k8s_audit_rules.yaml Outdated Show resolved Hide resolved
rules/falco_rules.yaml Show resolved Hide resolved
rules/falco_rules.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@Kaizhe Kaizhe left a comment

Choose a reason for hiding this comment

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

lgtm

@fntlnz fntlnz requested review from fntlnz, leodido and Kaizhe June 8, 2019 01:10
@mstemm mstemm force-pushed the granular-container-exceptions branch 2 times, most recently from 2547439 to 3483920 Compare June 10, 2019 23:31
@fntlnz
Copy link
Contributor

fntlnz commented Jun 11, 2019

/auto-cc

@fntlnz
Copy link
Contributor

fntlnz commented Jun 11, 2019

/check-dco

@fntlnz
Copy link
Contributor

fntlnz commented Jun 11, 2019

/lgtm

@poiana
Copy link
Contributor

poiana commented Jun 11, 2019

LGTM label has been added.

Git tree hash: 860948a72a1dbeff53d3417e3febf07a3124aa64

@fntlnz
Copy link
Contributor

fntlnz commented Jun 11, 2019

/auto-cc

@fntlnz
Copy link
Contributor

fntlnz commented Jun 11, 2019

/approve

@fntlnz fntlnz changed the title Clean up privileged/sens mount container rules wip: Clean up privileged/sens mount container rules Jun 11, 2019
@Kaizhe
Copy link
Contributor

Kaizhe commented Jun 11, 2019

/lgtm

@poiana
Copy link
Contributor

poiana commented Jun 11, 2019

LGTM label has been added.

Git tree hash: 3d734d9ae6aa2d326167b9e65ab0fa944e0bb762

mstemm added 4 commits June 11, 2019 11:02
Previously, the exceptions for Launch Privileged Container/Launch
Sensitive Mount Container came from a list of "trusted" images and/or a
macro that defined "trusted" containers. We want more fine-grained
control over the exceptions for these rules, so split them into
exception lists/macros that are specific to each rule. This defines:

 - falco_privileged_images: only those images that are known to require
   privileged=true
 - falco_privileged_containers: uses privileged_images and (for now) still
   allows all openshift images
 - user_privileged_containers: allows user exceptions
 - falco_sensitive_mount_images: only thoe images that are known to perform
   sensitive mounts
 - falco_sensitive_mount_containers: uses sensitive_mount_images
 - user_sensitive_mount_containers: allows user exceptions

For backwards compatibility purposes only, we keep the trusted_images
list and user_trusted_containers macro and they are still used as
exceptions for both rules. Comments recommend using the more
fine-grained alternatives, though.

While defining these lists, also do another survey to see if they still
require these permissions and remove them if they didn't. Removed:
 - quay.io/coreos/flannel
 - consul

Moved to sensitive mount only:
 - gcr.io/google_containers/hyperkube
 - datadog
 - gliderlabs/logspout

Finally, get rid of the k8s audit-specific lists of privileged/sensitive
mount images, relying on the ones in falco_rules.yaml.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
Define macros k8s_audit_always_true/k8s_audit_never_true that work for
k8s audit events. Use them in macros that were asserting true/false values.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
Start using a falco_ prefix for falco-provided lists/macros. Not
changing existing object names to retain compatibility.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
The main changes are to use falco_rules.yaml when using
k8s_audit_rules.yaml, as it now depends on it, and to modify one of the
tests to add granular exceptions instead of a single trusted list.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
@Kaizhe
Copy link
Contributor

Kaizhe commented Jun 11, 2019

/approve

@fntlnz
Copy link
Contributor

fntlnz commented Jun 11, 2019

/lgtm

@poiana
Copy link
Contributor

poiana commented Jun 11, 2019

LGTM label has been added.

Git tree hash: 1b17481992bc2fa6d52d34f9f8311b03ce2f6ccc

@poiana poiana added the lgtm label Jun 11, 2019
@poiana
Copy link
Contributor

poiana commented Jun 11, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fntlnz, Kaizhe, leodido

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit 56324d0 into dev Jun 11, 2019
@poiana poiana deleted the granular-container-exceptions branch June 11, 2019 18:06
@fntlnz fntlnz changed the title wip: Clean up privileged/sens mount container rules Clean up privileged/sens mount container rules Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants