oxidized icon indicating copy to clipboard operation
oxidized copied to clipboard

parsing data from dell powerconnect 8132F failes

Open wkg21 opened this issue 10 years ago • 23 comments

Hello, We have dell powerconnect switches 8132F,6248 it looks like oxidized is not working as expected. I can see in logs this message:

W, [2016-05-10T13:16:00.434609 #2192]  WARN -- : xx.xx.xx.110 raised Oxidized::PromptUndetect with msg "
net110> not matching configured prompt (?-mix:^([\w\s.@-]+[#>]\s?)$)"

and on web interface I can see only:

!
! Image Descriptions
! 
!  active :
!  backup :
! 
! 
!  Images currently available on Flash
! 
! unit  active       backup       current-active     next-active
! ----- ------------ ------------ ----------------- -----------------
! 
! 1     5.0.0.4      5.0.0.4      5.0.0.4            5.0.0.4
! 
! System Description: Dell Ethernet Switch
! ----     -----------    ------
! 1       Fan 1          OK
! 1       Fan 2          OK
! 1       Fan 3          OK
! 1       Fan 4          OK
! 1       Fan 5          OK
! 1       Fan 6          OK
! 
! USB Port Power Status:
! ----------------------
! Device Not Present
             ^
% Invalid input detected at '^' marker.'''

It looks like when it tries to enter in privileged mode with 'enable' oxidized takes password from 4 field from router.db as expected but also adds 'terminal length 0' so it fails.

I have tested it on two switches one with enable password the second without:

  • without:
net109.example.com>enable
net109.example.com#mypasswdterminal length 0
                        ^
% Invalid input detected at '^' marker.
  • with:
User:oxidized
Password:***********
net109>enable
Password:**************************

Authentication failed.

net109>show version

What can i do to fix it? where should i look into. thanks Wojciech

config.txt router.txt output.txt

wkg21 avatar May 10 '16 12:05 wkg21

Hello, modifying powerconnect.rb

from: send vars(:enable) + "\n" to: send vars(:enable) + "\r\n"

helped also removed post_login "terminal datadump" because there is no such commands in powerconnect 8132 and 6248 . cheers Wojciech patch.txt output.txt

wkg21 avatar May 11 '16 07:05 wkg21

I believe 'terminal datadump' is needed because some other powerconnects depend on it. Sending it for non-supporting platform isn''t really a problem, just complain in CLI which won't be seen in configs.

I'm happy to accept the \r\n as pull request though, thanks!

ytti avatar May 11 '16 10:05 ytti

There are some Powerconnect devices my environment and I usually replaced "\n" to "\r" , in the log file look like "\n" doesn't send to terminal and it messed all the password authentication, btw the oxizidized is running in container.

from: send vars(:enable) + "\n" to: send vars(:enable) + "\r"

this fixed also implement in some A10 device too.

broxio avatar May 13 '16 04:05 broxio

broxio, on my switches 8132, 6148 I can see switch returning all lines ending with '\r\n' it is worth to check what line feed dell returns and requires to avoid unexpected behaviours.

Newline

wkg21 avatar May 13 '16 08:05 wkg21

@broxio are you saying for you \r\n does not work, like it did for @wkg21

ytti avatar May 13 '16 10:05 ytti

I think I'm stuck with the same problem, but I cannot get it solved. From the SSH debug log, I can see, that the first two digits are 0a0d so CR/LF. It also complains that my ' prompt' is not matching the regular expression.

How can I get the module to parse the newlines from the switch as /r/n and not only /n?

TheBigfoot avatar Jun 10 '16 12:06 TheBigfoot

I get this error as well

! ! Machine Description............... Dell Networking Switch
! System Model ID................... N2024
! Machine Type...................... Dell Networking N2024
! Serial Number..................... xxx
! Manufacturer...................... 0xbc00
! Burned In MAC Address............. F8B1.5669.xxx
! System Object ID.................. 1.3.6.1.4.1.674.10895.3053
! SOC Version....................... BCM56342_A0
! HW Version........................ 5 ! CPLD Version...................... 13
! ! unit active backup current-active next-active
! ---- ----------- ----------- -------------- --------------
! 1 6.1.2.4 6.1.0.6 6.1.2.4 6.1.2.4
! ! System Description: Dell Networking Switch
! USB Port Power Status: 
! ---------------------- 
! Device Not Present ^ % Invalid input detected at '^' marker. 

Changing from \n to \r or to \r\n has no affect.

Cheers, Nicholas Barry

nbarry202 avatar Jul 14 '16 11:07 nbarry202

Can someone give me an access to sanitised affected device.

ytti avatar Jul 14 '16 11:07 ytti

Hi @ytti - to confirm, you're after SSH access to an affected switch?

nbarry202 avatar Jul 14 '16 12:07 nbarry202

Yes. I'd come from 91.198.120.1. You can contact me via email [email protected] for additional details

ytti avatar Jul 14 '16 13:07 ytti

Hi there, thanks, i've shot you an email.

Cheers.

nbarry202 avatar Jul 15 '16 06:07 nbarry202

Do you have a fix for this problem?

We have the same problem with a Dell 8024F:

` ! ! System Description................ Dell Ethernet Switch ! System Contact.................... ! System Name....................... csw0-gldc ! System Location................... ! Burned In MAC Address............. 5C26.0ABA.44EA ! System Object ID.................. 1.3.6.1.4.1.674.10895.3024 ! System Model ID................... PC8024F ! Machine Type...................... Powerconnect 8024F ! ! unit image1 image2 current-active next-active ! ---- ----------- ----------- -------------- -------------- ! 1 5.1.8.2 5.1.9.4 image2 image2 ! ! System Description: Dell Ethernet Switch ! ---- ----------- ------ ! 1 Fan 1 OK ! 1 Fan 2 OK ! 1 Fan 3 OK

            ^

% Invalid input detected at '^' marker. `

bitency avatar Aug 28 '16 08:08 bitency

W, [2016-08-28T18:32:31.363922 #20140] WARN -- : 192.168.1.1 raised Oxidized::PromptUndetect with msg " csw0-gldc> not matching configured prompt (?-mix:^([\w\s.@-]+[#>]\s?)$)"

But with a Ruby regex matcher the prompt matching correctly:

http://rubular.com/

(?-mix:^([\w\s.@-]+[#>]\s?)$)

Test string:

csw0-gldc>

(first line chars are \n and \r)

bitency avatar Aug 28 '16 16:08 bitency

Add:

input:
  debug: true

And check the file with some editor which shows unprintable chars. There might be some trash there.

ytti avatar Aug 28 '16 17:08 ytti

CRLF csw0-gldc>

\r\n or something?

bitency avatar Aug 28 '16 17:08 bitency

Oh also, we raise this issue in bit poor place in specific scenario.

Right now the model assumes SSH always authenticates, and presents login prompt for SSH too. If this does not happen, then the model does not work.

So when you login via SSH, does it use SSH auth or terminal auth? I think this question has been addressed in few cases at least. Some solutions might be

  1. create variable which defines which type of auth to use for SSH, ssh or terminal
  2. try to detect in ssh.rb if we are presented with with login or prompt, if login login, if prompt, ignore login
  3. create multiple models, one for SSH auths and one for terminal auths

ytti avatar Aug 28 '16 17:08 ytti

SSH auth (tested on Linux):

[root@nms logs]# ssh [email protected] [email protected]'s password:

csw0-gldc>enable Password:**********

csw0-gldc#

Another Dell switch auth always (get al Prompt from the switch for auth):

ssh [email protected]

User Name:

bitency avatar Aug 28 '16 17:08 bitency

Yeah so that's actually what's happening here, we're just catching it via same block which happens to throw promptundetect error.

We're actually waiting for login prompt, which won't come.

ytti avatar Aug 28 '16 20:08 ytti

We're actually waiting for login prompt, which won't come.

@username ? shell_login : expect(@node.prompt) This part of the code doesn't run correctly

shinespb avatar Aug 29 '16 09:08 shinespb

I made a quick and dirty fix: https://github.com/bitency/oxidized/pull/1

bitency avatar Aug 29 '16 10:08 bitency