ytti / oxidized

Oxidized is a network device configuration backup tool. It's a RANCID replacement!
Apache License 2.0
2.79k stars 922 forks source link

HP Comware xtd-cli-mode Password #611

Closed adamboutcher closed 6 years ago

adamboutcher commented 7 years ago

Hi,

As all the commands required for Oxidized to work are being some stupid password wall xtd_cli_mode, the HP Comware 1950 doesn't get its configuration backed up.

Some kind soul on Reddit has found the password here (foes-bent-pile-atom-ship), I was wondering if you guys could add support?

Thanks

ytti commented 7 years ago

It looks like the password maybe changing per firmware?

adamboutcher commented 7 years ago

This model of switch HP Comware 1950 has always had a different password although it looks like it's changeable per firmware, could we have this as a variable?

Thanks

On 8 Nov 2016 6:28 p.m., "ytti" notifications@github.com wrote:

It looks like the password maybe changing per firmware?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ytti/oxidized/issues/611#issuecomment-259218552, or mute the thread https://github.com/notifications/unsubscribe-auth/AB0qiwRm5r58VG9Q25PCqs2VZvPI4LZSks5q8L9bgaJpZM4KsgKA .

ytti commented 7 years ago

We could have hash mapping firmware to password. Then query for version, and set password from hash based on returned version.

But I don' really understand the problem even, I don't have these devices. Maybe @sid3windr @erJasp @amarti2038 or @nickhilliard can chime in.

adamboutcher commented 7 years ago

There's a section for the 1910/1920 I believe but the command it initially sends is incorrect for the later models...

adamboutcher commented 7 years ago

The line https://github.com/ytti/oxidized/blob/master/lib/oxidized/model/comware.rb#L32

is incorrect for this model switch, it should be

send "xtd-cli-mode\n"

ytti commented 7 years ago

@sid3windr comments about the cli-mode command?

adamboutcher commented 6 years ago

I know it's been a while but do we have any news/update on this issue?

laf commented 6 years ago

@adamboutcher Can we send both commands to catch the different models or will that cause issues?

adamboutcher commented 6 years ago

If you send _cmdline-mode on to my model which uses xtd-cli-mode just ends up saying "% Unrecognised command found at '^' potision.", so you could check for that and then provide the correct command.

laf commented 6 years ago

Or just send them both? If it returns to the prompt after then things should just carry on.

adamboutcher commented 6 years ago

I can't test how the models that don't support the xtd-cli-mode command would act but I cant see why not.

laf commented 6 years ago

Try it for you, add the command to the model (see https://github.com/ytti/oxidized/blob/master/docs/Creating-Models.md on how to do it in your own install). See if it works and then feel free to submit as a pull request. I'm not sure it's the way the project would want it to be done but let's see.

semplonius6 commented 6 years ago

i made the hp1950 work by making a copy of the comware model to : /var/lib/gems/2.3.0/gems/oxidized-0.21.0/lib/oxidized/model/comware1950.rb

changeing the lines: username /^login: $/ password /^Password: $/

and: cfg :telnet, :ssh do

enable command-line mode on SMB comware switches (HP V1910, V1920)

# autodetection is hard, because the 'summary' command is paged, and
# the pager cannot be disabled before _cmdline-mode on.
if vars :comware_cmdline
  post_login do
    #send "_cmdline-mode on\n"
    #send "y\n"
    #send vars(:comware_cmdline) + "\n"
    send "xtd-cli-mode\n"
    send "y\n"
    send vars(:comware_cmdline) + "\n"
  end
end
adamboutcher commented 6 years ago

@semplonius6 Thanks for the help, I'm not a ruby dev so wasn't sure where/how to edit the files. I've pushed a change to the comware file which works for my newer model Comwares:

adamboutcher commented 6 years ago

PR #1305

wk commented 6 years ago

Closed by #1305