<?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>Brad Conte</title>
	<atom:link href="http://bradconte.com/feed" rel="self" type="application/rss+xml" />
	<link>http://bradconte.com</link>
	<description>Why know the ordinary when you can understand the extraordinary?</description>
	<lastBuildDate>Wed, 16 May 2012 16:58:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>A Letter to My Congressmen Regarding SOPA and PIPA</title>
		<link>http://bradconte.com/congressmen-letter-regarding-sopa-pipa.html</link>
		<comments>http://bradconte.com/congressmen-letter-regarding-sopa-pipa.html#comments</comments>
		<pubDate>Wed, 18 Jan 2012 21:45:16 +0000</pubDate>
		<dc:creator>Brad Conte</dc:creator>
				<category><![CDATA[Computers & Tech]]></category>

		<guid isPermaLink="false">http://bradconte.com/?p=348</guid>
		<description><![CDATA[I wrote my three congressmen today to voice my opposition to a well-known pair of bills called SOPA and PIPA that are under consideration by the United States House of Representatives and Senate (respectively). These bills were drafted with strong support from the multimedia industry and they bring a very heavy hand into the legal [...]]]></description>
			<content:encoded><![CDATA[I wrote my three congressmen today to voice my opposition to a well-known pair of bills called SOPA and PIPA that are under consideration by the United States House of Representatives and Senate (respectively). These bills were drafted with strong support from the multimedia industry and they bring a very heavy hand into the legal realm of copyright enforcement and are very unpopular with Internet-based companies and most Internet users in general. As I write this, many websites are in the middle of a day-long <a href="http://sopastrike.com">self-imposed</a> <a href="http://www.theverge.com/2012/1/18/2715300/sopa-blackout-wikipedia-reddit-mozilla-google-protest">blackout</a> in protest.
<br /></br >

I strongly oppose these bills. I do sympathize with the fact that multimedia companies have their legal and moral rights that are violated by mass-piracy, but these bills take far too drastic action to protect the multimedia sector. I won&#8217;t re-iterate the <a href="http://blog.reddit.com/2012/01/technical-examination-of-sopa-and.html">reasons</a> <a href="http://www.guardian.co.uk/commentisfree/cifamerica/2012/jan/17/stop-sopa-or-web-will-go-dark">why</a> <a href="http://www.readwriteweb.com/enterprise/2012/01/what-i-wish-wikipedia-and-othe.php">these</a> <a href="http://www.eff.org/sites/default/files/One-Page-SOPA_0.pdf">bills</a> <a href="http://vimeo.com/31100268">are</a> <a href="http://americancencorship.org">bad</a>, even in spite of recent <a href="http://www.wired.com/threatlevel/2012/01/dns-sopa-provision/">tamer modifications</a>.
<br /></br >

So I wrote my three congressmen today to voice my opposition. I&#8217;d like to share the letter publicly, as a wider proclamation of my position on this issue and hopefully as an aid for anyone writing their congressmen on a political issue. It&#8217;s not a master-piece, but I thought it might be helpful. I&#8217;ll explain some of the reasoning and structure below. Here it is:
<br /></br >

<div class="quote">To the Honorable [insert congressman's full name],
<br /></br >

I would like to add my voice of support to the millions of people who oppose [SOPA/PIPA].
<br /></br >

I am sympathetic to the motivation of the bill. I understand that multimedia companies have proper motivation to protect their intellectual property. I support their moral and legal rights to own their content.
<br /></br >

However, I do not believe that their efforts to protect their property should be at the expense of humanity&#8217;s convenience and technological development. We the people do not exist to listen to music, we listen to music while we live our lives. Similarly, technology does not exist to play music, it exists to enable us to do what we want, some of which is to listen to music. Legislation like [SOPA/PIPA] takes a multimedia-centered viewpoint of the universe, assuming that we should hinder productivity and change the dynamics of an entire industry just to protect the convenience of one sector of that industry.
<br /></br >

The multimedia industry has a history of resisting technological development due to their reluctance to change business models. They tried to legally combat cassette tapes, video tapes, and CDs under the pretense of fighting piracy that would hurt them. Yet those very mediums enabled them to distribute their content in better, more widely-reaching ways than before. They resist change, yet change and progress is what technology, and humanity itself, is about. Every sector of an industry faces critical changes over time, and while it can be difficult for them to adjust they should not seek legal aid pass their difficulties onto us, the common citizen. This is a capitalist society, the multimedia sector needs to adjust, not be pampered. 
<br /></br >

My request, congressman, is that your position be to protect the progress of the general public. I support the multimedia sector&#8217;s desire to protect its content &#8211; once again, I sympathize with their motivation &#8211; but not at the expense of all our development. Their history and the current [SOPA/PIPA] legislation show that they are not seeking to provide us with multimedia enjoyment while we live our lives, they prefer to limit our lives to fit their existing business models.
<br /></br >

Thank you for your time. For what it&#8217;s worth, I voted for you. To protect me.
<br /></br >

&#8211;Brad Conte</div>
<br />

Some thoughts on this letter, in no particular order:
<br />

<ul>
<li>I used SOPA <i>or</i> PIPA where appropriate for the recipient. One bill is in one house, the other bill in the other house. Writing a blanket statement like &#8220;SOPA and PIPA&#8221;, or worse yet just the popular one &#8220;SOPA&#8221;, sounds more like a form letter. Who wants to get a letter that mentioning a bill that they can&#8217;t even vote on?</li>

<li>I wanted to paint a big picture perspective. 1) I gave a very quick history of similar actions in the industry and their outcomes. 2) I noted that the multimedia industry is just a sub-sector of the larger industry that this bill effects. 3) I remembered international concerns; the U.S. is the country most impacted immediately, but this likely has implications for the whole world, hence I slipped in the word &#8220;humanity&#8221; a couple times. The goal wasn&#8217;t to be dramatic, but to always remind them of how wide-reaching the implication would be. The overall point was that this was far too invasive an action to protect one specific sector.</li>

