-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add falco to Kubernetes modules (#108)
- Loading branch information
1 parent
3cfd788
commit c1165bc
Showing
13 changed files
with
241 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,11 @@ jobs: | |
- name: Setup TFLint | ||
uses: lablabs/[email protected] | ||
with: | ||
tflint_version: v0.20.3 | ||
tflint_version: v0.23.1 | ||
- name: Install azurerm plugin | ||
run: | | ||
mkdir -p .tflint.d/plugins | ||
wget https://github.com/terraform-linters/tflint-ruleset-azurerm/releases/download/v0.5.1/tflint-ruleset-azurerm_linux_amd64.zip | ||
wget https://github.com/terraform-linters/tflint-ruleset-azurerm/releases/download/v0.7.0/tflint-ruleset-azurerm_linux_amd64.zip | ||
unzip tflint-ruleset-azurerm_linux_amd64.zip | ||
mv tflint-ruleset-azurerm .tflint.d/plugins/ | ||
- name: Run lint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Falco | ||
|
||
Adds [`Falco`](https://github.com/falcosecurity/falco) to a Kubernetes clusters. | ||
The modules consists of two components, the main Falco driver and the sidekick which | ||
exports events to Datadog. | ||
|
||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| terraform | 0.13.5 | | ||
| helm | 1.3.2 | | ||
| kubernetes | 1.13.3 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| helm | 1.3.2 | | ||
| kubernetes | 1.13.3 | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| datadog\_api\_key | Datadog api key used to authenticate | `string` | n/a | yes | | ||
| datadog\_site | Datadog host to send events to | `string` | `"api.datadoghq.eu"` | no | | ||
| environment | Variable to add to custom fields | `string` | n/a | yes | | ||
| minimum\_priority | Minimum priority required before being exported | `string` | `"INFO"` | no | | ||
|
||
## Outputs | ||
|
||
No output. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* # Falco | ||
* | ||
* Adds [`Falco`](https://github.com/falcosecurity/falco) to a Kubernetes clusters. | ||
* The modules consists of two components, the main Falco driver and the sidekick which | ||
* exports events to Datadog. | ||
*/ | ||
|
||
terraform { | ||
required_version = "0.13.5" | ||
|
||
required_providers { | ||
kubernetes = { | ||
source = "hashicorp/kubernetes" | ||
version = "1.13.3" | ||
} | ||
helm = { | ||
source = "hashicorp/helm" | ||
version = "1.3.2" | ||
} | ||
} | ||
} | ||
|
||
locals { | ||
falco_values = templatefile("${path.module}/templates/falco-values.yaml.tpl", {}) | ||
falcosidekick_values = templatefile("${path.module}/templates/falcosidekick-values.yaml.tpl", { | ||
environment = var.environment | ||
minimum_priority = var.minimum_priority | ||
datadog_host = "https://${var.datadog_site}" | ||
datadog_api_key = var.datadog_api_key | ||
}) | ||
} | ||
|
||
resource "kubernetes_namespace" "this" { | ||
metadata { | ||
labels = { | ||
name = "falco" | ||
} | ||
name = "falco" | ||
} | ||
} | ||
|
||
resource "helm_release" "falco" { | ||
repository = "https://falcosecurity.github.io/charts" | ||
chart = "falco" | ||
name = "falco" | ||
namespace = kubernetes_namespace.this.metadata[0].name | ||
version = "v1.7.2" | ||
values = [local.falco_values] | ||
} | ||
|
||
resource "helm_release" "falcosidekick" { | ||
repository = "https://falcosecurity.github.io/charts" | ||
chart = "falcosidekick" | ||
name = "falcosidekick" | ||
namespace = kubernetes_namespace.this.metadata[0].name | ||
version = "v0.2.2" | ||
values = [local.falcosidekick_values] | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
auditLog: | ||
enabled: false | ||
|
||
# Use EBPF instead of kernel module | ||
ebpf: | ||
enabled: true | ||
|
||
falco: | ||
jsonOutput: true | ||
jsonIncludeOutputProperty: true | ||
httpOutput: | ||
enabled: true | ||
url: "http://falcosidekick:2801" | ||
|
||
# This should be further explored in the future but seems | ||
# to be a bug right now with no fix so the solution is sadly | ||
# to ignore all syscall errors. | ||
# https://github.com/falcosecurity/falco/issues/1403 | ||
syscallEventDrops: | ||
actions: | ||
- log |
6 changes: 6 additions & 0 deletions
6
modules/kubernetes/falco/templates/falcosidekick-values.yaml.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
config: | ||
customfields: "source:falco,env:${environment}" | ||
datadog: | ||
host: "${datadog_host}" | ||
apikey: "${datadog_api_key}" | ||
minimumpriority: "${minimum_priority}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
variable "environment" { | ||
description = "Variable to add to custom fields" | ||
type = string | ||
} | ||
|
||
variable "minimum_priority" { | ||
description = "Minimum priority required before being exported" | ||
type = string | ||
default = "INFO" | ||
} | ||
|
||
variable "datadog_site" { | ||
description = "Datadog host to send events to" | ||
type = string | ||
default = "api.datadoghq.eu" | ||
} | ||
|
||
variable "datadog_api_key" { | ||
description = "Datadog api key used to authenticate" | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,4 +69,8 @@ module "aks_core" { | |
name = "name" | ||
} | ||
} | ||
datadog_config = { | ||
datadog_site = "" | ||
api_key = "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
terraform { | ||
required_providers { | ||
kubernetes = { | ||
source = "hashicorp/kubernetes" | ||
version = "1.13.3" | ||
} | ||
helm = { | ||
source = "hashicorp/helm" | ||
version = "1.3.2" | ||
} | ||
} | ||
} | ||
|
||
provider "kubernetes" { | ||
load_config_file = "false" | ||
} | ||
|
||
provider "helm" { | ||
kubernetes { | ||
load_config_file = "false" | ||
} | ||
} | ||
|
||
module "falco" { | ||
source = "../../../modules/kubernetes/falco" | ||
|
||
providers = { | ||
kubernetes = kubernetes | ||
helm = helm | ||
} | ||
|
||
environment = "dev" | ||
datadog_api_key = "foobar" #tfsec:ignore:GEN003 | ||
} |