oxidized备份华为HRP防火墙配置失败问题

Oxidized备份华为防火墙配置Last Status红色,备份失败,查看oxidized日志(默认是~/.config/oxidized/logs/oxidized.log)能看到报错日志:

WARN -- : 10.10.0.14 raised Oxidized::PromptUndetect with msg "
*************************************************************************
* Copyright (C) 2014-2018 Huawei Technologies Co., Ltd. *
* All rights reserved. *
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
************************************************************************* Info: The max number of VTY users is 10, and the number
of current VTY users on line is 1.
HRP_M<USG6650E> not matching configured prompt (?-mix:^(<[\w.-]+>)$)"

出问题的原因是huawei防火墙运行在HRP模式下时,提示符前会加上HRP_M或者HRP_S字样,和独立运行情况下的尖括号或者方括号提示符不一样。

解决办法

不同设备的特征是在model里定义的,这里直接修改华为的model解决问题。

华为防火墙的系统成为VRP,由于oxidized是通过ruby gem安装的,model文件在gem的安装文件夹下。

在配置文件里要使用小写的vrp,如果大写备份也会失败,日志报错为 VRP not found for node xx.xx.xx.xx

使用命令 gem envi 可以显示gem安装的程序的安装路径,这里可能会显示:

  - GEM PATHS:
- /usr/local/lib/ruby/gems/2.7.0
- /root/.gem/ruby/2.7.0

那么进入model的安装路径 cd /usr/local/lib/ruby/gems/2.7.0/gems/oxidized-`oxidized -v`/lib/oxidized/model

编辑文件vrp.rb,把 prompt /^(<[\w.-]+>)$/ 改成 prompt /^(HRP_[MS])?(<[\w.-]+>)$/

(HRP_[MS])? 这部分正则可以兼容含有或不含有HRP的前缀。重启oxidized服务后生效。

上一篇:华为SSH认证配置


下一篇:华为服务器XH628配置软RAID