-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ved Ratan <[email protected]>
- Loading branch information
Showing
11 changed files
with
320 additions
and
31 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
12 changes: 9 additions & 3 deletions
12
tests/controllers/clustersecurityintentbinding/matchall/README.md
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
12 changes: 9 additions & 3 deletions
12
tests/controllers/clustersecurityintentbinding/matchname/README.md
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,145 @@ | ||
# Test: `kubearmor-policy-creation-and-validation-exploit-pfa` | ||
|
||
This test validates that creating a `expolit-pfa` SecurityIntent with SecurityIntentBinding generates the expected KubeArmor policy and verifies its effect on a sample test workload. | ||
|
||
|
||
## Steps | ||
|
||
| # | Name | Bindings | Try | Catch | Finally | | ||
|:-:|---|:-:|:-:|:-:|:-:| | ||
| 1 | [Create a SecurityIntent](#step-Create a SecurityIntent) | 0 | 1 | 0 | 0 | | ||
| 2 | [Create a SecurityIntentBinding](#step-Create a SecurityIntentBinding) | 0 | 1 | 0 | 0 | | ||
| 3 | [Verify NimbusPolicy creation](#step-Verify NimbusPolicy creation) | 0 | 1 | 0 | 0 | | ||
| 4 | [Verify KubeArmorPolicy creation](#step-Verify KubeArmorPolicy creation) | 0 | 1 | 0 | 0 | | ||
| 5 | [Verify status of created SecurityIntentBinding](#step-Verify status of created SecurityIntentBinding) | 0 | 1 | 0 | 0 | | ||
| 6 | [Verify status of created NimbusPolicy](#step-Verify status of created NimbusPolicy) | 0 | 1 | 0 | 0 | | ||
| 7 | [Verify that the corresponding NimbusPolicy status has been updated with the generated KubeArmor Policy](#step-Verify that the corresponding NimbusPolicy status has been updated with the generated KubeArmor Policy) | 0 | 1 | 0 | 0 | | ||
| 8 | [create nginx pod](#step-create nginx pod) | 0 | 1 | 0 | 0 | | ||
| 9 | [verify creation of nginx pod](#step-verify creation of nginx pod) | 0 | 1 | 0 | 0 | | ||
| 10 | [install git inside nginx pod](#step-install git inside nginx pod) | 0 | 1 | 0 | 0 | | ||
| 11 | [move git binary to tmp/ folder](#step-move git binary to tmp/ folder) | 0 | 1 | 0 | 0 | | ||
| 12 | [Verify the failure in cloning a repo via git binary in tmp/ folder in nginx pod](#step-Verify the failure in cloning a repo via git binary in tmp/ folder in nginx pod) | 0 | 1 | 0 | 0 | | ||
|
||
### Step: `Create a SecurityIntent` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `apply` | 0 | 0 | *No description* | | ||
|
||
### Step: `Create a SecurityIntentBinding` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `apply` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify NimbusPolicy creation` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `assert` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify KubeArmorPolicy creation` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `assert` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify status of created SecurityIntentBinding` | ||
|
||
Verify the created SecurityIntentBinding status subresource includes the number and names of bound intents, along with the generated NimbusPolicy name. | ||
|
||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `assert` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify status of created NimbusPolicy` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `assert` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify that the corresponding NimbusPolicy status has been updated with the generated KubeArmor Policy` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `script` | 0 | 0 | *No description* | | ||
|
||
### Step: `create nginx pod` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `script` | 0 | 0 | *No description* | | ||
|
||
### Step: `verify creation of nginx pod` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `script` | 0 | 0 | *No description* | | ||
|
||
### Step: `install git inside nginx pod` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `script` | 0 | 0 | *No description* | | ||
|
||
### Step: `move git binary to tmp/ folder` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `script` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify the failure in cloning a repo via git binary in tmp/ folder in nginx pod` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `script` | 0 | 0 | *No description* | | ||
|
||
--- | ||
|
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,39 @@ | ||
apiVersion: security.kubearmor.com/v1 | ||
kind: KubeArmorPolicy | ||
metadata: | ||
annotations: | ||
app.kubernetes.io/managed-by: nimbus-kubearmor | ||
name: exploit-pfa-binding-preventexecutionfromtemporlogsfolders | ||
namespace: default | ||
ownerReferences: | ||
- apiVersion: intent.security.nimbus.com/v1alpha1 | ||
blockOwnerDeletion: true | ||
controller: true | ||
kind: NimbusPolicy | ||
name: exploit-pfa-binding | ||
spec: | ||
action: Block | ||
capabilities: {} | ||
file: {} | ||
message: Mitigate the execution of harmful binaries which may result in exploiting | ||
public facing application | ||
network: {} | ||
process: | ||
action: Block | ||
matchDirectories: | ||
- dir: /var/tmp/ | ||
recursive: true | ||
- dir: /tmp/ | ||
recursive: true | ||
- dir: /var/log/ | ||
recursive: true | ||
- dir: /app/logs/ | ||
recursive: true | ||
- dir: /logs/ | ||
recursive: true | ||
- dir: /etc/ | ||
recursive: true | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
syscalls: {} |
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 @@ | ||
apiVersion: intent.security.nimbus.com/v1alpha1 | ||
kind: NimbusPolicy | ||
metadata: | ||
name: exploit-pfa-binding | ||
namespace: default | ||
ownerReferences: | ||
- apiVersion: intent.security.nimbus.com/v1alpha1 | ||
blockOwnerDeletion: true | ||
controller: true | ||
kind: SecurityIntentBinding | ||
name: exploit-pfa-binding | ||
spec: | ||
rules: | ||
- description: Mitigate the execution of harmful binaries which may result in exploiting | ||
public facing application | ||
id: preventExecutionFromTempOrLogsFolders | ||
rule: | ||
action: Block | ||
selector: | ||
matchLabels: | ||
app: nginx |
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,16 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright 2023 Authors of Nimbus | ||
|
||
apiVersion: intent.security.nimbus.com/v1alpha1 | ||
kind: NimbusPolicy | ||
metadata: | ||
name: exploit-pfa-binding | ||
ownerReferences: | ||
- apiVersion: intent.security.nimbus.com/v1alpha1 | ||
blockOwnerDeletion: true | ||
controller: true | ||
kind: SecurityIntentBinding | ||
name: exploit-pfa-binding | ||
status: | ||
numberOfAdapterPolicies: 1 | ||
status: Created |
Oops, something went wrong.