[rancid] Re: lrancid / llogin

1-8 von 8 Nachrichten werden angezeigt
[rancid] Re: lrancid / llogin Diego Ercolani 03.05.10 02:47
Hi Pekka,
please subscribe to rancid-discuss to actively partecipate to rancid
community.

In data lunedì 3 maggio 2010 11:28:44, hai scritto:
> "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
_______________________________________________
Rancid-discuss mailing list
Rancid-...@shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss

--
You received this message because you are subscribed to the Google Groups "rancid-discuss" group.
To post to this group, send email to rancid-...@googlegroups.com.
To unsubscribe from this group, send email to rancid-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rancid-discuss?hl=en.

[rancid] Re: lrancid / llogin Ron Whitney 03.05.10 13:21
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:

[rancid@harpo ~]$ llogin -t 10 -c"BackupFiles" groucho
groucho
spawn ssh -c 3des -x -l rwhitney groucho
rwhitney@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:

[rancid@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
[rancid] Re: lrancid / llogin Martin Barry 03.05.10 22:56
$quoted_author = "Ron Whitney" ;
>
> When I try to test, it logs on but issues no commands.  Eventually (10 seconds in this case), it times out:
>
> [rancid@harpo ~]$ llogin -t 10 -c"BackupFiles" groucho
> groucho
> spawn ssh -c 3des -x -l rwhitney groucho
> rwhitney@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

It's looking for an "enable" prompt and not finding one.

Try with -noenable

cheers
Marty
[rancid] Re: lrancid / llogin Diego Ercolani 04.05.10 00:13
You have to verify that:
1. the user has a regular shell: ssh whitney@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
[rancid] Re: lrancid / llogin Ron Whitney 04.05.10 13:48
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 "[rancid@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:

[rancid@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-----
> From: rancid-disc...@shrubbery.net
> [mailto:rancid-discuss-bounces@shrubbery.net] On Behalf Of
> Diego Ercolani
> Sent: Tuesday, May 04, 2010 03:14
> To: rancid-...@shrubbery.net
> Subject: [rancid] Re: lrancid / llogin
>
>
[rancid] Re: lrancid / llogin Diego Ercolani 05.05.10 00:14
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
[rancid] Re: lrancid / llogin Mr. James W. Laferriere 05.05.10 20:32
        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.
root@dsb-esx01's pssword:
Last login: Thu Apr  1 08:50:40 2010 from mo-it07.dsb.local
[root@dsb-esx01 root]# dir

Error: TIMEOUT reached


--
+------------------------------------------------------------------+
| James   W.   Laferriere | System    Techniques | Give me VMS     |
| Network&System Engineer | 3237     Holden Road |  Give me Linux  |
| bab...@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 "> "
         }
      }
[rancid] Re: lrancid / llogin Ron Whitney 06.05.10 06:11
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:

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


[rancid@harpo bin]$ llogin -t 10 -c"BackupFiles" groucho
groucho
spawn ssh -c 3des -x -l root groucho
root@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-----
> From: rancid-disc...@shrubbery.net
> [mailto:rancid-discuss-bounces@shrubbery.net] On Behalf Of
> Mr. James W. Laferriere
> Sent: Wednesday, May 05, 2010 23:32
> To: Diego Ercolani
> Cc: rancid-...@shrubbery.net
> Subject: [rancid] Re: lrancid / llogin
>
>