【已评审】支持cli下的passwd命令

ISSUE链接

【需求】支持cli接口下的passwd命令-rackmount-GitCode

评审背景

当前版本:
未支持passwd命令

客户希望支持的配置:
增加linux shell命令中的passwd命令,该命令用于允许用户通过命令行界面修改用户密码以及锁定和解锁用户

触发原因

新需求

决策点

1.新增cli接口下的passwd命令
命令格式: passwd [-l / -u] [username]
提示:
Usage: passwd [options] [LOGIN]

Options:
      -l, --lock         lock the password of the named account
      -u, --unlock       unlock the password of the named account

应用场景:在命令行界面使用

2.新增资源树协作接口,用来使能passwd命令
具体配置:
path:/bmc/kepler/:Customer/Cli/Command/:Id
interface:bmc.kepler.Cli.Command
property: Name
类型 : String
property: Enabled
类型 : boolean
默认值 : true

整体方案

1.支持passwd命令修改密码
2.支持passwd命令中的可选参数-l/-u判断启动锁定和解锁用户,如果当前用户的角色为管理员,则可以锁定和解锁用户

详细描述

1.命令说明:

命令 操作类型 操作描述 权限要求 成功 失败
passwd 修改密码 用户修改自身密码 ConfigureSelf passwd: all authentication tokens updated successfully. passwd: all authentication tokens updated failed.
passwd [username] 修改密码 管理员修改其他用户密码,其他用户修改自己的密码 ConfigureSelf passwd: all authentication tokens updated successfully. passwd: all authentication tokens updated failed.
passwd -l username 锁定用户 管理员锁定指定用户账户,禁止其登录 UserMgmt passwd: Success passwd:failed
passwd -u username 解锁用户 管理员解锁被锁定用户账户,允许其登录 UserMgmt passwd: Success passwd:failed

2.支持属性显示和隐藏passwd命令

资源path:/bmc/kepler/:Customer/Cli/Command/:Id

资源interface:bmc.kepler.Cli.Command

变化类型:新增资源协作对象路径、接口、属性

应用场景:客户定制组件能够显示和隐藏passwd命令,来满足客户特定诉求。
详细描述:

属性名称 变化类型 签名 访问权限 持久化 变化通知 接口说明 接口约束
Name 新增属性 s 只读:ReadOnly 不持久化 cli命令名称
Enabled 新增属性 b 只读:ReadOnly 不持久化 使能Cli命令 取值范围:[false , true]

使用示例:

//修改密码
passwd
Changing your current password.
Current password:输入当前登录用户的密码,进行鉴权
New password: 输入密码
Retype new password: 再次输入密码
成功: passwd: all authentication tokens updated successfully.
失败: passwd: all authentication tokens updated failed.
输入的当前密码错误:Incorrect password or locked account.
两次输入的新密码不一致: Confirm password error.

passwd username
Changing password for user.
Current password:输入当前登录用户的密码,进行鉴权
New password: 输入密码
Retype new password: 再次输入密码
成功: passwd: all authentication tokens updated successfully
失败: passwd: all authentication tokens updated failed.
输入的当前密码错误:Incorrect password or locked account.
两次输入的新密码不一致: Confirm password error.

//锁定或解锁
passwd -l/-u username
Locking/Unlocking password for user .
Current password:输入当前登录用户的密码,进行鉴权
成功: passwd: Success
失败: passwd:failed
输入的当前密码错误:Incorrect password or locked account.

遗留问题

评审结论

1、同意新增cli接口下的passwd命令,当前命令做定制需求,配合超长密码使用
命令及提示信息如下所示:

Usage: passwd [options] [LOGIN]
Options:
      -l, --lock         lock the password of the named account
      -u, --unlock       unlock the password of the named account

2、同意新增如下资源协作接口
新增path:/bmc/kepler/:Customer/Cli/Command/:Id
新增interface:bmc.kepler.Cli.Command
新增properties:

  • Name,签名为s,只读,读权限为ReadOnly,不发送变化通知
  • Enabled,签名为b,只读,读权限为ReadOnly,不发送变化通知,取值范围为[false,true],默认值为true
1 个赞

由于大量社区举报,此话题被临时关闭至少 4 小时。

此话题已在 8 小时后被自动打开。

  1. 补充一下命令执行的 操作权限 、 使用示例
  2. 针对功能补充描述信息,比如哪些权限可以修改其他用户的密码,哪些权限只能修改自己的密码
  3. 针对修改密码过程中的回显信息进行补充,参考标准的passwd命令进行说明

这里写错了,是允许其登录

另外,重新确认下锁定和解锁是否有二次认证,和ipmcset的操作保持一致