* [PATCH] image-account-extension: Avoid deprecated crypt module
@ 2023-10-28 8:59 Jan Kiszka
2023-11-01 7:13 ` Uladzimir Bely
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2023-10-28 8:59 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
crypt will be dropped from Python 13. Switch to 'openssl passwd' to
avoid extra dependencies like python3-passlib.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta/classes/image-account-extension.bbclass | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/meta/classes/image-account-extension.bbclass b/meta/classes/image-account-extension.bbclass
index 6f67f459..412aa06d 100644
--- a/meta/classes/image-account-extension.bbclass
+++ b/meta/classes/image-account-extension.bbclass
@@ -72,7 +72,6 @@ def image_create_users(d: "DataSmart") -> None:
None
"""
import hashlib
- import crypt
entries = (d.getVar("USERS") or "").split()
rootfsdir = d.getVar("ROOTFSDIR")
@@ -137,7 +136,7 @@ def image_create_users(d: "DataSmart") -> None:
if source_date_epoch:
command.append("-e")
salt = hashlib.sha256("{}\n".format(source_date_epoch).encode()).hexdigest()[0:15]
- password = crypt.crypt(password, "$6${}".format(salt))
+ password = bb.process.run('openssl passwd -6 --salt {} {}'.format(salt, password))[0].strip()
else:
command.append("-e")
--
2.35.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] image-account-extension: Avoid deprecated crypt module
2023-10-28 8:59 [PATCH] image-account-extension: Avoid deprecated crypt module Jan Kiszka
@ 2023-11-01 7:13 ` Uladzimir Bely
0 siblings, 0 replies; 2+ messages in thread
From: Uladzimir Bely @ 2023-11-01 7:13 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On Sat, 2023-10-28 at 10:59 +0200, 'Jan Kiszka' via isar-users wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> crypt will be dropped from Python 13. Switch to 'openssl passwd' to
> avoid extra dependencies like python3-passlib.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> meta/classes/image-account-extension.bbclass | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/meta/classes/image-account-extension.bbclass
> b/meta/classes/image-account-extension.bbclass
> index 6f67f459..412aa06d 100644
> --- a/meta/classes/image-account-extension.bbclass
> +++ b/meta/classes/image-account-extension.bbclass
> @@ -72,7 +72,6 @@ def image_create_users(d: "DataSmart") -> None:
> None
> """
> import hashlib
> - import crypt
>
> entries = (d.getVar("USERS") or "").split()
> rootfsdir = d.getVar("ROOTFSDIR")
> @@ -137,7 +136,7 @@ def image_create_users(d: "DataSmart") -> None:
> if source_date_epoch:
> command.append("-e")
> salt =
> hashlib.sha256("{}\n".format(source_date_epoch).encode()).hexdigest()
> [0:15]
> - password = crypt.crypt(password,
> "$6${}".format(salt))
> + password = bb.process.run('openssl passwd -6 --
> salt {} {}'.format(salt, password))[0].strip()
>
> else:
> command.append("-e")
> --
> 2.35.3
>
Applied to next, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-01 7:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-28 8:59 [PATCH] image-account-extension: Avoid deprecated crypt module Jan Kiszka
2023-11-01 7:13 ` Uladzimir Bely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox