Discussion:
[rancid] Re: lrancid / llogin
Diego Ercolani
2010-05-03 09:47:51 UTC
Permalink
Hi Pekka,
please subscribe to rancid-discuss to actively partecipate to rancid
community.
"Hi diego,
I have installed rancid 2.3.3 on debian (lenny). I wanted to backup a file
"/home/psuomi/data.cvs" (this is an example) from a remote linux machine.
I have found your scripts on rancid discussion forum which describs the
solution of my problem. I have followed your instruction and scripts but
could not backup the above mention file. I could login to the remote
machine and getting the below result.
remlinux:~# export HISTIGNORE="&:cat *:exit*:export *";export LANG=C
remlinux:~#
remlinux:~#
do you mean you can issue: llogin remlinux ?
So it should work
Have you configured the .clogin file with something like:

add method remlinux ssh
add user remlinux root
add password remlinux password password
add autoenable remlinux 1
add backupfile remlinux /home/psuomi/data.cvs

(and obviously.... data.cvs must be a FILE not a directory, if you want to
expand functionality, you should do)
Am I missing something? I would highly appreciate you reply.
Thanks in advance
regards,
Pekka S
Ron Whitney
2010-05-03 20:21:12 UTC
Permalink
I've tried to use the lrancid scripts as well without luck. Eventually, I gave up. Pekka's question prompted me to try again. Here are my details:

Relevant portion of .clogon:

add method groucho {ssh}
add user groucho {rwhitney}
add password groucho {password} {password}
add autoenable groucho 1
add backupfile groucho /var/named/p/mydoitbest.com

Added to rancid-fe:

"linux" => "lrancid llogin",

Finally, router.db:

Groucho:linux:up

When I try to test, it logs on but issues no commands. Eventually (10 seconds in this case), it times out:

[***@harpo ~]$ llogin -t 10 -c"BackupFiles" groucho
groucho
spawn ssh -c 3des -x -l rwhitney groucho
***@groucho's password:
Last login: Mon May 3 16:07:33 2010 from 12-162-57-170.doitbest.com
groucho 16:14:19 rwhitney >
Error: TIMEOUT reached

I get similar results testing lrancid:

[***@harpo ~]$ lrancid -d groucho
executing llogin -t 90 -c"BackupFiles" groucho
groucho llogin error: Error: TIMEOUT reached
groucho llogin error: Error: TIMEOUT reached
groucho: missed cmd(s): BackupFiles
groucho: missed cmd(s): BackupFiles
groucho: End of run not found
groucho: End of run not found
#

Can anyone point me in the right direction? RANCID is working on several Cisco switches and routers and a couple of Dell switches. So I know the base functionality is working. Thanks in advnace.


Ron
-----Original Message-----
Diego Ercolani
Sent: Monday, May 03, 2010 05:48
To: Pekka Suomi; Rancid Mailing List
Subject: [rancid] Re: lrancid / llogin
Hi Pekka,
please subscribe to rancid-discuss to actively partecipate to rancid
community.
"Hi diego,
I have installed rancid 2.3.3 on debian (lenny). I wanted
to backup a
file "/home/psuomi/data.cvs" (this is an example) from a
remote linux
machine. I have found your scripts on rancid discussion forum which
describs the solution of my problem. I have followed your
instruction
and scripts but could not backup the above mention file. I
could login
to the remote machine and getting the below result.
remlinux:~# export HISTIGNORE="&:cat *:exit*:export
*";export LANG=C
remlinux:~# remlinux:~#
do you mean you can issue: llogin remlinux ?
So it should work
add method remlinux ssh
add user remlinux root
add password remlinux password password
add autoenable remlinux 1
add backupfile remlinux /home/psuomi/data.cvs
(and obviously.... data.cvs must be a FILE not a directory,
if you want to
expand functionality, you should do)
Am I missing something? I would highly appreciate you reply.
Thanks in advance
regards,
Pekka S
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Martin Barry
2010-05-04 05:56:37 UTC
Permalink
$quoted_author = "Ron Whitney" ;
Post by Ron Whitney
groucho
spawn ssh -c 3des -x -l rwhitney groucho
Last login: Mon May 3 16:07:33 2010 from 12-162-57-170.doitbest.com
groucho 16:14:19 rwhitney >
Error: TIMEOUT reached
It's looking for an "enable" prompt and not finding one.

