1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2025-12-16 11:52:43 +03:00

Add passwd_hash

Without password hash '$user:*' to `chpasswd -e` will result to
inability for user to login, or change password. So I've add parameter
passwd_hash for the user. Password hash could be generated via command
`openssl passwd -5 your_password`.
This commit is contained in:
Aleksandr Berkuta 2025-05-19 17:43:19 +03:00 committed by Aleksandr Berkuta
parent 0054493216
commit 18a4111b4c

View File

@ -285,12 +285,16 @@ init__userdata_users() {
$MOCK adduser -D ${gecos:+-g "$gecos"} ${homedir:+-h "$homedir"} ${shell:+-s "$shell"} ${primary_group:+-G "$primary_group"} ${system:+-S} ${no_create_home:+-H} "$name" $MOCK adduser -D ${gecos:+-g "$gecos"} ${homedir:+-h "$homedir"} ${shell:+-s "$shell"} ${primary_group:+-G "$primary_group"} ${system:+-S} ${no_create_home:+-H} "$name"
fi fi
if in_list hashed_passwd $keys; then
hashed_passwd="$(get_userdata users/$i/hashed_passwd)"
fi
if in_list lock_passwd $keys; then if in_list lock_passwd $keys; then
lock_passwd="$(get_userdata users/$i/lock_passwd)" lock_passwd="$(get_userdata users/$i/lock_passwd)"
fi fi
if [ "$lock_passwd" != "false" ]; then if [ "$lock_passwd" != "false" ]; then
echo "$name:*" | $MOCK chpasswd -e echo "${name}:${hashed_passwd}" | $MOCK chpasswd -e
fi fi
if in_list ssh_authorized_keys $keys; then if in_list ssh_authorized_keys $keys; then