diff --git a/test/case/ietf_system/add_delete_user/Readme.adoc b/test/case/ietf_system/add_delete_user/Readme.adoc index 7bf0c1787..74795fd0e 100644 --- a/test/case/ietf_system/add_delete_user/Readme.adoc +++ b/test/case/ietf_system/add_delete_user/Readme.adoc @@ -1,6 +1,7 @@ === Add/delete user ==== Description -Verify that it is possible to add/delete a user. +Verify that it is possible to add/delete a user. The user password is hashed +with yescrypt. ==== Topology ifdef::topdoc[] @@ -18,6 +19,7 @@ endif::topdoc[] . Set up topology and attach to target DUT . Add new user 'newuser01' with password 'newuser01password' . Verify user 'newuser01' exist in operational +. Verify user 'newuser01' can login with SSH . Delete user 'newuser01' . Verify erasure of user 'newuser01' . Verify that 'newuser01' is removed from /etc/passwd diff --git a/test/case/ietf_system/add_delete_user/test.py b/test/case/ietf_system/add_delete_user/test.py index 4e08e4be2..532cf5de2 100755 --- a/test/case/ietf_system/add_delete_user/test.py +++ b/test/case/ietf_system/add_delete_user/test.py @@ -2,11 +2,11 @@ """ Add/delete user -Verify that it is possible to add/delete a user. +Verify that it is possible to add/delete a user. The user password is hashed +with yescrypt. """ import infamy import copy -from passlib.hash import sha256_crypt import random import string import re @@ -15,7 +15,7 @@ username = "newuser01" password = "newuser01password" - +hashed_password = "$y$j9T$SALT$gx4K1wugXsm3JDLwYZtnbr37FGGvljotXwIBGOxaGf2" with infamy.Test() as test: with test.step("Set up topology and attach to target DUT"): env = infamy.Env() @@ -23,8 +23,6 @@ tgtssh = env.attach("target", "mgmt", "ssh") with test.step("Add new user 'newuser01' with password 'newuser01password'"): - hashed_password = sha256_crypt.using(rounds=5000).hash(password) - target.put_config_dict("ietf-system", { "system": { "authentication": { @@ -50,6 +48,10 @@ break assert user_found, f"User 'newuser01' not found" + with test.step("Verify user 'newuser01' can login with SSH"): + newssh = env.attach("target", "mgmt", "ssh", None, username, password) + util.until(lambda: newssh.run("ls").returncode == 0, attempts=200) + with test.step("Delete user 'newuser01'"): target.delete_xpath(f"/ietf-system:system/authentication/user[name='{username}']")