ytti / oxidized

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

HP procurve that only asks for password #2833

Closed LoZio closed 7 months ago

LoZio commented 1 year ago

I have a mix of Procurve switches. I access them via Telnet (no SSH). Most of them require user/password combo, and they work fine, I get the config and all. Some only require the password, at the telnet prompt I get:

ProCurve J4903A Switch 2824
Firmware revision I.08.98

Copyright (C) 1991-2006 Hewlett-Packard Co.  All Rights Reserved.

                           RESTRICTED RIGHTS LEGEND

 Use, duplication, or disclosure by the Government is subject to restrictions
 as set forth in subdivision (b) (3) (ii) of the Rights in Technical Data and
 Computer Software clause at 52.227-7013.

         HEWLETT-PACKARD COMPANY, 3000 Hanover St., Palo Alto, CA 94303

We'd like to keep you up to date about:
  * Software feature updates
  * New product announcements
  * Special events

Please register your products now at:  www.ProCurve.com

Password:

So no username is asked. The backup fails, here is the debug log:

D, [2023-06-16T11:22:44.178980 #1337179] DEBUG -- : lib/oxidized/worker.rb: Added /192.168.14.11 to the job queue
D, [2023-06-16T11:22:44.179036 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2023-06-16T11:22:44.179139 #1337179] DEBUG -- : lib/oxidized/job.rb: Starting fetching process for 192.168.14.11 at 2023-06-16 09:22:44 UTC
D, [2023-06-16T11:22:44.189534 #1337179] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login commands at 192.168.14.11
D, [2023-06-16T11:22:44.189610 #1337179] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login command: "no page", block: nil at 192.168.14.11
D, [2023-06-16T11:22:44.189643 #1337179] DEBUG -- : Telnet: no page @192.168.14.11
D, [2023-06-16T11:22:44.191457 #1337179] DEBUG -- : lib/oxidized/model/model.rb Collecting commands' outputs
D, [2023-06-16T11:22:44.191529 #1337179] DEBUG -- : lib/oxidized/model/model.rb Executing show version
D, [2023-06-16T11:22:44.191568 #1337179] DEBUG -- : Telnet: show version @192.168.14.11
D, [2023-06-16T11:22:44.358597 #1337179] DEBUG -- : lib/oxidized/model/model.rb Executing show modules
D, [2023-06-16T11:22:44.358752 #1337179] DEBUG -- : Telnet: show modules @192.168.14.11
D, [2023-06-16T11:22:45.180019 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2023-06-16T11:22:46.182433 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2023-06-16T11:22:47.183494 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
W, [2023-06-16T11:22:47.604637 #1337179]  WARN -- : 192.168.14.11 raised EOFError (rescued IOError) with msg "end of file reached"
D, [2023-06-16T11:22:47.604773 #1337179] DEBUG -- : lib/oxidized/node.rb: Oxidized::Telnet failed for 192.168.14.11
D, [2023-06-16T11:22:47.604997 #1337179] DEBUG -- : lib/oxidized/input/ssh.rb: Connecting to 192.168.14.11
D, [2023-06-16T11:22:47.605283 #1337179] DEBUG -- : AUTH METHODS::["none", "publickey", "password"]
D, [2023-06-16T11:22:47.607637 #1337179] DEBUG -- : 192.168.14.11 raised Errno::ECONNREFUSED with msg "Connection refused - connect(2) for 192.168.14.11:22"
D, [2023-06-16T11:22:47.607723 #1337179] DEBUG -- : lib/oxidized/node.rb: Oxidized::SSH failed for 192.168.14.11
D, [2023-06-16T11:22:47.607780 #1337179] DEBUG -- : lib/oxidized/job.rb: Config fetched for 192.168.14.11 at 2023-06-16 09:22:47 UTC
W, [2023-06-16T11:22:48.185181 #1337179]  WARN -- : /192.168.14.11 status no_connection, retry attempt 1
D, [2023-06-16T11:22:48.185300 #1337179] DEBUG -- : lib/oxidized/worker.rb: Jobs running: 0 of 1 - ended: 1 of 3
D, [2023-06-16T11:22:48.185376 #1337179] DEBUG -- : lib/oxidized/worker.rb: Added /192.168.14.11 to the job queue
D, [2023-06-16T11:22:48.185416 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2023-06-16T11:22:48.185521 #1337179] DEBUG -- : lib/oxidized/job.rb: Starting fetching process for 192.168.14.11 at 2023-06-16 09:22:48 UTC
D, [2023-06-16T11:22:48.193221 #1337179] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login commands at 192.168.14.11
D, [2023-06-16T11:22:48.193302 #1337179] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login command: "no page", block: nil at 192.168.14.11
D, [2023-06-16T11:22:48.193337 #1337179] DEBUG -- : Telnet: no page @192.168.14.11
D, [2023-06-16T11:22:48.195036 #1337179] DEBUG -- : lib/oxidized/model/model.rb Collecting commands' outputs
D, [2023-06-16T11:22:48.195113 #1337179] DEBUG -- : lib/oxidized/model/model.rb Executing show version
D, [2023-06-16T11:22:48.195139 #1337179] DEBUG -- : Telnet: show version @192.168.14.11
D, [2023-06-16T11:22:48.359345 #1337179] DEBUG -- : lib/oxidized/model/model.rb Executing show modules
D, [2023-06-16T11:22:48.359452 #1337179] DEBUG -- : Telnet: show modules @192.168.14.11
D, [2023-06-16T11:22:49.186441 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2023-06-16T11:22:50.187760 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2023-06-16T11:22:51.188987 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
W, [2023-06-16T11:22:51.604697 #1337179]  WARN -- : 192.168.14.11 raised EOFError (rescued IOError) with msg "end of file reached"
D, [2023-06-16T11:22:51.604788 #1337179] DEBUG -- : lib/oxidized/node.rb: Oxidized::Telnet failed for 192.168.14.11
D, [2023-06-16T11:22:51.604944 #1337179] DEBUG -- : lib/oxidized/input/ssh.rb: Connecting to 192.168.14.11
D, [2023-06-16T11:22:51.605061 #1337179] DEBUG -- : AUTH METHODS::["none", "publickey", "password"]
D, [2023-06-16T11:22:51.606913 #1337179] DEBUG -- : 192.168.14.11 raised Errno::ECONNREFUSED with msg "Connection refused - connect(2) for 192.168.14.11:22"
D, [2023-06-16T11:22:51.606963 #1337179] DEBUG -- : lib/oxidized/node.rb: Oxidized::SSH failed for 192.168.14.11
D, [2023-06-16T11:22:51.607002 #1337179] DEBUG -- : lib/oxidized/job.rb: Config fetched for 192.168.14.11 at 2023-06-16 09:22:51 UTC
W, [2023-06-16T11:22:52.190146 #1337179]  WARN -- : /192.168.14.11 status no_connection, retry attempt 2
D, [2023-06-16T11:22:52.190259 #1337179] DEBUG -- : lib/oxidized/worker.rb: Jobs running: 0 of 1 - ended: 1 of 3
D, [2023-06-16T11:22:52.190333 #1337179] DEBUG -- : lib/oxidized/worker.rb: Added /192.168.14.11 to the job queue
D, [2023-06-16T11:22:52.190372 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2023-06-16T11:22:52.190518 #1337179] DEBUG -- : lib/oxidized/job.rb: Starting fetching process for 192.168.14.11 at 2023-06-16 09:22:52 UTC
D, [2023-06-16T11:22:52.198074 #1337179] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login commands at 192.168.14.11
D, [2023-06-16T11:22:52.198246 #1337179] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login command: "no page", block: nil at 192.168.14.11
D, [2023-06-16T11:22:52.198337 #1337179] DEBUG -- : Telnet: no page @192.168.14.11
D, [2023-06-16T11:22:52.200042 #1337179] DEBUG -- : lib/oxidized/model/model.rb Collecting commands' outputs
D, [2023-06-16T11:22:52.200195 #1337179] DEBUG -- : lib/oxidized/model/model.rb Executing show version
D, [2023-06-16T11:22:52.200299 #1337179] DEBUG -- : Telnet: show version @192.168.14.11
D, [2023-06-16T11:22:52.359356 #1337179] DEBUG -- : lib/oxidized/model/model.rb Executing show modules
D, [2023-06-16T11:22:52.359579 #1337179] DEBUG -- : Telnet: show modules @192.168.14.11
D, [2023-06-16T11:22:53.191599 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2023-06-16T11:22:54.192910 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2023-06-16T11:22:55.193321 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
W, [2023-06-16T11:22:55.605142 #1337179]  WARN -- : 192.168.14.11 raised EOFError (rescued IOError) with msg "end of file reached"
D, [2023-06-16T11:22:55.605380 #1337179] DEBUG -- : lib/oxidized/node.rb: Oxidized::Telnet failed for 192.168.14.11
D, [2023-06-16T11:22:55.605573 #1337179] DEBUG -- : lib/oxidized/input/ssh.rb: Connecting to 192.168.14.11
D, [2023-06-16T11:22:55.605820 #1337179] DEBUG -- : AUTH METHODS::["none", "publickey", "password"]
D, [2023-06-16T11:22:55.608350 #1337179] DEBUG -- : 192.168.14.11 raised Errno::ECONNREFUSED with msg "Connection refused - connect(2) for 192.168.14.11:22"
D, [2023-06-16T11:22:55.608516 #1337179] DEBUG -- : lib/oxidized/node.rb: Oxidized::SSH failed for 192.168.14.11
D, [2023-06-16T11:22:55.608716 #1337179] DEBUG -- : lib/oxidized/job.rb: Config fetched for 192.168.14.11 at 2023-06-16 09:22:55 UTC
W, [2023-06-16T11:22:56.195113 #1337179]  WARN -- : /192.168.14.11 status no_connection, retry attempt 3
D, [2023-06-16T11:22:56.195259 #1337179] DEBUG -- : lib/oxidized/worker.rb: Jobs running: 0 of 1 - ended: 1 of 3
D, [2023-06-16T11:22:56.195337 #1337179] DEBUG -- : lib/oxidized/worker.rb: Added /192.168.14.11 to the job queue
D, [2023-06-16T11:22:56.195380 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2023-06-16T11:22:56.195573 #1337179] DEBUG -- : lib/oxidized/job.rb: Starting fetching process for 192.168.14.11 at 2023-06-16 09:22:56 UTC
D, [2023-06-16T11:22:56.203631 #1337179] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login commands at 192.168.14.11
D, [2023-06-16T11:22:56.203824 #1337179] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login command: "no page", block: nil at 192.168.14.11
D, [2023-06-16T11:22:56.203925 #1337179] DEBUG -- : Telnet: no page @192.168.14.11
D, [2023-06-16T11:22:56.206020 #1337179] DEBUG -- : lib/oxidized/model/model.rb Collecting commands' outputs
D, [2023-06-16T11:22:56.206198 #1337179] DEBUG -- : lib/oxidized/model/model.rb Executing show version
D, [2023-06-16T11:22:56.206311 #1337179] DEBUG -- : Telnet: show version @192.168.14.11
D, [2023-06-16T11:22:56.359170 #1337179] DEBUG -- : lib/oxidized/model/model.rb Executing show modules
D, [2023-06-16T11:22:56.359374 #1337179] DEBUG -- : Telnet: show modules @192.168.14.11
D, [2023-06-16T11:22:57.196626 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2023-06-16T11:22:58.197973 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2023-06-16T11:22:59.199341 #1337179] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
W, [2023-06-16T11:22:59.606978 #1337179]  WARN -- : 192.168.14.11 raised EOFError (rescued IOError) with msg "end of file reached"
D, [2023-06-16T11:22:59.607186 #1337179] DEBUG -- : lib/oxidized/node.rb: Oxidized::Telnet failed for 192.168.14.11
D, [2023-06-16T11:22:59.607379 #1337179] DEBUG -- : lib/oxidized/input/ssh.rb: Connecting to 192.168.14.11
D, [2023-06-16T11:22:59.607650 #1337179] DEBUG -- : AUTH METHODS::["none", "publickey", "password"]
D, [2023-06-16T11:22:59.616039 #1337179] DEBUG -- : 192.168.14.11 raised Errno::ECONNREFUSED with msg "Connection refused - connect(2) for 192.168.14.11:22"
D, [2023-06-16T11:22:59.616192 #1337179] DEBUG -- : lib/oxidized/node.rb: Oxidized::SSH failed for 192.168.14.11
D, [2023-06-16T11:22:59.616309 #1337179] DEBUG -- : lib/oxidized/job.rb: Config fetched for 192.168.14.11 at 2023-06-16 09:22:59 UTC
W, [2023-06-16T11:23:00.200740 #1337179]  WARN -- : /192.168.14.11 status no_connection, retries exhausted, giving up

I tried creating an antry in the source databse using :: for the username with no luck. Any Ideas? Thanks

LoZio commented 1 year ago

Also some device respond with User Name: prompt I suppose I have to derive specific classes for those types of devices, am I right?

arreddy1 commented 1 year ago

first you need to group devices which require only password then refer below documentation

https://github.com/ytti/oxidized/blob/master/docs/Configuration.md

image

MarcHagen commented 1 year ago

Also it seems the newer prompt regex (https://github.com/ytti/oxidized/commit/8c9adc8391d85a84881aaef7f7530fef44967936) is to loose and now accepts Username: or Password: as valid prompt. which is not handy.

shell:

ProCurve J9280A Switch 2510G-48
Software revision Y.11.12

Copyright (C) 1991-2009 Hewlett-Packard Co.  All Rights Reserved.

                           RESTRICTED RIGHTS LEGEND

 Use, duplication, or disclosure by the Government is subject to restrictions
 as set forth in subdivision (b) (3) (ii) of the Rights in Technical Data and
 Computer Software clause at 52.227-7013.

         HEWLETT-PACKARD COMPANY, 3000 Hanover St., Palo Alto, CA 94303

We'd like to keep you up to date about:
  * Software feature updates
  * New product announcements
  * Special events

Please register your products now at:  www.ProCurve.com

Username:

Working (old) prompt: /(^\r|\e\[24;[0-9][hH])?([\w\s.-]+[#>](\s)?)($|(\e\[24;[0-9][0-9]?[hH]){3})/ So that can also cause the issues you are seeing .

Try this:

Adding a file procurve.rb in /home/oxidized/.config/oxidized/model/ with :

require 'oxidized/model/procurve.rb'

class Procurve
  using Refinements

  prompt /(^\r|\e\[24;[0-9][hH])?([\w\s.-]+[#>](\s)?)($|(\e\[24;[0-9][0-9]?[hH]){3})/
end
robertcheramy commented 7 months ago

The problem appeared with PR #2498. @sorano - I see no reason why the configuration mode should be used within the procurve model. If this is needed for a customization of model, the prompt can be changed there as stated in this thread.

I will revert the PR, so that the old procurves work again.

MarcHagen commented 7 months ago

@robertcheramy thank you!