diff options
author | Pawel Wieczorek <p.wieczorek2@samsung.com> | 2019-09-17 18:45:41 +0200 |
---|---|---|
committer | Pawel Wieczorek <p.wieczorek2@samsung.com> | 2019-09-19 15:14:01 +0200 |
commit | 6c95c5ca28dd3f48a58dc11cc9c17fd8b4934881 (patch) | |
tree | 15d8e107c46c828b1e7b9332c2cdd3c506dd75d5 /test/security/k8s/src/check/validators/master/api.go | |
parent | 1ef8cebe0663ec14d00cd62884fe55060c0b04a2 (diff) |
k8s: Validate API server auditing is enabled
This patch verifies if CIS Kubernetes Benchmark v1.3.0 section
regarding master node configuration is satisfied (1.1.15).
Issue-ID: SECCOM-235
Change-Id: Ia1d27ed7a9e439bb0abf4bd8941bdd4573a50bd5
Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
Diffstat (limited to 'test/security/k8s/src/check/validators/master/api.go')
-rw-r--r-- | test/security/k8s/src/check/validators/master/api.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/security/k8s/src/check/validators/master/api.go b/test/security/k8s/src/check/validators/master/api.go index 47a2a8e01..a316bbc00 100644 --- a/test/security/k8s/src/check/validators/master/api.go +++ b/test/security/k8s/src/check/validators/master/api.go @@ -253,3 +253,22 @@ func IsAlwaysAllowAuthorizationModeExcluded(params []string) bool { return isSingleFlagPresent("--authorization-mode=", params) && !hasFlagArgumentIncluded("--authorization-mode=", "AlwaysAllow", params) } + +// IsAuditLogPathSet validates there is single "--audit-log-path" flag and has non-empty argument. +func IsAuditLogPathSet(params []string) bool { + return hasSingleFlagNonemptyArgument("--audit-log-path=", params) +} + +// hasSingleFlagNonemptyArgument checks whether selected flag was used once and has non-empty argument. +func hasSingleFlagNonemptyArgument(flag string, params []string) bool { + found := filterFlags(params, flag) + if len(found) != 1 { + return false + } + + _, value := splitKV(found[0], "=") + if value == "" { + return false + } + return true +} |