Commit Graph

1374 Commits

Author SHA1 Message Date
Lorenzo Fontana
6c5554ca8b docs: add PR 906 to changelog for 0.18.0
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-10-31 12:32:39 +01:00
Lorenzo Fontana
d5e505165a docs: update changelog to 0.18.0
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-10-31 12:32:39 +01:00
Lorenzo Fontana
76b263269f docs(integrations): bump version to 0.18.0
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-10-31 12:32:39 +01:00
Lorenzo Fontana
eae65475e0 docs(docker): version bump to 0.18.0
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-10-31 12:32:39 +01:00
Mark Stemm
023f510a75 Don't pop excess values from stack
The call to rule_loader.load_rules only returns 2 values, so only pop
two values from the stack. This fixes #906.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-30 08:52:46 +01:00
kaizhe
b38db99449 rules update: add calico/node to trusted privileged container list; add calico_node_write_envvars macro to exception list of write below etc
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-10-25 15:18:32 +02:00
Mark Stemm
daec9cb30d Use falcoctl 0.0.4+ tests for space/dash psp names
Use falcoctl, which properly handles psp names containing
spaces/dashes. Also add tests that verify that the resulting rules are
valid.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-25 01:57:00 +02:00
kaizhe
5c61276695 rules update: expand list allowed_k8s_users
Signed-off-by: kaizhe <derek0405@gmail.com>

add comments

Signed-off-by: kaizhe <derek0405@gmail.com>
2019-10-24 13:46:23 +02:00
Mark Stemm
d21e69cf9a Use falcoctl 0.0.3 w/ unique names
Use the changes in https://github.com/falcosecurity/falcoctl/pull/25
that make sure rules, macros, lists, and rule names all have a unique
prefix. In this case the prefix is based on the psp name, so make sure
the psp name actually reflects what it does--there were a few
cut-and-paste carryovers.

This test assumes that falcoctl will be tagged/released as 0.0.3--the
tests won't pass until the falcoctl PR is merged and there's a release.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-23 10:45:03 -07:00
Mark Stemm
3fafac342b Add backward compat test for v4 k8s audit
Add tests that verify that this falco is backwards compatible with the
v4 k8s audit rules file. It includes tests for:

 - checking images by repository/image:
   ka.req.container.image/ka.req.container.image.repository
 - checking privileged status of any container in a pod:
   ka.req.container.privileged
 - checking host_network: ka.req.container.host_network

The tests were copied from the v5 versions of the tests, when necessary
adding back v4-compatible versions of macros like
allowed_k8s_containers.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-21 08:09:28 -07:00
Mark Stemm
ccb3cc13b4 Make engine v5 backward compatible w/ v4 rules
As a part of the changes in
https://github.com/falcosecurity/falco/pull/826/, we added several
breaking changes to rules files like renaming/removing some filter
fields. This isn't ideal for customers who are using their own rules
files.

We shouldn't break older rules files in this way, so add some minimal
backwards compatibility which adds back the fields that were
removed *and* actually used in k8s_audit_rules.yaml. They have the same
functionality as before. One exception is
ka.req.binding.subject.has_name, which was only used in a single output
field for debugging and shouldn't have been in the rules file in the
first place. This always returns the string "N/A".

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-21 08:09:28 -07:00
Mark Stemm
b4fdaa3544 Use falcoctl for psp conversion
Instead of using a psp_conv binary built in the falco build, download
falcoctl 0.0.2 and use its "falcoctl convert psp" subcommand to perform
the conversion.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-15 19:45:31 +02:00
Mark Stemm
89121527da Add automated tests for K8s PSP Support
Add ~74 new automated tests that verify K8s PSP Support.

For each PSP attribute, add both positive and negative test cases. For
some of the more complicated attributes like runAsUser/Group/etc,
include cases where the uids are specicified both at the container
security context level and pod security context level and then combined
with mayRunAs/mustRunAs, etc.

Also, some existing tests are updated to handle proper use of "in" and
"intersects" in expressions.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-15 19:45:31 +02:00
Mark Stemm
8ebcbac7a3 Use xenial instead of trusty
According to
https://blog.travis-ci.com/2019-04-15-xenial-default-build-environment,
xenial is supposed to be the default linux build environment, using
vms. However, our jobs are still using trusty, even though we don't
specify a distribution.

Explicitly use xenial via dist: xenial.

Also remove the sudo option, which historically made sure you were
running on a vm and not in a container. Container-based builds are
deprecated as of
https://changelog.travis-ci.com/the-container-based-build-environment-is-fully-deprecated-84517.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-15 19:45:31 +02:00
Mark Stemm
1c3bed135f Add improved field outputting
Support the notion of a message for all fields in a single class, and
making sure it's wrapped as well as the other fields.

This is used to display a single message about how indexing working for
ka.* filter fields and what IDX_ALLOWED/IDX_NUMERIC/IDX_KEY means,
rather than repeating the same text over and over in every field.

