-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Policies] [New Rule] Api server first automated rule (1.2.2) (
#11)
- Loading branch information
1 parent
ce673dc
commit 08d987a
Showing
5 changed files
with
89 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package compliance.cis_k8s.rules.cis_1_2_2 | ||
|
||
import data.compliance.cis_k8s | ||
import data.compliance.lib.common | ||
import data.compliance.lib.data_adapter | ||
|
||
# Ensure that the --basic-auth-file argument is not set (Automated) | ||
finding = result { | ||
command_args := data_adapter.command_args | ||
rule_evaluation := common.array_contains(command_args, "--basic-auth-file") == false | ||
|
||
# set result | ||
result := { | ||
"evaluation": common.calculate_result(rule_evaluation), | ||
"evidence": {"command_args": command_args}, | ||
} | ||
} | ||
|
||
metadata = { | ||
"name": "Ensure that the --basic-auth-file argument is not set", | ||
"description": "Basic authentication uses plaintext credentials for authentication. Currently, the basic authentication credentials last indefinitely, and the password cannot be changed without restarting the API server. The basic authentication is currently supported for convenience. Hence, basic authentication should not be used.", | ||
"impact": "You will have to configure and use alternate authentication mechanisms such as tokens and certificates. Username and password for basic authentication could no longer be used.", | ||
"tags": array.concat(cis_k8s.default_tags, ["CIS 1.2.2", "API Server"]), | ||
"benchmark": cis_k8s.benchmark_name, | ||
"remediation": "Follow the documentation and configure alternate mechanisms for authentication. Then, edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml on the master node and remove the --basic-auth-file=<filename> parameter.", | ||
} |
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,18 @@ | ||
package compliance.cis_k8s.rules.cis_1_2_2 | ||
|
||
import data.cis_k8s.test_data | ||
import data.lib.test | ||
|
||
test_violation { | ||
test.assert_fail(finding) with input as rule_input("api_server", "--basic-auth-file") | ||
} | ||
|
||
test_pass { | ||
test.assert_pass(finding) with input as rule_input("api_server", "") | ||
} | ||
|
||
test_not_evaluated { | ||
not finding with input as rule_input("some_process", "") | ||
} | ||
|
||
rule_input(process_type, argument) = test_data.api_server_input(process_type, [argument]) |
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