<?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; proxy</title>
	<atom:link href="http://notes.benv.junerules.com/tag/proxy/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>Opera + Squid -&gt; slow?!</title>
		<link>http://notes.benv.junerules.com/all/software/opera-squid-slow/</link>
		<comments>http://notes.benv.junerules.com/all/software/opera-squid-slow/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 13:36:21 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[squid]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=834</guid>
		<description><![CDATA[This tiny issue showed up a while ago, and I&#8217;m not quite sure when exactly it started. It sure was very annoying. The problem: Start opera, then load a ton of stuff at the same time. (your 25 tabs that have to be restored for instance). What happened was that after loading a few pages [...]]]></description>
			<content:encoded><![CDATA[<p>This tiny issue showed up a while ago, and I&#8217;m not quite sure when exactly it started. It sure was very annoying.</p>
<p>The problem:<br />
Start opera, then load a ton of stuff at the same time. (your 25 tabs that have to be restored for instance). What happened was that after loading a few pages<br />
partially, the rest would completely stall.</p>
<p>After some cursing I found out that it only happened when I used my squid proxy. (you know, to <a href="http://notes.benv.junerules.com/all/software/browser-ad-blocking/">filter out ads because they slow the stuff down</a>).<br />
First I figured it must be squid. Then I realized that it would be weird, since nothing really changed. Maybe the blocklist? Nope, all looked fine.</p>
<p>Apparently Opera only uses a limited amount of connections to the proxy, so when a few of those requests are slow (you know, because google analytics takes 6 years to get through) the requests stack up and completely halt the process. Brilliant.</p>
<p>Finally I found the solution in <a href="opera:config#Proxy">some obscure configuration panel</a>. Look for <span style="color:#FF00FF">Enable HTTP 1.1 for proxy</span> and make sure it&#8217;s enabled. Thanks for messing that up for me opera!<br />
Oh well, now it&#8217;s fast again. phew.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/opera-squid-slow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>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>
