安恒堡垒机——华为交换机改密脚本

一、环境

安恒堡垒机:明御运维审计与风险控制系统

版本号:V2.0R25C11SPC100(目前已知发行最新版本)

华为交换机改密脚本2026年5月测试可用。

二、注意事项:

请使用前仔细阅读

1、堡垒机改密脚本大体分为2类,一个是S系列交换机,一个是CE系列交换机,其中主要区别在于Commit命令。

2、堡垒机改密有2种模式,1是普通改密,2是使用特权账号改密,脚本略有不同(主要不通是特权账号不需要输入老密码,而普通账号需要输入${oldpassword}。)

3、看懂脚本的使用方法后,你可以稍微改变脚本,使得适用于其他版本交换机改密。

4、改密脚本存放位置,如下图:

image

三、改密脚本

1、华为S系列交换机改密脚本

# 华为S系列S5700交换机改密脚本
# ============global============

# before_send_read = 1
# before_match_wait = 0.2
# match_timeout = 10
# match_error = exit

# ============start============
# send command
system-view
# wait one second
<wait> 1
# prompt changed, [system-view], match prompt "]" must with "\"
aaa
local-user ${username} password irreversible-cipher ${newpassword}
${oldpassword}
<wait> 1
<Enter>
<wait> 1
<Enter>
<send> quit
<wait> 1
<Enter>
<wait> 1
<send> quit
<wait> 1
<Enter>
<wait> 1
save
<Enter>
y
<Enter> 

2、华为S系列交换机改密脚本(特权账号专用)

# ============global============

# before_send_read = 1
# before_match_wait = 0.2
# match_timeout = 10
# match_error = exit

# ============start============
# send command
system-view
# wait one second
<wait> 1
# prompt changed, [system-view], match prompt "]" must with "\"
aaa
local-user ${username} password irreversible-cipher ${newpassword}
<wait> 1
<Enter>
<wait> 1
<Enter>
<send> quit
<wait> 1
<Enter>
<wait> 1
<send> quit
<wait> 1
<Enter>
<wait> 1
save
<Enter>
y
<Enter> 

3、华为CE系列交换机CE16804改密脚本

# 华为CE系列交换机CE16804改密脚本
# ============global============

# before_send_read = 1
# before_match_wait = 0.2
# match_timeout = 10
# match_error = exit

# ============start============
# send command
system-view
# wait one second
<wait> 1
# prompt changed, [system-view], match prompt "]" must with "\"
aaa
local-user ${username} password irreversible-cipher  ${newpassword}
${oldpassword}
<wait> 1
<Enter>
<wait> 1
<Enter>
<send> commit
<Enter>
<wait> 1
<send> quit
<wait> 1
<Enter>
<wait> 1
<send> quit
<wait> 1
<Enter>
<wait> 1
save
<Enter>
y
<Enter> 

4、华为CE系列交换机改密脚本(特权账号专用)

# ============global============

# before_send_read = 1
# before_match_wait = 0.2
# match_timeout = 10
# match_error = exit

# ============start============
# send command
system-view
# wait one second
<wait> 1
# prompt changed, [system-view], match prompt "]" must with "\"
aaa
local-user ${username} password irreversible-cipher  ${newpassword}
<wait> 1
<Enter>
<wait> 1
<Enter>
<send> commit
<Enter>
<wait> 1
<send> quit
<wait> 1
<Enter>
<wait> 1
<send> quit
<wait> 1
<Enter>
<wait> 1
save
<Enter>
y
<Enter> 

如需使用特权账号改密,需要先在主机资产中设置唯一的特权账号,详细操作方法可以咨询安恒。

posted @ 2026-05-18 16:46  Magiclala  阅读(5)  评论(0)    收藏  举报