From 5bcc3cda489e16274072068c28417676c42b372b Mon Sep 17 00:00:00 2001 From: Zachary <123345317+zachary-bailey@users.noreply.github.com> Date: Fri, 12 Apr 2024 09:07:20 -0700 Subject: [PATCH] cleanup: suppress output when assigning root pw (#4277) Co-authored-by: Zachary Bailey --- parts/linux/cloud-init/artifacts/cis.sh | 2 ++ pkg/templates/templates_generated.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/parts/linux/cloud-init/artifacts/cis.sh b/parts/linux/cloud-init/artifacts/cis.sh index 818955ace86..3b3e95d325f 100644 --- a/parts/linux/cloud-init/artifacts/cis.sh +++ b/parts/linux/cloud-init/artifacts/cis.sh @@ -3,6 +3,7 @@ source /home/packer/provision_source.sh assignRootPW() { + set +x if grep '^root:[!*]:' /etc/shadow; then VERSION=$(grep DISTRIB_RELEASE /etc/*-release | cut -f 2 -d "=") SALT=$(openssl rand -base64 5) @@ -16,6 +17,7 @@ assignRootPW() { echo 'root:'$HASH | /usr/sbin/chpasswd -e || exit $ERR_CIS_ASSIGN_ROOT_PW fi + set -x } assignFilePermissions() { diff --git a/pkg/templates/templates_generated.go b/pkg/templates/templates_generated.go index 93f047ae9d7..3dbc11390bd 100644 --- a/pkg/templates/templates_generated.go +++ b/pkg/templates/templates_generated.go @@ -1881,6 +1881,7 @@ var _linuxCloudInitArtifactsCisSh = []byte(`#!/bin/bash source /home/packer/provision_source.sh assignRootPW() { + set +x if grep '^root:[!*]:' /etc/shadow; then VERSION=$(grep DISTRIB_RELEASE /etc/*-release | cut -f 2 -d "=") SALT=$(openssl rand -base64 5) @@ -1894,6 +1895,7 @@ assignRootPW() { echo 'root:'$HASH | /usr/sbin/chpasswd -e || exit $ERR_CIS_ASSIGN_ROOT_PW fi + set -x } assignFilePermissions() {