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

Adds policy report output support for falcosidekick #256

Merged
merged 37 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e865a32
Adding support for PolicyReport output
anushkamittal20 Jul 16, 2021
8d4ded1
First attempt at PolicyReportCreate
anushkamittal20 Jul 20, 2021
64db095
First attempt at PolicyReportCreate; with go mod
anushkamittal20 Jul 20, 2021
03cce35
Initial working prototype; res.yaml for one event
anushkamittal20 Jul 23, 2021
572cec4
Initial update logic
anushkamittal20 Jul 24, 2021
250eefd
Update logic corrected for accumulated events in report
anushkamittal20 Jul 26, 2021
f7d4f5c
fixes dependency to Kubernetes
anushkamittal20 Jul 26, 2021
8972b83
fixes handlers.go
anushkamittal20 Jul 26, 2021
c2b46e5
two separate reports;warnbound config
anushkamittal20 Aug 5, 2021
0992fc9
code clean up;max reports config
anushkamittal20 Aug 8, 2021
56b7410
updated README.md and config_example.yaml
anushkamittal20 Aug 11, 2021
0afb9b4
pruning logic
anushkamittal20 Aug 14, 2021
2871c10
fixed merge conflicts;updated docs
anushkamittal20 Aug 19, 2021
6e3d86b
refactoring; n+1 logic
anushkamittal20 Aug 25, 2021
f9748a4
fixed linting error
anushkamittal20 Aug 25, 2021
024e1f4
Corrected PolicyReports in N+1 logic
anushkamittal20 Aug 26, 2021
bbc2d8e
Added PruneByPriority config
anushkamittal20 Aug 29, 2021
320b291
Initial summary fix
anushkamittal20 Aug 29, 2021
5f3eeb8
minor fixes
anushkamittal20 Aug 29, 2021
64955ec
Changed from slice of reports to map
anushkamittal20 Aug 30, 2021
f0da806
Added uuid to report names
anushkamittal20 Aug 30, 2021
a1a51a8
UUID trim; mapping for category
anushkamittal20 Sep 10, 2021
4291a0b
Updated README.md
anushkamittal20 Sep 11, 2021
057eefb
Fixed logs and other minor changes
anushkamittal20 Sep 25, 2021
327a06f
changed some variable names for clarity
anushkamittal20 Sep 26, 2021
51bfb2c
replaced failthreshold with minimumpriority
anushkamittal20 Sep 26, 2021
0f13b79
minor fixes
anushkamittal20 Sep 26, 2021
fe9a377
refactorisation
Sep 28, 2021
8663b6d
fix nil pointer
Sep 29, 2021
88f0aa6
Corrected PolicyReportResult Logic
anushkamittal20 Oct 23, 2021
4861cd3
minor fixes
anushkamittal20 Oct 24, 2021
bcbfdcf
fixing variable name
anushkamittal20 Oct 24, 2021
564ac61
added new line
anushkamittal20 Oct 25, 2021
9d66c4e
changes in README
anushkamittal20 Jan 11, 2022
e36d74c
updated README.md; minor corrections
anushkamittal20 Jan 11, 2022
07e3dfd
fixes in README.md
anushkamittal20 Jan 14, 2022
cd0b7d1
resolve merge conflicts
anushkamittal20 Jan 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ It works as a single endpoint for as many as you want `Falco` instances :
- **Webhook**
- [**WebUI**](https://github.com/falcosecurity/falcosidekick-ui) (a Web UI for displaying latest events in real time)

### Other
- [**Policy Report**](https://github.com/kubernetes-sigs/wg-policy-prototypes/tree/master/policy-report/falco-adapter)

## Usage

Run the daemon as any other daemon in your architecture (systemd, k8s daemonset,
Expand Down Expand Up @@ -426,6 +429,13 @@ grafana:
# checkcert: true # check if ssl certificate of the output is valid (default: true)
# minimumpriority: "debug" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)

policyreport:
enabled: false # if true; policyreport output is enabled
kubeconfig: "~/.kube/config" # Kubeconfig file to use (only if falcosidekick is running outside the cluster)
minimumpriority: "debug" # events with a priority above this are mapped to fail in PolicyReport Summary and lower that those are mapped to warn (default="")
maxevents: 1000 # the max number of events that can be in a policyreport (default: 1000)
prunebypriority: false # if true; the events with lowest severity are pruned first, in FIFO order (default: false)

webui:
url: "" # WebUI URL, if not empty, WebUI output is enabled

Expand Down Expand Up @@ -828,6 +838,12 @@ care of lower/uppercases**) : `yaml: a.b --> envvar: A_B` :
- **SYSLOG_PROTOCOL**: Syslog transport protocol. It can be either "tcp" or "udp"
- **SYSLOG_MINIMUMPRIORITY**: minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default: "debug")

- **POLICYREPORT_ENABLED**: if true policyreport output is enabled (default: `false`)
- **POLICYREPORT_KUBECONFIG**: Kubeconfig file to use (only if falcosidekick is running outside the cluster)
- **POLICYREPORT_MINIMUMPRIORITY**: events with priority above this are mapped to fail in PolicyReport summary and lower that those are mapped to warn
- **POLICYREPORT_MAXEVENTS**: the max number of events that can be per report (default: 1000)
- **POLICYREPORT_PRUNEBYPRIORITY**: if true; the events with lowest severity are pruned first, in FIFO order (default: `false`)

#### Slack/Rocketchat/Mattermost/Googlechat Message Formatting

The `SLACK_MESSAGEFORMAT` environment variable and `slack.messageformat` YAML
Expand Down Expand Up @@ -1090,6 +1106,11 @@ time akey bkey ckey priority rule value

![google chat text example](https://github.com/falcosecurity/falcosidekick/raw/master/imgs/google_chat_example.png)

## Installing Policy Report Custom Resource Definition (CRD)

Information about how to find and install the CRD for the reports can be found [here](https://github.com/kubernetes-sigs/wg-policy-prototypes/tree/master/policy-report#installing). Installation of the Policy Report Custom Resource Definition (CRD) is a prerequisite for using Policy Report output.


## Development

### Build
Expand Down
7 changes: 7 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,13 @@ func getConfig() *types.Configuration {
v.SetDefault("Webui.URL", "")
v.SetDefault("Webui.MutualTls", false)
v.SetDefault("Webui.CheckCert", true)

v.SetDefault("PolicyReport.Enabled", false)
v.SetDefault("PolicyReport.Kubeconfig", "")
v.SetDefault("PolicyReport.MinimumPriority", "")
v.SetDefault("PolicyReport.MaxEvents", 1000)
v.SetDefault("PolicyReport.PruneByPriority", false)

v.SetDefault("Rabbitmq.URL", "")
v.SetDefault("Rabbitmq.Queue", "")
v.SetDefault("Rabbitmq.MinimumPriority", "")
Expand Down
8 changes: 8 additions & 0 deletions config_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,11 @@ fission:
# minimumpriority: "debug" # minimum priority of event for using this output, order is emergency|alert|critical|error|warning|notice|informational|debug or "" (default)
# checkcert: true # check if ssl certificate of the output is valid (default: true)
# mutualtls: false # if true, checkcert flag will be ignored (server cert will always be checked)

policyreport:
enabled: false # if true policyreport output is enabled
kubeconfig: "~/.kube/config" # Kubeconfig file to use (only if falcosidekick is running outside the cluster)
failthreshold: 4 # events with priority above this threshold are mapped to fail in PolicyReport Summary and lower that those are mapped to warn (default=4)
maxevents: 1000 # the max number of events per report(default: 1000)
prunebypriority: false # if true; the events with lowest severity are pruned first, in FIFO order (default: false)

33 changes: 18 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ require (
github.com/emersion/go-smtp v0.14.0
github.com/google/uuid v1.2.0
github.com/googleapis/gax-go v1.0.3
github.com/kubernetes-sigs/wg-policy-prototypes/policy-report/kube-bench-adapter v0.0.0-20210714174227-a3d56502c383
github.com/nats-io/nats-streaming-server v0.19.0 // indirect
github.com/nats-io/nats.go v1.10.0
github.com/nats-io/stan.go v0.8.3
github.com/prometheus/client_golang v1.9.0
Expand All @@ -27,7 +29,8 @@ require (
google.golang.org/api v0.40.0
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705
gopkg.in/alecthomas/kingpin.v2 v2.2.6
k8s.io/client-go v0.20.4
k8s.io/apimachinery v0.20.5
k8s.io/client-go v11.0.0+incompatible
Issif marked this conversation as resolved.
Show resolved Hide resolved
)

require (
anushkamittal20 marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -52,7 +55,7 @@ require (
github.com/devigned/tab v0.1.1 // indirect
github.com/form3tech-oss/jwt-go v3.2.2+incompatible // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-logr/logr v0.2.0 // indirect
github.com/go-logr/logr v0.3.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.4.3 // indirect
Expand All @@ -61,26 +64,25 @@ require (
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/googleapis/gnostic v0.4.1 // indirect
github.com/googleapis/gnostic v0.5.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/imdario/mergo v0.3.10 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.10 // indirect
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/klauspost/compress v1.9.8 // indirect
github.com/lightstep/tracecontext.go v0.0.0-20181129014701-1757c391b1ac // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/nats-io/jwt v1.1.0 // indirect
github.com/nats-io/nats-server/v2 v2.1.9 // indirect
github.com/nats-io/nats-streaming-server v0.19.0 // indirect
github.com/nats-io/nkeys v0.1.4 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pelletier/go-toml v1.8.1 // indirect
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -93,10 +95,9 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
go.opencensus.io v0.22.5 // indirect
go.uber.org/atomic v1.5.0 // indirect
go.uber.org/multierr v1.3.0 // indirect
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee // indirect
go.uber.org/zap v1.13.0 // indirect
go.uber.org/atomic v1.6.0 // indirect
go.uber.org/multierr v1.5.0 // indirect
go.uber.org/zap v1.15.0 // indirect
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 // indirect
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
Expand All @@ -114,12 +115,14 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
honnef.co/go/tools v0.0.1-2020.1.4 // indirect
k8s.io/api v0.20.4 // indirect
k8s.io/apimachinery v0.20.4 // indirect
k8s.io/api v0.20.5 // indirect
k8s.io/klog/v2 v2.4.0 // indirect
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 // indirect
sigs.k8s.io/controller-runtime v0.8.3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.0.2 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

replace k8s.io/client-go => k8s.io/client-go v0.20.5
Loading