[rancid] Re: SSH issues "couldn't compile regular expression pattern: parentheses () not balanced"

Per-Olof Olsson peo at chalmers.se
Wed Jun 23 05:10:00 UTC 2010


Hi


Missing hpuifilter in hlogin 2.3.3 for ssh.


<           set retval [ catch {eval spawn [split "$cmd -c $cyphertype
-x -l $user $router" { }]} reason ]
---
>           set retval [ catch {eval spawn hpuifilter -- [split "$cmd -c
$cyphertype -x -l $user $router" { }]} reason ]


more info from old subject/case
"[rancid] Re: Rancid stopped working for my HP switches"
from 04/03/2010



Sylvain 74 wrote:
> Hi everyone,
> 
> I can't connect to my HP Procurve 2625 nor 2524 using SSH. Telnet is ok as you can see :
> 
> ----------------------TELNET CONNEXION OK------------------
> [rancid at erf ~]$ bin/hlogin -f .cloginrc -c "sh version" lapphpsw27
> lapphpsw27
> spawn hpuifilter -- telnet lapphpsw27
> Trying 134.xxx.xxx.xx...
> Connected to lapphpsw27.xxxxx.xx (134.xxx.xxx.xx).
> Escape character is '^]'.
> ProCurve J4900B Switch 2626
> Software revision H.10.50
> 
> Copyright (C) 1991-2007 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
> 
> Press any key to continueUsername: manager
> Password: 
> hpsh27# 
> hpsh27# no page
> hpsh27#  sh version
> Image stamp:    /sw/code/build/fish(mkfs)
>                 Oct  9 2007 15:00:51
>                 H.10.50
>                 359
> Boot Image:     Primary
> hpsh27#exit
> hpsh27> exit
> Do you want to log out [y/n]? y
> 
> Connection closed by foreign host.
> -----------------------------------------------------------
> 
> When I run the same command using "add method ssh" in config file :
> 
> -------------------SSH CONNEXION FAILED--------------------
> [rancid at erf ~]$ bin/hlogin -f .cloginrc -c "sh version" lapphpsw27                                                                   
> lapphpsw27
> spawn ssh -c 3des -x -l manager lapphpsw27
> manager at lapphpsw27's password: 
> ProCurve J4900B Switch 2626
> Software revision H.10.50
> 
> Copyright (C) 1991-2007 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
> 
> 
> Press any key to continue
> 
> hpsh27# 
> hpsh27# couldn't compile regular expression pattern: parentheses () not balanced
>     while executing
> [^#>\r\n]+)?[#>](\([^)\r\n]+\))?} {} -re {[
> ]+} { exp_continue }"
>     invoked from within
> "expect {
>         -re $reprompt   {}
>         -re "\[\n\r]+"  { exp_continue }
>     }"
>     (procedure "run_commands" line 9)
>     invoked from within
> "run_commands $prompt $command"
>     ("foreach" body line 148)
>     invoked from within
> "foreach router [lrange $argv $i end] {
>     set router [string tolower $router]
>     send_user "$router\n"
> 
>     # device timeout
>     set timeout [find t..."
>     (file "bin/hlogin" line 594)
> [rancid at erf ~]$
> -----------------------------------------------------------
> 
> My .cloginrc file :
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> add user lapphpsw27     {xxxxx}
> add password lapphpsw27 {xxxx} {xxxx}
> add method lapphpsw27   ssh
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> The problem seems to be localised line 505 in hlogin :
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     # Turn off the pager and escape regex meta characters in the $prompt
>     send "no page\r"
>     regsub -all {[)(]} $prompt {\\&} reprompt
> ->  regsub -all {^(.{1,11}).*([#>])$} $reprompt {\1([^#>\r\n]+)?[#>](\\([^)\\r\\n]+\\))?} reprompt
>     expect {
>         -re $reprompt   {}
>         -re "\[\n\r]+"  { exp_continue }
>     }
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> If I replace this line by 
> ->  regsub -all {^(.{1,11}).*([#>])$} $reprompt {\1] reprompt
> then SSH seems to be ok but it closes strangely :
> 
> ----------------SSH WITH LINE 505 MODIFIED-----------
> [rancid at erf ~]$ bin/hlogin -f .cloginrc -c "sh version" lapphpsw27
> lapphpsw27
> spawn ssh -c 3des -x -l manager lapphpsw27
> manager at lapphpsw27's password: 
> ProCurve J4900B Switch 2626
> Software revision H.10.50
> 
> Copyright (C) 1991-2007 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
> 
> 
> Press any key to continue
> 
> 
> hpsh27# no page
> hpsh27# sh version
> Image stamp:    /sw/code/build/fish(mkfs)
>                 Oct  9 2007 15:00:51
>                 H.10.50
>                 359
> Boot Image:     Primary
> hpsh27# [xit9He
> hpsh27> exit
> Do you want to log out [y/n]? y
> ------------------------------------------------------------
> 
> As you can see the "exit" before logout is messed up.
> I would love to correct this line in hlogin (line 505), but I fear I'm not able to do that.
> 
> Rancid v2.3.3
> Expect v5.42.1
> SSH is ok when I log in manually on my HP switches.
> The error message is exactly the same when using clogin with HP switches.
> I don't have any problem when I connect to cisco switches using clogin and SSH.
> 
> Any suggestion ?
> 
> 
> sylvain;
> 
> 
> PS : Thanks all for your job, this soft is simply awesome !
> 
> 
>       
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss


/Peo
----------------------------------------------------------
Per-Olof Olsson               Email: peo at chalmers.se
Chalmers tekniska högskola    IT-service
Hörsalsvägen 5                412 96 Göteborg
Tel: 031/772 6738  Fax: 031/772 8660
----------------------------------------------------------


More information about the Rancid-discuss mailing list