[rancid] .cloginrc add method hostname {ssh:-port} for mtlogin/mtrancid?
heasley
heas at shrubbery.net
Fri Jun 5 00:13:58 UTC 2015
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.
> 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..
>
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss
More information about the Rancid-discuss
mailing list