summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorRomain Bazile <romain@bazile.io>2022-06-17 16:45:08 +0200
committerGitHub <noreply@github.com>2022-06-17 15:45:08 +0100
commit01b2432007766a6a1acc942f62d4ece7b25e560d (patch)
tree05583b5bc9fc9ea928fe97fccfb351a3be74357f /build.sh
parent3385618efbd428bc14a13b7195d44978689d343a (diff)
Create a `DISABLE_FIRST_BOOT_USER_RENAME` flag to be set in config (#618)
Closes #614
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/build.sh b/build.sh
index 014035c..135da35 100755
--- a/build.sh
+++ b/build.sh
@@ -225,6 +225,7 @@ export TARGET_HOSTNAME=${TARGET_HOSTNAME:-raspberrypi}
export FIRST_USER_NAME=${FIRST_USER_NAME:-pi}
export FIRST_USER_PASS
+export DISABLE_FIRST_BOOT_USER_RENAME=${DISABLE_FIRST_BOOT_USER_RENAME:-0}
export RELEASE=${RELEASE:-bullseye}
export WPA_ESSID
export WPA_PASSWORD
@@ -290,6 +291,17 @@ if [[ ! "$FIRST_USER_NAME" =~ ^[a-z][-a-z0-9_]*$ ]]; then
exit 1
fi
+if [[ "$DISABLE_FIRST_BOOT_USER_RENAME" == "1" ]] && [ -z "${FIRST_USER_PASS}" ]; then
+ echo "To disable user rename on first boot, FIRST_USER_PASS needs to be set"
+ echo "Not setting FIRST_USER_PASS makes your system vulnerable and open to cyberattacks"
+ exit 1
+fi
+
+if [[ "$DISABLE_FIRST_BOOT_USER_RENAME" == "1" ]]; then
+ echo "User rename on the first boot is disabled"
+ echo "Be advised of the security risks linked to shipping a device with default username/password set."
+fi
+
if [[ -n "${APT_PROXY}" ]] && ! curl --silent "${APT_PROXY}" >/dev/null ; then
echo "Could not reach APT_PROXY server: ${APT_PROXY}"
exit 1