The wrapping is handled by a function falco::utils::wrap_text.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-15 19:45:31 +02:00
Mark Stemm
154dd18c8f JSON/K8s Audit Evts extract multiple typed values
Refactor how JSON event/k8s audit events extract values in two important
ways:

1. An event can now extract multiple values.
2. The extracted value is a class json_event_value instead of a simple
string.

The driver for 1. was that some filtercheck fields like
"ka.req.container.privileged" actually should extract multiple values,
as a pod can have multiple containers and it doesn't make sense to
summarize that down to a single value.

The driver for 2. is that by having an object represent a single
extracted value, you can also hold things like numbers e.g. ports, uids,
gids, etc. and ranges e.g. [0:3]. With an object, you can override
operators ==, <, etc. to do comparisons between the numbers and ranges,
or even set membership tests between extracted numbers and sets of
ranges.

This is really handy for a lot of new fields implemented as a part of
PSP support, where you end up having to check for overlaps between the
paths, images, ports, uids, etc in a K8s Audit Event and the acceptable
values, ranges, path prefixes enumerated in a PSP.

Implementing these changes also involve an overhaul of how aliases are
implemented. Instead of having an optional "formatting" function, where
arguments to the formatting function were expressed as text within the
index, define optional extraction and indexing functions. If an
extraction function is defined, it's responsible for taking the full
json object and calling add_extracted_value() to add values. There's a
default extraction function that uses a list of json_pointers with
automatic iteration over array values returned by a json pointer.

There's still a notion of filter fields supporting indexes--that's
simply handled within the default extraction or custom extraction
function. And for most fields, there won't be a need to write a custom
extraction function simply to implement indexing.

Within a json_event_filter_check object, instead of having a single
extracted value as a string, hold a vector of extracted json_event_value
objects (vector because order matters) and a set of json_event_value
objects (for set comparisons) as m_evalues. Values on the right hand
side of the expression are held as a set m_values.

json_event_filter_check::compare now supports IN/INTERSECTS as set
comparisons. It also supports PMATCH using path_prefix_search objects,
which simplifies checks like ka.req.pod.volumes.hostpath--now they can
be expressed as "ka.req.pod.volumes.hostpath intersects (/proc,
/var/run/docker.sock, /, /etc, /root)" instead of
"ka.req.volume.hostpath[/proc]=true or
ka.req.volume.hostpath[/root]=true or ...".

Define ~10 new filtercheck fields that extract pod properties like
hostIpc, readOnlyRootFilesystem, etc. that are relevant for PSP validation.

As a part of these changes, also clarify the names of filter fields
related to pods to always have a .pod in the name. Furthermore, fields
dealing with containers in a pod always have a .pod.containers prefix in
the name.

Finally, change the comparisons for existing k8s audit rules to use
"intersects" and/or "in" when appropriate instead of a single equality
comparison.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-15 19:45:31 +02:00
Mark Stemm
b6fec781b7 Add support for parsing "intersects" operator
Related to the changes in https://github.com/draios/sysdig/pull/1501,
add support for an "intersects" operator that verifies if any of the
values in the rhs of an expression are found in the set of extracted
values.

For example:

  (a,b,c) in (a,b) is false, but (a,b,c) intersects (a,b) is true.

The code that implements CO_INTERSECTS is in a different commit.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-15 19:45:31 +02:00
Leo Di Donato
6019320f9d chore(proposals): apply code review about PSP rules proposal
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-10-14 13:59:15 +02:00
Mark Stemm
161b46474d Proposal for adding PSP Rules Support
Separate from the PR that actually makes the changes.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-14 13:59:15 +02:00
Leonardo Di Donato
f71c4f0bfd update: refer to latest probeinstaller library in falcoctl/pkg
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-10-11 19:43:56 +02:00
Lorenzo Fontana
7dc62b3119 docs: reflect the changes to probeloader docker images
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-10-11 19:43:56 +02:00
Lorenzo Fontana
707cdb5184 chore(docker/minimal): fix typo and set 0.17.1 as base
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-10-11 19:43:56 +02:00
Lorenzo Fontana
3c30ad9d38 chore(docker/kernel/linuxkit): reformat dockerfile
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-10-11 19:43:56 +02:00
Lorenzo Fontana
0c6d21eca4 update: httploader now is named probeloader and uses the falcoctl
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-10-11 19:43:56 +02:00
Lorenzo Fontana
af27c2bea5 chore: remove http loader code
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-10-11 19:43:56 +02:00
Michael Ducy
b49ade5627 use COPY not ADD
Signed-off-by: Michael Ducy <michael@ducy.org>
2019-10-11 19:43:56 +02:00
Michael Ducy
5a703ddbb8 updates based on code review rnd 1
Signed-off-by: Michael Ducy <michael@ducy.org>
2019-10-11 19:43:56 +02:00
Michael Ducy
01abe71256 add init container module loader
Signed-off-by: Michael Ducy <michael@ducy.org>
2019-10-11 19:43:56 +02:00
Michael Ducy
ac8204dc30 Initial try at slimmer images
Signed-off-by: Michael Ducy <michael@ducy.org>
2019-10-11 19:43:56 +02:00
Yathi Naik
49030af988 Added more context on Sysdig Secure in Adopters.md
Signed-off-by: Yathi Naik <yathi@sysdig.com>
2019-10-10 12:59:03 +02:00
Benjamin
4e6d347e43 Add k8s deployment yaml files for audit purpose only
Signed-off-by: Benjamin <benjamin@yunify.com>
2019-10-09 16:31:03 +02:00
Felipe Bessa Coelho
8353a0b22e Ignore sensitive mounts from ecs-agent
Without this, as ecs-agent starts we get a bunch of errors that look
like this (reformatted for readability):

  Notice Container with sensitive mount started (
    user=root
    command=init -- /agent ecs-agent (id=19d4e98bb0dc)
    image=amazon/amazon-ecs-agent:latest
    mounts=/proc:/host/proc:ro:false:rprivate,$lotsofthings
  )

