Page MenuHomeVyOS Platform

system users can not be added in "edit"
Closed, ResolvedPublicBUG

Description

vyos@vyos# edit system login
vyos@vyos# set user foo authentication plaintext-password bar
vyos@vyos# commit
Configuration path: [system login user foo authentication plaintext-password] is not valid

Delete failed
Configuration path: [system login user foo authentication encrypted-password $6$VDzi4CPNprXbQM4Z$jcuC1d5Gh8Xjr3be4K.GDND8aROjXmJHvD11aZj1LojruvwCpvY66PEcu4qoD6X1VW1GaSMh3.BthvSDJIsQU1] is not valid

Set failed

Runing the same command not from edit works

vyos@vyos# set system login user foo authentication plaintext-password bar
vyos@vyos# commit

Details

Difficulty level
Unknown (require assessment)
Version
1.3.0-rc1
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

c-po updated the task description. (Show Details)
c-po updated the task description. (Show Details)
c-po renamed this task from edit mode breaks adding system users to system users can not be added in "edit".Apr 2 2021, 9:41 PM

We can do some workaround for that level,

lvl = env['VYATTA_EDIT_LEVEL']
if lvl != '/':
    lvl = lvl.replace(lvl, ' ')
    call(f"/opt/vyatta/sbin/my_delete {lvl} user '{user}' " \
         f"authentication plaintext-password", env=env)
    call(f"/opt/vyatta/sbin/my_set {lvl} user '{user}' " \
         f"authentication encrypted-password '{encrypted_password}'", env=env)
else:
    call(f"/opt/vyatta/sbin/my_delete system login user '{user}' " \
         f"authentication plaintext-password", env=env)
    call(f"/opt/vyatta/sbin/my_set system login user '{user}' " \
         f"authentication encrypted-password '{encrypted_password}'", env=env)

But how about other levels, we get the same error for example with "edit system login user foo"

PR https://github.com/vyos/vyos-1x/pull/802

vyos@r4-roll# edit system login 
[edit system login]
vyos@r4-roll# set user foo authentication plaintext-password bar
[edit system login]
vyos@r4-roll# commit
[edit system login]
vyos@r4-roll# show user foo 
 authentication {
     encrypted-password $6$qpdouYBuwFjsVzBB$Zu3sf9yQgNRCJUtM2E5F955xKchpMkEnA61fVo3ZLfJ2Y.pwdFOuoKSUGWtiB/YXxJmYnCEQyhzvLw5GZdQLB1
 }
[edit system login]
vyos@r4-roll#
Viacheslav changed the task status from Open to Needs testing.Apr 13 2021, 5:10 PM

Works perfect in VyOS 1.4-rolling-202104260417

vyos@r6-roll:~$ conf
e[edit]
vyos@r6-roll# edit system login 
[edit system login]
vyos@r6-roll# set user foo authentication plaintext-password bar
[edit system login]
vyos@r6-roll# commit
[edit system login]
vyos@r6-roll# 
[edit system login]
vyos@r6-roll# show 
 user foo {
     authentication {
         encrypted-password $6$opwXqEjDESjL1QTL$tOC4oJfpVGMdUeHXNYU299JsXpR07jR9X1lBjKyG6AcHKQfvve1Zj/6cqqQ.L4kAuHMSBysXhcNa1y2UTA56M1
     }
 }
Viacheslav claimed this task.
SrividyaA set Issue type to Bug (incorrect behavior).Aug 31 2021, 5:31 PM