git: 7b73ecfe6484 - main - nuageinit: Accept plain text passwords
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 23 Jul 2024 13:04:17 UTC
The branch main has been updated by bapt:
URL: https://cgit.FreeBSD.org/src/commit/?id=7b73ecfe648487c7706ac2b854dcf1435e60e4ca
commit 7b73ecfe648487c7706ac2b854dcf1435e60e4ca
Author: Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2024-07-23 03:49:36 +0000
Commit: Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-07-23 13:01:54 +0000
nuageinit: Accept plain text passwords
Per pw(8), when -H is set, the password should be supplied already
encrypted in a form suitable for writing directly to the password
database (passwd in cloud-init tems); -h provides a special interface by
which interactive scripts can set an account password using pw(8) in
plain text (plain_text_passwd in cloud-init terms).
The default user (freebsd) is defined with a plain_text_passwd
(freebsd), not with an encrypted one.
---
libexec/nuageinit/nuage.lua | 2 +-
libexec/nuageinit/tests/nuageinit.sh | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua
index ca70c778791b..81fb40c0d8eb 100644
--- a/libexec/nuageinit/nuage.lua
+++ b/libexec/nuageinit/nuage.lua
@@ -112,7 +112,7 @@ local function adduser(pwd)
postcmd = " -H 0 "
elseif pwd.plain_text_passwd then
precmd = "echo "..pwd.plain_text_passwd .. "| "
- postcmd = " -H 0 "
+ postcmd = " -h 0 "
end
cmd = precmd .. "pw "
if root then
diff --git a/libexec/nuageinit/tests/nuageinit.sh b/libexec/nuageinit/tests/nuageinit.sh
index 54c88ceb539a..c6a86bc15486 100644
--- a/libexec/nuageinit/tests/nuageinit.sh
+++ b/libexec/nuageinit/tests/nuageinit.sh
@@ -104,6 +104,7 @@ sys:*:1:0::0:0:Sys:/home/sys:/bin/csh
freebsd:freebsd:1001:1003::0:0:FreeBSD User:/home/freebsd:/bin/sh
foobar:H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/:1002:1004::0:0:Foo B. Bar:/home/foobar:/bin/sh
EOF
+ sed -i "" "s/freebsd:.*:1001/freebsd:freebsd:1001/" ${here}/etc/master.passwd
atf_check -o file:expectedpasswd cat ${here}/etc/master.passwd
atf_check -o file:expectedgroup cat ${here}/etc/group
}