Try with -noenable

cheers
Marty
Diego Ercolani
2010-05-04 07:13:50 UTC
Permalink
You have to verify that:
1. the user has a regular shell: ssh ***@groucho give you a regular shell?
2. can you read the FILE you are trying to read ? (cat
/var/named/p/mydoitbest.com)
3. my script waits for the root prompt (#) so the timeout is related to this
issue. If you want to use a normal user you have to modify the script (llogin)
to accomplish this....
I use it in a production environment connecting to root user of debian/suse
workstations..... so It should work as is. If you need more functionality you
should implement it and release to the community.
This is opensource.

Hope This Help
Diego
In data lunedì 3 maggio 2010 22:21:12, Ron Whitney ha scritto:
: > I've tried to use the lrancid scripts as well without luck. Eventually, I
Post by Ron Whitney
add method groucho {ssh}
add user groucho {rwhitney}
add password groucho {password} {password}
add autoenable groucho 1
add backupfile groucho /var/named/p/mydoitbest.com
"linux" => "lrancid llogin",
Groucho:linux:up
When I try to test, it logs on but issues no commands. Eventually (10
groucho
spawn ssh -c 3des -x -l rwhitney groucho
Last login: Mon May 3 16:07:33 2010 from 12-162-57-170.doitbest.com
groucho 16:14:19 rwhitney >
Error: TIMEOUT reached
executing llogin -t 90 -c"BackupFiles" groucho
groucho llogin error: Error: TIMEOUT reached
groucho llogin error: Error: TIMEOUT reached
groucho: missed cmd(s): BackupFiles
groucho: missed cmd(s): BackupFiles
groucho: End of run not found
groucho: End of run not found
#
Can anyone point me in the right direction? RANCID is working on several
Cisco switches and routers and a couple of Dell switches. So I know the
base functionality is working. Thanks in advnace.
Ron
Ron Whitney
2010-05-04 20:48:06 UTC
Permalink
Thanks for the reply. I agree, it doesn't like the prompt. The Linux host in question is a RedHat box. The prompts given are as follows:

groucho 16:18:46 rwhitney > (Regular user)
groucho 16:17:08 SU > (root user)

(The machine running RANCID is Fedora which has a "[***@harpo bin]$ " prompt.)

As a test, I made some very crude changes to llogin and got past the prompt issue. However, I'm now receiving the following:

[***@harpo bin]$ lrancid -d groucho
executing llogin -t 90 -c"BackupFiles" groucho
bad option "-nocase": must be -exact, -glob, -regexp, or --
while executing
"switch -glob -nocase [subst -nocommands [lindex $commands $i]] {
backupfiles {
set files [find backupfile $host]
if { [info exists f..."
(procedure "run_commands" line 26)
invoked from within
"run_commands $router $prompt $command"
("foreach" body line 151)
invoked from within
"foreach router [lrange $argv $i end] {
set router [string tolower $router]
# attempt at platform switching.
set platform ""
send_user ..."
(file "/usr/local/rancid/bin/llogin" line 789)
groucho: missed cmd(s): BackupFiles
groucho: missed cmd(s): BackupFiles
groucho: End of run not found
groucho: End of run not found
#

I suspect I'm running into differences between flavors of linux (Mine are mostly RedHat or Fedora based) which is breaking llogin. Everything else (users, permissions, etc.) check out. Since my ability to code is non-existent, I think I'll abandon this up for now. Thanks for trying to assist.

Ron
-----Original Message-----
Diego Ercolani
Sent: Tuesday, May 04, 2010 03:14
Subject: [rancid] Re: lrancid / llogin
a regular shell? 2. can you read the FILE you are trying to
read ? (cat
/var/named/p/mydoitbest.com)
3. my script waits for the root prompt (#) so the timeout is
related to this
issue. If you want to use a normal user you have to modify
the script (llogin)
to accomplish this....
I use it in a production environment connecting to root user
of debian/suse
workstations..... so It should work as is. If you need more
functionality you
should implement it and release to the community.
This is opensource.
Hope This Help
Diego
: > I've tried to use the lrancid scripts as well without
luck. Eventually, I
Post by Ron Whitney
gave up. Pekka's question prompted me to try again. Here are my
add method groucho {ssh}
add user groucho {rwhitney}
add password groucho {password} {password}
add autoenable groucho 1
add backupfile groucho /var/named/p/mydoitbest.com
"linux" => "lrancid llogin",
Groucho:linux:up
When I try to test, it logs on but issues no commands.
Eventually (10
Post by Ron Whitney
spawn ssh -c 3des -x -l rwhitney groucho
Last login: Mon May 3 16:07:33 2010 from 12-162-57-170.doitbest.com
groucho 16:14:19 rwhitney >
Error: TIMEOUT reached
executing llogin -t 90 -c"BackupFiles" groucho
groucho llogin error: Error: TIMEOUT reached
groucho llogin error: Error: TIMEOUT reached
groucho: missed cmd(s): BackupFiles
groucho: missed cmd(s): BackupFiles
groucho: End of run not found
groucho: End of run not found
#
Can anyone point me in the right direction? RANCID is working on
several Cisco switches and routers and a couple of Dell
switches. So
Post by Ron Whitney
I know the base functionality is working. Thanks in advnace.
Ron
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Diego Ercolani
2010-05-05 07:14:41 UTC
Permalink
Uhm.... why don't you use a STANDARD root prompt?
PS1="${HOST}:${PWD} # "
linux machines (also RedHats) with BASH shell have this prompt normally

In data martedì 4 maggio 2010 22:48:06, Ron Whitney ha scritto:
: > Thanks for the reply. I agree, it doesn't like the prompt. The Linux
host
Post by Ron Whitney
groucho 16:18:46 rwhitney > (Regular user)
groucho 16:17:08 SU > (root user)
As a test, I made some very crude changes to llogin and got past the prompt
executing llogin -t 90 -c"BackupFiles" groucho
bad option "-nocase": must be -exact, -glob, -regexp, or --
while executing
"switch -glob -nocase [subst -nocommands [lindex $commands $i]] {
backupfiles {
set files [find backupfile $host]
if { [info exists f..."
(procedure "run_commands" line 26)
invoked from within
"run_commands $router $prompt $command"
("foreach" body line 151)
invoked from within
"foreach router [lrange $argv $i end] {
set router [string tolower $router]
# attempt at platform switching.
set platform ""
send_user ..."
(file "/usr/local/rancid/bin/llogin" line 789)
groucho: missed cmd(s): BackupFiles
groucho: missed cmd(s): BackupFiles
groucho: End of run not found
groucho: End of run not found
#
I suspect I'm running into differences between flavors of linux (Mine are
mostly RedHat or Fedora based) which is breaking llogin. Everything else
(users, permissions, etc.) check out. Since my ability to code is
non-existent, I think I'll abandon this up for now. Thanks for trying to
assist.
Ron
-----Original Message-----
Diego Ercolani
Sent: Tuesday, May 04, 2010 03:14
Subject: [rancid] Re: lrancid / llogin
a regular shell? 2. can you read the FILE you are trying to
read ? (cat
/var/named/p/mydoitbest.com)
3. my script waits for the root prompt (#) so the timeout is
related to this
issue. If you want to use a normal user you have to modify
the script (llogin)
to accomplish this....
I use it in a production environment connecting to root user
of debian/suse
workstations..... so It should work as is. If you need more
functionality you
should implement it and release to the community.
This is opensource.
Hope This Help
Diego
: > I've tried to use the lrancid scripts as well without
luck. Eventually, I
Post by Ron Whitney
gave up. Pekka's question prompted me to try again. Here are my
add method groucho {ssh}
add user groucho {rwhitney}
add password groucho {password} {password}
add autoenable groucho 1
add backupfile groucho /var/named/p/mydoitbest.com
"linux" => "lrancid llogin",
Groucho:linux:up
When I try to test, it logs on but issues no commands.
Eventually (10
Post by Ron Whitney
spawn ssh -c 3des -x -l rwhitney groucho
Last login: Mon May 3 16:07:33 2010 from 12-162-57-170.doitbest.com
groucho 16:14:19 rwhitney >
Error: TIMEOUT reached
executing llogin -t 90 -c"BackupFiles" groucho
groucho llogin error: Error: TIMEOUT reached
groucho llogin error: Error: TIMEOUT reached
groucho: missed cmd(s): BackupFiles
groucho: missed cmd(s): BackupFiles
groucho: End of run not found
groucho: End of run not found
#
Can anyone point me in the right direction? RANCID is working on
several Cisco switches and routers and a couple of Dell
switches. So
Post by Ron Whitney
I know the base functionality is working. Thanks in advnace.
Ron
Mr. James W. Laferriere
2010-05-06 03:32:21 UTC
Permalink
Hello Diago ,

Right in line with the other users I had difficutlies ssh'ng to one of
my systems , it's a Slackware Distro. & I noticed a few things .

The "$prompt" had (imo) extra chars in it that prevented the script from
completing see attached & inline patch . Maybe someone can clean it up a tad
more to make it submittable .

Hope this helps others . JimL


# llogin -noenable dsb-esx01
dsb-esx01
spawn ssh -c des -x -l root dsb-esx01
No valid ciphers for protocol version 2 given, using defaults.
The authenticity of host 'dsb-esx01 (10.1.1.102)' can't be established.
RSA key fingerprint is 3c:b8:0f:f5:51:7b:36:b8:0f:3e:de:66:75:a9:22:7b.
Are you sure you want to continue connecting (yes/no)?
Host dsb-esx01 added to the list of known hosts.
yes
Warning: Permanently added 'dsb-esx01' (RSA) to the list of known hosts.
***@dsb-esx01's pssword:
Last login: Thu Apr 1 08:50:40 2010 from mo-it07.dsb.local
[***@dsb-esx01 root]# dir

Error: TIMEOUT reached
--
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network&System Engineer | 3237 Holden Road | Give me Linux |
| ***@baby-dragons.com | Fairbanks, AK. 99709 | only on AXP |
+------------------------------------------------------------------+

--- llogin-ORIG 2010-05-05 10:31:59.000000000 -0800
+++ llogin 2010-05-05 11:45:14.000000000 -0800
@@ -714,7 +714,7 @@
# if it is not a "MetaCommand", passes the command "as is" to
# the console
# send_user "[subst [lindex $commands $i]]\n"
- switch -glob -nocase [subst -nocommands [lindex $commands $i]] {
+ switch -glob [subst -nocommands [lindex $commands $i]] {
backupfiles {
set files [find backupfile $host]
if { [info exists files] && [llength $files] > 0 } {
@@ -752,9 +752,12 @@
log_user 1

send -- "exit\r"
+### return 0
expect {
-re "\b+" { exp_continue }
- -re "Connection to .* closed" { return 0}
+ -re "Connection to .* closed" {
+ exp_continue;
+ }
-re "^\[^\n\r *]*$reprompt" {
# the Cisco CE and Jnx
ERX
# return to
non-enabled mode
@@ -798,17 +801,17 @@
if $avautoenable {
set autoenable 1
set enable 0
- set prompt ":~# "
+ set prompt "# "
} else {
set ae [find autoenable $router]
if { "$ae" == "1" } {
set autoenable 1
set enable 0
- set prompt ":~# "
+ set prompt "# "
} else {
set autoenable 0
set enable $avenable
- set prompt ":~> "
+ set prompt "> "
}
}
Ron Whitney
2010-05-06 13:11:08 UTC
Permalink
James, can you send me your working llogin script: I added your patch
to mine and it is helping me get farther. However, it didn't seem to
execute correctly. (I'm guessing I have a typo.) Here's what I'm
getting now:

[***@harpo bin]$ lrancid -d groucho
executing llogin -t 90 -c"BackupFiles" groucho
groucho: missed cmd(s): BackupFiles
groucho: missed cmd(s): BackupFiles


[***@harpo bin]$ llogin -t 10 -c"BackupFiles" groucho
groucho
spawn ssh -c 3des -x -l root groucho
***@groucho's password:
Last login: Thu May 6 09:03:40 2010 from 12-162-57-170.doitbest.com
groucho 09:04:02 SU > export HISTIGNORE="&:cat *:exit*:export *";export
LANG=C
groucho 09:04:03 SU >
groucho 09:04:03 SU > BackupFiles
-bash: BackupFiles: command not found
groucho 09:04:03 SU > exit
logout
Connection to groucho closed.

Snippet from my .cloginrc file:

add method groucho {ssh}
add user groucho {root}
add password groucho {deleted} {deleted}
add noenable groucho 1
add backupfile groucho /var/named/p/mydoitbest.com


Thoughts anyone? Thanks.

Ron
-----Original Message-----
Mr. James W. Laferriere
Sent: Wednesday, May 05, 2010 23:32
To: Diego Ercolani
Subject: [rancid] Re: lrancid / llogin
Hello Diago ,
Right in line with the other users I had difficutlies
ssh'ng to one of
my systems , it's a Slackware Distro. & I noticed a few things .
The "$prompt" had (imo) extra chars in it that
prevented the script from
completing see attached & inline patch . Maybe someone can
clean it up a tad
more to make it submittable .
Hope this helps others . JimL
# llogin -noenable dsb-esx01
dsb-esx01
spawn ssh -c des -x -l root dsb-esx01
No valid ciphers for protocol version 2 given, using defaults.
The authenticity of host 'dsb-esx01 (10.1.1.102)' can't be
established.
RSA key fingerprint is
3c:b8:0f:f5:51:7b:36:b8:0f:3e:de:66:75:a9:22:7b.
Are you sure you want to continue connecting (yes/no)?
Host dsb-esx01 added to the list of known hosts.
yes
Warning: Permanently added 'dsb-esx01' (RSA) to the list of
known hosts.
Last login: Thu Apr 1 08:50:40 2010 from mo-it07.dsb.local
Error: TIMEOUT reached
--
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network&System Engineer | 3237 Holden Road | Give me Linux |
+------------------------------------------------------------------+
--- llogin-ORIG 2010-05-05 10:31:59.000000000 -0800
+++ llogin 2010-05-05 11:45:14.000000000 -0800
@@ -714,7 +714,7 @@
# if it is not a "MetaCommand", passes the command "as is" to
# the console
# send_user "[subst [lindex $commands $i]]\n"
- switch -glob -nocase [subst -nocommands [lindex
$commands $i]] {
+ switch -glob [subst -nocommands [lindex $commands $i]] {
backupfiles {
set files [find backupfile $host]
if { [info exists files] && [llength $files] > 0 } {
@@ -752,9 +752,12 @@
log_user 1
send -- "exit\r"
+### return 0
expect {
-re "\b+" { exp_continue }
- -re "Connection to .* closed" { return 0}
+ -re "Connection to .* closed" {
+ exp_continue;
+ }
-re "^\[^\n\r *]*$reprompt" {
# the
Cisco CE and Jnx
ERX
# return to
non-enabled mode
@@ -798,17 +801,17 @@
if $avautoenable {
set autoenable 1
set enable 0
- set prompt ":~# "
+ set prompt "# "
} else {
set ae [find autoenable $router]
if { "$ae" == "1" } {
set autoenable 1
set enable 0
- set prompt ":~# "
+ set prompt "# "
} else {
set autoenable 0
set enable $avenable
- set prompt ":~> "
+ set prompt "> "
}
}
Loading...