Commit Graph

105 Commits

Author SHA1 Message Date
Leonardo Di Donato
bb1282c7be update(test): make run_regression_tests.sh script accept different
options

The following options have been added:
* -v (verbose)
* -p (prepare falco_traces test suite)
* -b (specify custom branch for downloading trace files)
* -d (specify the build directory)

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-07-20 22:48:00 +02:00
Leonardo Di Donato
8f07189ede docs(test): instructions for executing falco_traces integration test suite
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-07-20 22:48:00 +02:00
Leonardo Di Donato
dec2ff7d72 docs(test): prepare the local environment for running integration test suites
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-07-20 22:48:00 +02:00
Leonardo Di Donato
f3022e0abf build(test): target test-traces files
This make target calls the `trace-files-psp`, `trace-files-k8s-audit`,
`trace-files-base-scap` targets to place all the integration test
fixtures in the proper position.

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-07-20 22:48:00 +02:00
Leonardo Di Donato
9b42b20e1c build(test/trace_files): target trace-files-base-scap
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-07-20 22:48:00 +02:00
Leonardo Di Donato
850a49989f build(test/trace_files/psp): target trace-files-psp
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-07-20 22:48:00 +02:00
Leonardo Di Donato
0dc2a6abd3 build(test/traces_file/k8s_audit): target trace-files-k8s-audit
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-07-20 22:48:00 +02:00
Lorenzo Fontana
324a3b88e7 build: remove libyaml-0-2 as dependency in packages and dockerfiles
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2020-07-16 19:34:39 +02:00
Lorenzo Fontana
352307431a fix: update k8s audit endpoint to /k8s-audit everywhere
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2020-07-01 13:29:51 +02:00
Leonardo Grasso
6cfb0ec2b8 update(test): setup bidi gRPC integration test
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-06-30 13:04:03 +02:00
Leonardo Grasso
4af769f84c new(test): add gRPC unix socket support
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-06-30 13:04:03 +02:00
Leonardo Di Donato
b4d005eb51 new(test): read grpc config fields
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-06-30 13:04:03 +02:00
Leonardo Di Donato
061c5f5ac9 new(test): setup gRPC output test case
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-06-30 13:04:03 +02:00
Leonardo Di Donato
3bfd94fefd docs(test): run locally handling python deps with venv
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-05-26 15:01:48 +02:00
Leonardo Di Donato
6eb9b1add1 build(test): requirements.txt
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-05-26 15:01:48 +02:00
Leonardo Grasso
46483339a3 fix(test): correct kernel module name
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-05-18 14:08:25 +02:00
Leonardo Grasso
622a6c1e44 fix(test/driver-loader): source script to get env vars populated
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-05-15 11:19:31 +02:00
Leonardo Grasso
95e7242d13 test: add driver-loader integration tests
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-05-15 11:19:31 +02:00
Leonardo Grasso
05c684d68c test: add bin package (tar.gz) to integration test
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-05-12 19:22:49 +02:00
Mark Stemm
357da40fc4 Only use metadata in k8s audit event for secrets
Instead of using the request object to identify service account tokens,
exclude any secrets activity by system users (e.g. users starting with
"system:"). This allows the rules to work on k8s audit events at
Metadata level instead of RequestResponse level.

Also change the example objects for automated tests to ones collected at
Metadata level.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-04-22 21:00:38 +02:00
Mark Stemm
9af7c7fd59 Tests for creating/deleting secrets rules
Add test to verify new rules for creating/deleting secrets. New trace
files for creating a secret/deleting a secret, and test cases that
verify that the rules trigger. Two additional test cases/traces file
tracks creating a service account token secret/kube-system secret and
ensures that the rules do *not* trigger.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-04-22 21:00:38 +02:00
Leonardo Di Donato
09b87b9a3d fix(test): use .falco dir
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-03-23 18:50:06 +01:00
Lorenzo Fontana
a9658d446f fix(test): urrlib from python 2 to 3
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2020-03-23 18:50:06 +01:00
Leonardo Di Donato
c1d840d471 update(test): account only for falco version in tests, not driver version
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-03-23 18:50:06 +01:00
Lorenzo Fontana
9db36822e7 update(docker/tester): python 3 support for regression tests
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2020-03-17 21:24:31 +01:00
Hiroki Suezawa
3067af566e rule(Change thread namespace): fix regression test
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2020-03-12 16:35:46 +01:00
Leonardo Di Donato
f3dcacea5b fix(docker/tester): share rules and trace files with docker test runners
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-01-23 15:04:39 +01:00
Lorenzo Fontana
6b3adca132 update(integration): mount rules and traces paths in falco_test.py
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2020-01-23 15:04:39 +01:00
Lorenzo Fontana
ecfd22563f update(integration): switch to docker runners for packages
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2020-01-23 15:04:39 +01:00
Leonardo Di Donato
6ede7bd422 chore: removing sysdig references
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-11-14 10:00:36 -08:00
Kris Nova
ae7924cc41 Cleaning up some nomenclature
First of a handful of PRs to start clarifying the independence of Falco

