forked from kubearmor/KubeArmor
-
Notifications
You must be signed in to change notification settings - Fork 0
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: Jaehyun Nam <[email protected]>
- Loading branch information
1 parent
89a420b
commit 441a380
Showing
31 changed files
with
370 additions
and
6 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
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: diff --help | ||
result: failed | ||
--- | ||
operation: Process | ||
condition: diff | ||
action: Block |
23 changes: 23 additions & 0 deletions
23
tests/host_scenarios/kubearmor-dev-next_test_01/hsp-kubearmor-dev-next-proc-path-block.yaml
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,23 @@ | ||
apiVersion: security.kubearmor.com/v1 | ||
kind: KubeArmorHostPolicy | ||
metadata: | ||
name: hsp-kubearmor-dev-next-proc-path-block | ||
spec: | ||
nodeSelector: | ||
matchLabels: | ||
kubernetes.io/hostname: kubearmor-dev-next | ||
severity: 5 | ||
process: | ||
matchPaths: | ||
- path: /usr/bin/diff | ||
action: | ||
Block | ||
|
||
# kubearmor-dev-next_test_01 | ||
|
||
# test | ||
# $ diff --help | ||
# -bash: /usr/bin/diff: Permission denied | ||
|
||
# expectation | ||
# anyone cannot execute /usr/bin/diff |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: cat /etc/passwd | ||
result: passed | ||
--- | ||
operation: File | ||
condition: /etc/passwd | ||
action: Audit |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: head -n 1 /etc/passwd | ||
result: passed | ||
--- | ||
operation: File | ||
condition: /etc/passwd | ||
action: Audit |
25 changes: 25 additions & 0 deletions
25
tests/host_scenarios/kubearmor-dev-next_test_02/hsp-kubearmor-dev-next-file-path-audit.yaml
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,25 @@ | ||
apiVersion: security.kubearmor.com/v1 | ||
kind: KubeArmorHostPolicy | ||
metadata: | ||
name: hsp-kubearmor-dev-next-file-path-audit | ||
spec: | ||
nodeSelector: | ||
matchLabels: | ||
kubernetes.io/hostname: kubearmor-dev-next | ||
severity: 5 | ||
file: | ||
matchPaths: | ||
- path: /etc/passwd | ||
action: | ||
Audit | ||
|
||
# kubearmor-dev-next_test_02 | ||
|
||
# test | ||
# $ cat /etc/passwd | ||
# ... | ||
# $ head /etc/passwd | ||
# ... | ||
|
||
# expectation | ||
# anyone can access /etc/passwd, but the access would be audited |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: cat /etc/hostname | ||
result: failed | ||
--- | ||
operation: File | ||
condition: /etc/hostname | ||
action: Block |
23 changes: 23 additions & 0 deletions
23
tests/host_scenarios/kubearmor-dev-next_test_03/hsp-kubearmor-dev-next-file-path-block.yaml
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,23 @@ | ||
apiVersion: security.kubearmor.com/v1 | ||
kind: KubeArmorHostPolicy | ||
metadata: | ||
name: hsp-kubearmor-dev-next-file-path-block | ||
spec: | ||
nodeSelector: | ||
matchLabels: | ||
kubernetes.io/hostname: kubearmor-dev-next | ||
severity: 5 | ||
file: | ||
matchPaths: | ||
- path: /etc/hostname | ||
action: | ||
Block | ||
|
||
# kubearmor-dev-next_test_03 | ||
|
||
# test | ||
# $ cat /etc/hostname | ||
# cat: /etc/hostname: Permission denied | ||
|
||
# expectation | ||
# anyone cannot access /etc/hostname |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: bash -c date | ||
result: failed | ||
--- | ||
operation: Process | ||
condition: date | ||
action: Block |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: bash -c ls | ||
result: passed | ||
--- | ||
operation: Process | ||
condition: ls | ||
action: Block |
31 changes: 31 additions & 0 deletions
31
...enarios/kubearmor-dev-next_test_04/hsp-kubearmor-dev-next-proc-path-block-fromSource.yaml
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,31 @@ | ||
apiVersion: security.kubearmor.com/v1 | ||
kind: KubeArmorHostPolicy | ||
metadata: | ||
name: hsp-kubearmor-dev-next-proc-path-block-fromsource | ||
spec: | ||
nodeSelector: | ||
matchLabels: | ||
kubernetes.io/hostname: kubearmor-dev-next | ||
severity: 5 | ||
process: | ||
matchPaths: | ||
- path: /bin/date | ||
fromSource: | ||
- path: /bin/bash # ubuntu | ||
- path: /usr/bin/date | ||
fromSource: | ||
- path: /usr/bin/bash # centos | ||
action: | ||
Block | ||
|
||
# kubearmor-dev-next_test_04 | ||
|
||
# test | ||
# (/home/vagrant/selinux-test/) $ bash -c date | ||
# bash: 1: date: Permission denied | ||
# (/home/vagrant/selinux-test/) $ bash -c ls | ||
# ls ... | ||
|
||
# expectation | ||
# (/usr)/bin/bash cannot execute (/usr)/bin/date | ||
# (/usr)/bin/bash can execute any others |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: bash -c date | ||
result: passed | ||
--- | ||
operation: Process | ||
condition: date | ||
action: Allow |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: bash -c ls | ||
result: failed | ||
--- | ||
operation: Process | ||
condition: ls | ||
action: Allow |
31 changes: 31 additions & 0 deletions
31
...enarios/kubearmor-dev-next_test_05/hsp-kubearmor-dev-next-proc-path-allow-fromSource.yaml
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,31 @@ | ||
apiVersion: security.kubearmor.com/v1 | ||
kind: KubeArmorHostPolicy | ||
metadata: | ||
name: hsp-kubearmor-dev-next-proc-path-allow-fromsource | ||
spec: | ||
nodeSelector: | ||
matchLabels: | ||
kubernetes.io/hostname: kubearmor-dev-next | ||
severity: 5 | ||
process: | ||
matchPaths: | ||
- path: /bin/date | ||
fromSource: | ||
- path: /bin/bash # ubuntu | ||
- path: /usr/bin/date | ||
fromSource: | ||
- path: /usr/bin/bash # centos | ||
action: | ||
Allow | ||
|
||
# kubearmor-dev-next_test_05 | ||
|
||
# test | ||
# $ bash -c date | ||
# ... | ||
# $ bash -c ls | ||
# bash: /usr/bin/ls: Permission denied | ||
|
||
# expectation | ||
# (/usr)/bin/bash can only execute (/usr)/bin/date | ||
# (/usr)/bin/bash cannot execute any others |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: head -n 1 /etc/hostname | ||
result: failed | ||
--- | ||
operation: File | ||
condition: /etc/hostname | ||
action: Block |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: head -n 1 /etc/hosts | ||
result: passed | ||
--- | ||
operation: File | ||
condition: /etc/hosts | ||
action: Block |
28 changes: 28 additions & 0 deletions
28
...enarios/kubearmor-dev-next_test_06/hsp-kubearmor-dev-next-file-path-block-fromSource.yaml
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,28 @@ | ||
apiVersion: security.kubearmor.com/v1 | ||
kind: KubeArmorHostPolicy | ||
metadata: | ||
name: hsp-kubearmor-dev-next-file-path-block-fromsource | ||
spec: | ||
nodeSelector: | ||
matchLabels: | ||
kubernetes.io/hostname: kubearmor-dev-next | ||
severity: 5 | ||
file: | ||
matchPaths: | ||
- path: /etc/hostname | ||
fromSource: | ||
- path: /usr/bin/head | ||
action: | ||
Block | ||
|
||
# kubearmor-dev-next_test_06 | ||
|
||
# test | ||
# $ head /etc/hostname | ||
# head: cannot open '/etc/hostname' for reading: Permission denied | ||
# $ head /etc/hosts | ||
# ... | ||
|
||
# expectation | ||
# /usr/bin/head cannot access /etc/hostname | ||
# /usr/bin/head can access any others |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: head -n 1 /etc/hostname | ||
result: passed | ||
--- | ||
operation: File | ||
condition: /etc/hostname | ||
action: Allow |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: head -n 1 /etc/hosts | ||
result: failed | ||
--- | ||
operation: File | ||
condition: /etc/hosts | ||
action: Allow |
28 changes: 28 additions & 0 deletions
28
...enarios/kubearmor-dev-next_test_07/hsp-kubearmor-dev-next-file-path-allow-fromSource.yaml
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,28 @@ | ||
apiVersion: security.kubearmor.com/v1 | ||
kind: KubeArmorHostPolicy | ||
metadata: | ||
name: hsp-kubearmor-dev-next-file-path-allow-fromsource | ||
spec: | ||
nodeSelector: | ||
matchLabels: | ||
kubernetes.io/hostname: kubearmor-dev-next | ||
severity: 5 | ||
file: | ||
matchPaths: | ||
- path: /etc/hostname | ||
fromSource: | ||
- path: /usr/bin/head | ||
action: | ||
Allow | ||
|
||
# kubearmor-dev-next_test_07 | ||
|
||
# test | ||
# $ head /etc/hostname | ||
# kubearmor-dev | ||
# $ head /etc/hosts | ||
# head: /etc/hosts: Permission denied | ||
|
||
# expectation | ||
# /usr/bin/head can only access /etc/hostname | ||
# /usr/bin/head cannot access any others |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: head -n 1 /etc/default/useradd | ||
result: passed | ||
--- | ||
operation: File | ||
condition: /etc/default/useradd | ||
action: Allow |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: head -n 1 /etc/hostname | ||
result: failed | ||
--- | ||
operation: File | ||
condition: /etc/hostname | ||
action: Allow |
29 changes: 29 additions & 0 deletions
29
...cenarios/kubearmor-dev-next_test_08/hsp-kubearmor-dev-next-file-dir-allow-fromSource.yaml
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,29 @@ | ||
apiVersion: security.kubearmor.com/v1 | ||
kind: KubeArmorHostPolicy | ||
metadata: | ||
name: hsp-kubearmor-dev-next-file-dir-allow-fromsource | ||
spec: | ||
nodeSelector: | ||
matchLabels: | ||
kubernetes.io/hostname: kubearmor-dev-next | ||
severity: 5 | ||
file: | ||
matchDirectories: | ||
- dir: /etc/default/ | ||
recursive: true | ||
fromSource: | ||
- path: /usr/bin/head | ||
action: | ||
Allow | ||
|
||
# kubearmor-dev-next_test_08 | ||
|
||
# test | ||
# $ head /etc/default/useradd | ||
# Default values for useradd(8) ... | ||
# $ head /etc/hostname | ||
# head: /etc/hostname: Permission denied | ||
|
||
# expectation | ||
# /usr/bin/head can only access /etc/default/* | ||
# /usr/bin/head cannot access any others |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: head -n 1 /etc/default/useradd | ||
result: failed | ||
--- | ||
operation: File | ||
condition: /etc/default/useradd | ||
action: Block |
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,7 @@ | ||
source: kubearmor-dev | ||
cmd: head -n 1 /etc/hostname | ||
result: passed | ||
--- | ||
operation: File | ||
condition: /etc/hostname | ||
action: Block |
Oops, something went wrong.