Closed adebruyn-abit closed 1 year ago
I got the same error with Huawei VRP FWs. You have to ensure that the first line, after the ssh connection, will perfectly match the regex. I changed the regex in order to adapt it to the FWs. I know that it's a bit unorthodox but if someone here has other advices, please help :)
Thanks for your answer Giuseppe.
I have tried to adapt the prompt.
But I guess, I must get rid of the following lines : Your previous successful login (as operator) was on 2018-10-16 18:03:05 from 10.13.8.123
Did you managed that ?
Best regards,
@adebruyn-abit : Try to set no banner last-login
on your HP device.
Also, banner motd " "
and banner exec " "
could be helpful. When setting this, these expect a delimiter (e. g. "a") and then type space, "a" and enter:
sw(config)# banner motd a
Enter TEXT message. End with the character 'a'
a
sw(config)#
This is so far the only way to set an "empty" motd and/or exec banner.
Just want to add this for anyone finding this thread 2020. My switches had both banner motd and banner last-login enabled, but thankfully only last-login caused an issue (my company would not allow me to remove their custom motd). However, I didn't feel like SSH:ing to 30+ switches so I copied the regex that I found on 'procurve.rb' and modified it so it now works with (and without) banner last-login.
The Regex:
/(^\r|\e[24;[0-9][hH])?([\w\s():-]+[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})?([\w\s.-]+[#>] )($|(\e[24;[0-9][0-9]?[hH]){3})/
Hello, Thank you for your help but I think there's a little issue with your regex (you forgot 2 "\") :
The Regex:
/(^\r|\e[24;[0-9][hH])?([\w\s():-]+[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})?([\w\s.-]+[#>] )($|(\e[24;[0-9][0-9]?[hH]){3})/
I changed it to : /(^\r|\e[24;[0-9][hH])?([\w\s():-]+[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})?([\w\s.-]+[#>] )($|(\e[24;[0-9][0-9]?[hH]){3})/ It works perfectly for me now :)
@DarkCatapulter Where did you update the regex for your Procurve switches? Was it in the Oxidized config YAML file or the procurve.rb file or somewhere else? Thanks!
@kingtriumph Hello, it's been a while since I commented on this thread. If I remember correctly, then it was on the procurve.rb file - Line 6. Give me a moment and I will double check it for you :)
@kingtriumph Hi again, I looked at my procurve.rb file to verify my previous comment.
Find the following line on procurve.rb file: https://github.com/ytti/oxidized/blob/8179f48545d94a1c6b3a096153f70e9eabff1e20/lib/oxidized/model/procurve.rb#L6
And change it to this:
prompt /(^\r|\e[24;[0-9][hH])?([\w\s():-]+[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})?([\w\s.-]+[#>] )($|(\e[24;[0-9][0-9]?[hH]){3})/
Hope this helps!
Hi,
I have some troubles with : Product | HP 2530-48G-PoE+-2SFP+ Switch (J9853A) Primary Software | YA.16.04.0009 (Booted)
The ssh connection is working in a terminal $ ssh operator@switch12 We'd like to keep you up to date about:
operator@10.13.9.13's password: HP J9853A 2530-48G-PoE+-2SFP+ Switch Software revision YA.16.04.0009
(C) Copyright 2017 Hewlett Packard Enterprise Development LP
Confidential computer software. Valid license from Hewlett Packard Enterprise Development LP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license.
Press any key to continue Your previous successful login (as operator) was on 2018-10-16 18:03:05
from 10.13.8.123
2530-13>
But with Oxidized, I have got the following error : W, [2018-10-16T17:33:11.780609 #14023] WARN -- : 10.13.9.13 raised Oxidized::PromptUndetect with msg "Your previous successful login (as operator) was on 2018-10-16 17:32:32
from 10.110.1.9 2530-13> not matching configured prompt (?-mix:^\r?([\w.-]+# )$)" D, [2018-10-16T17:33:11.780737 #14023] DEBUG -- : lib/oxidized/node.rb: Oxidized::SSH failed for switch12
My router.db is: switch12:procurve:operator:admin:mypassword
Thanks for your help.