Discussion:
[rancid] HP switches
Munroe Sollog
2014-05-22 14:29:58 UTC
Permalink
I'm investigating rancid as a way to reliably download configs from HP switches. Below I have
included my .cloginrc file as well as the output from hlogin. It seems to log in successfully,
however it never executes the command. Any help would be appreciated

.cloginrc
- ---------------------
add password * password
add user * user



$ /usr/local/rancid/bin/hlogin -d -noenable -c "y;show version" 172.16.203.244
172.16.203.244
spawn hpuifilter -- telnet 172.16.203.244
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {23604}

expect: does "" (spawn_id exp6) match glob pattern "Press any key to continue"? no
"Enter switch number to connect to or <CR>:"? no
"(Connection refused|Secure connection [^\n\r]+ refused|Connection closed by)"? no
"Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).* \(yes/no\)\?"? no
"HOST IDENTIFICATION HAS CHANGED.* \(yes/no\)\?"? no
"HOST IDENTIFICATION HAS CHANGED[^\n\r]+"? no
"Offending key for .* \(yes/no\)\?"? no

expect: does "" (spawn_id exp6) match glob pattern "unknown host\r"? no

expect: does "" (spawn_id exp6) match regular expression "Enter passphrase.*: "? no
"([Uu]sername|[Ll]ogin|user name|Login Name):"? no
"([Pp]assword|passwd):"? no
">"? no
"denied"? no
"% Bad passwords"? no
Trying 172.16.203.244...
telnet: connect to address 172.16.203.244: Connection refused
telnet: Unable to connect to remote host: Connection refused

expect: does "Trying 172.16.203.244...\r\r\r\ntelnet: connect to address 172.16.203.244:
Connection refused\r\r\ntelnet: Unablo
"Enter switch number to connect to or <CR>:"? no
"(Connection refused|Secure connection [^\n\r]+ refused|Connection closed by)"? yes
expect: set expect_out(0,string) "Connection refused"
expect: set expect_out(1,string) "Connection refused"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "Trying 172.16.203.244...\r\r\r\ntelnet: connect to address
172.16.203.244: Connection refused"
spawn hpuifilter -- ssh -c 3des -x -l user 172.16.203.244
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {23608}

expect: does "" (spawn_id exp6) match glob pattern "Press any key to continue"? no
"Enter switch number to connect to or <CR>:"? no
"(Connection refused|Secure connection [^\n\r]+ refused|Connection closed by)"? no
"Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).* \(yes/no\)\?"? no
"HOST IDENTIFICATION HAS CHANGED.* \(yes/no\)\?"? no
"HOST IDENTIFICATION HAS CHANGED[^\n\r]+"? no
"Offending key for .* \(yes/no\)\?"? no

expect: does "" (spawn_id exp6) match glob pattern "unknown host\r"? no

expect: does "" (spawn_id exp6) match regular expression "Enter passphrase.*: "? no
"([Uu]sername|[Ll]ogin|user name|Login Name):"? no
"([Pp]assword|passwd):"? no
">"? no
"denied"? no
"% Bad passwords"? no
We'd like to keep you up to date about:
* Software feature updates
* New product announcements

expect: does "We'd like to keep you up to date about:\r\r\n * Software feature updates\r\r\n *
New product announcements\r\ro
"Enter switch number to connect to or <CR>:"? no
"(Connection refused|Secure connection [^\n\r]+ refused|Connection closed by)"? no
"Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).* \(yes/no\)\?"? no
"HOST IDENTIFICATION HAS CHANGED.* \(yes/no\)\?"? no
"HOST IDENTIFICATION HAS CHANGED[^\n\r]+"? no
"Offending key for .* \(yes/no\)\?"? no

expect: does "We'd like to keep you up to date about:\r\r\n * Software feature updates\r\r\n *
New product announcements\r\ro

expect: does "We'd like to keep you up to date about:\r\r\n * Software feature updates\r\r\n *
New product announcements\r\ro
"([Uu]sername|[Ll]ogin|user name|Login Name):"? no
"([Pp]assword|passwd):"? no
">"? no
"denied"? no
"% Bad passwords"? no
* Special events

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

