Security Subsystem Frequently Used Commands
更新时间: 2026/05/12
在Gitcode上查看源码

命令介绍

本文列举了安全常用的相关命令,方便查阅和开发调试。

IPMI分为带内与带外命令,区分依据为是否在OS侧下发命令。 - 带外命令格式为:ipmitool -H 环境IP -I lanplus -p 623 -U 用户名 -P 用户密码 -C 17 <operate>,其中-C 17为选择安全算法17,不加-C 17则默认为安全算法3(默认禁用)。 - 带内命令格式为:ipmitool <operate>

busctl命令, 只能在升级debug包的环境上调试使用, 命令组成格式为:busctl --user <operate> <service> <path> <interface> <property/method> <signature> <value>。

用户相关

新建用户

shell
busctl --user call bmc.kepler.account /bmc/kepler/AccountService/Accounts bmc.kepler.AccountService.ManagerAccounts  New a{ss}ysayiaii 3 Interface Busctl UserName <当前登录管理> ClientAddr 127.0.0.1 <user_id> <用户> <密码(ASCII码)>  <用户权限角色> <登录接口个数>  <登录接口>  <首次登陆密码策略>
shell
ipmitool -H <IP> -I lanplus -p 623 -U <管理员用> -P <> -C 17 user set name <not_exist_account_id> <username>
  • ipmi设置一个不存在的用户为合法用户名时新建用户,默认为一个首次登陆强制修改密码、拥有所有登录接口的无权限用户,且该用户无密码,需要建立后修改密码
shell
ipmcset -d adduser -v <username>
  • cli命令新建用户时只需要输入用户名和密码,结果为新建一个拥有所有登录接口的无权限用户

删除用户

shell
busctl --user call bmc.kepler.account /bmc/kepler/AccountService/Accounts/<用户id> bmc.kepler.AccountService.ManagerAccount Delete a{ss} 3 Interface Busctl UserName <当前登录管理> ClientAddr 127.0.0.1
shell
ipmitool -H <IP> -I lanplus -p 623 -U <管理员用> -P <> -C 17 user set name <exist_account_id> ''
  • ipmi设置一个存在的用户的用户名为空时删除该用户
shell
ipmcset -d deluser -v <username>

查看用户集合

shell
ipmitool -H <IP> -I lanplus -p 623 -U <管理员用> -P <> -C 17 user list 1
busctl --user tree bmc.kepler.account
ipmcget -t user -d list

查看某个用户的信息

shell
busctl --user introspect bmc.kepler.account /bmc/kepler/AccountService/Accounts/<用户id>

设置某个用户的用户名

shell
busctl --user set-property bmc.kepler.account /bmc/kepler/AccountService/Accounts/<用户id> bmc.kepler.AccountService.ManagerAccount UserName s name
无修改用户名的cli命令
ipmitool -H <IP> -I lanplus -p 623 -U <管理员用> -P <> -C 17 user set name <exist_account_id> <username>

设置某个用户的登录密码

shell
busctl --user call bmc.kepler.account /bmc/kepler/AccountService/Accounts/<用户id> bmc.kepler.AccountService.ManagerAccount ChangePwd a{ss}ay 3 Interface Busctl UserName <当前登录管理> ClientAddr 127.0.0.1 <欲设置密码长> <密码具体ascii>
ipmcset -t <user> -d password -v username
ipmitool -H <IP> -I lanplus -p 623 -U <管理员用> -P <> -C 17 user set password <account_id> <passowrd>
  • 此处的ay指密码长度与密码具体内容(密码使用的是ascii码)

设置某个用户的登录接口

shell
ipmcset -t user -d interface -v <username> <enabled/disabled> <option1 option2 ...>

其中options如下:

WebSNMPIPMISSHSFTPLocalRedfish
1234578

设置与查看某个用户的登录规则

shell
busctl --user set-property bmc.kepler.account /bmc/kepler/AccountService/Accounts/<account_id> bmc.kepler.AccountService.ManagerAccount LoginRuleIds as <rule_array_length> <rule_option ...>

其中rule_option的合法值为:Rule1, Rule2, Rule3

设置某个用户的首次登陆策略

shell
ipmcset -t user -d firstloginpolicy -v <username> 1/2
  • 1 表示提示修改密码,2表示强制修改密码

添加SSH用户公钥

shell
ipmcset -t user -d addpublickey -v <username> <localpath/URL>
busctl --user call bmc.kepler.account /bmc/kepler/AccountService/Accounts/<account_id> bmc.kepler.AccountService.ManagerAccount ImportSSHPublicKey a{ss}ss 4 Interface CLI UserName <当前登录管理> ClientAddr 127.0.0.1 Privilege 16 URI <localpath/URL>

删除SSH用户公钥

shell
ipmcset -t user -d delpublickey -v <username>
busctl --user call bmc.kepler.account /bmc/kepler/AccountService/Accounts/<account_id> bmc.kepler.AccountService.ManagerAccount DeleteSSHPublicKey a{ss} 3 Interface Busctl UserName <当前登录管理> ClientAddr 127.0.0.1

手动锁定某个用户

shell
ipmcset -t user -d lock -v <username>
busctl --user call bmc.kepler.account /bmc/kepler/AccountService/Accounts bmc.kepler.AccountService.ManagerAccounts SetAccountLockState a{ss}yb 3 Interface Busctl UserName <当前登录管理> ClientAddr 127.0.0.1 <account_id> True

手动解锁某个用户

shell
ipmcset -t user -d unlock -v <username>
busctl --user call bmc.kepler.account /bmc/kepler/AccountService/Accounts bmc.kepler.AccountService.ManagerAccounts SetAccountLockState a{ss}yb 3 Interface Busctl UserName <当前登录管理> ClientAddr 127.0.0.1 <account_id> False

修改某个用户的权限角色

shell
busctl --user set-property bmc.kepler.account /bmc/kepler/AccountService/Accounts/<account_id> bmc.kepler.AccountService.ManagerAccount RoleId y <privilege>

ipmcset -d privilege -v <username> <privilege>

其中权限角色privilege有效值为2~8、15,对应为:

UserOperatorAdministratorCustom Role1Custom Role2Custom Role3Custom Role4No Access
234567815

修改某个用户的使能状态

shell
ipmcset -t user -d state -v <username> <enabled|disabled>

修改某个用户的SNMP加密密码

shell
ipmcset -t user -d snmpprivacypassword -v <username>

会话相关

VNC会话超时时长

shell
ipmcset -t vnc -d timeout -v <value>
  • 设置值单位为分钟,取值范围为0~480,其中0表示无限制。

删除指定会话

shell
busctl --user call bmc.kepler.iam /bmc/kepler/SessionService/Sessions/{id} bmc.kepler.SessionService.Session SessionDelete a{ss}y 3 Interface Busctl UserName <当前登录管理> ClientAddr 127.0.0.1 0

用户配置

设置与查看弱口令检查开关

shell
# 查看开关
ipmitool -H <IP> -I lanplus -p 623 -U <管理员用> -P <> -C 17 raw 0x30 0x93 0xDB 0x07 0x00 0x76 0x01 0x00

busctl --user set-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService WeakPasswordDictionaryEnabled b <True|False>

busctl --user get-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService WeakPasswordDictionaryEnabled

ipmcset -t user -d weakpwddic -v <enabled/disabled>

导入弱口令文件

shell
busctl --user call bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService ImportWeakPasswordDictionary a{ss}s 4 Interface CLI UserName <当前登录管理> ClientAddr 127.0.0.1 Privilege 16 <localpath/URL>

ipmcset -t user -d weakpwddic -v import <localpath/URL>

导出弱口令文件

shell
busctl --user call bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService ExportWeakPasswordDictionary a{ss}s 4 Interface CLI UserName <当前登录管理> ClientAddr 127.0.0.1 Privilege 16 <localpath/URL>

ipmcset -t user -d weakpwddic -v export <localpath/URL>

设置与查看登录失败锁定时长

shell
busctl --user set-property bmc.kepler.iam /bmc/kepler/AccountService/Authentication bmc.kepler.AccountService.Authentication AccountLockoutDuration i <锁定时>

busctl --user get-property bmc.kepler.iam /bmc/kepler/AccountService/Authentication bmc.kepler.AccountService.Authentication AccountLockoutDuration
  • 设置值单位为秒,只能为60的整数倍

设置与查看登录失败锁定次数

shell
busctl --user set-property bmc.kepler.iam /bmc/kepler/AccountService/Authentication bmc.kepler.AccountService.Authentication AccountLockoutThreshold i <失败锁定次>