ecs-agent needs those to work properly, so this can cause lots of false
positives when starting a new instance.

Signed-off-by: Felipe Bessa Coelho <fcoelho.9@gmail.com>
2019-10-09 16:30:36 +02:00
Mark Stemm
1d1ecd9905 Add explicit catch2 dependency for tests
When I try to build the dev branch using the docker builder, the tests
target isn't properly checking out and building catch2 for the
dependency catch2.hpp. Adding this explicit dependency allowed the build
to succeed.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-08 16:12:18 +02:00
Leo Di Donato
aaff21106d update(.github): proposals area into PR template
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-10-08 16:11:43 +02:00
Lorenzo Fontana
c76518c681 update: license headers
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-10-08 16:02:26 +02:00
Leo Di Donato
0043c4937b docs: update COPYING
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-10-08 16:02:26 +02:00
Fahad Arshad
b951f2bb7d fix(permissions): Restrict the access to /dev on underlying host to read only (with rbac)
Signed-off-by: Fahad Arshad <fahad.arshad@hobsons.com>
2019-10-08 12:17:27 +02:00
Fahad Arshad
fcd1d60657 fix(permissions): Restrict the access to /dev on underlying host to read only
Signed-off-by: Fahad Arshad <fahad.arshad@hobsons.com>
2019-10-08 12:17:27 +02:00
Mark Stemm
2bc4bfd7fb Specify namespace compat w/ gcc 5
I wasn't able to compile the dev branch with gcc 5.4 (e.g. not using the
builder), getting this error:

```
.../falco/userspace/falco/grpc_server.cpp:40:109: error: specialization of ‘template<class Request, class Response> void falco::grpc::request_stream_context<Request, Response>::start(falco::grpc::server*)’ in different namespace [-fpermissive]
 void falco::grpc::request_stream_context<falco::output::request, falco::output::response>::start(server* srv)
                                                                                                             ^
In file included from .../falco/userspace/falco/grpc_server.cpp:26:0:
.../falco/userspace/falco/grpc_server.h:102:7: error:   from definition of ‘template<class Request, class Response> void falco::grpc::request_stream_context<Request, Response>::start(falco::grpc::server*)’ [-fpermissive]
  void start(server* srv);
```

It looks like gcc 5.4 doesn't handle a declaration with namespace blocks
but a definition with namespaces in the
function. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 has more
detail.

A workaround is to add `namespace falco {` and `namespace grpc {` around
the declarations.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-04 11:43:28 +02:00
Leonardo Di Donato
db3383180c docs(userspace/falco): documenting the keepalive field of the outputs request
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-10-03 11:55:04 +02:00
kaizhe
cdb5d71eb6 rule update: add more comments
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-10-03 10:16:28 +02:00
kaizhe
e81decac13 rule update: fix missing entries
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-10-03 10:16:28 +02:00
kaizhe
a43ae037a9 rules update: add back rule Delete Bash History for backport compatibility
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-10-03 10:16:28 +02:00
Kris Nova
b2a57f376e removing maintainers file
Signed-off-by: Kris Nova <kris@nivenly.com>
2019-09-30 12:17:59 -07:00
Leonardo Di Donato
8a6c0b796c fix(userspace/engine): guard lua state into falco engine
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-09-30 18:07:19 +02:00
Leonardo Di Donato
f0cd3344a2 fix(userspace/falco): guard lua state for falco outputs
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-09-30 18:07:19 +02:00
Lorenzo Fontana
3d8b7231f3 fix(userspace/falco): meta request should use the request field
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-09-30 16:55:24 +03:00
Lorenzo Fontana
221e1b53aa fix(userspace/falco): remove redundant check for grpc outputs
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-09-30 16:55:24 +03:00
Lorenzo Fontana
b08341644a update(changelog): prepare for v0.17.1
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-09-26 16:14:25 +02:00
kaizhe
79a10ad90e rules update: add fluent/fluentd-kubernetes-daemonset to clear log trusted images
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-09-26 13:56:59 +03:00