***@172.16.203.244's password:
expect: does "We'd like to keep you up to date about:\r\r\n * Software feature updates\r\r\n *
New product announcements\r\ro
"Enter switch number to connect to or <CR>:"? no
"(Connection refused|Secure connection [^\n\r]+ refused|Connection closed by)"? no
"Host is unreachable"? no
"No address associated with name"? no
"(Host key not found |The authenticity of host .* be established).* \(yes/no\)\?"? no
"HOST IDENTIFICATION HAS CHANGED.* \(yes/no\)\?"? no
"HOST IDENTIFICATION HAS CHANGED[^\n\r]+"? no
"Offending key for .* \(yes/no\)\?"? no

expect: does "We'd like to keep you up to date about:\r\r\n * Software feature updates\r\r\n *
New product announcements\r\ro

expect: does "We'd like to keep you up to date about:\r\r\n * Software feature updates\r\r\n *
New product announcements\r\ro
"([Uu]sername|[Ll]ogin|user name|Login Name):"? no
"([Pp]assword|passwd):"? yes
expect: set expect_out(0,string) "password:"
expect: set expect_out(1,string) "password"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "We'd like to keep you up to date about:\r\r\n * Software feature
updates\r\r\n * New product"
send: sending "password\r" to { exp6 }

expect: does " " (spawn_id exp6) match glob pattern "Press any key to continue"? no
"[Pp]assword:"? no
">"? no


expect: does " \r\r\n" (spawn_id exp6) match glob pattern "Press any key to continue"? no
"[Pp]assword:"? no
">"? no
ProCurve J9299A Switch 2520G-24-PoE
Software revision J.14.01


expect: does " \r\r\nProCurve J9299A Switch 2520G-24-PoE\r\r\r\nSoftware revision
J.14.01\r\r\r\n\r\r\r\n" (spawn_id exp6) mato
"[Pp]assword:"? no
">"? no
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

expect: does " \r\r\nProCurve J9299A Switch 2520G-24-PoE\r\r\r\nSoftware revision
J.14.01\r\r\r\n\r\r\r\nCopyright (C) 1991-20o
"[Pp]assword:"? no
">"? no
Computer Software clause at 52.227-7013.

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

Press any key to continue
expect: does " \r\r\nProCurve J9299A Switch 2520G-24-PoE\r\r\r\nSoftware revision
J.14.01\r\r\r\n\r\r\r\nCopyright (C) 1991-20s
expect: set expect_out(0,string) "Press any key to continue"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) " \r\r\nProCurve J9299A Switch 2520G-24-PoE\r\r\r\nSoftware
revision J.14.01\r\r\r\n\r\r\r\nCop"
send: sending " " to { exp6 }
expect: continuing expect

expect: does "" (spawn_id exp6) match glob pattern "Press any key to continue"? no
"[Pp]assword:"? no
">"? no
Richards_switch_F#
expect: does "Richards_switch_F# " (spawn_id exp6) match glob pattern "Press any key to continue"? no
"[Pp]assword:"? no
">"? no




sighandler: handling signal(2)
async event handler: Tcl_Eval(exit 130)


- --
Munroe Sollog
LTS - Network Analyst
x85002
Per-Olof Olsson
2014-05-24 05:05:46 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm investigating rancid as a way to reliably download configs from HP switches. Below I have
included my .cloginrc file as well as the output from hlogin. It seems to log in successfully,
however it never executes the command. Any help would be appreciated
.cloginrc
- ---------------------
add password * password
add user * user
$ /usr/local/rancid/bin/hlogin -d -noenable -c "y;show version" 172.16.203.244
172.16.203.244
...

Yes, looks like login working but you have to use "-autoenable" instead of -noenable
or set "add autoenable <hostname|ip|*> 1" in your .cloginrc

-noenable only useful if you login and stay at operator level.
HP switches, and some other devices that login directly to manager level, need to have autoenable on.


/Peo
----------------------------------------------------------
Per-Olof Olsson Email: ***@chalmers.se
Chalmers tekniska högskola IT-service
Arvid Hedvalls backe 6 412 96 Göteborg
Tel: 031/772 6738 Fax: 031/772 8680
----------------------------------------------------------

Loading...