[elbe-devel] [PATCH v3 7/7] preprocess: migrate login action

Holger Dengler holger at hdengler.de
Thu Jun 30 08:00:07 CEST 2022


Support legacy XMLs with a login action by moving the plain-text root
password to the login node.

XMLs with only hashed passwords or no login action will not be changed
by the preprocessing.

Signed-off-by: Holger Dengler <holger at hdengler.de>
Reviewed-by: Bastian Germann <bage at linutronix.de>
---
 elbepack/xmlpreprocess.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/elbepack/xmlpreprocess.py b/elbepack/xmlpreprocess.py
index 0daa7b497..719ab4510 100644
--- a/elbepack/xmlpreprocess.py
+++ b/elbepack/xmlpreprocess.py
@@ -260,6 +260,10 @@ def preprocess_passwd(xml):
 
     # migrate root password
     for passwd in xml.iterfind(".//target/passwd"):
+        # legacy support: move plain-text password to login action
+        if xml.find(".//action/login") is not None:
+            xml.find(".//action/login").text = passwd.text
+
         passwd.tag = "passwd_hashed"
         passwd.text = '%s' % sha512_crypt.hash(passwd.text)
 
-- 
2.36.1



More information about the elbe-devel mailing list