[rancid] .cloginrc add method hostname {ssh:-port} for mtlogin/mtrancid?
Lukasz Sokol
el.es.cr at gmail.com
Fri Jun 5 07:53:20 UTC 2015
On 05/06/15 01:13, heasley wrote:
> Thu, Jun 04, 2015 at 11:43:06AM +0100, Lukasz Sokol:
>> I added
>>
>> send_user "prog: $prog\n methcmd: $methcmd\n suffix: $suffix \nport: $port\n"
>>
>> under the regex and now I'm seeing:
>>
>> ~$ bin/mtlogin.patched shftedhost
>> shiftedhost
>> prog: ssh -p 65122
>> methcmd: ssh
>> suffix:
>> port:
>> spawn ssh -i /var/lib/rancid/.ssh/id_ssa_for_mt_backup -c 3des -x -l username+ct shiftedhost
>> ssh: connect to host shiftedhost port 22: Connection refused
>>
>> So it /does/ get the -p 65122 from somewhere above?
>>
>> for comparison, when running with workinghost:
>>
>> ~$ bin/mtlogin workinghost
>> workinghost
>> prog: ssh
>> methcmd: ssh
>> suffix:
>> port:
>> spawn ssh -i /var/lib/rancid/.ssh/id_ssa_for_mt_backup -c 3des -x -l username+ct workinghost
>>
>> So If i say the $cmd to be $prog...
>>
>> set $cmd $prog
>>
>> it works! for both cases (default and specified port)
>
> I am confused. I sent diffs from the trunk, but this and the related parts
> are unchanged since 3.0. I'll send you a fresh version to test in a
> separate email; one that is complete with cloginrc:sshcmd support.
>
This is against
rancid at george:~$ bin/rancid -V
rancid 2.3.8
together with the backport of ssh ident file support as you've backported it then for me...
(I applied it manually back then)
>> Patch inline below.
>>
>> --- mtlogin.orig 2015-06-03 17:08:33.642852694 +0100
>> +++ mtlogin 2015-06-04 11:37:31.085409961 +0100
>> @@ -323,10 +323,12 @@
>> send_user "\nError: telnet failed: $reason\n"
>> return 1
>> }
>> - } elseif ![string compare $prog "ssh"] {
>> + } elseif [string match "ssh*" $prog] {
>> # ssh to the router & try to login with or without an identfile. backported from trunk.
>> + # also if port given in method, use it
>> regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port
>> - set cmd $sshcmd
>> + send_user "prog: $prog\n methcmd: $methcmd\n suffix: $suffix \nport: $port\n" # debug line
>> + set cmd $prog
>> if {"$port" != ""} {
>> set cmd "$cmd -p $port"
>> }
>>
>> Please review..
>>
Will answer to that one.
More information about the Rancid-discuss
mailing list