diff --git a/.vib/harbor-adapter-trivy/goss/goss.yaml b/.vib/harbor-adapter-trivy/goss/goss.yaml new file mode 100644 index 000000000000..83a98015c517 --- /dev/null +++ b/.vib/harbor-adapter-trivy/goss/goss.yaml @@ -0,0 +1,10 @@ +gossfile: + # Goss tests exclusive to the current container + ../../harbor-adapter-trivy/goss/harbor-adapter-trivy.yaml: {} + # Load scripts from .vib/common/goss/templates + ../../common/goss/templates/check-binaries.yaml: {} + ../../common/goss/templates/check-broken-symlinks.yaml: {} + ../../common/goss/templates/check-ca-certs.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/harbor-adapter-trivy/goss/harbor-adapter-trivy.yaml b/.vib/harbor-adapter-trivy/goss/harbor-adapter-trivy.yaml new file mode 100644 index 000000000000..e1be6ab57c76 --- /dev/null +++ b/.vib/harbor-adapter-trivy/goss/harbor-adapter-trivy.yaml @@ -0,0 +1,26 @@ +group: + trivy-scanner: + exists: true +user: + trivy-scanner: + exists: true +file: + /bitnami/harbor-adapter-trivy/.cache/trivy: + exists: true + mode: "0775" + owner: trivy-scanner + filetype: directory + /bitnami/harbor-adapter-trivy/.cache/reports: + exists: true + mode: "0775" + owner: trivy-scanner + filetype: directory +command: + # Ensure a set of directories exist and the non-root user has write privileges to them + check-directories-exist-with-user: + exec: ls -dl /etc/ssl/certs /etc/pki/tls/certs/ 2>/dev/null | grep "drwxrwxr-x.*trivy-scanner" + exit-status: 0 + # Ensure permissions for Internal TLS + check-permissions-system-certs: + exec: ls -l /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.trust.crt /etc/ssl/certs/ca-certificates.crt 2>/dev/null | grep ".*-rw-rw-r--" + exit-status: 0 diff --git a/.vib/harbor-adapter-trivy/goss/vars.yaml b/.vib/harbor-adapter-trivy/goss/vars.yaml new file mode 100644 index 000000000000..2fefa532a58f --- /dev/null +++ b/.vib/harbor-adapter-trivy/goss/vars.yaml @@ -0,0 +1,5 @@ +binaries: + - scanner-trivy + - trivy + - wire +root_dir: /opt/bitnami diff --git a/.vib/harbor-adapter-trivy/vib-publish.json b/.vib/harbor-adapter-trivy/vib-publish.json index 8b6fe8eab4e6..297e3105a22f 100644 --- a/.vib/harbor-adapter-trivy/vib-publish.json +++ b/.vib/harbor-adapter-trivy/vib-publish.json @@ -3,7 +3,8 @@ "resources": { "url": "{VIB_ENV_CONTAINER_URL}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -33,6 +34,21 @@ }, "verify": { "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "harbor-adapter-trivy/goss/goss.yaml", + "vars_file": "harbor-adapter-trivy/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-harbor-adapter-trivy" + } + } + } + }, { "action_id": "trivy", "params": { diff --git a/.vib/harbor-adapter-trivy/vib-verify.json b/.vib/harbor-adapter-trivy/vib-verify.json index a34e8aee9161..8220a41ff502 100644 --- a/.vib/harbor-adapter-trivy/vib-verify.json +++ b/.vib/harbor-adapter-trivy/vib-verify.json @@ -3,7 +3,8 @@ "resources": { "url": "{SHA_ARCHIVE}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -29,6 +30,21 @@ }, "verify": { "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "harbor-adapter-trivy/goss/goss.yaml", + "vars_file": "harbor-adapter-trivy/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-harbor-adapter-trivy" + } + } + } + }, { "action_id": "trivy", "params": {