Skip to content

Commit 1071a0c

Browse files
committed
Add documentation for the new resources
Signed-off-by: Federico Barcelona <[email protected]>
1 parent df7e314 commit 1071a0c

8 files changed

+335
-66
lines changed

website/docs/r/sysdig_secure_policy.html.markdown

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: |-
66
Creates a Sysdig Secure Policy.
77
---
88

9-
# sysdig\secure\_policy
9+
# sysdig\_secure\_policy
1010

1111
Creates a Sysdig Secure Policy.
1212

@@ -22,21 +22,21 @@ resource "sysdig_secure_policy" "write_apt_database" {
2222
enabled = true
2323
2424
// Scope selection
25-
//filter = "host.ip.private = \"10.0.23.1\""
26-
container_scope = true
27-
host_scope = true
25+
scope = "container.id != \"\""
2826
29-
//actions {
30-
// container = "pause"
27+
// Rule selection
28+
rule_names = ["Terminal shell in container"]
3129
32-
// capture {
33-
// seconds_before_event = 60
34-
// seconds_after_event = 60
35-
// }
36-
//}
30+
actions {
31+
container = "stop"
32+
capture {
33+
seconds_before_event = 5
34+
seconds_after_event = 10
35+
}
36+
}
37+
38+
notification_channels = [10000]
3739
38-
// Falco rule selection
39-
falco_rule_name_regex = "Unexpected spawned process traefik"
4040
}
4141
```
4242

@@ -46,49 +46,43 @@ resource "sysdig_secure_policy" "write_apt_database" {
4646

4747
* `description` - (Required) The description of Secure policy.
4848

49-
* `severity` - (Required) The severity of Secure policy. The accepted values
50-
are: 2 (High), 4 (Medium) and 6 (Low).
49+
* `severity` - (Optional) The severity of Secure policy. The accepted values
50+
are: 0 (High), 4 (Medium), 6 (Low) and 7 (Info). The default value is 4 (Medium).
5151

52-
* `enabled` - (Required) Will secure process with this rule?
52+
* `enabled` - (Optional) Will secure process with this rule?. By default this is true.
5353

5454
- - -
5555

5656
### Scope selection
5757

58-
* `host_scope` - (Required) The application scope of this rule. Does this rule
59-
applies to hosts?
60-
61-
* `container_scope` - (Required) The application scope of this rule. Does this
62-
rule applies to containers? Note that the rule should apply at least to one
63-
scope, host or container.
64-
65-
* `filter` - (Optional) Limit appplication scope based in one expresion. By
66-
example: "host.ip.private = \"10.0.23.1\""
58+
* `scope` - (Optional) Limit appplication scope based in one expresion. For
59+
example: "host.ip.private = \\"10.0.23.1\\"". By default the rule won't be scoped
60+
and will target the entire infrastructure.
6761

6862
- - -
6963

7064
### Actions block
7165

7266
The actions block is optional and supports:
7367

74-
* `container` - (Required) The action applied to container when this Policy is
68+
* `container` - (Optional) The action applied to container when this Policy is
7569
triggered. Can be *stop* or *pause*.
7670

77-
which
78-
The capture block is optional and whan present captures with Sysdig the stream
79-
of system calls:
80-
81-
* `seconds_before_event` - (Required) Captures the system calls during the
71+
* `capture` - (Optional) Captures with Sysdig the stream of system calls:
72+
* `seconds_before_event` - (Required) Captures the system calls during the
8273
amount of seconds before the policy was triggered.
83-
84-
* `seconds_after_event` - (Required) Captures the system calls for the amount
74+
* `seconds_after_event` - (Required) Captures the system calls for the amount
8575
of seconds after the policy was triggered.
8676

8777
- - -
8878

8979
### Falco rule selection
9080

91-
* `falco_rule_name_regex` - (Required) The RegExp for checking matches with
92-
Falco Rule name. When a you have uploaded custom rules, and an alert is
93-
raised. Check if that alert matches with this regexp for raising the Policy
94-
Alert.
81+
* `rule_names` - (Optional) Array with the name of the rules to match.
82+
83+
- - -
84+
85+
### Notification
86+
87+
* `notification_channels` - (Optional) IDs of the notification channels to send alerts to
88+
when the policy is fired.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
layout: "sysdig"
3+
page_title: "Sysdig: sysdig_secure_rule_container"
4+
sidebar_current: "docs-sysdig-secure-rule-container"
5+
description: |-
6+
Creates a Sysdig Secure Container Rule.
7+
---
8+
9+
# sysdig\_secure\_rule\_container
10+
11+
Creates a Sysdig Secure Container Rule.
12+
13+
~> **Note:** This resource is still experimental, and is subject of being changed.
14+
15+
## Example usage
16+
17+
```hcl
18+
resource "sysdig_secure_rule_container" "sample" {
19+
name = "Nginx container spawned"
20+
description = "A container withthe nginx image spawned in the cluster."
21+
tags = ["container", "cis"]
22+
23+
matching = true // default
24+
containers = ["nginx"]
25+
}
26+
```
27+
28+
## Argument Reference
29+
30+
* `name` - (Required) The name of the Secure rule. It must be unique.
31+
* `description` - (Required) The description of Secure rule.
32+
* `tags` - (Optional) A list of tags for this rule.
33+
34+
### Matching
35+
36+
* `matching` - (Optional) Defines if the image name matches or not with the provided list. Default is true.
37+
* `containers` - (Required) List of containers to match.
38+
39+
## Attributes Reference
40+
41+
In addition to all arguments above, the following attributes are exported:
42+
43+
* `version` - Current version of the resource in Sysdig Secure.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
layout: "sysdig"
3+
page_title: "Sysdig: sysdig_secure_rule_falco"
4+
sidebar_current: "docs-sysdig-secure-rule-falco"
5+
description: |-
6+
Creates a Sysdig Secure Falco Rule.
7+
---
8+
9+
# sysdig\_secure\_rule\_falco
10+
11+
Creates a Sysdig Secure Falco Rule.
12+
13+
~> **Note:** This resource is still experimental, and is subject of being changed.
14+
15+
## Example usage
16+
17+
```hcl
18+
resource "sysdig_secure_rule_falco" "example" {
19+
name = "Terminal shell in container" // ID
20+
description = "A shell was used as the entrypoint/exec point into a container with an attached terminal."
21+
tags = ["container", "shell", "mitre_execution"]
22+
23+
condition = "spawned_process and container and shell_procs and proc.tty != 0 and container_entrypoint"
24+
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)"
25+
priority = "notice"
26+
source = "syscall" // syscall or k8s_audit
27+
}
28+
29+
```
30+
31+
## Argument Reference
32+
33+
The following arguments are supported:
34+
35+
* `name` - (Required) The name of the Secure rule. It must be unique.
36+
* `description` - (Required) The description of Secure rule.
37+
* `tags` - (Optional) A list of tags for this rule.
38+
39+
- - -
40+
41+
### Conditions
42+
43+
* `condition` - (Required) A [Falco condition](https://falco.org/docs/rules/) is simply a Boolean predicate on Sysdig events expressed using the Sysdig [filter syntax](http://www.sysdig.org/wiki/sysdig-user-guide/#filtering) and macro terms.
44+
* `output` - (Required) Add additional information to each Falco notification's output.
45+
* `priority` - (Required) The priority of the Falco rule. It can be: "emergency", "alert", "critical", "error", "warning", "notice", "informational", "informational" or "debug".
46+
* `source` - (Required) The source of the event. It can be either "syscall" or "k8s_audit".
47+
48+
## Attributes Reference
49+
50+
In addition to all arguments above, the following attributes are exported:
51+
52+
* `version` - Current version of the resource in Sysdig Secure.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
layout: "sysdig"
3+
page_title: "Sysdig: sysdig_secure_rule_filesystem"
4+
sidebar_current: "docs-sysdig-secure-rule-filesystem"
5+
description: |-
6+
Creates a Sysdig Secure Filesystem Rule.
7+
---
8+
9+
# sysdig\_secure\_rule\_filesystem
10+
11+
Creates a Sysdig Secure Filesystem Rule.
12+
13+
~> **Note:** This resource is still experimental, and is subject of being changed.
14+
15+
## Example usage
16+
17+
```hcl
18+
19+
resource "sysdig_secure_rule_filesystem" "example" {
20+
name = "Apache writing to non allowed directory"
21+
description = "Attempt to write to directories that should be immutable"
22+
tags = ["filesystem", "cis"]
23+
24+
read_only {
25+
matching = true // default
26+
paths = ["/etc"]
27+
}
28+
29+
read_write {
30+
matching = true // default
31+
paths = ["/var/log/apache2", "/dev/tty"]
32+
}
33+
}
34+
```
35+
36+
## Argument Reference
37+
38+
The following arguments are supported:
39+
40+
* `name` - (Required) The name of the Secure rule. It must be unique.
41+
* `description` - (Required) The description of Secure rule.
42+
* `tags` - (Optional) A list of tags for this rule.
43+
44+
### Read Only
45+
46+
* `matching` - (Optional) Defines if the path matches or not with the provided list. Default is true.
47+
* `paths` - (Required) List of paths to match.
48+
49+
### Read Write
50+
51+
* `matching` - (Optional) Defines if the path matches or not with the provided list. Default is true.
52+
* `paths` - (Required) List of paths to match.
53+
54+
## Attributes Reference
55+
56+
In addition to all arguments above, the following attributes are exported:
57+
58+
* `version` - Current version of the resource in Sysdig Secure.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
layout: "sysdig"
3+
page_title: "Sysdig: sysdig_secure_rule_network"
4+
sidebar_current: "docs-sysdig-secure-rule-network"
5+
description: |-
6+
Creates a Sysdig Secure Network Rule.
7+
---
8+
9+
# sysdig\_secure\_rule\_network
10+
11+
Creates a Sysdig Secure Network Rule.
12+
13+
~> **Note:** This resource is still experimental, and is subject of being changed.
14+
15+
## Example usage
16+
17+
```hcl
18+
resource "sysdig_secure_rule_network" "example" {
19+
name = "Disallowed SSH Connection"
20+
description = "Detect any new ssh connection to a host other than those in an allowed group of hosts"
21+
tags = ["network", "mitre_remote_service"]
22+
23+
block_inbound = true
24+
block_outbound = true
25+
26+
tcp {
27+
matching = true // default
28+
ports = [22]
29+
}
30+
31+
udp {
32+
matching = true // default
33+
ports = [22]
34+
}
35+
}
36+
37+
```
38+
39+
## Argument Reference
40+
41+
The following arguments are supported:
42+
43+
* `name` - (Required) The name of the Secure rule. It must be unique.
44+
* `description` - (Required) The description of Secure rule.
45+
* `tags` - (Optional) A list of tags for this rule.
46+
47+
### Disallow incoming or outgoing connections
48+
49+
* `block_inbound` - (Required) Detect if there is an inbound connection.
50+
* `block_outbound` - (Required) Detect if there is an outbound connection.
51+
52+
### Detect TCP Connections
53+
54+
* `matching` - (Optional) Defines if the port matches or not with the provided list. Default is true.
55+
* `ports` - (Required) List of ports to match.
56+
57+
### Detect UDP Connections
58+
59+
* `matching` - (Optional) Defines if the port matches or not with the provided list. Default is true.
60+
* `ports` - (Required) List of ports to match.
61+
62+
## Attributes Reference
63+
64+
In addition to all arguments above, the following attributes are exported:
65+
66+
* `version` - Current version of the resource in Sysdig Secure.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
layout: "sysdig"
3+
page_title: "Sysdig: sysdig_secure_rule_process"
4+
sidebar_current: "docs-sysdig-secure-rule-process"
5+
description: |-
6+
Creates a Sysdig Secure Process Rule.
7+
---
8+
9+
# sysdig\_secure\_rule\_process
10+
11+
Creates a Sysdig Secure Process Rule.
12+
13+
~> **Note:** This resource is still experimental, and is subject of being changed.
14+
15+
## Example usage
16+
17+
```hcl
18+
resource "sysdig_secure_rule_process" "sample" {
19+
name = "Launch Suspicious Network Tool in Container" // ID
20+
description = "Detect network tools launched inside container"
21+
22+
matching = true // default
23+
processes = ["nc", "ncat", "nmap", "dig", "tcpdump", "tshark", "ngrep"]
24+
}
25+
26+
```
27+
28+
## Argument Reference
29+
30+
* `name` - (Required) The name of the Secure rule. It must be unique.
31+
* `description` - (Required) The description of Secure rule.
32+
* `tags` - (Optional) A list of tags for this rule.
33+
34+
### Matching
35+
36+
* `matching` - (Optional) Defines if the process name matches or not with the provided list. Default is true.
37+
* `processes` - (Required) List of processes to match.
38+
39+
## Attributes Reference
40+
41+
In addition to all arguments above, the following attributes are exported:
42+
43+
* `version` - Current version of the resource in Sysdig Secure.

0 commit comments

Comments
 (0)