Discussion:
[rancid] microtik problems
Michael W. Lucas
2010-12-01 18:45:17 UTC
Permalink
Hi,

I'm trying to use the MicroTik scripts from
http://falz.net/tech/rancid-mikrotik, but have a couple of issues.

1) Setting a SSH port doesn't work. If I use this config:

add password core-5 password
add user core-5 username
add method core-5 ssh
add method core-5 {ssh:-2222}
add autoenable core-5 {1}

I get this:

%clogin core-5
core-5
spawn ssh -c 3des -x -l admin core-5
ssh: connect to host core-5.lodden.com port 22: Connection refused

Error: Connection Refused (ssh): core-5
%

I can work around this with:

add sshcmd core-5 {ssh -p 2222}

which gives me a login prompt, but the prompt is "nonresponsive."
Anything I type doesn't go into the router; it appears on the Unix
command line, after the connection times out.

Any suggestions, folks?

Thanks,
==ml
--
Michael W. Lucas ***@BlackHelicopters.org
http://www.MichaelWLucas.com/, http://blather.MichaelWLucas.com/
New book available: Network Flow Analysis
http://www.networkflowanalysis.com/
Chris Wopat
2010-12-03 20:07:14 UTC
Permalink
Michael,

I wonder if the issue has something to do with the Mikrotik doing a
color terminal by default? If you look at the code it looks like it's
supposed to append '+ct' to your username when you log in which
disables color (c) and terminal autodetection (t) per changelog:

http://www.mikrotik.com/download/CHANGELOG_3

I did a clogin test using ssh and I had the same issue. Doing it over
telnet does let me interact with the device. However, rancid-run -r
<mikrotik> does work properly.

--Chris
Michael W. Lucas
2010-12-06 14:12:31 UTC
Permalink
Chris,

Thanks for the hint (and the script). I wound up with the following
working configuration:

add password core-5 YourPasswordHere
add user core-5 username+ct
add method core-5 ssh
add sshcmd core-5 {/usr/local/scripts/microtiklogin.sh}
add noenable core-5 {1}

sshcmd apparently doesn't handle spaces well, so I had to use an
external script. The sshcmd script is just:

#!/bin/sh
exec ssh -p 2222 $@

I guess that the SSH username part of mtlogin doesn't add +ct
correctly.

==ml
Post by Chris Wopat
Michael,
I wonder if the issue has something to do with the Mikrotik doing a
color terminal by default? If you look at the code it looks like it's
supposed to append '+ct' to your username when you log in which
http://www.mikrotik.com/download/CHANGELOG_3
I did a clogin test using ssh and I had the same issue. Doing it over
telnet does let me interact with the device. However, rancid-run -r
<mikrotik> does work properly.
--Chris
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
--
Michael W. Lucas ***@BlackHelicopters.org
http://www.MichaelWLucas.com/, http://blather.MichaelWLucas.com/
New book available: Network Flow Analysis
http://www.networkflowanalysis.com/
john heasley
2011-04-27 18:10:50 UTC
Permalink
Post by Michael W. Lucas
sshcmd apparently doesn't handle spaces well, so I had to use an
This should fix that and will be included in the next release along
with the mikrotik module from Chris Boot.

Index: bin/mtlogin.in
===================================================================
--- bin/mtlogin.in (revision 2295)
+++ bin/mtlogin.in (working copy)
@@ -518,7 +518,7 @@
if { "$cmethod" == "" } { set cmethod {{telnet} {ssh}} }

# Figure out the SSH executable name
- set sshcmd [find sshcmd $router]
+ set sshcmd [join [lindex [find sshcmd $router] 0] ""]
if { "$sshcmd" == "" } { set sshcmd {ssh} }

# Login to the router

Continue reading on narkive:
Loading...