I don't see any breaking changes here, just cosmetic changes.

Signed-off-by: Kris Nova <kris@nivenly.com>
2019-11-05 16:40:56 +01: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
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
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
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
Leonardo Di Donato
a019b54fe6 docs: specify labels that apply to each area
If this work as intended PR will automatically get the area labels depending on the files he modified.
In case the user wants it can still apply other areas manually, by slash command, or editing the PR template during the opening of the PR.

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-09-16 10:11:25 +02:00
Mark Stemm
6e11e75c15 Pass the build dir along when running tests
As of 0e1c436d14, the build directory is
an argument to run_regression_tests.sh. However, the build directory in
falco_tests.yaml is currently hard-coded to /build, with the build
variant influencing the subdirectory.

Clean this up so the entire build directory passed to
run_regression_tests.sh is passed to avocado and used for the build
directory.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-08-30 07:25:23 -07:00
Mark Stemm
94d89eaea2 New tests for handling multi-doc files
New automated tests for testing parsing of multiple-doc rules files:

 - invalid_{overwrite,append}_{macro,rule}_multiple_docs are just like
   the previous versions, but with the multiple files combined into a
   single multi-document file.

 - multiple_docs combines the rules file from multiple_rules

The expect the same results and output as the multiple-file versions.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-08-02 11:01:59 -07:00
Mark Stemm
204f5f219d Remove containers from empty capture file
A recent sysdig change resulted in container info embedded in capture
files being reported as events. In turn, this caused some tests that
were depending on empty.scap not having any events to fail.

So recreate empty.scap from an environment where no containers were
running. As a result they won't be included in the capture file and
there won't be any container events.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-07-31 12:18:47 -07:00
Mark Stemm
9b7c7ff5e4 Addl test for validation across files
Add new tests that ensure that validation across files and involving
multiple macro/rule objects display the right context. When appending,
both objects are displayed. When overwriting, the overwritten object is
displayed.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-07-31 11:22:38 +02:00
Mark Stemm
a42ec9d7c7 Tests for rule name matching using patterns
Modify the disabled_rules_using_regex test to
disabled_rules_using_substring with an appropriate substring.

Also add a test where rule names have regex chars and allow rule names
to have regex chars when parsing falco's output in tests. These changes
are future-looking in case we want to add back support for rule
enabling/disabling using regexes.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-07-29 23:24:13 +02:00
Leonardo Di Donato
4224329905 fix(test): correct bash shebangs
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-07-26 03:23:01 +02:00
Leonardo Di Donato
c71703b566 update(test): better handling of build type
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-07-26 03:23:01 +02:00
Leonardo Di Donato
8400066ac8 update(test): ignore for generated traces
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-07-26 03:23:01 +02:00
Mark Stemm
01f65e3bae Add new tests for validating rules files
Add a bunch of additional test cases for validating rules files. Each
has a specific kind of parse failure and checks for the appropriate
error info on stdout.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-07-11 11:24:22 -07:00
Mark Stemm
dc7bff127f New flags to compare stdout/stderr, validate rules
New test options stdout_is/stderr_is do a direct comparison between
stdout/stderr and the provided value.

Test option validate_rules_file maps to -V arguments, which validate
rules and exits.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-07-11 11:24:22 -07:00
Mark Stemm
56324d094c Update tests for new granular image lists
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>
2019-06-11 20:06:51 +02:00
Mark Stemm
772d4f9515 Update engine fields checksum for fd.dev.* (#589)
* Update engine fields checksum for fd.dev.*

New fields fd.dev.*, so updating the fields checksum.

* Print a message why the trace file can't be read.

At debug level only, but better than nothing.

* Adjust tests to match new container_started macro

Now that the container_started macro works either on the container event
or the first process being spawned in a container, we need to adjust the
counts for some rules to handle both cases.
2019-04-30 12:46:25 -07:00