diff --git a/.vib/kubescape/goss/goss.yaml b/.vib/kubescape/goss/goss.yaml new file mode 100644 index 000000000000..cf627d6c396e --- /dev/null +++ b/.vib/kubescape/goss/goss.yaml @@ -0,0 +1,15 @@ +# Copyright VMware, Inc. +# SPDX-License-Identifier: APACHE-2.0 + +gossfile: + # Goss tests exclusive to the current container + ../../kubescape/goss/kubescape.yaml: {} + # Load scripts from .vib/common/goss/templates + ../../common/goss/templates/check-app-version.yaml: {} + ../../common/goss/templates/check-binaries.yaml: {} + ../../common/goss/templates/check-broken-symlinks.yaml: {} + ../../common/goss/templates/check-ca-certs.yaml: {} + ../../common/goss/templates/check-directories.yaml: {} + ../../common/goss/templates/check-linked-libraries.yaml: {} + ../../common/goss/templates/check-sed-in-place.yaml: {} + ../../common/goss/templates/check-spdx.yaml: {} diff --git a/.vib/kubescape/goss/kubescape.yaml b/.vib/kubescape/goss/kubescape.yaml new file mode 100644 index 000000000000..3d39a0d360b7 --- /dev/null +++ b/.vib/kubescape/goss/kubescape.yaml @@ -0,0 +1,18 @@ +# Copyright VMware, Inc. +# SPDX-License-Identifier: APACHE-2.0 + +command: + {{- $target := printf "/tmp/%s" (randAlpha 5) }} + check-scan: + exec: mkdir {{ $target }} && tar -xf ./kubescape/goss/testfiles/sealed-secrets.tar.gz -C {{ $target }}; kubescape scan ./kubescape/goss/testfiles/sealed-secrets.tar.gz --format=json {{ $target }} + exit-status: 0 + timeout: 30000 + stderr: + - "Overall compliance-score" + {{- $target := printf "/tmp/%s" (randAlpha 5) }} + check-oss-assessment: + exec: mkdir {{ $target }} && tar -xf ./kubescape/goss/testfiles/sealed-secrets.tar.gz -C {{ $target }}; /opt/bitnami/scripts/kubescape/entrypoint.sh oss-assessment {{ $target }} + exit-status: 0 + timeout: 30000 + stdout: + - "\"security\":" diff --git a/.vib/kubescape/goss/testfiles/sealed-secrets.tar.gz b/.vib/kubescape/goss/testfiles/sealed-secrets.tar.gz new file mode 100644 index 000000000000..fa6f92370ea8 Binary files /dev/null and b/.vib/kubescape/goss/testfiles/sealed-secrets.tar.gz differ diff --git a/.vib/kubescape/goss/vars.yaml b/.vib/kubescape/goss/vars.yaml new file mode 100644 index 000000000000..f93991ba7a61 --- /dev/null +++ b/.vib/kubescape/goss/vars.yaml @@ -0,0 +1,11 @@ +binaries: + - kubescape +root_dir: /opt/bitnami +directories: + - mode: "0775" + paths: + - /opt/bitnami/kubescape/.kubescape + - /opt/bitnami/kubescape/.cache +version: + bin_name: kubescape + flag: version diff --git a/.vib/kubescape/vib-verify.json b/.vib/kubescape/vib-verify.json new file mode 100644 index 000000000000..c47efd1eb7c8 --- /dev/null +++ b/.vib/kubescape/vib-verify.json @@ -0,0 +1,73 @@ +{ + "context": { + "resources": { + "url": "{SHA_ARCHIVE}", + "path": "{VIB_ENV_PATH}" + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" + }, + "phases": { + "package": { + "actions": [ + { + "action_id": "container-image-package", + "params": { + "application": { + "details": { + "name": "{VIB_ENV_CONTAINER}", + "tag": "{VIB_ENV_TAG}" + } + }, + "architectures": [ + "linux/amd64", + "linux/arm64" + ] + } + }, + { + "action_id": "container-image-lint", + "params": { + "threshold": "error" + } + } + ] + }, + "verify": { + "actions": [ + { + "action_id": "trivy", + "params": { + "threshold": "LOW", + "vuln_type": [ + "OS" + ] + } + }, + { + "action_id": "grype", + "params": { + "threshold": "CRITICAL", + "package_type": [ + "OS" + ] + } + }, + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "kubescape/goss/goss.yaml", + "vars_file": "kubescape/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-kubescape" + } + } + } + } + ] + } + } +}