<li>As a general rule for opinions and debates, you should always separate general intent from specific implementation and you should separate analysis of the consequences from debate over what the consequences are. If you want to get your point across to someone, decide which perspective you&#8217;re arguing and make it clear, too many conversations are completely wasted due to a missing of the minds on those simple topics and jumping confusingly between perspectives. In my letter, I opposed this implementation of copyright and laid out the consequences for what happened. If the congressmen doesn&#8217;t agree that the assessments that I asserted, that&#8217;s the subject for a separate, much longer e-mail. I would suggest that it&#8217;s best to go for lots of detail or very little, because few things are as weak as an argument that uses just a few details strewn out.</i>

<li>It&#8217;s easy to read &#8211; about 370 words and about 2/3 of a page when printed, so easily readable in a few minutes. There are 5 paragraphs (the closing line isn&#8217;t really a paragraph), but only 3 have the bulk of the content; it looks very digestible at a quick glance. And that&#8217;s all you need to give a summary of a position. This makes it also easily skim-able: a) while each paragraph is unique, you could omit any one and get the majority of the argument, b) you could read the first sentence of each paragraph and still get the message (that&#8217;s actually a good rule in general), and c) you could read the first and last paragraphs and understand it. Given the popularity of this topic, it&#8217;s likely that if the congressman is reading my letter, it is just one of hundreds on the same topic.</li>

<li>I emphasized that my position didn&#8217;t spell doom and gloom for the opposition. In fact, I trivialized their position as simply being for &#8220;convenience&#8221;. It isn&#8217;t the annihilation of multimedia companies it&#8217;s simply them finding and adjusting to a new business model, just like they&#8217;ve done several times in the past. It&#8217;s important to know what&#8217;s at stake in a situation like this, and I wanted to contrast humanity&#8217;s technological stifling against their convenient business model. (In retrospect, trivializing it as &#8220;convenience&#8221; was a pretty strong statement to make without supporting evidence, maybe it should&#8217;ve been a little tamer.)</li>

<li>Similar to the above, the secondary focus of the letter was on priorities. &#8220;We the people&#8221; are not befitted in general by this bill. I said and hinted at that a couple of times.</li>

<li>The tone is unemotional, yet a little grave. It&#8217;s a serious subject but it won&#8217;t kill my grandmother, so there&#8217;s no need to sound like it would.</li>