busctl --user get-property bmc.kepler.iam /bmc/kepler/AccountService/Authentication bmc.kepler.AccountService.Authentication AccountLockoutThreshold
  • 设置值范围为0-6,0为失败后不会锁定用户

设置与查看逃生用户

shell
busctl --user set-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService EmergencyLoginAccountId y <管理员用户ID>

busctl --user get-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService EmergencyLoginAccountId

设置与查看历史密码次数

shell
busctl --user set-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService HistoryPasswordCount y <历史密码次>

busctl --user get-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService HistoryPasswordCount
  • 设置值范围为0-5,0为无历史密码次数限制

设置与查看用户不活跃天数

shell
busctl --user set-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService InactiveDaysThreshold u <不活跃天>

busctl --user get-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService InactiveDaysThreshold

ipmcset -t securityenhance -d inactivetimelimit -v <time>

ipmcget -t securityenhance -d inactivetimelimit
  • 设置值范围为0、30-365,0为无不活跃天数限制

设置与查看初始登录强制修改状态位

shell
busctl --user set-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService InitialPasswordNeedModify b <True|False>

busctl --user get-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService InitialPasswordNeedModify

查看密码最大长度

shell
busctl --user get-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService MaxPasswordLength

设置与查看密码最小长度

shell
busctl --user set-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService MinPasswordLength i <>

busctl --user get-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService MinPasswordLength

设置与查看密码有效期

shell
busctl --user set-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService MaxPasswordValidDays u <有效>

busctl --user get-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService MaxPasswordValidDays

设置与查看密码最短使用期限

shell
busctl --user set-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService MinPasswordValidDays u <有效>

busctl --user get-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService MinPasswordValidDays

ipmcget -d minimumpasswordage

设置与查看密码复杂度开关

shell
busctl --user set-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService PasswordComplexityEnable b <True|False>

busctl --user get-property bmc.kepler.account /bmc/kepler/AccountService bmc.kepler.AccountService PasswordComplexityEnable

ipmcset -t user -d passwordcomplexity -v <enabled|disabled>
ipmcset -d passwordcomplexity -v <enabled|disabled>

设置与查看trap用户

shell
ipmcset -t trap -d user -v <username>

ipmcget -t trap -d user

SNMP相关

设置与查看团体名长口令使能开关

shell
busctl --user set-property bmc.kepler.account /bmc/kepler/Managers/1/SnmpService/SnmpCommunity bmc.kepler.Managers.SnmpService.SnmpCommunity LongCommunityEnabled b false

busctl --user get-property bmc.kepler.account /bmc/kepler/Managers/1/SnmpService/SnmpCommunity bmc.kepler.Managers.SnmpService.SnmpCommunity LongCommunityEnabled

设置与查看团体名

shell
busctl --user call bmc.kepler.account /bmc/kepler/Managers/1/SnmpService/SnmpCommunity bmc.kepler.Managers.SnmpService.SnmpCommunity SetRoCommunity a{ss}s 3 Interface Busctl UserName <当前登录管理> ClientAddr 127.1.2.1 <只读团体>

busctl --user call bmc.kepler.account /bmc/kepler/Managers/1/SnmpService/SnmpCommunity bmc.kepler.Managers.SnmpService.SnmpCommunity GetSnmpCommunity a{ss} 3 Interface Busctl UserName <当前登录管理> ClientAddr 127.0.0.1
  • 读写团体名为RwCommunity,只读团体名为RoCommunity

证书相关

导入SSL证书

shell
ipmcset -t certificate -d import -v <localpath/URL> <type> <passphrase>

查看SSL证书信息

shell
ipmcget -t certificate -d info

导入ssl证书

shell
busctl --user call bmc.kepler.certificate /bmc/kepler/CertificateService bmc.kepler.CertificateService ImportCertWithKey a{ss}isss 4 Interface CLI UserName <当前登录管理> ClientAddr 127.0.0.1 Privilege 16  1 URI <localpath/URL> <passphrase>
  • 此处需要注意环境时间与证书时间

安全配置

设置与查看安全公告

shell
ipmcset -t securitybanner -d content -v <content>

ipmcget -t securitybanner -d info
  • 设置内容为关键字default时,设置安全公告为默认信息

设置与查看安全公告使能

shell
ipmcset -t securitybanner -d state -v <enabled|disabled>

ipmcget -t securitybanner -d info