parsing data from dell powerconnect 8132F failes
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
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
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!
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, 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.
@broxio are you saying for you \r\n does not work, like it did for @wkg21
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?
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
Can someone give me an access to sanitised affected device.
Hi @ytti - to confirm, you're after SSH access to an affected switch?
Yes. I'd come from 91.198.120.1. You can contact me via email [email protected] for additional details
Hi there, thanks, i've shot you an email.
Cheers.
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. `
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)
Add:
input:
debug: true
And check the file with some editor which shows unprintable chars. There might be some trash there.
CRLF csw0-gldc>
\r\n or something?
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
- create variable which defines which type of auth to use for SSH, ssh or terminal
- try to detect in ssh.rb if we are presented with with login or prompt, if login login, if prompt, ignore login
- create multiple models, one for SSH auths and one for terminal auths
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):
User Name:
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.
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
I made a quick and dirty fix: https://github.com/bitency/oxidized/pull/1