diff --git a/src/confd/bin/bootstrap b/src/confd/bin/bootstrap index 67c68025..dec9667f 100755 --- a/src/confd/bin/bootstrap +++ b/src/confd/bin/bootstrap @@ -83,8 +83,9 @@ factory() # shellcheck disable=SC2086 gen-interfaces $GEN_IFACE_OPTS >"$FACTORY_D/20-interfaces.json" - if ! gen-admin-auth >"$FACTORY_D/10-authentication.json"; then - console_error "Unable to create factory config, gen-admin-auth failed" + # Extract password for admin user from VPD + if ! gen-admin-auth infix-shell-type:clish >"$FACTORY_D/20-authentication.json"; then + console_error "Unable to create factory-config, gen-admin-auth failed" return fi @@ -107,6 +108,12 @@ failure() gen-hostname "$FAIL_HOSTNAME" >"$FAILURE_D/20-hostname.json" gen-interfaces >"$FAILURE_D/20-interfaces.json" + # Same password as factory-config, but another login shell + if ! gen-admin-auth infix-shell-type:bash >"$FAILURE_D/20-authentication.json"; then + console_error "Unable to create failure-config, gen-admin-auth failed" + return + fi + [ -s "$FAILURE_D/20-hostkey.json" ] || gen-hostkeys >"$FAILURE_D/20-hostkey.json" # Optional failure/error config to generate (or override) for br2-externals diff --git a/src/confd/bin/gen-admin-auth b/src/confd/bin/gen-admin-auth index 8c28d890..ac19718d 100755 --- a/src/confd/bin/gen-admin-auth +++ b/src/confd/bin/gen-admin-auth @@ -1,6 +1,8 @@ #!/bin/sh +# This script extracts the admin user's password hash from VPD -pwhash="$(cat /run/system.json | jq '.pwhash')" +shell="$1" +pwhash="$(jq .pwhash /run/system.json)" if [ -z "$pwhash" ] || [ "$pwhash" = "null" ]; then exit 1 @@ -14,7 +16,7 @@ cat <