Files
infix/src/confd/bin/gen-admin-auth
T
Joachim Wiberg ff12ba72b5 confd: exctract password also for failure-config
This patch adds generation of the 20-authentication.json snippet also
for failure-config.  The gen-admin-auth script is extended with shell
parameter, since the default shell differs from factory-config.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-11-24 08:55:57 +01:00

26 lines
405 B
Bash
Executable File

#!/bin/sh
# This script extracts the admin user's password hash from VPD
shell="$1"
pwhash="$(jq .pwhash /run/system.json)"
if [ -z "$pwhash" ] || [ "$pwhash" = "null" ]; then
exit 1
fi
cat <<EOF
{
"ietf-system:system": {
"authentication": {
"user": [
{
"name": "admin",
"password": $pwhash,
"infix-system:shell": "$shell"
}
]
}
}
}
EOF