[elbe-devel] [PATCH v2 7/8] preprocess: migrate login action
Holger Dengler
holger at hdengler.de
Thu Jun 16 12:10:13 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 will not be changed by the
preprocessing.
Signed-off-by: Holger Dengler <holger at hdengler.de>
---
elbepack/xmlpreprocess.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/elbepack/xmlpreprocess.py b/elbepack/xmlpreprocess.py
index 947b3cfce..e00faedb1 100644
--- a/elbepack/xmlpreprocess.py
+++ b/elbepack/xmlpreprocess.py
@@ -259,6 +259,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_hashed = '%s' % crypt(passwd.text, METHOD_SHA512)
passwd.tag = "passwd_hashed"
passwd.text = passwd_hashed
--
2.36.1
More information about the elbe-devel
mailing list