<li>The closing line (&#8220;&#8230;I voted for you. To protect me.&#8221;) might come off a bit snarky, but it conveys a strong and valid point. Congressmen are put in place by &#8220;the people&#8221; and those people are who will lose (and lose very badly) should the legislation pass. Obviously there are times where a congressmen needs to put aside the individual or short-term benefits of each person for the big picture, but I wanted to remind them that my hope is that their voice will do its best to echo mine. If I would be screaming in opposition to it, that should count for something. I didn&#8217;t make any threats (ie, &#8220;I won&#8217;t vote for you if you don&#8217;t oppose this&#8221;), I just reminded them of established fact. And, for what it&#8217;s worth, I did actually vote for them. (I shouldn&#8217;t have to point that out, but it&#8217;s an easy statement to lie about and I&#8217;ve seen it done elsewhere.)</li>
</ul>
<br />

Hopefully the letters will do some good. I&#8217;m sure that some of you can do better.]]></content:encoded>
			<wfw:commentRss>http://bradconte.com/congressmen-letter-regarding-sopa-pipa.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirect input and output for an existing process on Linux</title>
		<link>http://bradconte.com/redirect-input-output-for-existing-process-on-linux.html</link>
		<comments>http://bradconte.com/redirect-input-output-for-existing-process-on-linux.html#comments</comments>
		<pubDate>Tue, 01 Mar 2011 23:51:17 +0000</pubDate>
		<dc:creator>Brad Conte</dc:creator>
				<category><![CDATA[Computers & Tech]]></category>

		<guid isPermaLink="false">http://bradconte.com/?p=291</guid>
		<description><![CDATA[Redirecting input and output of an executable is a standard and trivial practice in Linux operations. When launching a process, the user can trivially redirect the output of the process away from stdout via the &#8220;&#62;&#8221; operator and can redirect input away from stdin using the &#8220;&#60;&#8221; operator. But that only works if stdin or [...]]]></description>
			<content:encoded><![CDATA[Redirecting input and output of an executable is a standard and trivial practice in Linux operations. When launching a process, the user can trivially redirect the output of the process away from stdout via the &#8220;&gt;&#8221; operator and can redirect input away from stdin using the &#8220;&lt;&#8221; operator.
<br /></br />

But that only works if stdin or stdout are switching before the process is launched. What if we have a pre-existing process that we would like to change a file handles for, but we would like to avoid restarting the process? For example, say you have a cron script execute &#8220;sudo my_command&#8221; from an environment where you can&#8217;t provide input (perhaps you meant to use gksudo instead). You might be able to kill the sudo process, but perhaps when sudo exits the script will proceed with undesirable results. You could kill the script too, but assume that you very badly don&#8217;t want to abort the script in a semi-completed state. (Obviously a well-written script shouldn&#8217;t have this sort of behavior, but the assumption is that we are in an unusual situation.) The ideal solution would be to redirect input into the hanging sudo process allowing it to succeed and your script to continue. Another example would be if you needed to redirect the output of an existing process to a file on 
<br /></br />

Thankfully, we can perform redirection on existing processes by explicitly manipulating the existing file descriptors. The method for doing so is fairly straight forward:
<ol>
	<li>Determine which file descriptor you need to change.</li>
	<li>Attach to the target process via gdb.</li>
	<li>Create a file (to redirect output) or named pipe (to redirect input).</li>
	<li>Use gdb to point the desired file descriptor to the file or pipe.</li>
	<li>If applicable, send the necessary content through the pipe.</li>
</ol>

In terminal A, find the PID of the process, call it &#8220;TARGET_PID&#8221;. First, list the target&#8217;s existing file descriptors:
<div class="code">$ ls -l /proc/TARGET_PID/fd/</div>
When we are done we will double check this list to ensure we made the changes we wanted to.
<br /></br />

Now you need to determine which file descriptor (hereon &#8220;FD&#8221;) you want to change. Remember, we can only manipulate existing FDs, not add new ones. (For those who don&#8217;t know: FD 0 is stdin (standard input), FD 1 is stdout (standard output), FD 2 is stderr (standard error output). These are the the base FDs that every process will have, your target process may or may not have more.) Examples:
<ul>
	<li>To change the input for a typical terminal program you likely need to to change stdin.</li>
	<li>To change output file X to a different file Y, you need to find which FD on the list is linked to X.</li>
	<li>For sudo, to change the input that accepts the user password you actually need to change FD 4, which should point to /dev/tty or something similar.</li>
 </ul>
We&#8217;ll call the the FD number that you want to change &#8220;TARGET_FD&#8221;.
<br /></br />

For using a named pipe: First create the pipe using
<div class="code">$ mkfifo /my/file/name</div>
We&#8217;ll call this path TARGET_FILE. Then provide input to the pipe, or else gdb will not be able to open it in a later step. Provide the content by, for example, &#8220;echo MyContent > TARGET_FILE&#8221; from a separate terminal or as a backgrounded process. &#8220;MyContent&#8221; should be the content you want to send the process.
<br /></br />

For using a normal file: Create an output file called TARGET_FILE.
<br /></br />

Attach gdb to the process:
<div class="code">$ gdb -p TARGET_PID</div>

Within gdb, close the file descriptor using the &#8220;close()&#8221; system call:
<div class="code">(gdb) p close(TARGET_FD)
$1 = 0</div>
The right-hand side of the output is the return value of the call we just executed. A value of 0 means that all went well.
<br /></br />

Now create a FD using the &#8220;open()&#8221; system call. This must be done after &#8220;close()&#8221;, because file descriptors are issued sequentially from the lowest unused non-negative integer and we are making use of the fact that once we delete TARGET_FD it is now the lowest unused file descriptor, so the next one created will use the same number.
<div class="code">(gdb) p open(&#8220;TARGET_FILE&#8221;,0600)
$2 = TARGET_FD</div>
If the right-hand side number is equal to TARGET_FD, that means we just successfully created an FD and it got the same FD that we just closed, which is perfect. Remember, if you are using a named pipe, this step may (will?) hang if there is no output going into the named pipe.
<br /></br />

Now quit gdb:
<div class="code">(gdb) q</div>
At this point, you should be done. If you are redirecting output, the redirection should be under way. If you are redirecting input, the first input should be consumed from the pipe and you can continue to provide input as necessary by sending it into the pipe; when you are done simply delete the pipe using &#8220;rm&#8221;.
<br /></br />

We can verify hat we were successful by checking the target process&#8217;s FDs. Run &#8220;ls -l /proc/TARGET_PID/fd/&#8221; again and compare the output against the output from the first time. If all went well then TARGET_FD should be changed to point at TARGET_FILE.]]></content:encoded>
			<wfw:commentRss>http://bradconte.com/redirect-input-output-for-existing-process-on-linux.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FoxyProxy, Firefox 3.5, and DNS Leaking</title>
		<link>http://bradconte.com/foxyproxy-firefox-dns-leaking.html</link>
		<comments>http://bradconte.com/foxyproxy-firefox-dns-leaking.html#comments</comments>
		<pubDate>Sat, 14 Nov 2009 04:18:30 +0000</pubDate>
		<dc:creator>Brad Conte</dc:creator>
				<category><![CDATA[Computers & Tech]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://bradconte.com/?p=207</guid>
		<description><![CDATA[[Update: Jan. 24, 2010] The DNS leaking problem described in this article applied to FoxyProxy v2.14. On Jan. 12, FoxyProxy v2.17 fixed the problem. FoxyProxy is a popular Firefox extension that enables users to, setup, easily manage, and quickly switch between multiple proxy configurations. One of the most common uses of a proxy server is [...]]]></description>
			<content:encoded><![CDATA[<b>[Update: Jan. 24, 2010]</b> The DNS leaking problem described in this article applied to FoxyProxy v2.14. On Jan. 12, FoxyProxy <a href="http://foxyproxy.mozdev.org/releasenotes.html">v2.17</a> <a href="http://foxyproxy.mozdev.org/drupal/content/217-dns-leakage">fixed the problem</a>.
<br /><br />
<div class="hr-dotted"></div>
<br />
<a href="http://foxyproxy.mozdev.org">FoxyProxy</a> is a popular <a href="http://firefox.com">Firefox</a> extension that enables users to, setup, easily manage, and quickly switch between multiple proxy configurations. One of the most common uses of a proxy server is for security/privacy. By establishing an encrypted connection (usually via SSH) with a proxy server on a trusted network, you can have your web traffic go through an encrypted &#8220;pipe&#8221; to that server and have that server send and receive web requests on your behalf, relaying data to and from you only through that pipe. By doing this you eliminate the risk that someone on your current network could see your HTTP traffic. Maybe you don&#8217;t trust other clients on the network, maybe you don&#8217;t trust the gateway, it doesn&#8217;t matter &#8212; your HTTP(S) traffic is encrypted and shielded from prying eyes. (Readers unfamiliar with the concept of using HTTP proxies through SSH tunnels are encouraged to research the matter, there are many well-written tutorials available.)
<br /><br />

There are many other popular uses of proxy servers, but the application of encrypted web traffic is of concern in this case for the following reason: A key problem that arises when using web proxy servers is the issue of handling DNS requests. DNS does not go through the HTTP protocol, so even if HTTP is being forwarded to a proxy the DNS requests may not be. If DNS requests are sent out over the network like normal then eavesdroppers can still read them. So although the actual traffic may be encrypted, the DNS queries behave normally and may cause the same problems that using an encrypted tunnel was designed to avoid in the first place. A situation in which HTTP traffic is encrypted but DNS is not is referred to as &#8220;DNS leaking&#8221;. When using a proxy for the benefit of security or privacy, DNS leaking may be just as bad as non-encrypted traffic.
<br /><br />

Solving the DNS leaking problem is simple. One type of proxy, SOCKS5, can forward DNS requests as well as HTTP(S) data. A user simply needs to tell their browser to use the SOCKS5 proxy for both HTTP(S) and DNS and then both will be routed through the encrypted stream, allowing the user to surf the web with greatly strengthened security and privacy.
<br /><br />

However, Firefox users who use FoxyProxy at the moment will encounter a problem when using DNS forwarding to a SOCKS5 proxy. When using FoxyProxy, DNS leaking occurs even when it is configured not to, which has made many users very upset. Initially many people thought the problem was with Firefox 3.5, but others confirmed it was only present with FoxyProxy installed. Unfortunately, however, not everyone is convinced that this is FoxyProxy-related behavior and I have not found anyone who has presented a solution yet. I plan to do both.
<br /><br />

This is the basic setup for my tests:
<br /><br />

<ul>
<li> I set up an SSH server. </li>
<li> I established an SSH connection and used the built-in SOCKS5 functionality of the SSH server daemon:
<div class="code">$ ssh username@myserver -D localhost:8080</div>
(For the non-SSH inclined: This command forwarded all traffic my client sends to itself on port 8080 through the SSH connection to the SSH server, which then acts as a SOCKS5 proxy and sends the data on to the destination.)</li>
<li> I used Wireshark to monitor all packets, specifically DNS requests, sent or received my network&#8217;s interface. Note that DNS requests tunneled over the SSH connection to the SOCKS5 proxy are <i>not</i> visible to the packet sniffer. </li>
<li> I monitored my Firefox configuration in <b>about:config</b>. (All network proxy-related settings are under the filter <b>network.proxy</b>.) </li>
<li> I used Firefox v3.5.5 and FoxyProxy v2.14. </li>
</ul>
<br />

Using this I was able to monitor all DNS requests while I experimented with Firefox and FoxyProxy using a SOCKS5 proxy. I did a base test with no proxy configuration, a test using Firefox&#8217;s included proxy management, and a test using Foxyproxy for proxy management.
<br /><br />


<div class="section-title">Using no proxy</div>

Starting with a default configuration (SSH SOCKS connection established but no proxy settings configured to use it) I visited several websites such as google.com, yahoo.com, and schneier.com. This was the simple base test.
<br /><br />

I checked <a href="http://showmyip.com">showmyip.com</a> to get my IP address.
<br /><br />

The relevant about:config settings:
<div class="code">network.proxy.socks               &#8220;&#8221;
network.proxy.socks_port          0
network.proxy.socks_remote_dns    false
network.proxy.type                0
</div>

Via Wireshark I watched as the websites generated normal DNS requests over the standard network.
<br /><br />


<div class="section-title">Using Firefox to configure proxy settings</div>

I restarted Firefox to avoid any cached DNS entries. Then, without FoxyProxy installed, I setup my SOCKS5 proxy. (Note that FoxyProxy replaces the standard Firefox proxy editor, so it is impossible to not use FoxyProxy when it is installed.)
<br /><br />

Under Firefox&#8217;s Preferences/Tools (depending on your operating system) I went to the &#8220;Advanced&#8221; tab, &#8220;Network&#8221; sub-tab, and opened &#8220;Settings&#8221;. I chose &#8220;Manual proxy configuration&#8221; and entered &#8220;localhost&#8221; for the SOCKS Host and &#8220;8080&#8243; for the port.
<br /><br />

Unfortunately, Firefox v3.5 does not support a GUI method of enabling DNS SOCKS5 proxying, so I had to manually go to about:config and enable it by setting <b>network.proxy.socks_remote_dns</b> to &#8220;true&#8221;.
<br /><br />

I checked showmyip.com to ensure that my IP address displayed as coming from the server and not my client. It did show as coming from the server, so Firefox was using the proxy.
<br /><br />

The final about:config settings were:
<div class="code">network.proxy.socks               localhost
network.proxy.socks_port          8080
network.proxy.socks_remote_dns    true
network.proxy.type                1
</div>

I visited the same websites. Via Wireshark, I did <b>not</b> see any DNS requests sent over the standard network. Firefox channeled both the HTTP and DNS data through the SSH tunnel perfectly.
<br /><br />


<div class="section-title">Using FoxyProxy to configure proxy settings</div>

I reset all the about:config settings back to their defaults. Then I installed <a href="https://addons.mozilla.org/en-US/firefox/addon/2464">FoxyProxy Standard</a> v2.14. I went to FoxyProxy&#8217;s options and, under the &#8220;Proxies&#8221; tab, created a new proxy entry whch I named &#8220;SSH SOCKS5&#8243;. I set it to connect to &#8220;localhost&#8221; on port 8080. As well, I check-marked the &#8220;SOCKS proxy?&#8221; box and selected &#8220;SOCKS v5&#8243;. I went to the &#8220;Global Options&#8221; tab and checked the box &#8220;Use SOCKS proxy for DNS lookups&#8221;. To let this take effect, I had to restart Firefox.
<br /><br />

When Firefox had restarted, I went to the Tools > FoxyProxy menu and selected to &#8220;Use proxy SSH SOCKS5 for all URLS&#8221;. I checked <b>showmyip.com</b> to ensure that my IP address displayed as coming from the server and not my client. It did show as coming from the server, so Firefox was using the proxy.
<br /><br />

I checked about:config:
<div class="code">network.proxy.socks               &#8220;&#8221;
network.proxy.socks_port          0
network.proxy.socks_remote_dns    false
network.proxy.type                0
</div>

The configuration was the same as the default, so apparently FoxyProxy does not adjust about:config to do its work. 
<br /><br />

Watching the DNS requests via Wireshark, I watched as <b>all</b> the website visits generated DNS requests over the normal network. Complete and thorough DNS leaking. And I would like to emphasize that I had selected &#8220;Use SOCKS proxy for DNS lookups&#8221;, which is FoxyProxy&#8217;s option to address the DNS leaking issue.
<br /><br />


<div class="section-title">Fixing DNS leaking</div>

There was no question about it, FoxyProxy caused the DNS leaking in my test. I wanted to solve the problem so I fiddled with about:config.
<br /><br />

In about:config I manually set <b>network.proxy.type</b> to 1. I verified my IP address was from the server via showmyip.com.
<br /><br />

The new about:config:
<div class="code">network.proxy.socks               
network.proxy.socks_port          0
network.proxy.socks_remote_dns    false
network.proxy.type                1
</div>

I watched for DNS requests again via Wireshark. I saw <b>none</b>. It seemed that just manually setting <b>network.proxy.type</b> to 1 fixed the FoxyProxy DNS leaking problem.
<br /><br />

I also tried other about:config settings, such as manually changing <b>network.proxy.socks_remote_dns</b> to &#8220;true&#8221;, but that didn&#8217;t work. The above was the only change in about:config that I found that fixed the problem.
<br /><br />

<div class="section-title">Summary</div>

I repeated the results above three times in different orders on different computers on both Linux and Windows to ensure I made no configuration mistakes and to ensure that the behavior was consistent and cross-platform. All the tests yielded the same results. Here is the final summary:
<br /><br />

<ul>
<li> Firefox v3.5 does not suffer from DNS leaking by itself. </li>
<li> DNS leaking occurs when FoxyProxy is managing the proxies. </li>
<li> FoxyProxy does not suffer from DNS leaking when <b>network.proxy.type</b> is manually set to 1. </li>
</ul>
<br />

It is obvious that FoxyProxy does not adjust about:config in order to configure proxy settings, but I do not know why. Many Firefox extensions adjust about:config in order to accomplish their goals and I know of no reason they should not. It&#8217;s possible that FoxyProxy has not had a need to do so before, but in light of this serious problem that may need to change. The quickest/simplest solution for FoxyProxy may to set <b>network.proxy.type</b> to 1 if the currently enabled proxy is SOCKS5 and if the global options for FoxyProxy (or the about:config for Firefox) are set to enable DNS forwarding.
<br /><br />

However, although this seems to indicate that FoxyProxy has made a mistake, I don&#8217;t know that FoxyProxy is the party at fault. Clearly FoxyProxy does not have to alter about:config in order to change the other proxy settings, so why must <b>network.proxy.type</b> be set in about:config in order for DNS forwarding to work? Note that <b>network.proxy.type</b> isn&#8217;t related to DNS forwarding, it just specifies which type of proxy is enabled. For all I know someone implemented a hack in Firefox that checks about:config when it shouldn&#8217;t. Of course, I don&#8217;t know that and I don&#8217;t know if this is expected behavior from Firefox or not. It could be that FoxyProxy isn&#8217;t setting whatever hidden configuration for DNS forwarding that exists on the same plane as the other invisible proxy settings it uses. Or maybe FoxyProxy is relying on an unreliable hack in order to avoid changing about:config. I don&#8217;t know about any of that. What I do know is that Firefox by itself does not have this DNS leaking problem, FoxyProxy does, and a simple solution exists. 
<br /><br />

Again, I am certainly not the first person to note this problem, but a) I have seen many people blame Firefox for this bug, and b) I have not yet seen anyone else mention the solution that I noted above.
<br /><br />

I leave it to someone with more time and knowledge about these software projects to determine which project should have which bug report filed. This needs to be fixed permanently.]]></content:encoded>
			<wfw:commentRss>http://bradconte.com/foxyproxy-firefox-dns-leaking.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three Tips for the Linux Terminal</title>
		<link>http://bradconte.com/three-tips-for-the-linux-terminal.html</link>
		<comments>http://bradconte.com/three-tips-for-the-linux-terminal.html#comments</comments>
		<pubDate>Sun, 11 Jan 2009 10:11:47 +0000</pubDate>
		<dc:creator>Brad Conte</dc:creator>
				<category><![CDATA[Computers & Tech]]></category>

		<guid isPermaLink="false">http://bradconte.com/?p=79</guid>
		<description><![CDATA[The power of Linux lies in the tools it uses. If you spend a lot of time in a terminal, you likely value anything that makes using it smoother. Here are a few tips to help make the terminal experience as smooth as possible. These tips are all shell-independent. Change directories with the directory stack [...]]]></description>
			<content:encoded><![CDATA[The power of Linux lies in the tools it uses. If you spend a lot of time in a terminal, you likely value anything that makes using it smoother. Here are a few tips to help make the terminal experience as smooth as possible. These tips are all shell-independent.
<br/><br/>

<ul>
<li><div class="section-title">Change directories with the directory stack</div>

The Bash shell (as well as others, like Zsh) have a built-in &#8220;back&#8221; feature for navigating directories. The built-in &#8220;pushd&#8221; command will put your current working path at the top of a shell-maintained stack and allow you to change to another directory. To go back to the saved path you can use &#8220;popd&#8221;. 
<br/><br/>

Example:
<div class="code">user@host : /some/long/path/you/don&#8217;t/want/to/retype$ pushd /some/other/path/
/some/long/path/you/don&#8217;t/want/to/retype
user@host : /some/other/path/$
[do stuff]
user@host : /some/other/path/$ popd
/some/big/long/directory/you/don&#8217;t/want/to/retype
user@host : /some/long/path/you/don&#8217;t/want/to/retype$
</div>

Since &#8220;pushd&#8221; stores the directories in a stack, you can push multiple directories onto the stack and later pop them off in the reverse order you pushed them. It&#8217;s basically the standard &#8220;cd&#8221; only with a &#8220;back&#8221; feature. Speaking of which, the command &#8220;$ cd -&#8221; will always take you back to the previous directory you were in.

<br/><br/></li>

<li><div class="section-title">Interact with the X clipboard</div>

Before I discovered &#8220;xclip&#8221;, one of the most annoying things about being in a terminal was my lack of access to the X clipboard. Most shells (all the ones I&#8217;ve come across) have a simple means of pasting text into the terminal, but not all have an elegant means of getting text out of the terminal. Yes, highlight-and-middle-click is often an option, but it&#8217;s a) not always feasible, and b) not always convenient. Remember, this is the terminal, you don&#8217;t necessarily want to be using your mouse. &#8220;xclip&#8221; removes the annoyance of using the X clipboard.
<br/><br/>

xclip can read and store to the clipboard from the standard input. As well, it can output the current contents of the clipboard. Since xclip can manipulate multiple clipboard buffers, the argument &#8220;-selection c&#8221; must be used to select the standard X clipboard. The &#8220;-i&#8221; and &#8220;-o&#8221; arguments tell xclip whether you are inputting or outputting clipboard contents, respectively.
<br/><br/>

Example:
<div class="code">$ pwd
/some/long/path/you/don&#8217;t/want/to/retype
$ ls /some/path | xclip -selection c -i
</div>

You may now paste (standard Ctrl-v, or right-click -> paste) the directory listing where ever you choose. Another example:

<div class="code">xclip -selection c -o | cat >> /some/file
</div>

This will concatenate the contents of the clipboard to &#8220;/some/file&#8221;.
<br/><br/>

If you only use yourself using xclip to manage the X clipboard, you might want to consider aliasing &#8220;xclip&#8221; to &#8220;xclip -selection c&#8221; to make it simpler to type. Or you could take it one step further and alias &#8220;xcopy&#8221; to &#8220;xclip -selection c -i&#8221; and &#8220;xpaste&#8221; to &#8220;xclip -selection c -o&#8221;, or something similar.

<br/><br/></li>

<li><div class="section-title">Use &#8220;head&#8221; and &#8220;tail&#8221; more powerfully</div>

You probably know how to use &#8220;head&#8221; to extract the first N lines from a file and &#8220;tail&#8221; to extract the last N lines of a file. While this is useful, it&#8217;s often just as useful to extract the <i>complement</i> of those selections, namely, everything except the first N lines or everything except the last N lines.
<br/><br/>

Thankfully, &#8220;head&#8221; and &#8220;tail&#8221; are powerful enough to accommodate those needs. &#8220;head&#8221; allows you to extract either a finite quantity of text from the top or everything but a finite quantity of text from the bottom, and &#8220;tail&#8221; allows you to extract a finite quantity of text from the bottom or everything but a finite quantity of text from the top. 
<br/><br/>

&bull; head -n N &#8212; by default outputs the first N lines. Using -N outputs all but the last N lines.
<br/><br/>

&bull; tail -n N &#8212; by default outputs the last N lines. Using +N outputs lines starting on the Nth.
<br/><br/>

Example:
<div class="code">/tmp $ cat example
1
2
3
4
5
/tmp $ head -n 2 example
1
2
/tmp $ tail -n 2 example
4
5
/tmp $ head -n -2 example
1
2
3
/tmp $ tail -n +3 example
3
4
5
</div>

Note that tail&#8217;s complement mode requires you to specify the first line number to include in the output. Thus if you want all but the top N lines, actually specify N+1.
</li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://bradconte.com/three-tips-for-the-linux-terminal.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LoginMSG</title>
		<link>http://bradconte.com/loginmsg.html</link>
		<comments>http://bradconte.com/loginmsg.html#comments</comments>
		<pubDate>Wed, 26 Nov 2008 03:36:06 +0000</pubDate>
		<dc:creator>Brad Conte</dc:creator>
				<category><![CDATA[My Projects]]></category>

		<guid isPermaLink="false">http://bradconte.com/?p=72</guid>
		<description><![CDATA[About I wrote LoginMSG to address a very simple convenience that I was without in my day-to-day life in Linux, namely, a simple way to leave myself a one-time message for the next time I logged in. Keeping to-do lists is one thing, but quick &#8220;first thing tomorrow&#8221; reminders are another. After writing my fair [...]]]></description>
			<content:encoded><![CDATA[<div class="section-title">About</div>

I wrote LoginMSG to address a very simple convenience that I was without in my day-to-day life in Linux, namely, a simple way to leave myself a one-time message for the next time I logged in.
<br /><br />

Keeping to-do lists is one thing, but quick &#8220;first thing tomorrow&#8221; reminders are another. After writing my fair share of such reminders, I got tired of going through post-it notes and decided to write a quick script that would allow me to automatically display myself a message the next time I logged in.
<br /><br />

Thus LoginMSG was born. LoginMSG is a simple shell script (less than 50 lines long) that stores a text message and displays it. You can add a message, append to the existing message, remove the message, and view the existing message. When you view the message, a simple, no-frills xmessage box is displayed center-screen with your message, allowing you to read it and then remove it or keep it.
<br /><br />

<center><img src="/files/projects/loginmsg/loginmsg-example.png" height="159" width="313" /></center>
<br /><br />

<div class="section-title">Download</div>

&bull; <a href="/files/projects/loginmsg/loginmsg">LoginMSG v.1</a> &#8211; <i>Jan 6, 2009</i>
<br /><br />

<div class="section-title">Usage</div>

<div class="code"> LoginMSG v.1 &#8211; Display yourself a message (the next time X starts)

 usage: loginmsg [ options ]

 &#8211;add MSG : Create a message with contents MSG, or
             append MSG to the existing message contents.
             Message contents are stored in ~/.loginmsg.
 &#8211;show    : Display the message.
 &#8211;remove  : Remove any existing message.</div>
<br /><br />

Place the script somewhere in your $PATH. Add (or append) a message from a terminal using &#8220;loginmsg &#8211;add&#8221;. To display any existing messages when you login, have your desktop environment run &#8220;loginmsg &#8211;show&#8221; when you log in. LoginMSG does not have a feature to make itself automatically start when a user logs in &#8212; you will have to see to that manually. There are many ways to do this. For example, in Gnome you could add it to the &#8220;Session&#8221; list in System -> Preferences -> Session. In Openbox, you could add it to ~/.config/openbox/autostart.sh. Reference the help pages for your specific desktop environment.]]></content:encoded>
			<wfw:commentRss>http://bradconte.com/loginmsg.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ArchLinux AUR Contributions</title>
		<link>http://bradconte.com/archlinux-aur-contributions.html</link>
		<comments>http://bradconte.com/archlinux-aur-contributions.html#comments</comments>
		<pubDate>Sat, 27 Sep 2008 21:16:57 +0000</pubDate>
		<dc:creator>Brad Conte</dc:creator>
				<category><![CDATA[My Projects]]></category>

		<guid isPermaLink="false">http://bradconte.com/?p=64</guid>
		<description><![CDATA[I&#8217;m a user of ArchLinux, a lightweight and flexible Linux distribution that tries to Keep It Simple. There are thousands of packages officially maintained in Arch&#8217;s package repositories. However, to ensure the robustness and completeness of available packages, a supplementary user-administrated repository exists, where users can create and maintain their own packages. This is called [...]]]></description>
			<content:encoded><![CDATA[I&#8217;m a user of <a href="http://archlinux.org">ArchLinux</a>, a lightweight and flexible Linux distribution that tries to Keep It Simple. 
<br /><br />

There are thousands of packages officially maintained in Arch&#8217;s <a href="http://archlinux.org/packages/">package repositories</a>. However, to ensure the robustness and completeness of available packages, a supplementary user-administrated repository exists, where users can create and maintain their own packages. This is called the <a href="http://aur.archlinux.org">Arch User Repository</a>. The AUR allows users to add lesser-known packages that are not widely used enough to warrant maintenance time from an official developer, create spin-off packages of packages in the official repositories, contribute their own scripts, etc.
<br /><br />

I&#8217;ve made a few contributions to the AUR. To see them, I refer you to:<br />
&bull; <a href="http://aur.archlinux.org/account.php?Action=AccountInfo&#038;ID=6310">My AUR profile</a> <br />
&bull; <a href="http://aur.archlinux.org/packages.php?K=B-Con">My AUR List of Packages</a>]]></content:encoded>
			<wfw:commentRss>http://bradconte.com/archlinux-aur-contributions.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash Path Hashing</title>
		<link>http://bradconte.com/bash-path-hashing.html</link>
		<comments>http://bradconte.com/bash-path-hashing.html#comments</comments>
		<pubDate>Fri, 05 Sep 2008 22:41:29 +0000</pubDate>
		<dc:creator>Brad Conte</dc:creator>
				<category><![CDATA[Computers & Tech]]></category>

		<guid isPermaLink="false">http://bradconte.com/?p=63</guid>
		<description><![CDATA[Bash is a Unix shell of many features. One of those features, which is both useful and potentially annoying, is the path hash table. The environment variable we are probably most familiar with is PATH &#8212; it contains all the paths that should be searched when we specify an executable to run. Bash starts with [...]]]></description>
			<content:encoded><![CDATA[Bash is a Unix shell of many features. One of those features, which is both useful and potentially annoying, is the path hash table. 
<br /><br />

The environment variable we are probably most familiar with is PATH &#8212; it contains all the paths that should be searched when we specify an executable to run. Bash starts with the first path specified in PATH and looks to see if there is an executable present, if there is not it checks the second directory, and so on until it either finds an executable with the specified name or it runs out of paths to search.
<br /><br />

The path of an executable practically never changes. &#8220;ls&#8221; is always in the same place, as is &#8220;cat&#8221;, and every other executable you might have. Thus, to save time, the first time Bash executes an executable it saves the path it finds the executable in, this way Bash can avoid searching for the executable again. The first time you execute &#8220;ls&#8221;, Bash has to search for it. The second through bajillionth times you execute it, Bash will just look up the full path from the table &#8212; much more efficient. It is important to note that every instance of bash maintains its own path hash table &#8212; thus if you have multiple terminals open they will not share path tables.
<br /><br />

However, if the actual desired path of an executable changes, problems can arise. By default, Bash will not look for an executable again. If an executable changes paths, Bash will not find it. If an executable is duplicated to a new path, Bash will execute the original executable even if the new one is in a path of higher priority (namely, listed first in PATH). As can be imagined, this can cause quite a headache in these rare scenarios if one is unfamiliar with Bash path hashing. If you create a script, execute it, then edit it and copy it somewhere else (say from your personal &#8220;bin&#8221; to a global &#8220;bin&#8221;), the old version will still execute. If you simply move an executable between paths, bash will not find the new executable despite the fact that it seemingly should. Observe the following example, in which I create &#8220;myscript&#8221; in my home bin, run it, copy it to a global bin, run &#8220;myscript&#8221; again, and execute the one in my home bin again.
<br /><br />

<center>
<img src="/files/images/articles/bash_path_hash.png" height="713" width="502" alt="Example of Bash storing the full path of a script and not recognizing a new one." title="Bash path hash table example" /><br />
<small>(This image can suffice stand-alone &#8212; feel free to redistribute it.)</small>
</center>
<br />

Thankfully, however, the hash table is easily manipulated &#8212; by the builtin shell command &#8220;hash&#8221; no less. There are four switches that are likely of the most interest to you: 
<ul>
<li> &#8220;-d [name]&#8221; will delete a specific entry from the table </li>
<li> &#8220;-r&#8221; will remove all entries from the table </li>
<li> &#8220;-t [name]&#8221; will list the save path for the given executable name </li>
<li> &#8220;-l&#8221; will list all existing executable -> path entries in the table </li>
</ul>
Using this tool you can view existing hashes and remove old stale ones as you see fit. To solve an out-of-date path hash problem, simple removing it will suffice. The next time the command is run the path hash will be re-updated. For more details, I refer you to the following key excerpts from the Bash man page:

<div class="code">       If the name is neither a shell function nor a builtin, and contains  no
       slashes,  bash  searches  each element of the PATH for a directory con-
       taining an executable file by that name.  Bash uses  a  hash  table  to
       remember  the  full pathnames of executable files (see hash under SHELL
       BUILTIN COMMANDS below).  A full search of the directories in  PATH  is
       performed  only  if the command is not found in the hash table.  If the
       search is unsuccessful, the shell prints an error message  and  returns
       an exit status of 127.

[...]

       hash [-lr] [-p filename] [-dt] [name]
              For  each  name, the full file name of the command is determined
              by searching the directories in $PATH and remembered.  If the -p
              option is supplied, no path search is performed, and filename is
              used as the full file name of the command.  The -r option causes
              the  shell  to  forget  all remembered locations.  The -d option
              causes the shell to forget the remembered location of each name.
              If  the  -t  option is supplied, the full pathname to which each
              name corresponds is printed.  If  multiple  name  arguments  are
              supplied  with  -t,  the  name is printed before the hashed full
              pathname.  The -l option causes output to be displayed in a for-
              mat  that may be reused as input.  If no arguments are given, or
              if only -l is supplied, information about remembered commands is
              printed.   The  return status is true unless a name is not found
              or an invalid option is supplied.</div>]]></content:encoded>
			<wfw:commentRss>http://bradconte.com/bash-path-hashing.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

