<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;"><div><div>If you’re looking to connect to a custom port number, this is what we do. Not sure if you can use it or not, but thought it might help someone.</div><div><br></div><div>/var/rancid/foo/router.db:</div><div><p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">host.example.com:2222;hp;up;HP switch 22</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">host.example.com:3222;aruba;up;Aruba switch 32</p></div><div><br></div><div>/var/rancid/.cloginrc:</div><div><p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">add sshcmd * {/usr/local/bin/sshport}</p></div><div><br></div><div>/usr/local/bin/sshport:</div><div><p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">#!/bin/sh</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">#host is the last argument passed</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">FULLHOST=${!#}</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">#check it for the colon</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">if [ -z "${FULLHOST##*:*}" ]</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">then</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>#stuff left of colon</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>HOST=${FULLHOST%:*}</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>#stuff right of colon</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>PORT=${FULLHOST#*:}</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">else</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>HOST=$FULLHOST</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre"> </span>PORT=22</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">fi</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">#now remove the original host from the arguments list</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">#??? magic! </p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">ARGS=( "$@" )</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">unset ARGS[${#ARGS[@]}-1]</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">ARGS=${ARGS[@]}</p>
<p style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(235, 235, 235); background-color: rgb(0, 0, 0);">/usr/bin/ssh -p $PORT $ARGS $HOST</p></div><div><br></div><div><br></div><div><div id=""><div style="font-family: Calibri;"><p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 7.5pt; font-family: Verdana, sans-serif; color: rgb(51, 102, 153);"><br></span></p><p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 7.5pt; font-family: Verdana, sans-serif; color: rgb(51, 102, 153);">--</span><span style="font-size: 10.5pt;"><o:p></o:p></span></p></div><div style="font-family: Calibri;"><p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 7.5pt; font-family: Verdana, sans-serif; color: rgb(51, 102, 153);">Michael Newton<br>Director, Product Development<br>Point of Presence Technologies<br><br></span></p></div></div></div></div><div><br></div><span id="OLK_SRC_BODY_SECTION"><div style="font-family:Calibri; font-size:12pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt"><span style="font-weight:bold">From: </span> Rancid-discuss on behalf of Lukasz Sokol<br><span style="font-weight:bold">Date: </span> Wednesday, June 3, 2015 at 9:04 AM<br><span style="font-weight:bold">To: </span> "<a href="mailto:rancid-discuss@shrubbery.net">rancid-discuss@shrubbery.net</a>"<br><span style="font-weight:bold">Subject: </span> Re: [rancid] .cloginrc add method hostname {ssh:-port} for mtlogin/mtrancid?<br></div><div><br></div><div><div><div>On 03/06/15 16:42, Lukasz Sokol wrote:</div><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;"><div> On 03/06/15 16:08, heasley wrote:</div><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;"><div> Wed, Jun 03, 2015 at 03:07:39PM +0100, Lukasz Sokol:</div><blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;"><div> rancid@george:~$ bin/mtlogin hostname</div><div> hostname</div><div><br></div><div> Error: unknown connection method: ssh:65122</div><div><br></div><div> will get there, eventually :)</div></blockquote><div><br></div><div> grumble. it needs to match the port below; i think this change is the</div><div> missing bit. sorry</div><div><br></div><div> Index: bin/mtlogin.in</div><div> ===================================================================</div><div> --- bin/mtlogin.in<span class="Apple-tab-span" style="white-space:pre"> </span>(revision 3124)</div><div> +++ bin/mtlogin.in<span class="Apple-tab-span" style="white-space:pre"> </span>(working copy)</div><div> @@ -277,7 +277,7 @@</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>send_user "\nError: telnet failed: $reason\n"</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>return 1</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span> }</div><div> -<span class="Apple-tab-span" style="white-space:pre"> </span>} elseif ![string compare $prog "ssh"] {</div><div> +<span class="Apple-tab-span" style="white-space:pre"> </span>} elseif [string match "ssh*" $prog] {</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span> # ssh to the router & try to login with or without an identfile.</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span> regexp {ssh(:([^[:space:]]+))*} $prog methcmd suffix port</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span> set cmd $sshcmd</div><div><br></div><div><br></div></blockquote><div> I found the relevant line next to the previous backport,</div><div> but this change causes all ssh contacts to fail even the 'up' test.</div><div> </div><div> what is wrong with compare ?</div><div> </div><div> lukasz</div></blockquote><div><br></div><div>would this mean that the default ssh method would need to be {ssh:22} with this change? </div><div>so that the one with {ssh:65122} will be an exception ? </div><div><br></div><div>or might the order of 'regexp {...} methcmd suffix port' matter then?</div><div><br></div><div>sorry for stabbing in the dark :)</div><div><br></div><div>lukasz</div><div><br></div><div>_______________________________________________</div><div>Rancid-discuss mailing list</div><div><a href="mailto:Rancid-discuss@shrubbery.net">Rancid-discuss@shrubbery.net</a></div><div><a href="http://www.shrubbery.net/mailman/listinfo/rancid-discuss">http://www.shrubbery.net/mailman/listinfo/rancid-discuss</a></div><div><br></div></div></div></span></body></html>