<?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>ejohansson.se &#187; linux</title>
	<atom:link href="http://ejohansson.se/categories/computers/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://ejohansson.se</link>
	<description>Random bits about Linux, programming, computers and occasionally other stuff.</description>
	<lastBuildDate>Tue, 06 Mar 2012 09:02:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Transparent HTTP proxy in&#160;python</title>
		<link>http://ejohansson.se/archives/2012/03/06/transparent-http-proxy-in-python/</link>
		<comments>http://ejohansson.se/archives/2012/03/06/transparent-http-proxy-in-python/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 09:02:05 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://ejohansson.se/?p=460</guid>
		<description><![CDATA[I recently wanted to modify a web resource that a device on my local network loads when starting. To avoid having a static local modified copy of the resource I wrote a simple transparent HTTP proxy in python using the Twisted networking engine (which btw was a joy to use) which does the modification when [...]]]></description>
			<content:encoded><![CDATA[<p>I recently wanted to modify a web resource that a device on my local network loads when starting. To avoid having a static local modified copy of the resource I wrote a simple transparent HTTP proxy in python using the <a href="http://twistedmatrix.com/">Twisted networking engine</a> (which btw was a joy to use) which does the modification when the resource is loaded. The code is not modular (e.g. the resource modification is hard coded in the processResponse() function) and the logging is very verbose, but if anyone is interested the code is available on github: <a href="https://github.com/erijo/transparent-proxy">transparent-proxy.git</a>.</p>
<p>The proxy is now running on my local server which sits behind the real gateway. Besides making the device use the server as gateway and enable NAT on the server this single iptables rule is all that is needed:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">iptables <span style="color: #660033;">-t</span> nat <span style="color: #660033;">-A</span> PREROUTING <span style="color: #660033;">-s</span> <span style="color: #007800;">$CLIENT_IP</span> <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">80</span> <span style="color: #660033;">-j</span> REDIRECT <span style="color: #660033;">--to-port</span> <span style="color: #000000;">8080</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2012/03/06/transparent-http-proxy-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handelsbanken login now works on&#160;Linux</title>
		<link>http://ejohansson.se/archives/2011/11/02/handelsbanken-login-now-works-on-linux/</link>
		<comments>http://ejohansson.se/archives/2011/11/02/handelsbanken-login-now-works-on-linux/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 08:32:59 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://ejohansson.se/?p=365</guid>
		<description><![CDATA[Thanks to the hard work done by the FriBID project I was today able to login to Handelsbanken (my bank) using the card reader connected to the computer. This by following the instructions on the FriBID wiki. Good stuff! I&#8217;m using Ubuntu 11.10 on amd64.]]></description>
			<content:encoded><![CDATA[<p>Thanks to the hard work done by the <a href="http://fribid.se/">FriBID</a> project I was today able to login to Handelsbanken (my bank) using the card reader connected to the computer. This by following <a href="http://wiki.fribid.se/sidor/SmartCards">the instructions on the FriBID wiki</a>. Good stuff!</p>
<p>I&#8217;m using Ubuntu 11.10 on amd64.</p>
]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2011/11/02/handelsbanken-login-now-works-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ELF Auxiliary&#160;Vectors</title>
		<link>http://ejohansson.se/archives/2010/10/30/elf-auxiliary-vectors/</link>
		<comments>http://ejohansson.se/archives/2010/10/30/elf-auxiliary-vectors/#comments</comments>
		<pubDate>Sat, 30 Oct 2010 08:09:30 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://ejohansson.se/?p=354</guid>
		<description><![CDATA[Interesting article about ELF Auxiliary Vectors. Found it after reading a comment mentioning AT_SECURE in the LWN article about glibc vulnerabilities.]]></description>
			<content:encoded><![CDATA[<p>Interesting article about <a href="http://articles.manugarg.com/aboutelfauxiliaryvectors.html">ELF Auxiliary Vectors</a>. Found it after reading a comment mentioning AT_SECURE in the LWN article about <a href="http://lwn.net/Articles/412048/">glibc vulnerabilities</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2010/10/30/elf-auxiliary-vectors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>debian/licq.git mirror on&#160;Gitorious</title>
		<link>http://ejohansson.se/archives/2010/04/18/debianlicq-git-mirror-on-gitorious/</link>
		<comments>http://ejohansson.se/archives/2010/04/18/debianlicq-git-mirror-on-gitorious/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 20:23:14 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[licq]]></category>

		<guid isPermaLink="false">http://ejohansson.se/?p=332</guid>
		<description><![CDATA[To get better speed and a backup I&#8217;ve set up a mirror of debian/licq.git on Gitorious.org. I don&#8217;t really know the best way to do this, but I did it by adding the following line to hooks/post-update: git push --mirror git@gitorious.org:licq/debian.git This way the mirror will always be updated when I push to the &#8220;real&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>To get better speed and a backup I&#8217;ve set up a mirror of <a href="http://git.ejohansson.se/?p=debian/licq.git;a=summary">debian/licq.git</a> on <a href="http://gitorious.org/licq/debian">Gitorious.org</a>.</p>
<p>I don&#8217;t really know the best way to do this, but I did it by adding the following line to hooks/post-update:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> push <span style="color: #660033;">--mirror</span> <span style="color: #c20cb9; font-weight: bold;">git</span><span style="color: #000000; font-weight: bold;">@</span>gitorious.org:licq<span style="color: #000000; font-weight: bold;">/</span>debian.git</pre></div></div>

<p>This way the mirror will always be updated when I push to the &#8220;real&#8221; repository.</p>
<p>Get it by running</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> gbp-clone <span style="color: #660033;">--pristine-tar</span> <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>gitorious.org<span style="color: #000000; font-weight: bold;">/</span>licq<span style="color: #000000; font-weight: bold;">/</span>debian.git</pre></div></div>

<p>or clone it on Gitorious and send me merge requests <img src='http://ejohansson.se/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2010/04/18/debianlicq-git-mirror-on-gitorious/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First kernel&#160;patch</title>
		<link>http://ejohansson.se/archives/2007/07/13/first-kernel-patch/</link>
		<comments>http://ejohansson.se/archives/2007/07/13/first-kernel-patch/#comments</comments>
		<pubDate>Thu, 12 Jul 2007 22:03:37 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://ejohansson.se/archives/2007/07/13/first-kernel-patch/</guid>
		<description><![CDATA[It&#8217;s a tiny patch with almost no impact. But if I someday get to call myself kernel developer, I&#8217;ll know that this was where it started For now I&#8217;ll settle with the fact that I have at least contributed something to my favorite OS. Even if it took some convincing to get it in. But [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a <a href="http://git.kernel.org/?p=linux/kernel/git/lethal/sh-2.6.git;a=commit;h=8cb661d6a4b69734c393beeb523cbf86c915f374">tiny patch</a> with almost no impact. But if I someday get to call myself kernel developer, I&#8217;ll know that this was where it started <img src='http://ejohansson.se/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>For now I&#8217;ll settle with the fact that I have at least contributed something to my favorite OS. Even if it took some <a href="http://thread.gmane.org/gmane.linux.ports.sh.devel/2285">convincing</a> to get it in. But then again, I&#8217;m glad they don&#8217;t just accept patches from any random Joe Developer without reviewing it.</p>
]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2007/07/13/first-kernel-patch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An alias to give the world some&#160;color</title>
		<link>http://ejohansson.se/archives/2007/02/14/an-alias-to-give-the-world-some-color/</link>
		<comments>http://ejohansson.se/archives/2007/02/14/an-alias-to-give-the-world-some-color/#comments</comments>
		<pubDate>Wed, 14 Feb 2007 20:16:09 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://ejohansson.se/archives/2007/02/14/an-alias-to-give-the-world-some-color/</guid>
		<description><![CDATA[Just wanted to share my new favourite alias. Really nice, especially if you read a lot of source code using less and prefer colors. alias cless='LESSOPEN="&#124; highlight --ansi --force %s" less -NR' Tip: If you&#8217;d like more colors, replace &#8211;ansi with &#8211;xterm256.]]></description>
			<content:encoded><![CDATA[<p>Just wanted to share my new favourite alias. Really nice, especially if you read a lot of source code using less and prefer colors.</p>
<pre>
alias cless='LESSOPEN="| highlight --ansi --force %s" less -NR'
</pre>
<p>Tip: If you&#8217;d like more colors, replace &#8211;ansi with &#8211;xterm256.</p>
]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2007/02/14/an-alias-to-give-the-world-some-color/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My dspam&#160;configuration</title>
		<link>http://ejohansson.se/archives/2006/07/25/my-dspam-configuration/</link>
		<comments>http://ejohansson.se/archives/2006/07/25/my-dspam-configuration/#comments</comments>
		<pubDate>Tue, 25 Jul 2006 17:45:00 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://ejohansson.se/archives/2006/07/25/my-dspam-configuration/</guid>
		<description><![CDATA[Since I was asked by Adam to give some hints how to setup dspam, I&#8217;m posting snippets from my configuration in hope that it will help at least a bit. We&#8217;ll start with exim. First of all, we&#8217;ll need a router that will pass all incoming email through dspam. Since I use ldap to store [...]]]></description>
			<content:encoded><![CDATA[<p>Since I was <a href="http://ejohansson.se/archives/2006/05/14/dspam-sarge-backport/#comment-1810">asked by Adam</a> to give some hints how to setup dspam, I&#8217;m posting snippets from my configuration in hope that it will help at least a bit.</p>
<p>We&#8217;ll start with exim. First of all, we&#8217;ll need a router that will pass all incoming email through dspam. Since I use ldap to store all domains and users, it might look a bit intimidating. But, as always, <a href="http://exim.org/exim-html-4.62/doc/html/spec_html/index.html">the documentation</a> is your friend. Anyhow, the interesting part is the condition.</p>
<pre>
dspam_router:
  driver = accept
  no_verify
  domains = +virtual_domains
  hide local_parts = ${lookup ldap {user=LDAP_USER pass=LDAP_PASS \
    ldap:///dc=${quote_ldap_dn:$domain},ou=domains,dc=ejohansson,dc=se?uid?one?\
    (&#038;(objectClass=posixAccount)(uid=${quote_ldap:$local_part}@$domain))}\
    {${extract{1}{@}{$value}}} fail}
  local_part_suffix = +*
  local_part_suffix_optional

  # When to scan a message :
  # - it isn't already scanned
  # - it isn't local
  # - it is less than 512k in size
  condition = "${if and {\
    {!eq {$received_protocol}{spam-scanned}}\
    {!eq {$received_protocol}{local}}\
    { <= {$message_size}{512k}}\
    } {1}{0}}"
  headers_add = "X-FILTER-DSPAM: by $primary_hostname on $tod_full"
  transport = dspam_spamcheck
</pre>
<p>If the message matched the condition, it will be sent to the dspam_spamcheck transport. Which looks like follows.</p>
<pre>
dspam_spamcheck:
  driver = pipe
  command = "/usr/bin/dspam --deliver=innocent,spam \
    --user '${lc:$local_part}@${lc:$domain}' -- \
    -f '$sender_address' %u"
  home_directory = "/var/spool/dspam"
  current_directory = "/var/spool/dspam"
  user = dspam
  group = dspam
  log_output = true

  return_fail_output = true
  return_path_add = false
  message_prefix =
  message_suffix =
</pre>
<p>This will check the message and then send it to exim, to have it pass through the exim router chain once more. But this time, since we'll be using the spam-scanned protocol, it wont match the condition in dspam_router. But for this to work, we need to set the delivery agent in  dspam.conf.</p>
<pre>
TrustedDeliveryAgent "/usr/sbin/exim4 -oMr spam-scanned"
</pre>
<p>Then we need to give the dspam user right to set the received protocol. We do this by adding dspam to the list of trusted_users in our exim conf.</p>
<p>See the <a href="/files/dspam/">configuration files</a> for more details and the <a href="http://dspamwiki.expass.de/">DSPAM wiki</a> for even some more.</p>
<p>If you have comments or would like me too explain something a bit more, please don't hesitate to leave a comment or drop me a mail.</p>
]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2006/07/25/my-dspam-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>grep with&#160;color</title>
		<link>http://ejohansson.se/archives/2006/06/18/grep-with-color/</link>
		<comments>http://ejohansson.se/archives/2006/06/18/grep-with-color/#comments</comments>
		<pubDate>Sun, 18 Jun 2006 11:01:10 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://ejohansson.se/archives/2006/06/18/grep-with-color/</guid>
		<description><![CDATA[grep --color=always some_text * &#124; less -R /me like! (more)]]></description>
			<content:encoded><![CDATA[<pre>
grep --color=always some_text * | less -R
</pre>
<p>/me like! (<a href="http://www.linux.com/article.pl?sid=06/05/19/1920231">more</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2006/06/18/grep-with-color/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interesting&#160;trends</title>
		<link>http://ejohansson.se/archives/2006/05/14/interesting-trends/</link>
		<comments>http://ejohansson.se/archives/2006/05/14/interesting-trends/#comments</comments>
		<pubDate>Sun, 14 May 2006 19:49:51 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://ejohansson.se/archives/2006/05/14/interesting-trends/</guid>
		<description><![CDATA[Interesting data from Google trends: linux distributions and xfree86 vs xorg.]]></description>
			<content:encoded><![CDATA[<p>Interesting data from <a href="http://www.google.com/trends">Google trends</a>: <a href="http://www.google.com/trends?q=debian%2C+ubuntu%2C+fedora%2C+opensuse%2C+gentoo&#038;ctab=0&#038;geo=all&#038;date=all">linux distributions</a> and <a href="http://www.google.com/trends?q=xfree86%2C+xorg&#038;ctab=0&#038;date=all&#038;geo=all">xfree86 vs xorg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2006/05/14/interesting-trends/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problems with bcm43xx and&#160;dhcp</title>
		<link>http://ejohansson.se/archives/2006/02/14/problems-with-bcm43xx-and-dhcp/</link>
		<comments>http://ejohansson.se/archives/2006/02/14/problems-with-bcm43xx-and-dhcp/#comments</comments>
		<pubDate>Tue, 14 Feb 2006 16:34:36 +0000</pubDate>
		<dc:creator>Erik Johansson</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ibook]]></category>
		<category><![CDATA[wifi]]></category>

		<guid isPermaLink="false">http://ejohansson.se/archives/2006/02/14/problems-with-bcm43xx-and-dhcp/</guid>
		<description><![CDATA[After getting airport extreme working on linux (see ibook + linux == wlan!) I thought everything was good and I was ready to move to linux fulltime (on my laptop that is, my workstation has been running linux fulltime a number of years now). But the next time I booted I was unable to get [...]]]></description>
			<content:encoded><![CDATA[<p>After getting airport extreme working on linux (see <a href="http://ejohansson.se/archives/2006/01/27/ibook-linux-wlan/">ibook + linux == wlan!</a>) I thought everything was good and I was ready to move to linux fulltime (on my laptop that is, my workstation has been running linux fulltime a number of years now). But the next time I booted I was unable to get the wireless network to function. When I ran dhclient I wasn&#8217;t given an ip address, just this error message.</p>
<pre>
receive_packet failed on eth1: Network is down
</pre>
<p>The only thing I noticed was that even though I explicitly set the rate to 11M, it was set to 54M after running dhclient. So it seemed like dhclient was doing something funny. But I was unable to pinpoint the exact problem and left it be for the time.</p>
<p>Today I found a solution in <a href="https://lists.berlios.de/pipermail/bcm43xx-dev/2006-February/001266.html">this thread</a>. It&#8217;s not a permanent solution, rather some kind of a hack, but it works.</p>
<p>First bring up the interface.</p>
<pre>
# ifconfig eth1 up
</pre>
<p>Next, and this is the key, associate the interface at the same time as dhclient is DHCPDISCOVERing. Run this command in one terminal.</p>
<pre>
# dhclient eth1
</pre>
<p>When you get output similar to this</p>
<pre>
DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 7
</pre>
<p>you run this command in another terminal.</p>
<pre>
# iwconfig eth1 channel 11 rate 11M essid "Erik" enc &lt;secret password&gt;
</pre>
<p>Of course you&#8217;ll have to replace &#8220;Erik&#8221; etc with your settings.</p>
<p>And, once again, I&#8217;m able to say: the wireless network card (AirPort Extreme) is now working.</p>
]]></content:encoded>
			<wfw:commentRss>http://ejohansson.se/archives/2006/02/14/problems-with-bcm43xx-and-dhcp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

