<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BenV&#039;s notes &#187; ssh</title>
	<atom:link href="http://notes.benv.junerules.com/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://notes.benv.junerules.com</link>
	<description>Rants and notes</description>
	<lastBuildDate>Wed, 28 Jul 2010 13:36:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>SOCKS, Opera, and brute force</title>
		<link>http://notes.benv.junerules.com/all/software/socks-opera-and-brute-force/</link>
		<comments>http://notes.benv.junerules.com/all/software/socks-opera-and-brute-force/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 16:27:08 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=511</guid>
		<description><![CDATA[Especially force, that&#8217;s what we need. Because somehow Opera still hasn&#8217;t bothered to implement SOCKS proxy support. And if you would like to use&#8230; oh I don&#8217;t know&#8230; tor&#8230; or maybe simple ssh proxying support to test stuff from an external IP instead of from inside your local network, or for whatever your reason might [...]]]></description>
			<content:encoded><![CDATA[<p>Especially <span style="color:#FF0000">force</span>, that&#8217;s what we need.<br />
Because somehow <a href="http://www.opera.com/browser/download/" title="Get Opera">Opera</a> still hasn&#8217;t bothered to implement SOCKS proxy support. And if you would like to use&#8230; oh I don&#8217;t know&#8230; <a href="http://www.torproject.org/">tor</a>&#8230; or maybe simple <a href="http://notes.benv.junerules.com/daily/the-wonders-of-ssh-forwarding/" title="The wonders of SSH forwarding">ssh proxying support</a> to test stuff from an external IP instead of from inside your local network, or for whatever your reason might be (working around your corperate firewall? <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )&#8230;. you have to use <a href="http://www.mozilla.com/en-US/firefox/firefox.html?from=BenVsNotes" title="Get Firefox">Firefox</a>. Because they DO have SOCKS support. Strange. A case to bash Opera <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <span id="more-511"></span></p>
<p>So <a href="http://www.opera.com/support/kb/view/194/" title="Opera Socks">Opera doesn&#8217;t suck^Wsocks</a>, huh.<br />
However, since I personally don&#8217;t like Firefox enough to recommend people using it over Opera, we&#8217;ll have to get socks support using an external program. There are several options for doing this. Bascially what we need is some method to catch the calls to the socket system call and converts them to go through the socks proxy. My expert google skills have found me 3 solutions:</p>
<ul>
<li><a href="http://sourceforge.net/projects/tsocks/" title="TSocks">Tsocks</a></li>
<li><a href="http://proxychains.sourceforge.net/" title="ProxyChains">Proxychains</a></li>
<li><a href="http://ksb.sourceforge.net/" title="Kernel Socks Bouncer">Kernel Socks Bouncer</a></li>
</ul>
<p>From this list <span style="color:#00FFFF">TSocks</span> sounds like the easiest one, even though it hasn&#8217;t been updated in _years_. Means either it works or it&#8217;s impossible to get to work these days <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Anyway, slackbuild didn&#8217;t have any issues building me a tsocks package. Let&#8217;s see if it works!<br />
First we create a little tsocks.conf file:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>janeman<span style="color: #666666; font-style: italic;"># echo -e &quot;local = 192.168.1.0/24\nserver = 127.0.0.1\nserver_port = 1234&quot; &gt; /etc/tsocks.conf</span></div></div>
<p>This tells tsocks that we want to access the proxy for everything that isn&#8217;t in our LAN (192.168.1.0/24) using a server on 127.0.0.1 on port 1234. It&#8217;s picky about the whitespace around the &#8216;=&#8217; in the config though, don&#8217;t forget them. Now we have to enable tsocks, either by running the application by using the tsocks wrapper script, or by letting tsocks put itself in the LD_PRELOAD environment variable. I chose the latter:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>janeman<span style="color: #666666; font-style: italic;"># source tsocks on ; tsocks show &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><br />
ERROR: ld.so: object <span style="color: #ff0000;">'/usr/lib/libtsocks.so'</span> from LD_PRELOAD cannot be preloaded: ignored.<br />
<span style="color: #007800;">LD_PRELOAD</span>=<span style="color: #ff0000;">&quot;/usr/lib/libtsocks.so&quot;</span></div></div>
<p>*<span style="color:#00FF33"><b>BZZZT</b></span>* WRONG! That&#8217;s strike 1 for being an ancient (not updated for more than 5 years) piece of junk. I&#8217;m running a 64 bit OS, that means the library is inside /usr/lib64. Fine, we patch it:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>janeman<span style="color: #666666; font-style: italic;"># sed -ie 's#/lib/#/lib64/#g; s#\\/lib\\/#\\/lib64\\/#g' /usr/bin/tsocks</span></div></div>
<p>If you&#8217;re getting errors about that /usr/lib/libtsocks.so not being found, unset your LD_PRELOAD variable <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Good, time for a test!</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">benv<span style="color: #000000; font-weight: bold;">@</span>janeman$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-D</span> <span style="color: #000000;">1234</span> <span style="color: #660033;">-N</span> some.host.to.proxy.with<br />
benv<span style="color: #000000; font-weight: bold;">@</span>some.host.to.proxy.with<span style="color: #ff0000;">'s password: ******<br />
# SSH is forwarding but doesn'</span>t take commands from you now, leave it, switch to another terminal and <span style="color: #7a0874; font-weight: bold;">continue</span> there<br />
benv<span style="color: #000000; font-weight: bold;">@</span>janeman$ <span style="color: #7a0874; font-weight: bold;">source</span> tsocks on ; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'GET / HTTP/1.0\r\nHost: www.whatismyip.crg \n\r\n'</span> <span style="color: #000000; font-weight: bold;">|</span> nc www.whatismyip.org <span style="color: #000000;">80</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-1</span><br />
123.456.789.012</div></div>
<p>It works! In order to make Opera use it simply start it like that:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">benv<span style="color: #000000; font-weight: bold;">@</span>janeman$ <span style="color: #7a0874; font-weight: bold;">source</span> tsocks on ; opera</div></div>
<p><b>NEXT! ProxyChains</b><br />
&#8220;Q: Why use it in the first place? Tsocks works!&#8221;<br />
A: Because it&#8217;s always good to have more than 1 tool available to use. Because its latest version is not 7 years old (only 2 *cough*). Because it has other features. Because it&#8217;s fun to test shit <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Chalk down another success for slackbuild. Next, the configuration file. <span style="color:#3000FF">/etc/proxychains.conf</span> is automagically installed, so we only have to adapt it if we choose to. The default config should work for <b>tor</b>, but we want it for my SSH proxy. I changed the default proxy at the end of the file to be &#8216;socks5 127.0.0.1 1234&#8242;. Note that it has the cool features to use several proxies (hence the name I suppose) in a chain (randomly if wanted) and also to proxy DNS. Anyway, the test (after unsettings the LD_PRELOAD variable!):</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">benv<span style="color: #000000; font-weight: bold;">@</span>janeman$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'GET / HTTP/1.0\r\nHost: www.whatismyip.crg \n\r\n'</span> <span style="color: #000000; font-weight: bold;">|</span> proxychains nc www.whatismyip.org <span style="color: #000000;">80</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-1</span><br />
<span style="color: #000000; font-weight: bold;">|</span>DNS-request<span style="color: #000000; font-weight: bold;">|</span> www.whatismyip.org <br />
<span style="color: #000000; font-weight: bold;">|</span>S-chain<span style="color: #000000; font-weight: bold;">|</span>-<span style="color: #000000; font-weight: bold;">&lt;&gt;</span>-127.0.0.1:<span style="color: #000000;">1234</span>-<span style="color: #000000; font-weight: bold;">&lt;&gt;&lt;&gt;</span>-4.2.2.2:<span style="color: #000000;">53</span>-<span style="color: #000000; font-weight: bold;">&lt;&gt;&lt;&gt;</span>-OK<br />
<span style="color: #000000; font-weight: bold;">|</span>DNS-response<span style="color: #000000; font-weight: bold;">|</span> www.whatismyip.org is 75.147.234.41<br />
<span style="color: #000000; font-weight: bold;">|</span>S-chain<span style="color: #000000; font-weight: bold;">|</span>-<span style="color: #000000; font-weight: bold;">&lt;&gt;</span>-127.0.0.1:<span style="color: #000000;">1234</span>-<span style="color: #000000; font-weight: bold;">&lt;&gt;&lt;&gt;</span>-75.147.234.41:<span style="color: #000000;">80</span>-<span style="color: #000000; font-weight: bold;">&lt;&gt;&lt;&gt;</span>-OK<br />
123.456.789.123</div></div>
<p>Cool, another working solution. Note how it proxied the DNS request for us. Also I find this one easier to use than tsocks.</p>
<p>Finally there&#8217;s this Kernel Socks Bouncer module, but it&#8217;s too much of a hassle for me to run kernel modules for a simple socks proxy. Let me know if it&#8217;s great if you used it <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Thanks for reading folks!</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/socks-opera-and-brute-force/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pokemon OS, rsync/ssh and MAC</title>
		<link>http://notes.benv.junerules.com/all/software/pokemon-os-rsyncssh-and-mac/</link>
		<comments>http://notes.benv.junerules.com/all/software/pokemon-os-rsyncssh-and-mac/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 10:26:14 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[pokemon os]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=360</guid>
		<description><![CDATA[So yesterday at work I ran into the famous ssh MAC failure like this: wouter@wouter-laptop:~:0&#62; rsync -varP ./vmware/ wouter@192.168.1.2:/archive/archive2/programs/vmware/ Password: sending incremental file list ./ Keys &#160; &#160; &#160; &#160; &#160;116 100% &#160; &#160;0.00kB/s &#160; &#160;0:00:00 &#40;xfer#1, to-check=8/10) linux/ linux/VMware-server-2.0.1-156745.i386.tar.gz &#160; &#160; &#160; &#160;32768 &#160; 0% &#160;800.00kB/s &#160; &#160;0:10:11 &#160;Received disconnect from 192.168.1.2: 2: Corrupted [...]]]></description>
			<content:encoded><![CDATA[<p>So yesterday at work I ran into the famous ssh <span style="color:#FF00FF">MAC</span> failure like this:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">wouter<span style="color: #000000; font-weight: bold;">@</span>wouter-laptop:~:<span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">&gt;</span> rsync <span style="color: #660033;">-varP</span> .<span style="color: #000000; font-weight: bold;">/</span>vmware<span style="color: #000000; font-weight: bold;">/</span> wouter<span style="color: #000000; font-weight: bold;">@</span>192.168.1.2:<span style="color: #000000; font-weight: bold;">/</span>archive<span style="color: #000000; font-weight: bold;">/</span>archive2<span style="color: #000000; font-weight: bold;">/</span>programs<span style="color: #000000; font-weight: bold;">/</span>vmware<span style="color: #000000; font-weight: bold;">/</span><br />
Password: <br />
sending incremental <span style="color: #c20cb9; font-weight: bold;">file</span> list<br />
.<span style="color: #000000; font-weight: bold;">/</span><br />
Keys<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">116</span> <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; &nbsp;0.00kB<span style="color: #000000; font-weight: bold;">/</span>s &nbsp; &nbsp;<span style="color: #000000;">0</span>:00:00 <span style="color: #7a0874; font-weight: bold;">&#40;</span>xfer<span style="color: #666666; font-style: italic;">#1, to-check=8/10)</span><br />
linux<span style="color: #000000; font-weight: bold;">/</span><br />
linux<span style="color: #000000; font-weight: bold;">/</span>VMware-server-2.0.1-<span style="color: #000000;">156745</span>.i386.tar.gz<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">32768</span> &nbsp; <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp;800.00kB<span style="color: #000000; font-weight: bold;">/</span>s &nbsp; &nbsp;<span style="color: #000000;">0</span>:<span style="color: #000000;">10</span>:<span style="color: #000000;">11</span> &nbsp;Received disconnect from 192.168.1.2: <span style="color: #000000;">2</span>: Corrupted MAC on input.<br />
<br />
rsync: writefd_unbuffered failed to <span style="color: #c20cb9; font-weight: bold;">write</span> <span style="color: #000000;">4</span> bytes to socket <span style="color: #7a0874; font-weight: bold;">&#91;</span>sender<span style="color: #7a0874; font-weight: bold;">&#93;</span>: Broken pipe <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">32</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
rsync: connection unexpectedly closed <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">53</span> bytes received so far<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>sender<span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
rsync error: error <span style="color: #000000; font-weight: bold;">in</span> rsync protocol data stream <span style="color: #7a0874; font-weight: bold;">&#40;</span>code <span style="color: #000000;">12</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> at io.c<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">600</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">sender</span>=3.0.6<span style="color: #7a0874; font-weight: bold;">&#93;</span></div></div>
<p>No, that has nothing to do with <a href="http://www.apple.com/">Apple/Mac computers</a> or <a href="http://en.wikipedia.org/wiki/MAC_address">Media Access Control</a>, it&#8217;s<br />
part of the SSH protocol (and others) called <a href="http://en.wikipedia.org/wiki/Message_authentication_code">Messenge Authentication Code</a>. This blog has a nice explanation: <a href="http://blogs.sun.com/janp/entry/ssh_messages_code_bad_packet">Jan Pechanec on SSH messages</a>.</p>
<p>Funny thing, my brother also had this exact issue with the same kind of laptop. Well&#8230;. in his case it was putty failing his connection from a windows machine to this laptop.<br />
The reason? Same as ever,  <span style="color:#FFFF00">checksum offloading</span>.<br />
You can check if your card does this with the  <span style="color:#00FFFF">ethtool</span> program:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">wouter<span style="color: #000000; font-weight: bold;">@</span>wouter-laptop:~:<span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> ethtool <span style="color: #660033;">-k</span> eth0<br />
Offload parameters <span style="color: #000000; font-weight: bold;">for</span> eth0:<br />
Cannot get device flags: Operation not supported<br />
rx-checksumming: on<br />
tx-checksumming: on<br />
scatter-gather: on<br />
tcp-segmentation-offload: off<br />
udp-fragmentation-offload: off<br />
generic-segmentation-offload: on<br />
generic-receive-offload: off<br />
large-receive-offload: off</div></div>
<p>And the fix for this:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">wouter<span style="color: #000000; font-weight: bold;">@</span>wouter-laptop:~:<span style="color: #000000;">85</span><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> &nbsp;ethtool <span style="color: #660033;">-K</span> eth0 tx off</div></div>
<p>Fixed.</p>
<p>&#8221; <span style="color:#000FFF">Wait, what does Pokemon OS have to do with this?</span>&#8221;<br />
Well, isn&#8217;t that obvious? It&#8217;s supposed to magically work, and it doesn&#8217;t! <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Probably more a kernel thing though&#8230; oh well.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/pokemon-os-rsyncssh-and-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The wonders of SSH forwarding</title>
		<link>http://notes.benv.junerules.com/all/daily/the-wonders-of-ssh-forwarding/</link>
		<comments>http://notes.benv.junerules.com/all/daily/the-wonders-of-ssh-forwarding/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 15:20:24 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Boring]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[forward]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=227</guid>
		<description><![CDATA[This is trivial stuff, but nice to know. Do they have a cute little firewall at your work that only allows outgoing traffic on a certain port? Does some site have retarded IP restrictions? Does the piratebay block you from home? Have no fear, ssh is slow as a bear. (huh?) Anyway, you could use [...]]]></description>
			<content:encoded><![CDATA[<p>This is trivial stuff, but nice to know.</p>
<p>Do they have a cute little firewall at your work that only allows outgoing traffic on a certain port? Does some site have retarded IP restrictions? Does the piratebay block you from home?<br />
Have no fear, ssh is slow as a bear. (huh?)</p>
<p>Anyway, you could use an anonymous proxy to get around all of this, but they are often slow and hard to find. Not only that, they often require you to use a specific port.<br />
So the simple solution for all this: use ssh. Of course this requires you to have ssh access on a machine outside of the network that you&#8217;re trying to get out of.<br />
But if you don&#8217;t even have that, you probably suck anyway. (get lost with your micro~s fail piece of cardboard).</p>
<p>Solution #1, for simple <span style="color:#FF0000">TCP</span> port forwards. For instance when you&#8217;re trying to access a remote snmp server that has the irc port (6667 by default) firewalled:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">idiot<span style="color: #000000; font-weight: bold;">@</span>yourmachine$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-L</span> <span style="color: #000000;">1234</span>:127.0.0.1:<span style="color: #000000;">6667</span> ip.of.irc.machine<br />
<span style="color: #000000; font-weight: bold;">*</span>username and password stuff<span style="color: #000000; font-weight: bold;">*</span></div></div>
<p>After a successful login you can now connect an IRC program to localhost on port 1234 and it will act as if you were connecting to the remote machine directly. (bypassing the firewall).<br />
Woei. Too bad this fails for UDP though. You also need to keep the ssh connection open, but that&#8217;s pretty obvious.</p>
<p>Solution #2, for a real proxy solution. When you&#8217;re trying to access a remote web server it becomes more annoying to use a simple port forward, since your browser will not pass the correct<br />
information to the remote server. (It will say <code class="codecolorer text vibrant"><span class="text">Host: 127.0.0.1</span></code> for where it was supposed to be <code class="codecolorer text vibrant"><span class="text">Host: www.piratebay.org</span></code> for example).<br />
To make this work we simply turn ssh into a socks proxy like this:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">moron<span style="color: #000000; font-weight: bold;">@</span>yourmom$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-D</span> <span style="color: #000000;">1234</span> ip.remote.shell.machine<br />
<span style="color: #000000; font-weight: bold;">*</span>username and password stuff<span style="color: #000000; font-weight: bold;">*</span></div></div>
<p>Now you can enter localhost and port 1234 in your browser&#8217;s proxy configuration in the SOCKS proxy section. Magic, you can now go to any site and it will be tunneled through the nicely <span style="color: #FF00FF">encrypted</span> ssh session. (although it might be a bit slower).</p>
<p>Well, so much for the obvious stuff today.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/daily/the-wonders-of-ssh-forwarding/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
