summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2023-11-14 18:15:43 +0200
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2023-12-21 14:24:52 +0000
commitf1de91ff9c27b1bb5762d6929a7636a652c9284c (patch)
treed4d05bb15dc7913129dc4abf730501b9c26dfaed
parent1c98ef560088d442b3a1ab218e0503e45406c82b (diff)
downloadvyatta-cfg-system-f1de91ff9c27b1bb5762d6929a7636a652c9284c.tar.gz
vyatta-cfg-system-f1de91ff9c27b1bb5762d6929a7636a652c9284c.zip
boot: T5739: Fixed password recovery
This change fixes a filter used for `sed` during password reset in the `set_encrypted_password()` function. Old logic: search between `user username {` and the first line with `}` does not work for users with extra options in config, like public keys. New logic: search between `user username {` and the first line with `encrypted-password` which should cover all possible combinations, except situations when a password is not presented in a configuration file. (cherry picked from commit 6ee88ac6387ce0dbb570bde3e9c4582b206580aa)
-rwxr-xr-xscripts/standalone_root_pw_reset2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/standalone_root_pw_reset b/scripts/standalone_root_pw_reset
index 1a73de71..c82cea32 100755
--- a/scripts/standalone_root_pw_reset
+++ b/scripts/standalone_root_pw_reset
@@ -28,7 +28,7 @@ ADMIN=vyos
set_encrypted_password() {
sed -i \
- -e "/ user $1 {/,/}/s/encrypted-password .*\$/encrypted-password $2/" $3
+ -e "/ user $1 {/,/encrypted-password/s/encrypted-password .*\$/encrypted-password \"$2\"/" $3
}