forked from mirrors/linux-bench
Fake test file that GitHub Actions should accept
This commit is contained in:
parent
0c3a7001d7
commit
65ff70ae4e
2 changed files with 39 additions and 7 deletions
11
app_test.go
11
app_test.go
|
@ -5,14 +5,9 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
cfgdir = "./cfg"
|
|
||||||
ver = "1.1.0"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Tests all standard linux-bench defintion files
|
// Tests all standard linux-bench defintion files
|
||||||
func TestGetDefinitionFilePath(t *testing.T) {
|
func TestGetDefinitionFilePath(t *testing.T) {
|
||||||
d, err := os.Open(cfgdir)
|
d, err := os.Open("./cfg")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error: %s\n", err)
|
t.Errorf("unexpected error: %s\n", err)
|
||||||
}
|
}
|
||||||
|
@ -23,6 +18,7 @@ func TestGetDefinitionFilePath(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, ver := range vers {
|
for _, ver := range vers {
|
||||||
|
t.Logf("%v", ver)
|
||||||
_, err := getDefinitionFilePath(ver)
|
_, err := getDefinitionFilePath(ver)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error: %s\n", err)
|
t.Errorf("unexpected error: %s\n", err)
|
||||||
|
@ -31,7 +27,8 @@ func TestGetDefinitionFilePath(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunControls(t *testing.T) {
|
func TestRunControls(t *testing.T) {
|
||||||
path, err := getDefinitionFilePath(ver)
|
cfgDir = "./hack"
|
||||||
|
path, err := getDefinitionFilePath("test-definitions")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error: %s\n", err)
|
t.Errorf("unexpected error: %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
35
hack/test-definitions/definitions.yaml
Normal file
35
hack/test-definitions/definitions.yaml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
---
|
||||||
|
controls:
|
||||||
|
version: 0.1
|
||||||
|
id: 1
|
||||||
|
description: "Test YAMl file"
|
||||||
|
type: "hack"
|
||||||
|
groups:
|
||||||
|
- id: 1.1
|
||||||
|
description: "Filesystem Configuration"
|
||||||
|
checks:
|
||||||
|
- id: 1.1.1
|
||||||
|
description: "Disable unused filesystems"
|
||||||
|
checks:
|
||||||
|
- id: 1.1.1.1.a
|
||||||
|
description: "Ensure mounting of cramfs filesystems is disabled"
|
||||||
|
audit: "echo hello"
|
||||||
|
tests:
|
||||||
|
test_items:
|
||||||
|
- flag: "hello"
|
||||||
|
set: true
|
||||||
|
remediation: |
|
||||||
|
Correct something about this test
|
||||||
|
scored: true
|
||||||
|
- id: 1.1.1.1.b
|
||||||
|
description: "Ensure mounting of cramfs filesystems is disabled"
|
||||||
|
audit: "echo hello=false"
|
||||||
|
tests:
|
||||||
|
test_items:
|
||||||
|
- flag: "hello"
|
||||||
|
compare:
|
||||||
|
op: eq
|
||||||
|
value: "false"
|
||||||
|
set: true
|
||||||
|
remediation: |
|
||||||
|
Put your remediation here
|
Loading…
Add table
Reference in a new issue