<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Alex's Adventures on the Infobahn - server</title><link href="https://www.bennee.com/~alex/" rel="alternate"></link><link href="https://www.bennee.com/~alex/blog/tag/server/feed" rel="self"></link><id>https://www.bennee.com/~alex/</id><updated>2010-06-30T14:37:00+01:00</updated><subtitle>the wanderings of a supposed digital native</subtitle><entry><title>Phone Home</title><link href="https://www.bennee.com/~alex/blog/2010/06/30/phone-home/" rel="alternate"></link><published>2010-06-30T14:37:00+01:00</published><updated>2010-06-30T14:37:00+01:00</updated><author><name>alex</name></author><id>tag:www.bennee.com,2010-06-30:/~alex/blog/2010/06/30/phone-home/</id><summary type="html">&lt;p&gt;In the old days when I ran my server from my basement I automatically had access to my home machines. This was useful for all sorts of things but mainly allowing me to monitor my &lt;a class="reference external" href="http://www.gentoo.org/"&gt;Gentoo&lt;/a&gt; system while it re-built the world. However nowadays this is trickier, especially when I'm …&lt;/p&gt;</summary><content type="html">&lt;p&gt;In the old days when I ran my server from my basement I automatically had access to my home machines. This was useful for all sorts of things but mainly allowing me to monitor my &lt;a class="reference external" href="http://www.gentoo.org/"&gt;Gentoo&lt;/a&gt; system while it re-built the world. However nowadays this is trickier, especially when I'm using my work provided pipe which goes through multiple &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Network_address_translation"&gt;NAT&lt;/a&gt; steps, not all of which I can control.&lt;/p&gt;
&lt;p&gt;There is of course a solution available with &lt;a class="reference external" href="http://en.wikipedia.org/wiki/OpenSSH"&gt;OpenSSH&lt;/a&gt; and it's powerful port forwarding capabilities. First I add a backchannel configuration to &lt;em&gt;~/.ssh/config&lt;/em&gt;:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
Host backchannel
     User username
     HostName myserver.com
     RemoteForward localhost:10001 localhost:22
     TCPKeepAlive no
     ServerAliveInterval 2
&lt;/pre&gt;
&lt;p&gt;Now by simple typing &lt;em&gt;ssh backchannel&lt;/em&gt; I've created a reverse tunnel that means I can ssh into my server on the public internet and login to my home machine by typing &lt;em&gt;ssh -p 10000 username&amp;#64;localhost&lt;/em&gt;. As my public machine is also fairly locked down only people actually logged into my machine can use this port (in fact I can lock this down further with a --uid-owner &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Iptables"&gt;iptables&lt;/a&gt; rule).&lt;/p&gt;
&lt;p&gt;The one remaining problem is that occasionally the backchannel connection drops, most likely due to rogue RST packets from the ISP. This is solved by a some metaphorical duct tape:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
while [ 1 ]; do ssh backchannel; done
&lt;/pre&gt;
&lt;p&gt;The only thing I'd really like to improve is using a special key for the backchannel which would only be able to set up the tunnel rather than have full shell access to my server. Apparently it's possible but my Google-fu has been weak in finding out the answer.&lt;/p&gt;
</content><category term="geek"></category><category term="backchannel"></category><category term="server"></category><category term="ssh"></category><category term="tips"></category></entry></feed>