File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 22# Baseline Validation Check
33#
44# This script validates that the machine matches the committed baseline
5- # specifications using supascan (pre-installed via nix profile).
5+ # specifications using supascan (pre-installed via nix profile for ubuntu user).
6+ #
7+ # Must be run as ubuntu user with sudo access (supascan calls sudo goss internally).
68#
79# Usage: cis_baseline_check.sh [baselines-dir]
810
@@ -23,17 +25,16 @@ if [[ ! -d $BASELINES_DIR ]]; then
2325 exit 1
2426fi
2527
26- # Source nix environment
27- if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then
28- # shellcheck source=/dev/null
29- . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
30- fi
28+ # Source nix environment (for ubuntu user's profile)
29+ # shellcheck source=/dev/null
30+ . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
3131
3232# Verify supascan is available
3333if ! command -v supascan & > /dev/null; then
34- echo " ERROR: supascan not found. It should be pre-installed via nix profile."
34+ echo " ERROR: supascan not found in PATH"
35+ echo " PATH: $PATH "
3536 exit 1
3637fi
3738
38- # Run supascan validate
39+ # Run supascan validate (it calls sudo goss internally for privileged checks)
3940exec supascan validate --verbose " $BASELINES_DIR "
Original file line number Diff line number Diff line change 222222
223223 - name : Run CIS baseline validation
224224 become : yes
225+ become_user : ubuntu
225226 shell : |
226227 /bin/bash /tmp/ansible-playbook/ansible/files/cis_baseline_check.sh /tmp/ansible-playbook/audit-specs/baselines
227228 when : stage2_nix
You can’t perform that action at this time.
0 commit comments