mirror of
https://github.com/falcosecurity/falco.git
synced 2026-03-20 03:32:09 +00:00
Compare commits
78 Commits
feat/grpc-
...
0.24.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4b7f17271 | ||
|
|
ebb0c47524 | ||
|
|
a447b6996e | ||
|
|
596e7ee303 | ||
|
|
8ae6aa51b9 | ||
|
|
1343fd7e92 | ||
|
|
1954cf3af3 | ||
|
|
bc8f9a5692 | ||
|
|
1af1226566 | ||
|
|
c743f1eb68 | ||
|
|
bca98e0419 | ||
|
|
32bae35de2 | ||
|
|
de147447ed | ||
|
|
825e249294 | ||
|
|
00689a5d97 | ||
|
|
4d31784a83 | ||
|
|
2848eceb03 | ||
|
|
c7ac1ef61b | ||
|
|
5fd3c38422 | ||
|
|
3bad1d2a56 | ||
|
|
8ad5c4f834 | ||
|
|
553856ad68 | ||
|
|
2d52be603d | ||
|
|
75e62269c3 | ||
|
|
3d1f27d082 | ||
|
|
ad960a9485 | ||
|
|
d8d218230d | ||
|
|
b7e7a10035 | ||
|
|
fecf1a9fea | ||
|
|
54a6d5c523 | ||
|
|
9fe78bf658 | ||
|
|
727755e276 | ||
|
|
352307431a | ||
|
|
6cfb0ec2b8 | ||
|
|
4af769f84c | ||
|
|
82e0b5f217 | ||
|
|
b4d005eb51 | ||
|
|
061c5f5ac9 | ||
|
|
c06ccf8378 | ||
|
|
3408ea9164 | ||
|
|
51aea00be8 | ||
|
|
a5cadbf5fa | ||
|
|
9eb0b7fb5f | ||
|
|
869d883dc7 | ||
|
|
b88767f558 | ||
|
|
bdbdf7b830 | ||
|
|
4e2f3e2c71 | ||
|
|
3d9bc8f67b | ||
|
|
c89c11c3c4 | ||
|
|
5bd9ba0529 | ||
|
|
b9e6d65e69 | ||
|
|
0d194f2b40 | ||
|
|
d9f2cda8cf | ||
|
|
2ebc55f897 | ||
|
|
01ae8701d9 | ||
|
|
be6c4b273d | ||
|
|
a72f27c028 | ||
|
|
58adc5b60c | ||
|
|
cf31712fad | ||
|
|
a568c42adb | ||
|
|
05dd170d70 | ||
|
|
e29a4c8560 | ||
|
|
c5ba95deff | ||
|
|
27037e64cc | ||
|
|
1859552834 | ||
|
|
298ba29c88 | ||
|
|
0272b94bb1 | ||
|
|
dbd86234ad | ||
|
|
b69bde6bd4 | ||
|
|
d2f0ad7c07 | ||
|
|
70b9bfe1d6 | ||
|
|
17f6da7885 | ||
|
|
dee0cc67f3 | ||
|
|
8429256e37 | ||
|
|
00884ef581 | ||
|
|
578ef7f64d | ||
|
|
a5ce61f03f | ||
|
|
74ca02d199 |
5
.github/stale.yml
vendored
5
.github/stale.yml
vendored
@@ -6,7 +6,6 @@ daysUntilClose: 7
|
||||
exemptLabels:
|
||||
- cncf
|
||||
- roadmap
|
||||
- enhancement
|
||||
- "help wanted"
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: wontfix
|
||||
@@ -15,5 +14,7 @@ markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
Issues labeled "cncf", "roadmap" and "help wanted" will not be automatically closed.
|
||||
Please refer to a maintainer to get such label added if you think this should be kept open.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
closeComment: false
|
||||
|
||||
@@ -8,8 +8,13 @@ This is a list of production adopters of Falco (in alphabetical order):
|
||||
|
||||
* [Frame.io](https://frame.io/) - Frame.io is a cloud-based (SaaS) video review and collaboration platform that enables users to securely upload source media, work-in-progress edits, dailies, and more into private workspaces where they can invite their team and clients to collaborate on projects. Understanding what is running on production servers, and the context around why things are running is even more tricky now that we have further abstractions like Docker and Kubernetes. To get this needed visibility into our system, we rely on Falco. Falco's ability to collect raw system calls such as open, connect, exec, along with their arguments offer key insights on what is happening on the production system and became the foundation of our intrusion detection and alerting system.
|
||||
|
||||
* [GitLab](https://about.gitlab.com/direction/defend/container_host_security/) - GitLab is a complete DevOps platform, delivered as a single application, fundamentally changing the way Development, Security, and Ops teams collaborate. GitLab Ultimate provides the single tool teams need to find, triage, and fix vulnerabilities in applications, services, and cloud-native environments enabling them to manage their risk. This provides them with repeatable, defensible processes that automate security and compliance policies. GitLab includes a tight integration with Falco, allowing users to defend their containerized applications from attacks while running in production.
|
||||
|
||||
* [League](https://league.com/ca/) - League provides health benefits management services to help employees understand and get the most from their benefits, and employers to provide effective, efficient plans. Falco is used to monitor our deployed services on Kubernetes, protecting against malicious access to containerswhich could lead to leaks of PHI or other sensitive data. The Falco alerts are logged in Stackdriver for grouping and further analysis. In the future, we're hoping for integrations with Prometheus and AlertManager as well.
|
||||
|
||||
* [Logz.io](https://logz.io/) - Logz.io is a cloud observability platform for modern engineering teams. The Logz.io platform consists of three products — Log Management, Infrastructure Monitoring, and Cloud SIEM — that work together to unify the jobs of monitoring, troubleshooting, and security. We empower engineers to deliver better software by offering the world's most popular open source observability tools — the ELK Stack, Grafana, and Jaeger — in a single, easy to use, and powerful platform purpose-built for monitoring distributed cloud environments. Cloud SIEM supports data from multiple sources, including Falco's alerts, and offers useful rules and dashboards content to visualize and manage incidents across your systems in a unified UI.
|
||||
* https://logz.io/blog/k8s-security-with-falco-and-cloud-siem/
|
||||
|
||||
* [Preferral](https://www.preferral.com) - Preferral is a HIPAA-compliant platform for Referral Management and Online Referral Forms. Preferral streamlines the referral process for patients, specialists and their referral partners. By automating the referral process, referring practices spend less time on the phone, manual efforts are eliminated, and patients get the right care from the right specialist. Preferral leverages Falco to provide a Host Intrusion Detection System to meet their HIPPA compliance requirements.
|
||||
* https://hipaa.preferral.com/01-preferral_hipaa_compliance/
|
||||
|
||||
|
||||
105
CHANGELOG.md
105
CHANGELOG.md
@@ -2,6 +2,111 @@
|
||||
|
||||
This file documents all notable changes to Falco. The release numbering uses [semantic versioning](http://semver.org).
|
||||
|
||||
## v0.24.0
|
||||
|
||||
Released on 2020-16-07
|
||||
|
||||
### Major Changes
|
||||
|
||||
* new: Falco now supports userspace instrumentation with the -u flag [[#1195](https://github.com/falcosecurity/falco/pull/1195)]
|
||||
* BREAKING CHANGE: --stats_interval is now --stats-interval [[#1308](https://github.com/falcosecurity/falco/pull/1308)]
|
||||
* new: auto threadiness for gRPC server [[#1271](https://github.com/falcosecurity/falco/pull/1271)]
|
||||
* BREAKING CHANGE: server streaming gRPC outputs method is now `falco.outputs.service/get` [[#1241](https://github.com/falcosecurity/falco/pull/1241)]
|
||||
* new: new bi-directional async streaming gRPC outputs (`falco.outputs.service/sub`) [[#1241](https://github.com/falcosecurity/falco/pull/1241)]
|
||||
* new: unix socket for the gRPC server [[#1217](https://github.com/falcosecurity/falco/pull/1217)]
|
||||
|
||||
|
||||
### Minor Changes
|
||||
|
||||
* update: driver version is 85c88952b018fdbce2464222c3303229f5bfcfad now [[#1305](https://github.com/falcosecurity/falco/pull/1305)]
|
||||
* update: `SKIP_MODULE_LOAD` renamed to `SKIP_DRIVER_LOADER` [[#1297](https://github.com/falcosecurity/falco/pull/1297)]
|
||||
* docs: add leogr to OWNERS [[#1300](https://github.com/falcosecurity/falco/pull/1300)]
|
||||
* update: default threadiness to 0 ("auto" behavior) [[#1271](https://github.com/falcosecurity/falco/pull/1271)]
|
||||
* update: k8s audit endpoint now defaults to /k8s-audit everywhere [[#1292](https://github.com/falcosecurity/falco/pull/1292)]
|
||||
* update(falco.yaml): `webserver.k8s_audit_endpoint` default value changed from `/k8s_audit` to `/k8s-audit` [[#1261](https://github.com/falcosecurity/falco/pull/1261)]
|
||||
* docs(test): instructions to run regression test suites locally [[#1234](https://github.com/falcosecurity/falco/pull/1234)]
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix: --stats-interval correctly accepts values >= 999 (ms) [[#1308](https://github.com/falcosecurity/falco/pull/1308)]
|
||||
* fix: make the eBPF driver build work on CentOS 8 [[#1301](https://github.com/falcosecurity/falco/pull/1301)]
|
||||
* fix(userspace/falco): correct options handling for `buffered_output: false` which was not honored for the `stdout` output [[#1296](https://github.com/falcosecurity/falco/pull/1296)]
|
||||
* fix(userspace/falco): honor -M also when using a trace file [[#1245](https://github.com/falcosecurity/falco/pull/1245)]
|
||||
* fix: high CPU usage when using server streaming gRPC outputs [[#1241](https://github.com/falcosecurity/falco/pull/1241)]
|
||||
* fix: missing newline from some log messages (eg., token bucket depleted) [[#1257](https://github.com/falcosecurity/falco/pull/1257)]
|
||||
|
||||
|
||||
### Rule Changes
|
||||
|
||||
* rule(Container Drift Detected (chmod)): disabled by default [[#1316](https://github.com/falcosecurity/falco/pull/1316)]
|
||||
* rule(Container Drift Detected (open+create)): disabled by default [[#1316](https://github.com/falcosecurity/falco/pull/1316)]
|
||||
* rule(Write below etc): allow snapd to write its unit files [[#1289](https://github.com/falcosecurity/falco/pull/1289)]
|
||||
* rule(macro remote_file_copy_procs): fix reference to remote_file_copy_binaries [[#1224](https://github.com/falcosecurity/falco/pull/1224)]
|
||||
* rule(list allowed_k8s_users): whitelisted kube-apiserver-healthcheck user created by kops >= 1.17.0 for the kube-apiserver-healthcheck sidecar [[#1286](https://github.com/falcosecurity/falco/pull/1286)]
|
||||
* rule(Change thread namespace): Allow `protokube`, `dockerd`, `tini` and `aws` binaries to change thread namespace. [[#1222](https://github.com/falcosecurity/falco/pull/1222)]
|
||||
* rule(macro exe_running_docker_save): to filter out cmdlines containing `/var/run/docker`. [[#1222](https://github.com/falcosecurity/falco/pull/1222)]
|
||||
* rule(macro user_known_cron_jobs): new macro to be overridden to list known cron jobs [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Schedule Cron Jobs): exclude known cron jobs [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_update_package_registry): new macro to be overridden to list known package registry update [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Update Package Registry): exclude known package registry update [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_read_ssh_information_activities): new macro to be overridden to list known activities that read SSH info [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Read ssh information): do not throw for activities known to read SSH info [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_read_sensitive_files_activities): new macro to be overridden to list activities known to read sensitive files [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Read sensitive file trusted after startup): do not throw for activities known to read sensitive files [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Read sensitive file untrusted): do not throw for activities known to read sensitive files [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_write_rpm_database_activities): new macro to be overridden to list activities known to write RPM database [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Write below rpm database): do not throw for activities known to write RPM database [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_db_spawned_processes): new macro to be overridden to list processes known to spawn DB [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(DB program spawned process): do not throw for processes known to spawn DB [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_modify_bin_dir_activities): new macro to be overridden to list activities known to modify bin directories [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Modify binary dirs): do not throw for activities known to modify bin directories [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_mkdir_bin_dir_activities): new macro to be overridden to list activities known to create directories below bin directories [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Mkdir binary dirs): do not throw for activities known to create directories below bin directories [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_system_user_login): new macro to exclude known system user logins [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(System user interactive): do not throw for known system user logins [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_user_management_activities): new macro to be overridden to list activities known to do user managements activities [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(User mgmt binaries): do not throw for activities known to do user managements activities [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_create_files_below_dev_activities): new macro to be overridden to list activities known to create files below dev [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Create files below dev): do not throw for activities known to create files below dev [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_contact_k8s_api_server_activities): new macro to be overridden to list activities known to contact Kubernetes API server [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Contact K8S API Server From Container): do not throw for activities known to contact Kubernetes API server [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_network_tool_activities): new macro to be overridden to list activities known to spawn/use network tools [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Launch Suspicious Network Tool in Container): do not throw for activities known to spawn/use network tools [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_remove_data_activities): new macro to be overridden to list activities known to perform data remove commands [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Remove Bulk Data from Disk): do not throw for activities known to perform data remove commands [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_create_hidden_file_activities): new macro to be overridden to list activities known to create hidden files [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Create Hidden Files or Directories): do not throw for activities known to create hidden files [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_stand_streams_redirect_activities): new macro to be overridden to list activities known to redirect stream to network connection (in containers) [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Redirect STDOUT/STDIN to Network Connection in Container): do not throw for activities known to redirect stream to network connection (in containers) [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_container_drift_activities): new macro to be overridden to list activities known to create executables in containers [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Container Drift Detected (chmod)): do not throw for activities known to give execution permissions to files in containers [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Container Drift Detected (open+create)): do not throw for activities known to create executables in containers [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_node_port_service): do not throw for services known to start with a NopePort service type (k8s) [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Create NodePort Service): do not throw for services known to start with a NopePort service type (k8s) [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro user_known_exec_pod_activities): do not throw for activities known to attach/exec to a pod (k8s) [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Attach/Exec Pod): do not throw for activities known to attach/exec to a pod (k8s) [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro trusted_pod): defines trusted pods by an image list [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Pod Created in Kube Namespace): do not throw for trusted pods [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(macro trusted_sa): define trusted ServiceAccount [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(Service Account Created in Kube Namespace): do not throw for trusted ServiceAccount [[#1294](https://github.com/falcosecurity/falco/pull/1294)]
|
||||
* rule(list network_tool_binaries): add zmap to the list [[#1284](https://github.com/falcosecurity/falco/pull/1284)]
|
||||
* rule(macro root_dir): correct macro to exactly match the `/root` dir and not other with just `/root` as a prefix [[#1279](https://github.com/falcosecurity/falco/pull/1279)]
|
||||
* rule(macro user_expected_terminal_shell_in_container_conditions): allow whitelisting terminals in containers under specific conditions [[#1154](https://github.com/falcosecurity/falco/pull/1154)]
|
||||
* rule(macro user_known_write_below_binary_dir_activities): allow writing to a binary dir in some conditions [[#1260](https://github.com/falcosecurity/falco/pull/1260)]
|
||||
* rule(macro trusted_logging_images): Add addl fluentd image [[#1230](https://github.com/falcosecurity/falco/pull/1230)]
|
||||
* rule(macro trusted_logging_images): Let azure-npm image write to /var/log [[#1230](https://github.com/falcosecurity/falco/pull/1230)]
|
||||
* rule(macro lvprogs_writing_conf): Add lvs as a lvm program [[#1230](https://github.com/falcosecurity/falco/pull/1230)]
|
||||
* rule(macro user_known_k8s_client_container): Allow hcp-tunnelfront to run kubectl in containers [[#1230](https://github.com/falcosecurity/falco/pull/1230)]
|
||||
* rule(list allowed_k8s_users): Add vertical pod autoscaler as known k8s users [[#1230](https://github.com/falcosecurity/falco/pull/1230)]
|
||||
* rule(Anonymous Request Allowed): update to checking auth decision equals to allow [[#1267](https://github.com/falcosecurity/falco/pull/1267)]
|
||||
* rule(Container Drift Detected (chmod)): new rule to detect if an existing file get exec permissions in a container [[#1254](https://github.com/falcosecurity/falco/pull/1254)]
|
||||
* rule(Container Drift Detected (open+create)): new rule to detect if a new file with execution permission is created in a container [[#1254](https://github.com/falcosecurity/falco/pull/1254)]
|
||||
* rule(Mkdir binary dirs): correct condition in macro `bin_dir_mkdir` to catch `mkdirat` syscall [[#1250](https://github.com/falcosecurity/falco/pull/1250)]
|
||||
* rule(Modify binary dirs): correct condition in macro `bin_dir_rename` to catch `rename`, `renameat`, and `unlinkat` syscalls [[#1250](https://github.com/falcosecurity/falco/pull/1250)]
|
||||
* rule(Create files below dev): correct condition to catch `openat` syscall [[#1250](https://github.com/falcosecurity/falco/pull/1250)]
|
||||
* rule(macro user_known_set_setuid_or_setgid_bit_conditions): create macro [[#1213](https://github.com/falcosecurity/falco/pull/1213)]
|
||||
|
||||
## v0.23.0
|
||||
|
||||
Released on 2020-18-05
|
||||
|
||||
@@ -93,7 +93,7 @@ message(STATUS "Using bundled nlohmann-json in '${NJSON_SRC}'")
|
||||
set(NJSON_INCLUDE "${NJSON_SRC}/single_include")
|
||||
ExternalProject_Add(
|
||||
njson
|
||||
URL "https://s3.amazonaws.com/download.draios.com/dependencies/njson-3.3.0.tar.gz"
|
||||
URL "https://github.com/nlohmann/json/archive/v3.3.0.tar.gz"
|
||||
URL_HASH "SHA256=2fd1d207b4669a7843296c41d3b6ac5b23d00dec48dba507ba051d14564aa801"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
@@ -106,14 +106,15 @@ find_package(Curses REQUIRED)
|
||||
message(STATUS "Found ncurses: include: ${CURSES_INCLUDE_DIR}, lib: ${CURSES_LIBRARIES}")
|
||||
|
||||
# libb64
|
||||
|
||||
set(B64_SRC "${PROJECT_BINARY_DIR}/b64-prefix/src/b64")
|
||||
message(STATUS "Using bundled b64 in '${B64_SRC}'")
|
||||
set(B64_INCLUDE "${B64_SRC}/include")
|
||||
set(B64_LIB "${B64_SRC}/src/libb64.a")
|
||||
ExternalProject_Add(
|
||||
b64
|
||||
URL "https://s3.amazonaws.com/download.draios.com/dependencies/libb64-1.2.src.zip"
|
||||
URL_HASH "SHA256=343d8d61c5cbe3d3407394f16a5390c06f8ff907bd8d614c16546310b689bfd3"
|
||||
URL "https://github.com/libb64/libb64/archive/v1.2.1.zip"
|
||||
URL_HASH "SHA256=665134c2b600098a7ebd3d00b6a866cb34909a6d48e0e37a0eda226a4ad2638a"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ${CMD_MAKE}
|
||||
BUILD_IN_SOURCE 1
|
||||
@@ -135,8 +136,8 @@ set(LUAJIT_INCLUDE "${LUAJIT_SRC}")
|
||||
set(LUAJIT_LIB "${LUAJIT_SRC}/libluajit.a")
|
||||
ExternalProject_Add(
|
||||
luajit
|
||||
URL "https://s3.amazonaws.com/download.draios.com/dependencies/LuaJIT-2.0.3.tar.gz"
|
||||
URL_HASH "SHA256=55be6cb2d101ed38acca32c5b1f99ae345904b365b642203194c585d27bebd79"
|
||||
URL "https://github.com/LuaJIT/LuaJIT/archive/v2.0.3.tar.gz"
|
||||
URL_HASH "SHA256=8da3d984495a11ba1bce9a833ba60e18b532ca0641e7d90d97fafe85ff014baa"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ${CMD_MAKE}
|
||||
BUILD_IN_SOURCE 1
|
||||
@@ -151,8 +152,8 @@ list(APPEND LPEG_DEPENDENCIES "luajit")
|
||||
ExternalProject_Add(
|
||||
lpeg
|
||||
DEPENDS ${LPEG_DEPENDENCIES}
|
||||
URL "https://s3.amazonaws.com/download.draios.com/dependencies/lpeg-1.0.0.tar.gz"
|
||||
URL_HASH "SHA256=10190ae758a22a16415429a9eb70344cf29cbda738a6962a9f94a732340abf8e"
|
||||
URL "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-1.0.2.tar.gz"
|
||||
URL_HASH "SHA256=48d66576051b6c78388faad09b70493093264588fcd0f258ddaab1cdd4a15ffe"
|
||||
BUILD_COMMAND LUA_INCLUDE=${LUAJIT_INCLUDE} "${PROJECT_SOURCE_DIR}/scripts/build-lpeg.sh" "${LPEG_SRC}/build"
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ""
|
||||
@@ -175,7 +176,7 @@ list(APPEND LYAML_DEPENDENCIES "luajit")
|
||||
ExternalProject_Add(
|
||||
lyaml
|
||||
DEPENDS ${LYAML_DEPENDENCIES}
|
||||
URL "https://s3.amazonaws.com/download.draios.com/dependencies/lyaml-release-v6.0.tar.gz"
|
||||
URL "https://github.com/gvvaughan/lyaml/archive/release-v6.0.tar.gz"
|
||||
URL_HASH "SHA256=9d7cf74d776999ff6f758c569d5202ff5da1f303c6f4229d3b41f71cd3a3e7a7"
|
||||
BUILD_COMMAND ${CMD_MAKE}
|
||||
BUILD_IN_SOURCE 1
|
||||
|
||||
2
OWNERS
2
OWNERS
@@ -3,6 +3,7 @@ approvers:
|
||||
- kris-nova
|
||||
- leodido
|
||||
- mstemm
|
||||
- leogr
|
||||
reviewers:
|
||||
- fntlnz
|
||||
- kaizhe
|
||||
@@ -10,3 +11,4 @@ reviewers:
|
||||
- leodido
|
||||
- mfdii
|
||||
- mstemm
|
||||
- leogr
|
||||
|
||||
10
RELEASE.md
10
RELEASE.md
@@ -2,7 +2,7 @@
|
||||
|
||||
Our release process is mostly automated, but we still need some manual steps to initiate and complete it.
|
||||
|
||||
Changes and new features are grouped in [milestones](https://github.com/falcosecurity/falco/milestones), the milestone with the next version represents what is going to be released.
|
||||
Changes and new features are grouped in [milestones](https://github.com/falcosecurity/falco/milestones), the milestone with the next version represents what is going to be released.
|
||||
|
||||
Releases happen on a monthly cadence, towards the 16th of the on-going month, and we need to assign owners for each (usually we pair a new person with an experienced one). Assignees and the due date are proposed during the [weekly community call](https://github.com/falcosecurity/community). Note that hotfix releases can happen as soon as it is needed.
|
||||
|
||||
@@ -19,18 +19,19 @@ Finally, on the proposed due date the assignees for the upcoming release proceed
|
||||
- Double-check that there are no more merged PRs without the target milestone assigned with the `is:pr is:merged no:milestone closed:>YYYT-MM-DD` [filters](https://github.com/falcosecurity/falco/pulls?q=is%3Apr+is%3Amerged+no%3Amilestone+closed%3A%3EYYYT-MM-DD), if any, fix them
|
||||
|
||||
### 2. Milestones
|
||||
|
||||
- Move the [tasks not completed](https://github.com/falcosecurity/falco/pulls?q=is%3Apr+is%3Aopen) to a new minor milestone
|
||||
- Close the completed milestone
|
||||
|
||||
|
||||
### 3. Release PR
|
||||
|
||||
- Double-check if any hard-coded version number is present in the code, it should be not present anywhere:
|
||||
- If any, manually correct it then open an issue to automate version number bumping later
|
||||
- Versions table in the `README.md` update itself automatically
|
||||
- Generate the change log https://github.com/leodido/rn2md, or https://fs.fntlnz.wtf/falco/milestones-changelog.txt for the lazy people (it updates every 5 minutes)
|
||||
- Generate the change log https://github.com/leodido/rn2md, or https://fs.fntlnz.wtf/falco/milestones-changelog.txt for the lazy people (it updates every 5 minutes)
|
||||
- Add the lastest changes on top the previous `CHANGELOG.md`
|
||||
- Submit a PR with the above modifications
|
||||
- Await PR approval
|
||||
- Close the completed milestone as soon PR is merged
|
||||
|
||||
## Release
|
||||
|
||||
@@ -52,6 +53,7 @@ Let `x.y.z` the new version.
|
||||
- Wait for the CI to complete
|
||||
|
||||
### 2. Update the GitHub release
|
||||
|
||||
- [Draft a new release](https://github.com/falcosecurity/falco/releases/new)
|
||||
- Use `x.y.z` both as tag version and release title
|
||||
- Use the following template to fill the release description:
|
||||
|
||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
@@ -32,8 +32,8 @@ else()
|
||||
ExternalProject_Add(
|
||||
openssl
|
||||
# START CHANGE for CVE-2017-3735, CVE-2017-3731, CVE-2017-3737, CVE-2017-3738, CVE-2017-3736
|
||||
URL "https://s3.amazonaws.com/download.draios.com/dependencies/openssl-1.0.2n.tar.gz"
|
||||
URL_HASH "SHA256=370babb75f278c39e0c50e8c4e7493bc0f18db6867478341a832a982fd15a8fe"
|
||||
URL "https://github.com/openssl/openssl/archive/OpenSSL_1_0_2n.tar.gz"
|
||||
URL_HASH "SHA256=4f4bc907caff1fee6ff8593729e5729891adcee412049153a3bb4db7625e8364"
|
||||
# END CHANGE for CVE-2017-3735, CVE-2017-3731, CVE-2017-3737, CVE-2017-3738, CVE-2017-3736
|
||||
CONFIGURE_COMMAND ./config shared --prefix=${OPENSSL_INSTALL_DIR}
|
||||
BUILD_COMMAND ${CMD_MAKE}
|
||||
|
||||
@@ -31,7 +31,7 @@ else()
|
||||
curl
|
||||
DEPENDS openssl
|
||||
# START CHANGE for CVE-2017-8816, CVE-2017-8817, CVE-2017-8818, CVE-2018-1000007
|
||||
URL "https://s3.amazonaws.com/download.draios.com/dependencies/curl-7.61.0.tar.bz2"
|
||||
URL "https://github.com/curl/curl/releases/download/curl-7_61_0/curl-7.61.0.tar.bz2"
|
||||
URL_HASH "SHA256=5f6f336921cf5b84de56afbd08dfb70adeef2303751ffb3e570c936c6d656c9c"
|
||||
# END CHANGE for CVE-2017-8816, CVE-2017-8817, CVE-2017-8818, CVE-2018-1000007
|
||||
CONFIGURE_COMMAND
|
||||
|
||||
@@ -26,8 +26,8 @@ file(MAKE_DIRECTORY ${SYSDIG_CMAKE_WORKING_DIR})
|
||||
# To update sysdig version for the next release, change the default below
|
||||
# In case you want to test against another sysdig version just pass the variable - ie., `cmake -DSYSDIG_VERSION=dev ..`
|
||||
if(NOT SYSDIG_VERSION)
|
||||
set(SYSDIG_VERSION "96bd9bc560f67742738eb7255aeb4d03046b8045")
|
||||
set(SYSDIG_CHECKSUM "SHA256=766e8952a36a4198fd976b9d848523e6abe4336612188e4fc911e217d8e8a00d")
|
||||
set(SYSDIG_VERSION "85c88952b018fdbce2464222c3303229f5bfcfad")
|
||||
set(SYSDIG_CHECKSUM "SHA256=6c3f5f2d699c9540e281f50cbc5cb6b580f0fc689798bc65d4a77f57f932a71c")
|
||||
endif()
|
||||
set(PROBE_VERSION "${SYSDIG_VERSION}")
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (C) 2019 The Falco Authors.
|
||||
# Copyright (C) 2020 The Falco Authors.
|
||||
#
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -16,10 +16,14 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# todo(leogr): remove deprecation notice within a couple of releases
|
||||
if [[ ! -z "${SKIP_MODULE_LOAD}" ]]; then
|
||||
echo "* SKIP_MODULE_LOAD is deprecated and will be removed soon, use SKIP_DRIVER_LOADER instead"
|
||||
fi
|
||||
|
||||
# Set the SKIP_MODULE_LOAD variable to skip loading the kernel module
|
||||
# Set the SKIP_DRIVER_LOADER variable to skip loading the driver
|
||||
|
||||
if [[ -z "${SKIP_MODULE_LOAD}" ]]; then
|
||||
if [[ -z "${SKIP_DRIVER_LOADER}" ]] && [[ -z "${SKIP_MODULE_LOAD}" ]]; then
|
||||
echo "* Setting up /usr/src links from host"
|
||||
|
||||
for i in "$HOST_ROOT/usr/src"/*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (C) 2019 The Falco Authors.
|
||||
# Copyright (C) 2020 The Falco Authors.
|
||||
#
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,9 +17,9 @@
|
||||
#
|
||||
|
||||
|
||||
# Set the SKIP_MODULE_LOAD variable to skip loading the kernel module
|
||||
# Set the SKIP_DRIVER_LOADER variable to skip loading the driver
|
||||
|
||||
if [[ -z "${SKIP_MODULE_LOAD}" ]]; then
|
||||
if [[ -z "${SKIP_DRIVER_LOADER}" ]]; then
|
||||
echo "* Setting up /usr/src links from host"
|
||||
|
||||
for i in "$HOST_ROOT/usr/src"/*
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
FROM fedora:31
|
||||
|
||||
LABEL name="falcosecurity/falco-tester"
|
||||
LABEL usage="docker run -v /boot:/boot:ro -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/..:/source -v $PWD/build:/build -e FALCO_VERSION=<current_falco_version> --name <name> falcosecurity/falco-tester test"
|
||||
LABEL usage="docker run -v /boot:/boot:ro -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/..:/source -v $PWD/build:/build --name <name> falcosecurity/falco-tester test"
|
||||
LABEL maintainer="cncf-falco-dev@lists.cncf.io"
|
||||
|
||||
ENV FALCO_VERSION=
|
||||
ENV BUILD_TYPE=release
|
||||
|
||||
ADD https://github.com/fullstorydev/grpcurl/releases/download/v1.6.0/grpcurl_1.6.0_linux_x86_64.tar.gz /
|
||||
RUN dnf install -y python-pip python docker findutils jq unzip && dnf clean all
|
||||
ENV PATH="/root/.local/bin/:${PATH}"
|
||||
RUN pip install --user avocado-framework==69.0
|
||||
RUN pip install --user avocado-framework-plugin-varianter-yaml-to-mux==69.0
|
||||
RUN pip install --user watchdog==0.10.2
|
||||
RUN pip install --user pathtools==0.1.2
|
||||
RUN tar -C /usr/bin -xvf grpcurl_1.6.0_linux_x86_64.tar.gz
|
||||
|
||||
COPY ./root /
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ stdout_output:
|
||||
webserver:
|
||||
enabled: true
|
||||
listen_port: 8765
|
||||
k8s_audit_endpoint: /k8s_audit
|
||||
k8s_audit_endpoint: /k8s-audit
|
||||
ssl_enabled: false
|
||||
ssl_certificate: /etc/falco/falco.pem
|
||||
|
||||
@@ -182,7 +182,8 @@ http_output:
|
||||
# grpc:
|
||||
# enabled: true
|
||||
# bind_address: "0.0.0.0:5060"
|
||||
# threadiness: 8
|
||||
# # when threadiness is 0, Falco sets it by automatically figuring out the number of online cores
|
||||
# threadiness: 0
|
||||
# private_key: "/etc/falco/certs/server.key"
|
||||
# cert_chain: "/etc/falco/certs/server.crt"
|
||||
# root_certs: "/etc/falco/certs/ca.crt"
|
||||
@@ -191,7 +192,8 @@ http_output:
|
||||
grpc:
|
||||
enabled: false
|
||||
bind_address: "unix:///var/run/falco.sock"
|
||||
threadiness: 8
|
||||
# when threadiness is 0, Falco automatically guesses it depending on the number of online cores
|
||||
threadiness: 0
|
||||
|
||||
# gRPC output service.
|
||||
# By default it is off.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# gRPC Falco Output
|
||||
# Falco gRPC Outputs
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
@@ -25,7 +25,7 @@ An alert is an "output" when it goes over a transport, and it is emitted by Falc
|
||||
|
||||
At the current moment, however, Falco can deliver alerts in a very basic way, for example by dumping them to standard output.
|
||||
|
||||
For this reason, many Falco users asked, with issues - eg., [falco#528](https://github.com/falcosecurity/falco/issues/528) - or in the [slack channel](https://sysdig.slack.com) if we can find a more consumable way to implement Falco outputs in an extensible way.
|
||||
For this reason, many Falco users asked, with issues - eg., [falco#528](https://github.com/falcosecurity/falco/issues/528) - or in the [slack channel](https://slack.k8s.io) if we can find a more consumable way to implement Falco outputs in an extensible way.
|
||||
|
||||
The motivation behind this proposal is to design a new output implementation that can meet our user's needs.
|
||||
|
||||
@@ -39,7 +39,10 @@ The motivation behind this proposal is to design a new output implementation tha
|
||||
- To continue supporting the old output formats by implementing their same interface
|
||||
- To be secure by default (**mutual TLS** authentication)
|
||||
- To be **asynchronous** and **non-blocking**
|
||||
- To implement a Go SDK
|
||||
- To provide a connection over unix socket (no authentication)
|
||||
- To implement a Go client
|
||||
- To implement a Rust client
|
||||
- To implement a Python client
|
||||
|
||||
### Non-Goals
|
||||
|
||||
@@ -77,26 +80,25 @@ syntax = "proto3";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "schema.proto";
|
||||
|
||||
package falco.output;
|
||||
package falco.outputs;
|
||||
|
||||
option go_package = "github.com/falcosecurity/client-go/pkg/api/output";
|
||||
option go_package = "github.com/falcosecurity/client-go/pkg/api/outputs";
|
||||
|
||||
// The `subscribe` service defines the RPC call
|
||||
// to perform an output `request` which will lead to obtain an output `response`.
|
||||
// This service defines the RPC methods
|
||||
// to `request` a stream of output `response`s.
|
||||
service service {
|
||||
rpc subscribe(request) returns (stream response);
|
||||
// Subscribe to a stream of Falco outputs by sending a stream of requests.
|
||||
rpc sub(stream request) returns (stream response);
|
||||
// Get all the Falco outputs present in the system up to this call.
|
||||
rpc get(request) returns (stream response);
|
||||
}
|
||||
|
||||
// The `request` message is the logical representation of the request model.
|
||||
// It is the input of the `subscribe` service.
|
||||
// It is used to configure the kind of subscription to the gRPC streaming server.
|
||||
// It is the input of the `output.service` service.
|
||||
message request {
|
||||
bool keepalive = 1;
|
||||
// string duration = 2; // TODO(leodido, fntlnz): not handled yet but keeping for reference.
|
||||
// repeated string tags = 3; // TODO(leodido, fntlnz): not handled yet but keeping for reference.
|
||||
}
|
||||
|
||||
// The `response` message is the logical representation of the output model.
|
||||
// The `response` message is the representation of the output model.
|
||||
// It contains all the elements that Falco emits in an output along with the
|
||||
// definitions for priorities and source.
|
||||
message response {
|
||||
@@ -106,7 +108,7 @@ message response {
|
||||
string rule = 4;
|
||||
string output = 5;
|
||||
map<string, string> output_fields = 6;
|
||||
// repeated string tags = 7; // TODO(leodido,fntlnz): tags not supported yet, keeping for reference
|
||||
string hostname = 7;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
- macro: proc_name_exists
|
||||
condition: (proc.name!="<NA>")
|
||||
|
||||
# todo(leogr): we miss "renameat2", but it's not yet supported by sinsp
|
||||
- macro: rename
|
||||
condition: evt.type in (rename, renameat)
|
||||
- macro: mkdir
|
||||
@@ -80,24 +81,36 @@
|
||||
|
||||
- macro: bin_dir_mkdir
|
||||
condition: >
|
||||
(evt.arg[1] startswith /bin/ or
|
||||
evt.arg[1] startswith /sbin/ or
|
||||
evt.arg[1] startswith /usr/bin/ or
|
||||
evt.arg[1] startswith /usr/sbin/)
|
||||
(evt.arg.path startswith /bin/ or
|
||||
evt.arg.path startswith /sbin/ or
|
||||
evt.arg.path startswith /usr/bin/ or
|
||||
evt.arg.path startswith /usr/sbin/)
|
||||
|
||||
- macro: bin_dir_rename
|
||||
condition: >
|
||||
evt.arg[1] startswith /bin/ or
|
||||
evt.arg[1] startswith /sbin/ or
|
||||
evt.arg[1] startswith /usr/bin/ or
|
||||
evt.arg[1] startswith /usr/sbin/
|
||||
(evt.arg.path startswith /bin/ or
|
||||
evt.arg.path startswith /sbin/ or
|
||||
evt.arg.path startswith /usr/bin/ or
|
||||
evt.arg.path startswith /usr/sbin/ or
|
||||
evt.arg.name startswith /bin/ or
|
||||
evt.arg.name startswith /sbin/ or
|
||||
evt.arg.name startswith /usr/bin/ or
|
||||
evt.arg.name startswith /usr/sbin/ or
|
||||
evt.arg.oldpath startswith /bin/ or
|
||||
evt.arg.oldpath startswith /sbin/ or
|
||||
evt.arg.oldpath startswith /usr/bin/ or
|
||||
evt.arg.oldpath startswith /usr/sbin/ or
|
||||
evt.arg.newpath startswith /bin/ or
|
||||
evt.arg.newpath startswith /sbin/ or
|
||||
evt.arg.newpath startswith /usr/bin/ or
|
||||
evt.arg.newpath startswith /usr/sbin/)
|
||||
|
||||
- macro: etc_dir
|
||||
condition: fd.name startswith /etc/
|
||||
|
||||
# This detects writes immediately below / or any write anywhere below /root
|
||||
- macro: root_dir
|
||||
condition: ((fd.directory=/ or fd.name startswith /root) and fd.name contains "/")
|
||||
condition: (fd.directory=/ or fd.name startswith /root/)
|
||||
|
||||
- list: shell_binaries
|
||||
items: [ash, bash, csh, ksh, sh, tcsh, zsh, dash]
|
||||
@@ -219,7 +232,7 @@
|
||||
# The truncated dpkg-preconfigu is intentional, process names are
|
||||
# truncated at the sysdig level.
|
||||
- list: package_mgmt_binaries
|
||||
items: [rpm_binaries, deb_binaries, update-alternat, gem, pip, pip3, sane-utils.post, alternatives, chef-client, apk]
|
||||
items: [rpm_binaries, deb_binaries, update-alternat, gem, pip, pip3, sane-utils.post, alternatives, chef-client, apk, snapd]
|
||||
|
||||
- macro: package_mgmt_procs
|
||||
condition: proc.name in (package_mgmt_binaries)
|
||||
@@ -477,12 +490,16 @@
|
||||
- macro: consider_all_cron_jobs
|
||||
condition: (never_true)
|
||||
|
||||
- macro: user_known_cron_jobs
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Schedule Cron Jobs
|
||||
desc: Detect cron jobs scheduled
|
||||
condition: >
|
||||
consider_all_cron_jobs and
|
||||
((open_write and fd.name startswith /etc/cron) or
|
||||
(spawned_process and proc.name = "crontab"))
|
||||
(spawned_process and proc.name = "crontab")) and
|
||||
consider_all_cron_jobs and
|
||||
not user_known_cron_jobs
|
||||
output: >
|
||||
Cron jobs were scheduled to run (user=%user.name command=%proc.cmdline
|
||||
file=%fd.name container_id=%container.id container_name=%container.name image=%container.image.repository:%container.image.tag)
|
||||
@@ -848,7 +865,8 @@
|
||||
- macro: exe_running_docker_save
|
||||
condition: >
|
||||
proc.name = "exe"
|
||||
and proc.cmdline contains "/var/lib/docker"
|
||||
and (proc.cmdline contains "/var/lib/docker"
|
||||
or proc.cmdline contains "/var/run/docker")
|
||||
and proc.pname in (dockerd, docker)
|
||||
|
||||
# Ideally we'd have a length check here as well but sysdig
|
||||
@@ -917,18 +935,28 @@
|
||||
- macro: modify_repositories
|
||||
condition: (evt.arg.newpath pmatch (repository_directories))
|
||||
|
||||
- macro: user_known_update_package_registry
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Update Package Repository
|
||||
desc: Detect package repositories get updated
|
||||
condition: >
|
||||
((open_write and access_repositories) or (modify and modify_repositories))
|
||||
and not package_mgmt_procs
|
||||
and not exe_running_docker_save
|
||||
and not user_known_update_package_registry
|
||||
output: >
|
||||
Repository files get updated (user=%user.name command=%proc.cmdline pcmdline=%proc.pcmdline file=%fd.name newpath=%evt.arg.newpath container_id=%container.id image=%container.image.repository)
|
||||
priority:
|
||||
NOTICE
|
||||
tags: [filesystem, mitre_persistence]
|
||||
|
||||
# Users should overwrite this macro to specify conditions under which a
|
||||
# write under the binary dir is ignored. For example, it may be okay to
|
||||
# install a binary in the context of a ci/cd build.
|
||||
- macro: user_known_write_below_binary_dir_activities
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Write below binary dir
|
||||
desc: an attempt to write to any file below a set of binary directories
|
||||
condition: >
|
||||
@@ -937,6 +965,7 @@
|
||||
and not exe_running_docker_save
|
||||
and not python_running_get_pip
|
||||
and not python_running_ms_oms
|
||||
and not user_known_write_below_binary_dir_activities
|
||||
output: >
|
||||
File below a known binary directory opened for writing (user=%user.name
|
||||
command=%proc.cmdline file=%fd.name parent=%proc.pname pcmdline=%proc.pcmdline gparent=%proc.aname[2] container_id=%container.id image=%container.image.repository)
|
||||
@@ -1007,13 +1036,17 @@
|
||||
- macro: consider_ssh_reads
|
||||
condition: (never_true)
|
||||
|
||||
- macro: user_known_read_ssh_information_activities
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Read ssh information
|
||||
desc: Any attempt to read files below ssh directories by non-ssh programs
|
||||
condition: >
|
||||
(consider_ssh_reads and
|
||||
(open_read or open_directory) and
|
||||
((open_read or open_directory) and
|
||||
consider_ssh_reads and
|
||||
(user_ssh_directory or fd.name startswith /root/.ssh) and
|
||||
(not proc.name in (ssh_binaries)))
|
||||
not user_known_read_ssh_information_activities and
|
||||
not proc.name in (ssh_binaries))
|
||||
output: >
|
||||
ssh-related file/directory read by non-ssh program (user=%user.name
|
||||
command=%proc.cmdline file=%fd.name parent=%proc.pname pcmdline=%proc.pcmdline container_id=%container.id image=%container.image.repository)
|
||||
@@ -1356,6 +1389,9 @@
|
||||
- macro: runc_writing_exec_fifo
|
||||
condition: (proc.cmdline="runc:[1:CHILD] init" and fd.name=/exec.fifo)
|
||||
|
||||
- macro: runc_writing_var_lib_docker
|
||||
condition: (proc.cmdline="runc:[1:CHILD] init" and evt.arg.filename startswith /var/lib/docker)
|
||||
|
||||
- rule: Write below root
|
||||
desc: an attempt to write to any file directly below / or /root
|
||||
condition: >
|
||||
@@ -1386,12 +1422,15 @@
|
||||
- macro: cmp_cp_by_passwd
|
||||
condition: proc.name in (cmp, cp) and proc.pname in (passwd, run-parts)
|
||||
|
||||
- macro: user_known_read_sensitive_files_activities
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Read sensitive file trusted after startup
|
||||
desc: >
|
||||
an attempt to read any sensitive file (e.g. files containing user/password/authentication
|
||||
information) by a trusted program after startup. Trusted programs might read these files
|
||||
at startup to load initial state, but not afterwards.
|
||||
condition: sensitive_files and open_read and server_procs and not proc_is_new and proc.name!="sshd"
|
||||
condition: sensitive_files and open_read and server_procs and not proc_is_new and proc.name!="sshd" and not user_known_read_sensitive_files_activities
|
||||
output: >
|
||||
Sensitive file opened for reading by trusted program after startup (user=%user.name
|
||||
command=%proc.cmdline parent=%proc.pname file=%fd.name parent=%proc.pname gparent=%proc.aname[2] container_id=%container.id image=%container.image.repository)
|
||||
@@ -1442,6 +1481,7 @@
|
||||
and not veritas_driver_script
|
||||
and not perl_running_centrifydc
|
||||
and not runuser_reading_pam
|
||||
and not user_known_read_sensitive_files_activities
|
||||
output: >
|
||||
Sensitive file opened for reading by non-trusted program (user=%user.name program=%proc.name
|
||||
command=%proc.cmdline file=%fd.name parent=%proc.pname gparent=%proc.aname[2] ggparent=%proc.aname[3] gggparent=%proc.aname[4] container_id=%container.id image=%container.image.repository)
|
||||
@@ -1454,6 +1494,9 @@
|
||||
proc.pcmdline = "python -m amazon_linux_extras system_motd" and
|
||||
proc.cmdline startswith "python -c import yum;")
|
||||
|
||||
- macro: user_known_write_rpm_database_activities
|
||||
condition: (never_true)
|
||||
|
||||
# Only let rpm-related programs write to the rpm database
|
||||
- rule: Write below rpm database
|
||||
desc: an attempt to write to the rpm database by any non-rpm related program
|
||||
@@ -1464,6 +1507,7 @@
|
||||
and not python_running_chef
|
||||
and not exe_running_docker_save
|
||||
and not amazon_linux_running_python_yum
|
||||
and not user_known_write_rpm_database_activities
|
||||
output: "Rpm database opened for writing by a non-rpm program (command=%proc.cmdline file=%fd.name parent=%proc.pname pcmdline=%proc.pcmdline container_id=%container.id image=%container.image.repository)"
|
||||
priority: ERROR
|
||||
tags: [filesystem, software_mgmt, mitre_persistence]
|
||||
@@ -1488,6 +1532,9 @@
|
||||
- macro: run_by_appdynamics
|
||||
condition: (proc.pname=java and proc.pcmdline startswith "java -jar -Dappdynamics")
|
||||
|
||||
- macro: user_known_db_spawned_processes
|
||||
condition: (never_true)
|
||||
|
||||
- rule: DB program spawned process
|
||||
desc: >
|
||||
a database-server related program spawned a new process other than itself.
|
||||
@@ -1497,24 +1544,31 @@
|
||||
and spawned_process
|
||||
and not proc.name in (db_server_binaries)
|
||||
and not postgres_running_wal_e
|
||||
and not user_known_db_spawned_processes
|
||||
output: >
|
||||
Database-related program spawned process other than itself (user=%user.name
|
||||
program=%proc.cmdline parent=%proc.pname container_id=%container.id image=%container.image.repository)
|
||||
priority: NOTICE
|
||||
tags: [process, database, mitre_execution]
|
||||
|
||||
- macro: user_known_modify_bin_dir_activities
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Modify binary dirs
|
||||
desc: an attempt to modify any file below a set of binary directories.
|
||||
condition: (bin_dir_rename) and modify and not package_mgmt_procs and not exe_running_docker_save
|
||||
condition: bin_dir_rename and modify and not package_mgmt_procs and not exe_running_docker_save and not user_known_modify_bin_dir_activities
|
||||
output: >
|
||||
File below known binary directory renamed/removed (user=%user.name command=%proc.cmdline
|
||||
pcmdline=%proc.pcmdline operation=%evt.type file=%fd.name %evt.args container_id=%container.id image=%container.image.repository)
|
||||
priority: ERROR
|
||||
tags: [filesystem, mitre_persistence]
|
||||
|
||||
- macro: user_known_mkdir_bin_dir_activities
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Mkdir binary dirs
|
||||
desc: an attempt to create a directory below a set of binary directories.
|
||||
condition: mkdir and bin_dir_mkdir and not package_mgmt_procs
|
||||
condition: mkdir and bin_dir_mkdir and not package_mgmt_procs and not user_known_mkdir_bin_dir_activities
|
||||
output: >
|
||||
Directory below known binary directory created (user=%user.name
|
||||
command=%proc.cmdline directory=%evt.arg.path container_id=%container.id image=%container.image.repository)
|
||||
@@ -1550,7 +1604,7 @@
|
||||
and not proc.name in (user_known_change_thread_namespace_binaries)
|
||||
and not proc.name startswith "runc"
|
||||
and not proc.cmdline startswith "containerd"
|
||||
and not proc.pname in (sysdigcloud_binaries, hyperkube, kubelet)
|
||||
and not proc.pname in (sysdigcloud_binaries, hyperkube, kubelet, protokube, dockerd, tini, aws)
|
||||
and not python_running_sdchecks
|
||||
and not java_running_sdjagent
|
||||
and not kubelet_running_loopback
|
||||
@@ -1917,6 +1971,9 @@
|
||||
priority: WARNING
|
||||
tags: [container, mitre_lateral_movement]
|
||||
|
||||
- macro: user_known_system_user_login
|
||||
condition: (never_true)
|
||||
|
||||
# Anything run interactively by root
|
||||
# - condition: evt.type != switch and user.name = root and proc.name != sshd and interactive
|
||||
# output: "Interactive root (%user.name %proc.name %evt.dir %evt.type %evt.args %fd.name)"
|
||||
@@ -1924,17 +1981,23 @@
|
||||
|
||||
- rule: System user interactive
|
||||
desc: an attempt to run interactive commands by a system (i.e. non-login) user
|
||||
condition: spawned_process and system_users and interactive
|
||||
condition: spawned_process and system_users and interactive and not user_known_system_user_login
|
||||
output: "System user ran an interactive command (user=%user.name command=%proc.cmdline container_id=%container.id image=%container.image.repository)"
|
||||
priority: INFO
|
||||
tags: [users, mitre_remote_access_tools]
|
||||
|
||||
# In some cases, a shell is expected to be run in a container. For example, configuration
|
||||
# management software may do this, which is expected.
|
||||
- macro: user_expected_terminal_shell_in_container_conditions
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Terminal shell in container
|
||||
desc: A shell was used as the entrypoint/exec point into a container with an attached terminal.
|
||||
condition: >
|
||||
spawned_process and container
|
||||
and shell_procs and proc.tty != 0
|
||||
and container_entrypoint
|
||||
and not user_expected_terminal_shell_in_container_conditions
|
||||
output: >
|
||||
A shell was spawned in a container with an attached terminal (user=%user.name %container.info
|
||||
shell=%proc.name parent=%proc.pname cmdline=%proc.cmdline terminal=%proc.tty container_id=%container.id image=%container.image.repository)
|
||||
@@ -2189,6 +2252,9 @@
|
||||
priority: NOTICE
|
||||
tags: [users, mitre_privilege_escalation]
|
||||
|
||||
- macro: user_known_user_management_activities
|
||||
condition: (never_true)
|
||||
|
||||
- rule: User mgmt binaries
|
||||
desc: >
|
||||
activity by any programs that can manage users, passwords, or permissions. sudo and su are excluded.
|
||||
@@ -2206,7 +2272,8 @@
|
||||
not run_by_sumologic_securefiles and
|
||||
not run_by_yum and
|
||||
not run_by_ms_oms and
|
||||
not run_by_google_accounts_daemon
|
||||
not run_by_google_accounts_daemon and
|
||||
not user_known_user_management_activities
|
||||
output: >
|
||||
User management binary command run outside of container
|
||||
(user=%user.name command=%proc.cmdline parent=%proc.pname gparent=%proc.aname[2] ggparent=%proc.aname[3] gggparent=%proc.aname[4])
|
||||
@@ -2219,16 +2286,20 @@
|
||||
/dev/random, /dev/urandom, /dev/console, /dev/kmsg
|
||||
]
|
||||
|
||||
- macro: user_known_create_files_below_dev_activities
|
||||
condition: (never_true)
|
||||
|
||||
# (we may need to add additional checks against false positives, see:
|
||||
# https://bugs.launchpad.net/ubuntu/+source/rkhunter/+bug/86153)
|
||||
- rule: Create files below dev
|
||||
desc: creating any files below /dev other than known programs that manage devices. Some rootkits hide files in /dev.
|
||||
condition: >
|
||||
fd.directory = /dev and
|
||||
(evt.type = creat or (evt.type = open and evt.arg.flags contains O_CREAT))
|
||||
(evt.type = creat or ((evt.type = open or evt.type = openat) and evt.arg.flags contains O_CREAT))
|
||||
and not proc.name in (dev_creation_binaries)
|
||||
and not fd.name in (allowed_dev_files)
|
||||
and not fd.name startswith /dev/tty
|
||||
and not user_known_create_files_below_dev_activities
|
||||
output: "File created below /dev by untrusted program (user=%user.name command=%proc.cmdline file=%fd.name container_id=%container.id image=%container.image.repository)"
|
||||
priority: ERROR
|
||||
tags: [filesystem, mitre_persistence]
|
||||
@@ -2288,9 +2359,18 @@
|
||||
- macro: k8s_api_server
|
||||
condition: (fd.sip.name="kubernetes.default.svc.cluster.local")
|
||||
|
||||
- macro: user_known_contact_k8s_api_server_activities
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Contact K8S API Server From Container
|
||||
desc: Detect attempts to contact the K8S API Server from a container
|
||||
condition: evt.type=connect and evt.dir=< and (fd.typechar=4 or fd.typechar=6) and container and not k8s_containers and k8s_api_server
|
||||
condition: >
|
||||
evt.type=connect and evt.dir=< and
|
||||
(fd.typechar=4 or fd.typechar=6) and
|
||||
container and
|
||||
not k8s_containers and
|
||||
k8s_api_server and
|
||||
not user_known_contact_k8s_api_server_activities
|
||||
output: Unexpected connection to K8s API Server from container (command=%proc.cmdline %container.info image=%container.image.repository:%container.image.tag connection=%fd.name)
|
||||
priority: NOTICE
|
||||
tags: [network, k8s, container, mitre_discovery]
|
||||
@@ -2312,7 +2392,7 @@
|
||||
tags: [network, k8s, container, mitre_port_knocking]
|
||||
|
||||
- list: network_tool_binaries
|
||||
items: [nc, ncat, nmap, dig, tcpdump, tshark, ngrep, telnet, mitmproxy, socat]
|
||||
items: [nc, ncat, nmap, dig, tcpdump, tshark, ngrep, telnet, mitmproxy, socat, zmap]
|
||||
|
||||
- macro: network_tool_procs
|
||||
condition: (proc.name in (network_tool_binaries))
|
||||
@@ -2356,10 +2436,13 @@
|
||||
priority: WARNING
|
||||
tags: [network, process, mitre_execution]
|
||||
|
||||
- macro: user_known_network_tool_activities
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Launch Suspicious Network Tool in Container
|
||||
desc: Detect network tools launched inside container
|
||||
condition: >
|
||||
spawned_process and container and network_tool_procs
|
||||
spawned_process and container and network_tool_procs and not user_known_network_tool_activities
|
||||
output: >
|
||||
Network tool launched in container (user=%user.name command=%proc.cmdline parent_process=%proc.pname
|
||||
container_id=%container.id container_name=%container.name image=%container.image.repository:%container.image.tag)
|
||||
@@ -2378,7 +2461,8 @@
|
||||
spawned_process and
|
||||
not container and
|
||||
consider_network_tools_on_host and
|
||||
network_tool_procs
|
||||
network_tool_procs and
|
||||
not user_known_network_tool_activities
|
||||
output: >
|
||||
Network tool launched on host (user=%user.name command=%proc.cmdline parent_process=%proc.pname)
|
||||
priority: NOTICE
|
||||
@@ -2461,9 +2545,12 @@
|
||||
- macro: clear_data_procs
|
||||
condition: (proc.name in (data_remove_commands))
|
||||
|
||||
- macro: user_known_remove_data_activities
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Remove Bulk Data from Disk
|
||||
desc: Detect process running to clear bulk data from disk
|
||||
condition: spawned_process and clear_data_procs
|
||||
condition: spawned_process and clear_data_procs and not user_known_remove_data_activities
|
||||
output: >
|
||||
Bulk data has been removed from disk (user=%user.name command=%proc.cmdline file=%fd.name container_id=%container.id image=%container.image.repository)
|
||||
priority:
|
||||
@@ -2502,7 +2589,7 @@
|
||||
- rule: Delete Bash History
|
||||
desc: Detect bash history deletion
|
||||
condition: >
|
||||
((spawned_process and proc.name in (shred, rm, mv) and proc.args contains "bash_history") or
|
||||
((spawned_process and proc.name in (shred, rm, mv) and proc.args contains "bash_history") or
|
||||
(open_write and fd.name contains "bash_history" and evt.arg.flags contains "O_TRUNC"))
|
||||
output: >
|
||||
Shell history had been deleted or renamed (user=%user.name type=%evt.type command=%proc.cmdline fd.name=%fd.name name=%evt.arg.name path=%evt.arg.path oldpath=%evt.arg.oldpath %container.info)
|
||||
@@ -2546,14 +2633,17 @@
|
||||
- macro: consider_hidden_file_creation
|
||||
condition: (never_true)
|
||||
|
||||
- macro: user_known_create_hidden_file_activities
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Create Hidden Files or Directories
|
||||
desc: Detect hidden files or directories created
|
||||
condition: >
|
||||
(consider_hidden_file_creation and (
|
||||
(modify and evt.arg.newpath contains "/.") or
|
||||
(mkdir and evt.arg.path contains "/.") or
|
||||
(open_write and evt.arg.flags contains "O_CREAT" and fd.name contains "/." and not fd.name pmatch (exclude_hidden_directories)))
|
||||
)
|
||||
((modify and evt.arg.newpath contains "/.") or
|
||||
(mkdir and evt.arg.path contains "/.") or
|
||||
(open_write and evt.arg.flags contains "O_CREAT" and fd.name contains "/." and not fd.name pmatch (exclude_hidden_directories))) and
|
||||
consider_hidden_file_creation and
|
||||
not user_known_create_hidden_file_activities
|
||||
output: >
|
||||
Hidden file or directory created (user=%user.name command=%proc.cmdline
|
||||
file=%fd.name newpath=%evt.arg.newpath container_id=%container.id container_name=%container.name image=%container.image.repository:%container.image.tag)
|
||||
@@ -2726,7 +2816,7 @@
|
||||
output: Packet socket was created in a container (user=%user.name command=%proc.cmdline socket_info=%evt.args container_id=%container.id container_name=%container.name image=%container.image.repository:%container.image.tag)
|
||||
priority: NOTICE
|
||||
tags: [network, mitre_discovery]
|
||||
|
||||
|
||||
# Change to (always_true) to enable rule 'Network connection outside local subnet'
|
||||
- macro: enabled_rule_network_only_subnet
|
||||
condition: (never_true)
|
||||
@@ -2742,7 +2832,7 @@
|
||||
- macro: network_local_subnet
|
||||
condition: >
|
||||
fd.rnet in (rfc_1918_addresses) or
|
||||
fd.ip = "0.0.0.0" or
|
||||
fd.ip = "0.0.0.0" or
|
||||
fd.net = "127.0.0.0/8"
|
||||
|
||||
# # How to test:
|
||||
@@ -2802,18 +2892,67 @@
|
||||
not fd.sport in (authorized_server_port)
|
||||
output: >
|
||||
Network connection outside authorized port and binary
|
||||
(command=%proc.cmdline connection=%fd.name user=%user.name container_id=%container.id
|
||||
(command=%proc.cmdline connection=%fd.name user=%user.name container_id=%container.id
|
||||
image=%container.image.repository)
|
||||
priority: WARNING
|
||||
tags: [network]
|
||||
|
||||
- macro: user_known_stand_streams_redirect_activities
|
||||
condition: (never_true)
|
||||
|
||||
- rule: Redirect STDOUT/STDIN to Network Connection in Container
|
||||
desc: Detect redirecting stdout/stdin to network connection in container (potential reverse shell).
|
||||
condition: evt.type=dup and evt.dir=> and container and fd.num in (0, 1, 2) and fd.type in ("ipv4", "ipv6")
|
||||
condition: evt.type=dup and evt.dir=> and container and fd.num in (0, 1, 2) and fd.type in ("ipv4", "ipv6") and not user_known_stand_streams_redirect_activities
|
||||
output: >
|
||||
Redirect stdout/stdin to network connection (user=%user.name %container.info process=%proc.name parent=%proc.pname cmdline=%proc.cmdline terminal=%proc.tty container_id=%container.id image=%container.image.repository fd.name=%fd.name fd.num=%fd.num fd.type=%fd.type fd.sip=%fd.sip)
|
||||
priority: WARNING
|
||||
|
||||
# The two Container Drift rules below will fire when a new executable is created in a container.
|
||||
# There are two ways to create executables - file is created with execution permissions or permissions change of existing file.
|
||||
# We will use a new sysdig filter, is_open_exec, to find all files creations with execution permission, and will trace all chmods in a container.
|
||||
# The use case we are targeting here is an attempt to execute code that was not shipped as part of a container (drift) -
|
||||
# an activity that might be malicious or non-compliant.
|
||||
# Two things to pay attention to:
|
||||
# 1) In most cases, 'docker cp' will not be identified, but the assumption is that if an attacker gained access to the container runtime daemon, they are already privileged
|
||||
# 2) Drift rules will be noisy in environments in which containers are built (e.g. docker build)
|
||||
# These two rules are not enabled by default. Use `never_true` in macro condition to enable them.
|
||||
|
||||
- macro: user_known_container_drift_activities
|
||||
condition: (always_true)
|
||||
|
||||
- rule: Container Drift Detected (chmod)
|
||||
desc: New executable created in a container due to chmod
|
||||
condition: >
|
||||
chmod and
|
||||
consider_all_chmods and
|
||||
container and
|
||||
not runc_writing_exec_fifo and
|
||||
not runc_writing_var_lib_docker and
|
||||
not user_known_container_drift_activities and
|
||||
evt.rawres>=0 and
|
||||
((evt.arg.mode contains "S_IXUSR") or
|
||||
(evt.arg.mode contains "S_IXGRP") or
|
||||
(evt.arg.mode contains "S_IXOTH"))
|
||||
output: Drift detected (chmod), new executable created in a container (user=%user.name command=%proc.cmdline filename=%evt.arg.filename name=%evt.arg.name mode=%evt.arg.mode event=%evt.type)
|
||||
priority: ERROR
|
||||
|
||||
# ****************************************************************************
|
||||
# * "Container Drift Detected (open+create)" requires FALCO_ENGINE_VERSION 6 *
|
||||
# ****************************************************************************
|
||||
- rule: Container Drift Detected (open+create)
|
||||
desc: New executable created in a container due to open+create
|
||||
condition: >
|
||||
evt.type in (open,openat,creat) and
|
||||
evt.is_open_exec=true and
|
||||
container and
|
||||
not runc_writing_exec_fifo and
|
||||
not runc_writing_var_lib_docker and
|
||||
not user_known_container_drift_activities and
|
||||
evt.rawres>=0
|
||||
output: Drift detected (open+create), new executable created in a container (user=%user.name command=%proc.cmdline filename=%evt.arg.filename name=%evt.arg.name mode=%evt.arg.mode event=%evt.type)
|
||||
priority: ERROR
|
||||
|
||||
|
||||
# Application rules have moved to application_rules.yaml. Please look
|
||||
# there if you want to enable them by adding to
|
||||
# falco_rules.local.yaml.
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
- list: allowed_k8s_users
|
||||
items: [
|
||||
"minikube", "minikube-user", "kubelet", "kops", "admin", "kube", "kube-proxy",
|
||||
"minikube", "minikube-user", "kubelet", "kops", "admin", "kube", "kube-proxy", "kube-apiserver-healthcheck",
|
||||
vertical_pod_autoscaler_users,
|
||||
]
|
||||
|
||||
@@ -155,10 +155,13 @@
|
||||
source: k8s_audit
|
||||
tags: [k8s]
|
||||
|
||||
- macro: user_known_node_port_service
|
||||
condition: (k8s_audit_never_true)
|
||||
|
||||
- rule: Create NodePort Service
|
||||
desc: >
|
||||
Detect an attempt to start a service with a NodePort service type
|
||||
condition: kevt and service and kcreate and ka.req.service.type=NodePort
|
||||
condition: kevt and service and kcreate and ka.req.service.type=NodePort and not user_known_node_port_service
|
||||
output: NodePort Service Created (user=%ka.user.name service=%ka.target.name ns=%ka.target.namespace ports=%ka.req.service.ports)
|
||||
priority: WARNING
|
||||
source: k8s_audit
|
||||
@@ -186,7 +189,7 @@
|
||||
- rule: Anonymous Request Allowed
|
||||
desc: >
|
||||
Detect any request made by the anonymous user that was allowed
|
||||
condition: kevt and ka.user.name=system:anonymous and ka.auth.decision!=reject and not health_endpoint
|
||||
condition: kevt and ka.user.name=system:anonymous and ka.auth.decision="allow" and not health_endpoint
|
||||
output: Request by anonymous user allowed (user=%ka.user.name verb=%ka.verb uri=%ka.uri reason=%ka.auth.reason))
|
||||
priority: WARNING
|
||||
source: k8s_audit
|
||||
@@ -201,10 +204,13 @@
|
||||
# attach request was created privileged or not. For now, we have a
|
||||
# less severe rule that detects attaches/execs to any pod.
|
||||
|
||||
- macro: user_known_exec_pod_activities
|
||||
condition: (k8s_audit_never_true)
|
||||
|
||||
- rule: Attach/Exec Pod
|
||||
desc: >
|
||||
Detect any attempt to attach/exec to a pod
|
||||
condition: kevt_started and pod_subresource and kcreate and ka.target.subresource in (exec,attach)
|
||||
condition: kevt_started and pod_subresource and kcreate and ka.target.subresource in (exec,attach) and not user_known_exec_pod_activities
|
||||
output: Attach/Exec to pod (user=%ka.user.name pod=%ka.target.name ns=%ka.target.namespace action=%ka.target.subresource command=%ka.uri.param[command])
|
||||
priority: NOTICE
|
||||
source: k8s_audit
|
||||
@@ -222,19 +228,31 @@
|
||||
source: k8s_audit
|
||||
tags: [k8s]
|
||||
|
||||
- list: user_trusted_image_list
|
||||
items: []
|
||||
|
||||
- macro: trusted_pod
|
||||
condition: (ka.req.pod.containers.image.repository in (user_trusted_image_list))
|
||||
|
||||
# Detect any new pod created in the kube-system namespace
|
||||
- rule: Pod Created in Kube Namespace
|
||||
desc: Detect any attempt to create a pod in the kube-system or kube-public namespaces
|
||||
condition: kevt and pod and kcreate and ka.target.namespace in (kube-system, kube-public)
|
||||
condition: kevt and pod and kcreate and ka.target.namespace in (kube-system, kube-public) and not trusted_pod
|
||||
output: Pod created in kube namespace (user=%ka.user.name pod=%ka.resp.name ns=%ka.target.namespace images=%ka.req.pod.containers.image)
|
||||
priority: WARNING
|
||||
source: k8s_audit
|
||||
tags: [k8s]
|
||||
|
||||
- list: user_known_sa_list
|
||||
items: []
|
||||
|
||||
- macro: trusted_sa
|
||||
condition: (ka.target.name in (user_known_sa_list))
|
||||
|
||||
# Detect creating a service account in the kube-system/kube-public namespace
|
||||
- rule: Service Account Created in Kube Namespace
|
||||
desc: Detect any attempt to create a serviceaccount in the kube-system or kube-public namespaces
|
||||
condition: kevt and serviceaccount and kcreate and ka.target.namespace in (kube-system, kube-public) and response_successful
|
||||
condition: kevt and serviceaccount and kcreate and ka.target.namespace in (kube-system, kube-public) and response_successful and not trusted_sa
|
||||
output: Service account created in kube namespace (user=%ka.user.name serviceaccount=%ka.target.name ns=%ka.target.namespace)
|
||||
priority: WARNING
|
||||
source: k8s_audit
|
||||
@@ -476,8 +494,6 @@
|
||||
source: k8s_audit
|
||||
tags: [k8s]
|
||||
|
||||
|
||||
|
||||
- macro: ingress
|
||||
condition: ka.target.resource=ingresses
|
||||
|
||||
@@ -513,8 +529,6 @@
|
||||
priority: WARNING
|
||||
tags: [k8s, network]
|
||||
|
||||
|
||||
|
||||
- macro: node
|
||||
condition: ka.target.resource=nodes
|
||||
|
||||
|
||||
38
test/confs/grpc_unix_socket.yaml
Normal file
38
test/confs/grpc_unix_socket.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# Copyright (C) 2020 The Falco Authors.
|
||||
#
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# Whether to output events in json or text.
|
||||
json_output: false
|
||||
|
||||
# Send information logs to stderr and/or syslog
|
||||
# Note these are *not* security notification logs!
|
||||
# These are just Falco lifecycle (and possibly error) logs.
|
||||
log_stderr: false
|
||||
log_syslog: false
|
||||
|
||||
# Where security notifications should go.
|
||||
stdout_output:
|
||||
enabled: false
|
||||
|
||||
# gRPC server using an unix socket.
|
||||
grpc:
|
||||
enabled: true
|
||||
bind_address: "unix:///tmp/falco/falco.sock"
|
||||
threadiness: 8
|
||||
|
||||
grpc_output:
|
||||
enabled: true
|
||||
@@ -136,7 +136,7 @@ stdout_output:
|
||||
webserver:
|
||||
enabled: true
|
||||
listen_port: 8765
|
||||
k8s_audit_endpoint: /k8s_audit
|
||||
k8s_audit_endpoint: /k8s-audit
|
||||
ssl_enabled: false
|
||||
ssl_certificate: /etc/falco/falco.pem
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ import urllib.request
|
||||
from avocado import Test
|
||||
from avocado import main
|
||||
from avocado.utils import process
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import PatternMatchingEventHandler
|
||||
|
||||
class FalcoTest(Test):
|
||||
|
||||
@@ -195,6 +197,24 @@ class FalcoTest(Test):
|
||||
os.makedirs(filedir)
|
||||
self.outputs = outputs
|
||||
|
||||
self.grpcurl_res = None
|
||||
self.grpc_observer = None
|
||||
self.grpc_address = self.params.get('address', 'grpc/*', default='/var/run/falco.sock')
|
||||
if self.grpc_address.startswith("unix://"):
|
||||
self.is_grpc_using_unix_socket = True
|
||||
self.grpc_address = self.grpc_address[len("unix://"):]
|
||||
else:
|
||||
self.is_grpc_using_unix_socket = False
|
||||
self.grpc_proto = self.params.get('proto', 'grpc/*', default='')
|
||||
self.grpc_service = self.params.get('service', 'grpc/*', default='')
|
||||
self.grpc_method = self.params.get('method', 'grpc/*', default='')
|
||||
self.grpc_results = self.params.get('results', 'grpc/*', default='')
|
||||
if self.grpc_results == '':
|
||||
self.grpc_results = []
|
||||
else:
|
||||
if type(self.grpc_results) == str:
|
||||
self.grpc_results = [self.grpc_results]
|
||||
|
||||
self.disable_tags = self.params.get('disable_tags', '*', default='')
|
||||
|
||||
if self.disable_tags == '':
|
||||
@@ -417,6 +437,48 @@ class FalcoTest(Test):
|
||||
self.log.debug("Copying {} to {}".format(driver_path, module_path))
|
||||
shutil.copyfile(driver_path, module_path)
|
||||
|
||||
def init_grpc_handler(self):
|
||||
self.grpcurl_res = None
|
||||
if len(self.grpc_results) > 0:
|
||||
if not self.is_grpc_using_unix_socket:
|
||||
self.fail("This test suite supports gRPC with unix socket only")
|
||||
|
||||
cmdline = "grpcurl -import-path ../userspace/falco " \
|
||||
"-proto {} -plaintext -unix {} " \
|
||||
"{}/{}".format(self.grpc_proto, self.grpc_address, self.grpc_service, self.grpc_method)
|
||||
that = self
|
||||
class GRPCUnixSocketEventHandler(PatternMatchingEventHandler):
|
||||
def on_created(self, event):
|
||||
# that.log.info("EVENT: {}", event)
|
||||
that.grpcurl_res = process.run(cmdline)
|
||||
|
||||
path = os.path.dirname(self.grpc_address)
|
||||
process.run("mkdir -p {}".format(path))
|
||||
event_handler = GRPCUnixSocketEventHandler(patterns=['*'],
|
||||
ignore_directories=True)
|
||||
self.grpc_observer = Observer()
|
||||
self.grpc_observer.schedule(event_handler, path, recursive=False)
|
||||
self.grpc_observer.start()
|
||||
|
||||
def check_grpc(self):
|
||||
if self.grpc_observer is not None:
|
||||
self.grpc_observer.stop()
|
||||
self.grpc_observer = None
|
||||
if self.grpcurl_res is None:
|
||||
self.fail("gRPC responses not found")
|
||||
|
||||
for exp_result in self.grpc_results:
|
||||
found = False
|
||||
for line in self.grpcurl_res.stdout.decode("utf-8").splitlines():
|
||||
match = re.search(exp_result, line)
|
||||
|
||||
if match is not None:
|
||||
found = True
|
||||
|
||||
if found == False:
|
||||
self.fail("Could not find a line '{}' in gRPC responses".format(exp_result))
|
||||
|
||||
|
||||
def test(self):
|
||||
self.log.info("Trace file %s", self.trace_file)
|
||||
|
||||
@@ -424,6 +486,8 @@ class FalcoTest(Test):
|
||||
|
||||
self.possibly_copy_driver()
|
||||
|
||||
self.init_grpc_handler()
|
||||
|
||||
if self.package != 'None':
|
||||
# This sets falco_binary_path as a side-effect.
|
||||
self.install_package()
|
||||
@@ -526,6 +590,7 @@ class FalcoTest(Test):
|
||||
self.check_detections_by_rule(res)
|
||||
self.check_json_output(res)
|
||||
self.check_outputs()
|
||||
self.check_grpc()
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -672,6 +672,22 @@ trace_files: !mux
|
||||
outputs:
|
||||
- /tmp/falco_outputs/program_output.txt: Warning An open was seen
|
||||
|
||||
grpc_unix_socket_outputs:
|
||||
detect: True
|
||||
detect_level: WARNING
|
||||
rules_file:
|
||||
- rules/single_rule.yaml
|
||||
conf_file: confs/grpc_unix_socket.yaml
|
||||
trace_file: trace_files/cat_write.scap
|
||||
run_duration: 5
|
||||
grpc:
|
||||
address: unix:///tmp/falco/falco.sock
|
||||
proto: outputs.proto
|
||||
service: falco.outputs.service
|
||||
method: get
|
||||
results:
|
||||
- "Warning An open was seen"
|
||||
|
||||
detect_counts:
|
||||
detect: True
|
||||
detect_level: WARNING
|
||||
|
||||
@@ -3,9 +3,11 @@ avocado-framework-plugin-varianter-yaml-to-mux==69.0
|
||||
certifi==2020.4.5.1
|
||||
chardet==3.0.4
|
||||
idna==2.9
|
||||
pathtools==0.1.2
|
||||
pbr==5.4.5
|
||||
PyYAML==5.3.1
|
||||
requests==2.23.0
|
||||
six==1.14.0
|
||||
stevedore==1.32.0
|
||||
urllib3==1.25.9
|
||||
watchdog==0.10.2
|
||||
@@ -16,9 +16,9 @@ limitations under the License.
|
||||
|
||||
// The version of rules/filter fields/etc supported by this falco
|
||||
// engine.
|
||||
#define FALCO_ENGINE_VERSION (5)
|
||||
#define FALCO_ENGINE_VERSION (6)
|
||||
|
||||
// This is the result of running "falco --list -N | sha256sum" and
|
||||
// represents the fields supported by this version of falco. It's used
|
||||
// at build time to detect a changed set of fields.
|
||||
#define FALCO_FIELDS_CHECKSUM "ca9e75fa41fe4480cdfad8cf275cdbbc334e656569f070c066d87cbd2955c1ae"
|
||||
#define FALCO_FIELDS_CHECKSUM "2f324e2e66d4b423f53600e7e0fcf2f0ff72e4a87755c490f2ae8f310aba9386"
|
||||
|
||||
@@ -52,6 +52,12 @@ std::string wrap_text(const std::string& str, uint32_t initial_pos, uint32_t ind
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32_t hardware_concurrency()
|
||||
{
|
||||
auto hc = std::thread::hardware_concurrency();
|
||||
return hc ? hc : 1;
|
||||
}
|
||||
|
||||
void readfile(const std::string& filename, std::string& data)
|
||||
{
|
||||
std::ifstream file(filename.c_str(), std::ios::in);
|
||||
|
||||
@@ -21,6 +21,7 @@ limitations under the License.
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <nonstd/string_view.hpp>
|
||||
|
||||
#pragma once
|
||||
@@ -34,6 +35,9 @@ namespace utils
|
||||
std::string wrap_text(const std::string& str, uint32_t initial_pos, uint32_t indent, uint32_t line_len);
|
||||
|
||||
void readfile(const std::string& filename, std::string& data);
|
||||
|
||||
uint32_t hardware_concurrency();
|
||||
|
||||
namespace network
|
||||
{
|
||||
static const std::string UNIX_SCHEME("unix://");
|
||||
|
||||
@@ -45,7 +45,7 @@ const json &json_event::jevt()
|
||||
return m_jevt;
|
||||
}
|
||||
|
||||
uint64_t json_event::get_ts()
|
||||
uint64_t json_event::get_ts() const
|
||||
{
|
||||
return m_event_ts;
|
||||
}
|
||||
|
||||
@@ -38,14 +38,14 @@ public:
|
||||
void set_jevt(nlohmann::json &evt, uint64_t ts);
|
||||
const nlohmann::json &jevt();
|
||||
|
||||
uint64_t get_ts();
|
||||
uint64_t get_ts() const;
|
||||
|
||||
inline uint16_t get_source()
|
||||
inline uint16_t get_source() const
|
||||
{
|
||||
return ESRC_K8S_AUDIT;
|
||||
}
|
||||
|
||||
inline uint16_t get_type()
|
||||
inline uint16_t get_type() const
|
||||
{
|
||||
// All k8s audit events have the single tag "1". - see falco_engine::process_k8s_audit_event
|
||||
return 1;
|
||||
|
||||
@@ -19,23 +19,24 @@ add_custom_command(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.grpc.pb.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.pb.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.pb.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/output.grpc.pb.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/output.grpc.pb.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/output.pb.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/output.pb.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/outputs.grpc.pb.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/outputs.grpc.pb.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/outputs.pb.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/outputs.pb.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/schema.pb.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/schema.pb.h
|
||||
COMMENT "Generate gRPC version API"
|
||||
COMMENT "Generate gRPC API"
|
||||
# Falco gRPC Version API
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version.proto
|
||||
COMMAND ${PROTOC} -I ${CMAKE_CURRENT_SOURCE_DIR} --cpp_out=. ${CMAKE_CURRENT_SOURCE_DIR}/version.proto
|
||||
COMMAND ${PROTOC} -I ${CMAKE_CURRENT_SOURCE_DIR} --grpc_out=. --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/version.proto
|
||||
COMMENT "Generate gRPC outputs API"
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/output.proto
|
||||
COMMAND ${PROTOC} -I ${CMAKE_CURRENT_SOURCE_DIR} --cpp_out=. ${CMAKE_CURRENT_SOURCE_DIR}/output.proto
|
||||
# Falco gRPC Outputs API
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/outputs.proto
|
||||
COMMAND ${PROTOC} -I ${CMAKE_CURRENT_SOURCE_DIR} --cpp_out=. ${CMAKE_CURRENT_SOURCE_DIR}/outputs.proto
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/schema.proto
|
||||
COMMAND ${PROTOC} -I ${CMAKE_CURRENT_SOURCE_DIR} --grpc_out=. --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/output.proto
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/outputs.proto
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(
|
||||
@@ -54,8 +55,8 @@ add_executable(
|
||||
grpc_server.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.grpc.pb.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.pb.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/output.grpc.pb.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/output.pb.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/outputs.grpc.pb.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/outputs.pb.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/schema.pb.cc)
|
||||
|
||||
add_dependencies(falco civetweb string-view-lite)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2019 The Falco Authors.
|
||||
Copyright (C) 2020 The Falco Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ limitations under the License.
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include "falco_utils.h"
|
||||
|
||||
#include "configuration.h"
|
||||
#include "logger.h"
|
||||
@@ -32,7 +33,7 @@ falco_configuration::falco_configuration():
|
||||
m_time_format_iso_8601(false),
|
||||
m_webserver_enabled(false),
|
||||
m_webserver_listen_port(8765),
|
||||
m_webserver_k8s_audit_endpoint("/k8s_audit"),
|
||||
m_webserver_k8s_audit_endpoint("/k8s-audit"),
|
||||
m_webserver_ssl_enabled(false),
|
||||
m_config(NULL)
|
||||
{
|
||||
@@ -148,11 +149,12 @@ void falco_configuration::init(string conf_filename, list<string> &cmdline_optio
|
||||
|
||||
m_grpc_enabled = m_config->get_scalar<bool>("grpc", "enabled", false);
|
||||
m_grpc_bind_address = m_config->get_scalar<string>("grpc", "bind_address", "0.0.0.0:5060");
|
||||
m_grpc_threadiness = m_config->get_scalar<uint32_t>("grpc", "threadiness", 8); // todo > limit it to avoid overshubscription? std::thread::hardware_concurrency()
|
||||
m_grpc_threadiness = m_config->get_scalar<uint32_t>("grpc", "threadiness", 0);
|
||||
if(m_grpc_threadiness == 0)
|
||||
{
|
||||
throw logic_error("error reading config file (" + m_config_file + "): gRPC threadiness must be greater than 0");
|
||||
m_grpc_threadiness = falco::utils::hardware_concurrency();
|
||||
}
|
||||
// todo > else limit threadiness to avoid oversubscription?
|
||||
m_grpc_private_key = m_config->get_scalar<string>("grpc", "private_key", "/etc/falco/certs/server.key");
|
||||
m_grpc_cert_chain = m_config->get_scalar<string>("grpc", "cert_chain", "/etc/falco/certs/server.crt");
|
||||
m_grpc_root_certs = m_config->get_scalar<string>("grpc", "root_certs", "/etc/falco/certs/ca.crt");
|
||||
@@ -198,7 +200,7 @@ void falco_configuration::init(string conf_filename, list<string> &cmdline_optio
|
||||
|
||||
m_webserver_enabled = m_config->get_scalar<bool>("webserver", "enabled", false);
|
||||
m_webserver_listen_port = m_config->get_scalar<uint32_t>("webserver", "listen_port", 8765);
|
||||
m_webserver_k8s_audit_endpoint = m_config->get_scalar<string>("webserver", "k8s_audit_endpoint", "/k8s_audit");
|
||||
m_webserver_k8s_audit_endpoint = m_config->get_scalar<string>("webserver", "k8s_audit_endpoint", "/k8s-audit");
|
||||
m_webserver_ssl_enabled = m_config->get_scalar<bool>("webserver", "ssl_enabled", false);
|
||||
m_webserver_ssl_certificate = m_config->get_scalar<string>("webserver", "ssl_certificate", "/etc/falco/falco.pem");
|
||||
|
||||
@@ -344,4 +346,4 @@ void falco_configuration::set_cmdline_option(const string &opt)
|
||||
{
|
||||
m_config->set_scalar(keyval.first, keyval.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,7 +206,7 @@ public:
|
||||
bool m_time_format_iso_8601;
|
||||
|
||||
bool m_grpc_enabled;
|
||||
int m_grpc_threadiness;
|
||||
uint32_t m_grpc_threadiness;
|
||||
std::string m_grpc_bind_address;
|
||||
std::string m_grpc_private_key;
|
||||
std::string m_grpc_cert_chain;
|
||||
|
||||
@@ -140,9 +140,9 @@ static void usage()
|
||||
" -P, --pidfile <pid_file> When run as a daemon, write pid to specified file\n"
|
||||
" -r <rules_file> Rules file/directory (defaults to value set in configuration file, or /etc/falco_rules.yaml).\n"
|
||||
" Can be specified multiple times to read from multiple files/directories.\n"
|
||||
" -s <stats_file> If specified, write statistics related to falco's reading/processing of events\n"
|
||||
" to this file. (Only useful in live mode).\n"
|
||||
" --stats_interval <msec> When using -s <stats_file>, write statistics every <msec> ms.\n"
|
||||
" -s <stats_file> If specified, append statistics related to Falco's reading/processing of events\n"
|
||||
" to this file (only useful in live mode).\n"
|
||||
" --stats-interval <msec> When using -s <stats_file>, write statistics every <msec> ms.\n"
|
||||
" This uses signals, so don't recommend intervals below 200 ms.\n"
|
||||
" Defaults to 5000 (5 seconds).\n"
|
||||
" -S <len>, --snaplen <len>\n"
|
||||
@@ -158,6 +158,8 @@ static void usage()
|
||||
" This causes every single line emitted by falco to be flushed,\n"
|
||||
" which generates higher CPU usage but is useful when piping those outputs\n"
|
||||
" into another process or into a script.\n"
|
||||
" -u, --userspace Parse events from userspace.\n"
|
||||
" To be used in conjunction with the ptrace(2) based driver (pdig).\n"
|
||||
" -V, --validate <rules_file> Read the contents of the specified rules(s) file and exit.\n"
|
||||
" Can be specified multiple times to validate multiple files.\n"
|
||||
" -v Verbose output.\n"
|
||||
@@ -443,6 +445,7 @@ int falco_init(int argc, char **argv)
|
||||
set<string> disable_sources;
|
||||
bool disable_syscall = false;
|
||||
bool disable_k8s_audit = false;
|
||||
bool userspace = false;
|
||||
|
||||
// Used for writing trace files
|
||||
int duration_seconds = 0;
|
||||
@@ -479,9 +482,10 @@ int falco_init(int argc, char **argv)
|
||||
{"print-base64", no_argument, 0, 'b'},
|
||||
{"print", required_argument, 0, 'p'},
|
||||
{"snaplen", required_argument, 0, 'S'},
|
||||
{"stats_interval", required_argument, 0},
|
||||
{"stats-interval", required_argument, 0},
|
||||
{"support", no_argument, 0},
|
||||
{"unbuffered", no_argument, 0, 'U'},
|
||||
{"userspace", no_argument, 0, 'u'},
|
||||
{"validate", required_argument, 0, 'V'},
|
||||
{"version", no_argument, 0, 0},
|
||||
{"writefile", required_argument, 0, 'w'},
|
||||
@@ -500,7 +504,7 @@ int falco_init(int argc, char **argv)
|
||||
// Parse the args
|
||||
//
|
||||
while((op = getopt_long(argc, argv,
|
||||
"hc:AbdD:e:F:ik:K:Ll:m:M:No:P:p:r:S:s:T:t:UvV:w:",
|
||||
"hc:AbdD:e:F:ik:K:Ll:m:M:No:P:p:r:S:s:T:t:UuvV:w:",
|
||||
long_options, &long_index)) != -1)
|
||||
{
|
||||
switch(op)
|
||||
@@ -607,6 +611,9 @@ int falco_init(int argc, char **argv)
|
||||
buffered_outputs = false;
|
||||
buffered_cmdline = true;
|
||||
break;
|
||||
case 'u':
|
||||
userspace = true;
|
||||
break;
|
||||
case 'v':
|
||||
verbose = true;
|
||||
break;
|
||||
@@ -646,7 +653,7 @@ int falco_init(int argc, char **argv)
|
||||
list_flds_source = optarg;
|
||||
}
|
||||
}
|
||||
else if (string(long_options[long_index].name) == "stats_interval")
|
||||
else if (string(long_options[long_index].name) == "stats-interval")
|
||||
{
|
||||
stats_interval = atoi(optarg);
|
||||
}
|
||||
@@ -1091,7 +1098,17 @@ int falco_init(int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
open_t open_cb = [](sinsp* inspector) {
|
||||
open_t open_cb = [&userspace](sinsp* inspector)
|
||||
{
|
||||
if(userspace)
|
||||
{
|
||||
// open_udig() is the underlying method used in the capture code to parse userspace events from the kernel.
|
||||
//
|
||||
// Falco uses a ptrace(2) based userspace implementation.
|
||||
// Regardless of the implementation, the underlying method remains the same.
|
||||
inspector->open_udig();
|
||||
return;
|
||||
}
|
||||
inspector->open();
|
||||
};
|
||||
open_t open_nodriver_cb = [](sinsp* inspector) {
|
||||
@@ -1116,11 +1133,17 @@ int falco_init(int argc, char **argv)
|
||||
}
|
||||
catch(sinsp_exception &e)
|
||||
{
|
||||
if(system("modprobe " PROBE_NAME " > /dev/null 2> /dev/null"))
|
||||
// If syscall input source is enabled and not through userspace instrumentation
|
||||
if (!disable_syscall && !userspace)
|
||||
{
|
||||
falco_logger::log(LOG_ERR, "Unable to load the driver. Exiting.\n");
|
||||
// Try to insert the Falco kernel module
|
||||
if(system("modprobe " PROBE_NAME " > /dev/null 2> /dev/null"))
|
||||
{
|
||||
falco_logger::log(LOG_ERR, "Unable to load the driver. Exiting.\n");
|
||||
}
|
||||
open_f(inspector);
|
||||
}
|
||||
open_f(inspector);
|
||||
rethrow_exception(current_exception());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1139,7 +1162,7 @@ int falco_init(int argc, char **argv)
|
||||
duration = ((double)clock()) / CLOCKS_PER_SEC;
|
||||
|
||||
//
|
||||
// run k8s, if required
|
||||
// Run k8s, if required
|
||||
//
|
||||
if(k8s_api)
|
||||
{
|
||||
@@ -1178,7 +1201,7 @@ int falco_init(int argc, char **argv)
|
||||
}
|
||||
|
||||
//
|
||||
// run mesos, if required
|
||||
// Run mesos, if required
|
||||
//
|
||||
if(mesos_api)
|
||||
{
|
||||
@@ -1206,6 +1229,7 @@ int falco_init(int argc, char **argv)
|
||||
// gRPC server
|
||||
if(config.m_grpc_enabled)
|
||||
{
|
||||
falco_logger::log(LOG_INFO, "gRPC server threadiness equals to " + to_string(config.m_grpc_threadiness) + "\n");
|
||||
// TODO(fntlnz,leodido): when we want to spawn multiple threads we need to have a queue per thread, or implement
|
||||
// different queuing mechanisms, round robin, fanout? What we want to achieve?
|
||||
grpc_server.init(
|
||||
@@ -1260,6 +1284,14 @@ int falco_init(int argc, char **argv)
|
||||
|
||||
}
|
||||
|
||||
// Honor -M also when using a trace file.
|
||||
// Since inspection stops as soon as all events have been consumed
|
||||
// just await the given duration is reached, if needed.
|
||||
if(!trace_filename.empty() && duration_to_tot>0)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::seconds(duration_to_tot));
|
||||
}
|
||||
|
||||
inspector->close();
|
||||
engine->print_stats();
|
||||
sdropmgr.print_stats();
|
||||
|
||||
@@ -22,11 +22,10 @@ limitations under the License.
|
||||
|
||||
#include "formats.h"
|
||||
#include "logger.h"
|
||||
#include "falco_output_queue.h"
|
||||
#include "falco_outputs_queue.h"
|
||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
||||
|
||||
using namespace std;
|
||||
using namespace falco::output;
|
||||
|
||||
const static struct luaL_reg ll_falco_outputs [] =
|
||||
{
|
||||
@@ -316,7 +315,7 @@ int falco_outputs::handle_grpc(lua_State *ls)
|
||||
lua_error(ls);
|
||||
}
|
||||
|
||||
response grpc_res = response();
|
||||
falco::outputs::response grpc_res;
|
||||
|
||||
// time
|
||||
gen_event *evt = (gen_event *)lua_topointer(ls, 1);
|
||||
@@ -366,7 +365,7 @@ int falco_outputs::handle_grpc(lua_State *ls)
|
||||
auto host = grpc_res.mutable_hostname();
|
||||
*host = (char *)lua_tostring(ls, 7);
|
||||
|
||||
falco::output::queue::get().push(grpc_res);
|
||||
falco::outputs::queue::get().push(grpc_res);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "output.pb.h"
|
||||
#include "outputs.pb.h"
|
||||
#include "tbb/concurrent_queue.h"
|
||||
|
||||
namespace falco
|
||||
{
|
||||
namespace output
|
||||
namespace outputs
|
||||
{
|
||||
typedef tbb::concurrent_queue<response> response_cq;
|
||||
|
||||
@@ -36,7 +36,7 @@ class context
|
||||
{
|
||||
public:
|
||||
context(::grpc::ServerContext* ctx);
|
||||
~context() = default;
|
||||
virtual ~context() = default;
|
||||
|
||||
void get_metadata(std::string key, std::string& val);
|
||||
|
||||
@@ -50,7 +50,7 @@ class stream_context : public context
|
||||
public:
|
||||
stream_context(::grpc::ServerContext* ctx):
|
||||
context(ctx){};
|
||||
~stream_context() = default;
|
||||
virtual ~stream_context() = default;
|
||||
|
||||
enum : char
|
||||
{
|
||||
@@ -61,6 +61,15 @@ public:
|
||||
|
||||
mutable void* m_stream = nullptr; // todo(fntlnz, leodido) > useful in the future
|
||||
mutable bool m_has_more = false;
|
||||
mutable bool m_is_running = true;
|
||||
};
|
||||
|
||||
class bidi_context : public stream_context
|
||||
{
|
||||
public:
|
||||
bidi_context(::grpc::ServerContext* ctx):
|
||||
stream_context(ctx){};
|
||||
virtual ~bidi_context() = default;
|
||||
};
|
||||
|
||||
} // namespace grpc
|
||||
|
||||
@@ -24,12 +24,12 @@ namespace grpc
|
||||
{
|
||||
|
||||
template<>
|
||||
void request_stream_context<falco::output::service, falco::output::request, falco::output::response>::start(server* srv)
|
||||
void request_stream_context<outputs::service, outputs::request, outputs::response>::start(server* srv)
|
||||
{
|
||||
m_state = request_context_base::REQUEST;
|
||||
m_srv_ctx.reset(new ::grpc::ServerContext);
|
||||
auto srvctx = m_srv_ctx.get();
|
||||
m_res_writer.reset(new ::grpc::ServerAsyncWriter<output::response>(srvctx));
|
||||
m_res_writer.reset(new ::grpc::ServerAsyncWriter<outputs::response>(srvctx));
|
||||
m_stream_ctx.reset();
|
||||
m_req.Clear();
|
||||
auto cq = srv->m_completion_queue.get();
|
||||
@@ -38,7 +38,7 @@ void request_stream_context<falco::output::service, falco::output::request, falc
|
||||
}
|
||||
|
||||
template<>
|
||||
void request_stream_context<falco::output::service, falco::output::request, falco::output::response>::process(server* srv)
|
||||
void request_stream_context<outputs::service, outputs::request, outputs::response>::process(server* srv)
|
||||
{
|
||||
// When it is the 1st process call
|
||||
if(m_state == request_context_base::REQUEST)
|
||||
@@ -48,40 +48,46 @@ void request_stream_context<falco::output::service, falco::output::request, falc
|
||||
}
|
||||
|
||||
// Processing
|
||||
output::response res;
|
||||
(srv->*m_process_func)(*m_stream_ctx, m_req, res); // subscribe()
|
||||
outputs::response res;
|
||||
(srv->*m_process_func)(*m_stream_ctx, m_req, res); // get()
|
||||
|
||||
if(!m_stream_ctx->m_is_running)
|
||||
{
|
||||
m_state = request_context_base::FINISH;
|
||||
m_res_writer->Finish(::grpc::Status::OK, this);
|
||||
return;
|
||||
}
|
||||
|
||||
// When there are still more responses to stream
|
||||
if(m_stream_ctx->m_has_more)
|
||||
{
|
||||
// todo(leodido) > log "write: tag=this, state=m_state"
|
||||
m_res_writer->Write(res, this);
|
||||
return;
|
||||
}
|
||||
|
||||
// No more responses to stream
|
||||
else
|
||||
{
|
||||
// Communicate to the gRPC runtime that we have finished.
|
||||
// The memory address of "this" instance uniquely identifies the event.
|
||||
m_state = request_context_base::FINISH;
|
||||
// todo(leodido) > log "finish: tag=this, state=m_state"
|
||||
m_res_writer->Finish(::grpc::Status::OK, this);
|
||||
}
|
||||
// Communicate to the gRPC runtime that we have finished.
|
||||
// The memory address of "this" instance uniquely identifies the event.
|
||||
m_state = request_context_base::FINISH;
|
||||
// todo(leodido) > log "finish: tag=this, state=m_state"
|
||||
m_res_writer->Finish(::grpc::Status::OK, this);
|
||||
}
|
||||
|
||||
template<>
|
||||
void request_stream_context<falco::output::service, falco::output::request, falco::output::response>::end(server* srv, bool errored)
|
||||
void request_stream_context<outputs::service, outputs::request, outputs::response>::end(server* srv, bool error)
|
||||
{
|
||||
if(m_stream_ctx)
|
||||
{
|
||||
if(errored)
|
||||
if(error)
|
||||
{
|
||||
// todo(leodido) > log error "error streaming: tag=this, state=m_state, stream=m_stream_ctx->m_stream"
|
||||
}
|
||||
m_stream_ctx->m_status = errored ? stream_context::ERROR : stream_context::SUCCESS;
|
||||
m_stream_ctx->m_status = error ? stream_context::ERROR : stream_context::SUCCESS;
|
||||
|
||||
// Complete the processing
|
||||
output::response res;
|
||||
(srv->*m_process_func)(*m_stream_ctx, m_req, res); // subscribe()
|
||||
outputs::response res;
|
||||
(srv->*m_process_func)(*m_stream_ctx, m_req, res); // get()
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -98,7 +104,7 @@ void request_stream_context<falco::output::service, falco::output::request, falc
|
||||
}
|
||||
|
||||
template<>
|
||||
void falco::grpc::request_context<falco::version::service, falco::version::request, falco::version::response>::start(server* srv)
|
||||
void request_context<version::service, version::request, version::response>::start(server* srv)
|
||||
{
|
||||
m_state = request_context_base::REQUEST;
|
||||
m_srv_ctx.reset(new ::grpc::ServerContext);
|
||||
@@ -113,7 +119,7 @@ void falco::grpc::request_context<falco::version::service, falco::version::reque
|
||||
}
|
||||
|
||||
template<>
|
||||
void falco::grpc::request_context<falco::version::service, falco::version::request, falco::version::response>::process(server* srv)
|
||||
void request_context<version::service, version::request, version::response>::process(server* srv)
|
||||
{
|
||||
version::response res;
|
||||
(srv->*m_process_func)(m_srv_ctx.get(), m_req, res);
|
||||
@@ -125,13 +131,85 @@ void falco::grpc::request_context<falco::version::service, falco::version::reque
|
||||
}
|
||||
|
||||
template<>
|
||||
void falco::grpc::request_context<falco::version::service, falco::version::request, falco::version::response>::end(server* srv, bool errored)
|
||||
void request_context<version::service, version::request, version::response>::end(server* srv, bool error)
|
||||
{
|
||||
// todo(leodido) > handle processing errors here
|
||||
|
||||
|
||||
// Ask to start processing requests
|
||||
start(srv);
|
||||
}
|
||||
|
||||
template<>
|
||||
void request_bidi_context<outputs::service, outputs::request, outputs::response>::start(server* srv)
|
||||
{
|
||||
m_state = request_context_base::REQUEST;
|
||||
m_srv_ctx.reset(new ::grpc::ServerContext);
|
||||
auto srvctx = m_srv_ctx.get();
|
||||
m_reader_writer.reset(new ::grpc::ServerAsyncReaderWriter<outputs::response, outputs::request>(srvctx));
|
||||
m_req.Clear();
|
||||
auto cq = srv->m_completion_queue.get();
|
||||
// Request to start processing given requests.
|
||||
// Using "this" - ie., the memory address of this context - as the tag that uniquely identifies the request.
|
||||
// In this way, different contexts can serve different requests concurrently.
|
||||
(srv->m_output_svc.*m_request_func)(srvctx, m_reader_writer.get(), cq, cq, this);
|
||||
};
|
||||
|
||||
template<>
|
||||
void request_bidi_context<outputs::service, outputs::request, outputs::response>::process(server* srv)
|
||||
{
|
||||
switch(m_state)
|
||||
{
|
||||
case request_context_base::REQUEST:
|
||||
m_bidi_ctx.reset(new bidi_context(m_srv_ctx.get()));
|
||||
m_bidi_ctx->m_status = bidi_context::STREAMING;
|
||||
m_state = request_context_base::WRITE;
|
||||
m_reader_writer->Read(&m_req, this);
|
||||
return;
|
||||
case request_context_base::WRITE:
|
||||
// Processing
|
||||
{
|
||||
outputs::response res;
|
||||
(srv->*m_process_func)(*m_bidi_ctx, m_req, res); // sub()
|
||||
|
||||
if(!m_bidi_ctx->m_is_running)
|
||||
{
|
||||
m_state = request_context_base::FINISH;
|
||||
m_reader_writer->Finish(::grpc::Status::OK, this);
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_bidi_ctx->m_has_more)
|
||||
{
|
||||
m_state = request_context_base::WRITE;
|
||||
m_reader_writer->Write(res, this);
|
||||
return;
|
||||
}
|
||||
|
||||
m_state = request_context_base::WRITE;
|
||||
m_reader_writer->Read(&m_req, this);
|
||||
}
|
||||
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
void request_bidi_context<outputs::service, outputs::request, outputs::response>::end(server* srv, bool error)
|
||||
{
|
||||
if(m_bidi_ctx)
|
||||
{
|
||||
m_bidi_ctx->m_status = error ? bidi_context::ERROR : bidi_context::SUCCESS;
|
||||
|
||||
// Complete the processing
|
||||
outputs::response res;
|
||||
(srv->*m_process_func)(*m_bidi_ctx, m_req, res); // sub()
|
||||
}
|
||||
|
||||
// Ask to start processing requests
|
||||
start(srv);
|
||||
};
|
||||
|
||||
} // namespace grpc
|
||||
} // namespace falco
|
||||
} // namespace falco
|
||||
|
||||
@@ -29,7 +29,8 @@ class request_context_base
|
||||
{
|
||||
public:
|
||||
request_context_base() = default;
|
||||
~request_context_base() = default;
|
||||
// virtual to guarantee that the derived classes are destructed properly
|
||||
virtual ~request_context_base() = default;
|
||||
|
||||
std::unique_ptr<::grpc::ServerContext> m_srv_ctx;
|
||||
enum : char
|
||||
@@ -39,6 +40,7 @@ public:
|
||||
WRITE,
|
||||
FINISH
|
||||
} m_state = UNKNOWN;
|
||||
|
||||
virtual void start(server* srv) = 0;
|
||||
virtual void process(server* srv) = 0;
|
||||
virtual void end(server* srv, bool isError) = 0;
|
||||
@@ -63,7 +65,7 @@ public:
|
||||
|
||||
void start(server* srv);
|
||||
void process(server* srv);
|
||||
void end(server* srv, bool isError);
|
||||
void end(server* srv, bool error);
|
||||
|
||||
private:
|
||||
std::unique_ptr<::grpc::ServerAsyncWriter<Response>> m_res_writer;
|
||||
@@ -90,11 +92,37 @@ public:
|
||||
|
||||
void start(server* srv);
|
||||
void process(server* srv);
|
||||
void end(server* srv, bool isError);
|
||||
void end(server* srv, bool error);
|
||||
|
||||
private:
|
||||
std::unique_ptr<::grpc::ServerAsyncResponseWriter<Response>> m_res_writer;
|
||||
Request m_req;
|
||||
};
|
||||
|
||||
template<class Service, class Request, class Response>
|
||||
class request_bidi_context : public request_context_base
|
||||
{
|
||||
public:
|
||||
request_bidi_context():
|
||||
m_process_func(nullptr),
|
||||
m_request_func(nullptr){};
|
||||
~request_bidi_context() = default;
|
||||
|
||||
// Pointer to function that does actual processing
|
||||
void (server::*m_process_func)(const bidi_context&, const Request&, Response&);
|
||||
|
||||
// Pointer to function that requests the system to start processing given requests
|
||||
void (Service::AsyncService::*m_request_func)(::grpc::ServerContext*, ::grpc::ServerAsyncReaderWriter<Response, Request>*, ::grpc::CompletionQueue*, ::grpc::ServerCompletionQueue*, void*);
|
||||
|
||||
void start(server* srv);
|
||||
void process(server* srv);
|
||||
void end(server* srv, bool error);
|
||||
|
||||
private:
|
||||
std::unique_ptr<::grpc::ServerAsyncReaderWriter<Response, Request>> m_reader_writer;
|
||||
std::unique_ptr<bidi_context> m_bidi_ctx;
|
||||
Request m_req;
|
||||
};
|
||||
|
||||
} // namespace grpc
|
||||
} // namespace falco
|
||||
} // namespace falco
|
||||
|
||||
@@ -44,6 +44,15 @@ limitations under the License.
|
||||
c.start(this); \
|
||||
}
|
||||
|
||||
#define REGISTER_BIDI(req, res, svc, rpc, impl, num) \
|
||||
std::vector<request_bidi_context<svc, req, res>> rpc##_contexts(num); \
|
||||
for(request_bidi_context<svc, req, res> & c : rpc##_contexts) \
|
||||
{ \
|
||||
c.m_process_func = &server::impl; \
|
||||
c.m_request_func = &svc::AsyncService::Request##rpc; \
|
||||
c.start(this); \
|
||||
}
|
||||
|
||||
static void gpr_log_dispatcher_func(gpr_log_func_args* args)
|
||||
{
|
||||
int priority;
|
||||
@@ -60,7 +69,10 @@ static void gpr_log_dispatcher_func(gpr_log_func_args* args)
|
||||
break;
|
||||
}
|
||||
|
||||
falco_logger::log(priority, args->message);
|
||||
string copy = "grpc: ";
|
||||
copy.append(args->message);
|
||||
copy.push_back('\n');
|
||||
falco_logger::log(priority, copy);
|
||||
}
|
||||
|
||||
void falco::grpc::server::thread_process(int thread_index)
|
||||
@@ -199,7 +211,8 @@ void falco::grpc::server::run()
|
||||
// todo(leodido) > take a look at thread_stress_test.cc into grpc repository
|
||||
|
||||
REGISTER_UNARY(version::request, version::response, version::service, version, version, context_num)
|
||||
REGISTER_STREAM(output::request, output::response, output::service, subscribe, subscribe, context_num)
|
||||
REGISTER_STREAM(outputs::request, outputs::response, outputs::service, get, get, context_num)
|
||||
REGISTER_BIDI(outputs::request, outputs::response, outputs::service, sub, sub, context_num)
|
||||
|
||||
m_threads.resize(m_threadiness);
|
||||
int thread_idx = 0;
|
||||
@@ -211,7 +224,7 @@ void falco::grpc::server::run()
|
||||
|
||||
while(server_impl::is_running())
|
||||
{
|
||||
sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
// todo(leodido) > log "stopping gRPC server"
|
||||
stop();
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
void run();
|
||||
void stop();
|
||||
|
||||
output::service::AsyncService m_output_svc;
|
||||
outputs::service::AsyncService m_output_svc;
|
||||
version::service::AsyncService m_version_svc;
|
||||
|
||||
std::unique_ptr<::grpc::ServerCompletionQueue> m_completion_queue;
|
||||
|
||||
@@ -16,7 +16,8 @@ limitations under the License.
|
||||
|
||||
#include "config_falco.h"
|
||||
#include "grpc_server_impl.h"
|
||||
#include "falco_output_queue.h"
|
||||
#include "falco_outputs_queue.h"
|
||||
#include "logger.h"
|
||||
#include "banned.h" // This raises a compilation error when certain functions are used
|
||||
|
||||
bool falco::grpc::server_impl::is_running()
|
||||
@@ -28,29 +29,39 @@ bool falco::grpc::server_impl::is_running()
|
||||
return true;
|
||||
}
|
||||
|
||||
void falco::grpc::server_impl::subscribe(const stream_context& ctx, const output::request& req, output::response& res)
|
||||
void falco::grpc::server_impl::get(const stream_context& ctx, const outputs::request& req, outputs::response& res)
|
||||
{
|
||||
if(ctx.m_status == stream_context::SUCCESS || ctx.m_status == stream_context::ERROR)
|
||||
{
|
||||
// todo(leodido) > log "status=ctx->m_status, stream=ctx->m_stream"
|
||||
ctx.m_stream = nullptr;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start or continue streaming
|
||||
// todo(leodido) > check for m_status == stream_context::STREAMING?
|
||||
// todo(leodido) > set m_stream
|
||||
if(output::queue::get().try_pop(res) && !req.keepalive())
|
||||
{
|
||||
ctx.m_has_more = true;
|
||||
return;
|
||||
}
|
||||
while(is_running() && !output::queue::get().try_pop(res) && req.keepalive())
|
||||
{
|
||||
}
|
||||
|
||||
ctx.m_has_more = !is_running() ? false : req.keepalive();
|
||||
ctx.m_is_running = is_running();
|
||||
|
||||
// Start or continue streaming
|
||||
// m_status == stream_context::STREAMING?
|
||||
// todo(leodido) > set m_stream
|
||||
|
||||
ctx.m_has_more = outputs::queue::get().try_pop(res);
|
||||
}
|
||||
|
||||
void falco::grpc::server_impl::sub(const bidi_context& ctx, const outputs::request& req, outputs::response& res)
|
||||
{
|
||||
if(ctx.m_status == stream_context::SUCCESS || ctx.m_status == stream_context::ERROR)
|
||||
{
|
||||
ctx.m_stream = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
ctx.m_is_running = is_running();
|
||||
|
||||
// Start or continue streaming
|
||||
// m_status == stream_context::STREAMING?
|
||||
// todo(leodido) > set m_stream
|
||||
|
||||
ctx.m_has_more = outputs::queue::get().try_pop(res);
|
||||
}
|
||||
|
||||
void falco::grpc::server_impl::version(const context& ctx, const version::request&, version::response& res)
|
||||
|
||||
@@ -17,7 +17,7 @@ limitations under the License.
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include "output.grpc.pb.h"
|
||||
#include "outputs.grpc.pb.h"
|
||||
#include "version.grpc.pb.h"
|
||||
#include "grpc_context.h"
|
||||
|
||||
@@ -36,8 +36,11 @@ public:
|
||||
protected:
|
||||
bool is_running();
|
||||
|
||||
void subscribe(const stream_context& ctx, const output::request& req, output::response& res);
|
||||
// Outputs
|
||||
void get(const stream_context& ctx, const outputs::request& req, outputs::response& res);
|
||||
void sub(const bidi_context& ctx, const outputs::request& req, outputs::response& res);
|
||||
|
||||
// Version
|
||||
void version(const context& ctx, const version::request& req, version::response& res);
|
||||
|
||||
private:
|
||||
|
||||
@@ -134,7 +134,7 @@ void falco_logger::log(int priority, const string msg)
|
||||
if(gtm != NULL &&
|
||||
(strftime(buf, sizeof(buf), "%FT%T%z", gtm) != 0))
|
||||
{
|
||||
fprintf(stderr, "%s: %s", buf, msg.c_str());
|
||||
fprintf(stderr, "%s: %s", buf, copy.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -151,7 +151,7 @@ void falco_logger::log(int priority, const string msg)
|
||||
{
|
||||
tstr = "N/A";
|
||||
}
|
||||
fprintf(stderr, "%s: %s", tstr.c_str(), msg.c_str());
|
||||
fprintf(stderr, "%s: %s", tstr.c_str(), copy.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ local mod = {}
|
||||
local outputs = {}
|
||||
|
||||
function mod.stdout(event, rule, source, priority, priority_num, msg, format, hostname, options)
|
||||
mod.stdout_message(priority, priority_num, msg, outputs)
|
||||
mod.stdout_message(priority, priority_num, msg, options)
|
||||
end
|
||||
|
||||
function mod.stdout_message(priority, priority_num, msg, options)
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "schema.proto";
|
||||
|
||||
package falco.output;
|
||||
|
||||
option go_package = "github.com/falcosecurity/client-go/pkg/api/output";
|
||||
|
||||
// The `subscribe` service defines the RPC call
|
||||
// to perform an output `request` which will lead to obtain an output `response`.
|
||||
service service {
|
||||
rpc subscribe(request) returns (stream response);
|
||||
}
|
||||
|
||||
// The `request` message is the logical representation of the request model.
|
||||
// It is the input of the `subscribe` service.
|
||||
// It is used to configure the kind of subscription to the gRPC streaming server.
|
||||
//
|
||||
// By default the request asks to the server to only receive the accumulated events.
|
||||
// In case you want to wait indefinitely for new events to come set the keepalive option to true.
|
||||
message request {
|
||||
bool keepalive = 1;
|
||||
// string duration = 2; // TODO(leodido, fntlnz): not handled yet but keeping for reference.
|
||||
// repeated string tags = 3; // TODO(leodido, fntlnz): not handled yet but keeping for reference.
|
||||
}
|
||||
|
||||
// The `response` message is the logical representation of the output model.
|
||||
// It contains all the elements that Falco emits in an output along with the
|
||||
// definitions for priorities and source.
|
||||
message response {
|
||||
google.protobuf.Timestamp time = 1;
|
||||
falco.schema.priority priority = 2;
|
||||
falco.schema.source source = 3;
|
||||
string rule = 4;
|
||||
string output = 5;
|
||||
map<string, string> output_fields = 6;
|
||||
string hostname = 7;
|
||||
// repeated string tags = 8; // TODO(leodido,fntlnz): tags not supported yet, keeping for reference
|
||||
}
|
||||
55
userspace/falco/outputs.proto
Normal file
55
userspace/falco/outputs.proto
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Copyright (C) 2020 The Falco Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "schema.proto";
|
||||
|
||||
package falco.outputs;
|
||||
|
||||
option go_package = "github.com/falcosecurity/client-go/pkg/api/outputs";
|
||||
|
||||
// This service defines the RPC methods
|
||||
// to `request` a stream of output `response`s.
|
||||
service service {
|
||||
// Subscribe to a stream of Falco outputs by sending a stream of requests.
|
||||
rpc sub(stream request) returns (stream response);
|
||||
// Get all the Falco outputs present in the system up to this call.
|
||||
rpc get(request) returns (stream response);
|
||||
}
|
||||
|
||||
// The `request` message is the logical representation of the request model.
|
||||
// It is the input of the `output.service` service.
|
||||
message request {
|
||||
// TODO(leodido,fntlnz): tags not supported yet, keeping it for reference.
|
||||
// repeated string tags = 1;
|
||||
}
|
||||
|
||||
// The `response` message is the representation of the output model.
|
||||
// It contains all the elements that Falco emits in an output along with the
|
||||
// definitions for priorities and source.
|
||||
message response {
|
||||
google.protobuf.Timestamp time = 1;
|
||||
falco.schema.priority priority = 2;
|
||||
falco.schema.source source = 3;
|
||||
string rule = 4;
|
||||
string output = 5;
|
||||
map<string, string> output_fields = 6;
|
||||
string hostname = 7;
|
||||
// TODO(leodido,fntlnz): tags not supported yet, keeping it for reference.
|
||||
// repeated string tags = 8;
|
||||
}
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2020 The Falco Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package falco.schema;
|
||||
|
||||
@@ -58,8 +58,8 @@ bool StatsFileWriter::init(sinsp *inspector, string &filename, uint32_t interval
|
||||
return false;
|
||||
}
|
||||
|
||||
timer.it_value.tv_sec = 0;
|
||||
timer.it_value.tv_usec = interval_msec * 1000;
|
||||
timer.it_value.tv_sec = interval_msec / 1000;
|
||||
timer.it_value.tv_usec = (interval_msec % 1000) * 1000;
|
||||
timer.it_interval = timer.it_value;
|
||||
if (setitimer(ITIMER_REAL, &timer, NULL) == -1)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
Copyright (C) 2020 The Falco Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package falco.version;
|
||||
|
||||
Reference in New Issue
Block a user