<?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>Yet another web log</title>
	<atom:link href="http://blog.philippheckel.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.philippheckel.com</link>
	<description>Life, Linux and other things</description>
	<lastBuildDate>Sat, 06 Mar 2010 13:53:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WP-UN: WordPress version update notification with cron</title>
		<link>http://blog.philippheckel.com/2010/01/29/wp-un-wordpress-version-update-notification-with-cron/</link>
		<comments>http://blog.philippheckel.com/2010/01/29/wp-un-wordpress-version-update-notification-with-cron/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 13:32:30 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Cron]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/?p=164</guid>
		<description><![CDATA[WordPress is a very popular open-source blog software and is used widely throughout the Internet. However, with great success comes great attack potential: like any other wide spread open-source software, WordPress is target for frequent hacking attacks and spam-bots. All the more important is it to always update the distribution to the latest release.
As Debian/Ubuntu [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wordpress.org/">WordPress</a> is a very popular open-source blog software and is used widely throughout the Internet. However, with great success comes great attack potential: like any other wide spread open-source software, WordPress is target for frequent hacking attacks and spam-bots. All the more important is it to always update the distribution to the latest release.</p>
<p>As Debian/Ubuntu user, I am spoiled when it comes to update management: <em>apt-get</em> updates most of my software, and <em>apticron</em> notifies me when updates are available. For WordPress however, the packaged versions of Debian/Ubuntu are really old and less adjustable which unfortunately makes a manual installation inevitable. While there are several automated WordPress update mechanisms out there, I couldn&#8217;t find a simple notify-on-update tool.</p>
<p>This post introduces the <em>WordPress Update Notifier</em> (WP-UN), a simple script that frequently compares the installed WordPress version with the latest available one. If a new version is available, it sends an e-mail to a given address.</p>
<p><span id="more-164"></span></p>
<h3>Requirements</h3>
<p>WP-UN needs a local mail server such as <a href="http://www.sendmail.org/">Sendmail</a> or <a href="http://www.postfix.org/">Postfix</a> to deliver the notification e-mail. </p>
<h3>Download &amp; Installation</h3>
<p>Download the script, save it to your preferred location and make it executable:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>wp-un \
          http:<span style="color: #000000; font-weight: bold;">//</span>blog.philippheckel.com<span style="color: #000000; font-weight: bold;">/</span>uploads<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span><span style="color: #000000; font-weight: bold;">/</span>01<span style="color: #000000; font-weight: bold;">/</span>wp-un
$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>wp-un</pre></div></div>

<p>That&#8217;s it for the installation. The script can now be called by simply running <em>wp-un</em>.</p>
<p><strong>Download</strong>: <a href="http://blog.philippheckel.com/uploads/2010/01/wp-un">WP-UN 0.1, January 2010</a></p>
<h3>Usage</h3>
<p>Now you can call the script with the following arguments:</p>
<ul>
<li><strong>&#8211;test</strong>: to test if the notification works, use the <em>&#8211;test</em> parameter (optional).</li>
<li><strong>INSTALL-DIR</strong>: the path to your local WordPress installation, for example /var/www/myblog.</li>
<li><strong>NOTIFY-EMAIL</strong>: the e-mail address of the person to notify if a new WordPress version is available.</li>
</ul>
<p>By default, the script is completely silent so that adding a cronjob doesn&#8217;t require output redirections. If, however, the <em>&#8211;test</em> option is given, it is more verbose and sends the notification e-mail in any case.</p>
<p>If a new WordPress version is available, the output looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ wp-un --test /var/www/myblog admin@example.com
Checking installed version... WordPress 2.5.1
Checking latest version... WordPress 2.9.1
Update required; Sending notification to admin@example.com... done.</pre></div></div>

<p>If WordPress is up-to-date, WP-UN would normally not send any notification. If, however, the <em>&#8211;test</em> option is enabled, it sends the e-mail no matter what. In this case, the output will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ wp-un --test /var/www/myblog admin@example.com
Checking installed version... WordPress 2.9.1
Checking latest version... WordPress 2.9.1
Update not necessary; WordPress is up-to-date.
TEST-flag enabled: sending notfication to admin@example.com... done.</pre></div></div>

<p>The notification you receive will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"> The WordPress installation on host example.com needs an update:
&nbsp;
   Installed Version: WordPress 2.5.1
                  at: /var/www/myblog
&nbsp;
      Latest Version: WordPress 2.9.1
            Download: http://www.wordpress.org/latest.tar.gz</pre></div></div>

<h3>As cronjob</h3>
<p>If you want to be notified as soon as a new version comes out, installing a cronjob is a good idea. Simply run <em>crontab -e</em> and add the following line to the file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span> <span style="color: #000000;">6</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>wp-un <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>myblog admin<span style="color: #000000; font-weight: bold;">@</span>example.com</pre></div></div>

<p>WP-UN will now run every morning at 6am and notify you if a new WordPress version is out there!</p>
<h3>Conclusion</h3>
<p>WP-UN is just one of many solutions and it&#8217;s only the work of one afternoon. However, it doesn&#8217;t need any additional software and keeps it simple. It serves its purpose and keeps my WordPress installation always up-to-date. If you have any suggestions or questions, feel free to comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2010/01/29/wp-un-wordpress-version-update-notification-with-cron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to: Postfix as mail relay with greylisting support</title>
		<link>http://blog.philippheckel.com/2010/01/28/how-to-postfix-as-mail-relay-with-greylisting-support/</link>
		<comments>http://blog.philippheckel.com/2010/01/28/how-to-postfix-as-mail-relay-with-greylisting-support/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 20:35:11 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Greylisting]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[SQLgrey]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/?p=30</guid>
		<description><![CDATA[Greylisting is a very efficient technique for fighting spam and can reduce the spam messages in your mailbox by more than 90%. It uses the fact that most spammers only try delivering their spam-mails once, whereas real mail transfer agents (such as the ones regular e-mail service providers are using) try delivering each message up [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.greylisting.org/">Greylisting</a> is a very efficient technique for fighting spam and can reduce the spam messages in your mailbox by more than 90%. It uses the fact that most spammers only try delivering their spam-mails once, whereas real mail transfer agents (such as the ones regular e-mail service providers are using) try delivering each message up to 4-5 days before they give up. </p>
<p>I have always wondered why most ESPs don&#8217;t offer greylisting for their mailboxes, but only rely on less effective and resource-hungry post-retrieval filter methods. Unfortunately, my e-mail provider is one of them so that I get at least a couple of spam mails a day &#8230;</p>
<p>Luckily, it is very easy to set up your own mail relay with greylisting support, i.e. a mail server that simply forwards the mail to your real provider once it passes the greylist-filter. </p>
<p>This little tutorial describes how to set up <a href="http://www.postfix.org">Postfix</a> and <a href="http://sqlgrey.sourceforge.net/">SQLgrey</a> as mail relay.</p>
<p><span id="more-30"></span></p>
<h3>1. What you need</h3>
<ul>
<li>A dedicated or virtual private server with SSH root access.</li>
<li>Access to the DNS entries of your domain for adjusting the MX record; in this post called <em>example.com</em></li>
</ul>
<h3>2. How it works</h3>
<p>If you have outsourced all e-mail services to a service provider like I have, the MX record of your domain usually points to your provider&#8217;s mail server. That is, your mails go directly to the mail server of your provider, e.g. <strong>Google&#8217;s mail server → your provider&#8217;s mail server</strong>. That is, your DNS configuration looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ dig example.com mx
...
example.com.		IN	MX	50 mx0.example.com.
mx0.example.com.	IN	A	(your provider's mail server IP)
...</pre></div></div>

<p>In order to pre-process mails with greylisting and blacklisting, your server will handle mails as intermediary, i.e., mails will always traverse your server first; in the above case something like <strong>Google&#8217;s mail server → your mail server → your provider&#8217;s mail server</strong>. Consequently, the MX record has to be changed to the IP address of your server:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ dig example.com mx
...
example.com.		IN	MX	50 mx0.example.com.
mx0.example.com.	IN	A	(your server IP)
...</pre></div></div>

<p><strong>But</strong>, first things first: we need to configure our server before we change the DNS records!</p>
<h3>3. Installation &amp; Configuration</h3>
<p>If you have a Debian based system, install Postfix, SQLgrey and MySQL using apt-get:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> postfix sqlgrey mysql-server</pre></div></div>

<p>This will install:</p>
<ul>
<li><strong><a href="http://www.postfix.org/">Postfix</a></strong>: a fully functioning MTA which will be configured as mail relay, i.e., instead of storing arriving mails on the system, it will just greylist them and then forward them to their real destination (your provider&#8217;s mail server).</li>
<li><strong><a href="http://sqlgrey.sourceforge.net/">SQLgrey</a></strong>: a SQL-based greylisting add-on for Postfix. Before accepting mails blindly, Postfix will ask the SQLgrey daemon whether to accept the mail or not. SQLgrey keeps track of mail delivery attempts and only replies with success if the foreign MTA tried delivering the mail at least twice.</li>
<li><strong><a href="http://www.mysql.com/">MySQL</a></strong>: a RDBMS which will be used as back-end for storing Postfix&#8217;s routing tables and SQLgrey&#8217;s caching tables. Both Postfix and SQLgrey also support other back-ends such as <a href="http://www.postgresql.org/">PostgreSQL</a>.</li>
</ul>
<h4>3.1. Configuring SQLgrey</h4>
<p>SQLgrey&#8217;s config files reside in <em>/etc/sqlgrey/</em>, the main configuration happens in <em>/etc/sqlgrey/sqlgrey.conf</em>. The file is well documented and offers many possibilities. </p>
<p>The most important options are:</p>
<ul>
<li><strong>inet</strong>: IP address and port to bind the daemon to, default is 127.0.0.1:2501</li>
<li><strong>db_*</strong>: database connection details, i.e., database, user and password</li>
<li><strong>greymethod</strong>: defines which <a href="http://en.wikipedia.org/wiki/Classful_network#Introduction_of_address_classes">IP class</a> to use for greylisting. Especially important for big e-mail service providers since the same mail might be delivered from two different IP addresses (Class C greylisting recommended!).</li>
<li><strong>optmethod</strong>: defines if greylisting is enabled by default (optout), or has to be enabled specifically for each address or domain (optin).</li>
</ul>
<h5>3.1.1. Config file /etc/sqlgrey/sqlgrey.conf</h5>
<p>My configuration looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #000080; font-weight:bold;">inet</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> <span style="">10101</span> </span><span style="color: #808080; font-style: italic;"># bind to localhost:10101</span>
<span style="color: #000080; font-weight:bold;">reconnect_delay</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> <span style="">5</span> </span><span style="color: #808080; font-style: italic;"># no reconnect before 5 minutes</span>
<span style="color: #000080; font-weight:bold;">max_connect_age</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> <span style="">24</span> </span><span style="color: #808080; font-style: italic;"># no reconnect after 24 hours</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># database settings</span>
<span style="color: #000080; font-weight:bold;">db_type</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> mysql</span>
<span style="color: #000080; font-weight:bold;">db_name</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> sqlgrey</span>
<span style="color: #000080; font-weight:bold;">db_host</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> localhost</span>
<span style="color: #000080; font-weight:bold;">db_user</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> sqlgrey</span>
<span style="color: #000080; font-weight:bold;">db_pass</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> sqlgreypassword</span>
<span style="color: #000080; font-weight:bold;">db_cleandelay</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> <span style="">1800</span> </span>
<span style="color: #000080; font-weight:bold;">clean_method</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> sync </span><span style="color: #808080; font-style: italic;"># 'async' is said to be buggy</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># greylist by class C network. eg: 2.3.4.6 connection</span>
<span style="color: #808080; font-style: italic;"># accepted if 2.3.4.145 did connect earlier</span>
<span style="color: #000080; font-weight:bold;">greymethod</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> classc</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># one must optin to have its (incoming) messages being greylisted</span>
<span style="color: #000080; font-weight:bold;">optmethod</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> optin</span></pre></div></div>

<h5>3.1.2. Database</h5>
<p>SQLgrey has a fixed database structure which is set up automatically when the script is started. All that needs to be done is to create a new database <em>sqlgrey</em> with a corresponding user. You can do this manually, or with a tool like <a href="http://www.phpmyadmin.net/">phpMyAdmin</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> USER <span style="color: #ff0000;">'sqlgrey'</span>@<span style="color: #ff0000;">'localhost'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'sqlgreypassword'</span>;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">`sqlgrey`</span> ;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">ALL</span> PRIVILEGES <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #ff0000;">`sqlgrey`</span> <span style="color: #66cc66;">.</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'sqlgrey'</span>@<span style="color: #ff0000;">'localhost'</span>;
<span style="color: #993333; font-weight: bold;">FLUSH</span> PRIVILEGES;</pre></div></div>

<h5>3.1.3. Populating the database</h5>
<p>SQLgrey automatically creates the required tables when it starts for the first time. So start the daemon using the provided init.d-script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>sqlgrey start</pre></div></div>

<p>This creates a couple of tables in the <em>sqlgrey</em>-database. For our purpose and configuration, the tables <em>optin_email</em> and <em>optin_domain</em> are most interesting because only domains and e-mail addresses in these tables will be greylisted.</p>
<p>For our example, we will enable greylisting for the whole domain <em>example.com</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`sqlgrey`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`optin_domain`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`domain`</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'example.com'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>That&#8217;s it for SQLgrey. Once we connect it to Postfix, it&#8217;ll provide us with the greylisting service we want. </p>
<h4>3.2. Configuring Postfix</h4>
<p>Postfix is a very flexible and powerful mail transfer agent (MTA) and can be used as final destination, or mail forwarder (mail relay). For this scenario, Postfix will be a <em>mail relay</em> which only forwards an e-mail if</p>
<ul>
<li>its recipient is listed in the database</li>
<li>and it passes the greylisting-filter</li>
</ul>
<p>The configuration files of Postfix reside in <em>/etc/postfix/</em>. The most interesting file for our purpose is <em>/etc/postfix/main.cf</em>.</p>
<p>In order to not be confused by all the more or less useful config parameters, the file shown here is <em>minimal</em>, i.e., you <em>cannot</em> remove any parameter without major consequences. Details to each of them can be found in the <a href="http://www.postfix.org/postconf.5.html">Postfix configuration man-page</a>.</p>
<p>The most important parameters for the configuration as mail relay are:</p>
<ul>
<li><strong><a href="http://www.postfix.org/postconf.5.html#myhostname">myhostname</a></strong>: this defines your hostname, i.e., in this case <em>relay.example.com</em>. Regarding the hostname, two things must be considered very thoroughly:
<ol>
<li>The hostname must resolve to the IP address of your server, i.e., make sure you don&#8217;t state a fake host here. Postfix uses this value as <a href="http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol">HELO/EHLO</a> identification, and some mail servers might <strong>reject</strong> your mails if  this value doesn&#8217;t resolve to your server&#8217;s IP address.</li>
<li>If you use your top level domain here, e.g. example.com, some mail servers might additionally perform a <a href="http://en.wikipedia.org/wiki/MX_record">MX lookup</a> and match your server&#8217;s IP address with the one of the MX record. In case the MX record points to a different IP address than the A record of the TLD, foreign servers might also <strong>reject</strong> all your mails. In my case, this resulted in log entries like this:

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">postfix/smtp: to=&lt;john.doe@example.com&gt;, 
  relay=mx.my-esp.tld:25,  status=bounced 
  (host mx.somedomain.com[1.2.3.4] refused to talk to me: 
  550 Forged HELO: you are not example.com)</pre></div></div>

<p>As you can see, the foreign hosts suspected me of forging the HELO name, and denied relaying my mails.</li>
</ol>
</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#relay_domains">relay_domains</a></strong>: this option links to the database table <em>relay_domains</em> and defines the domains managed by this mail server. If a recipient-domain is not in this table, Postfix will reject the mail. For this example, the domain <em>example.com</em> must be added to this DB table.</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#relay_recipient_maps">relay_recipient_maps</a></strong>: this option links to the database table <em>relay_recipients</em> and defines the e-mail addresses managed by this mail server. If a recipient address is not in this table, Postfix will reject the mail. This option is closely linked to <em>relay_domains</em> and will not work without it!
<p>In this case, only one address will be added to this table: <em>john.doe@example.com</em>.</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#transport_maps">transport_maps</a></strong>: this option links to the database table <em>transport</em> and defines to which mail server incoming mails will be forwarded. Routing can happen address- or domain-based.
<p>In this case, mails for <em>example.com</em> shall be forwarded to our provider&#8217;s mail server, i.e., this table must have an entry of the form <em>example.com</em> → <em>smtp:[mx.my-esp.tld]</em>.</p>
<p>For details on the value format, read the <a href="http://www.postfix.org/transport.5.html">transport man page</a>.</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a></strong>: this is where the actual magic happens. This option checks the RCPT TO field of each incoming mail, i.e., the recipient, and then queries the greylisting service. Its options closely relate to the <em>relay_*</em>-tables from above:
<ul>
<li><strong><a href="http://www.postfix.org/postconf.5.html#permit_mynetworks">permit_mynetworks</a></strong> allows local applications to send e-mails. If you have web sites running on localhost that may use e-mail, do not remove this option.</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#reject_unauth_destination">reject_unauth_destination</a></strong> queries the <em>relay_domains</em> SQL table, i.e., it checks whether a the incoming recipient domain is relayed by our server.</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#reject_unlisted_recipient">reject_unlisted_recipient</a></strong> queries the <em>relay_recipients</em> SQL table to find out if the exact address is relayed.</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#check_policy_service">check_policy_service</a></strong> queries the SQLgrey daemon which in turn either allows or rejects the mail.</li>
</ul>
</li>
</ul>
<h5>3.2.1 Config file /etc/postfix/main.cf</h5>
<p>Here&#8217;s the minimal <em>main.cf</em> config file to make Postfix a mail relay with greylisting support:</p>

<div class="wp_syntax"><div class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># This is a minimal main.cf config file. Make sure to read the above </span>
<span style="color: #808080; font-style: italic;"># comments so you understand what each option means.</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># server name; must resolve to your server's IP address</span>
<span style="color: #000080; font-weight:bold;">myhostname</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> relay.example.com</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># avoid warning message 'dict_nis_init: NIS ...'</span>
<span style="color: #000080; font-weight:bold;">alias_maps</span> <span style="color: #000000;">=</span> 
&nbsp;
<span style="color: #000080; font-weight:bold;">relay_domains</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> mysql:/etc/postfix/mysql_relay_domains.cf</span>
<span style="color: #000080; font-weight:bold;">relay_recipient_maps</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> mysql:/etc/postfix/mysql_relay_recipient_maps.cf</span>
<span style="color: #000080; font-weight:bold;">transport_maps</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> mysql:/etc/postfix/mysql_transport_maps.cf</span>
&nbsp;
<span style="color: #000080; font-weight:bold;">smtpd_recipient_restrictions</span> <span style="color: #000000;">=</span>
        permit_mynetworks,
        reject_unauth_destination,
        reject_unlisted_recipient,
        check_policy_service inet:127.0.0.1:<span style="">10101</span></pre></div></div>

<h5>3.2.2. Database</h5>
<p>Postfix is very flexible when it comes to address and route handling. In fact, its configuration doesn&#8217;t need a database back-end at all. However, using a SQL database makes everything much easier. I decided to use a very straight forward database structure which directly relates to Postfix&#8217; configuration options. </p>
<p>First, create a database <em>postfix</em> and a corresponding read-only user:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> USER <span style="color: #ff0000;">'postfix'</span>@<span style="color: #ff0000;">'127.0.0.1'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'postfixpassword'</span>;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">`postfix`</span> ;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #ff0000;">`postfix`</span> <span style="color: #66cc66;">.</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'postfix'</span>@<span style="color: #ff0000;">'127.0.0.1'</span>;
<span style="color: #993333; font-weight: bold;">FLUSH</span> PRIVILEGES;</pre></div></div>

<p><strong>Note</strong>: It is important that you use <em>127.0.0.1</em> as host, and not <em>localhost</em>, because Postfix runs in a <a href="http://en.wikipedia.org/wiki/Chroot">chroot</a>-environment and wouldn&#8217;t be able to access <em>localhost</em>. </p>
<p>After setting up the database, add the following three tables:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`relay_domains`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`domain`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`active`</span> enum<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'n'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`domain`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`relay_recipients`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`email`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`active`</span> enum<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'n'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`email`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`transport`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`pattern`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`relay`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`active`</span> enum<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'n'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`pattern`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>In order to connect Postfix with the database, we need to create the three config files specified above: /etc/postfix/mysql_*.cf:</p>

<div class="wp_syntax"><div class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># /etc/postfix/mysql_relay_domains.cf</span>
<span style="color: #000080; font-weight:bold;">hosts</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> 127.0.0.1</span>
<span style="color: #000080; font-weight:bold;">user</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfix-read</span>
<span style="color: #000080; font-weight:bold;">password</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfixpassword</span>
<span style="color: #000080; font-weight:bold;">dbname</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfix</span>
<span style="color: #000080; font-weight:bold;">query</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> SELECT domain FROM relay_domains WHERE domain='%s' AND active='y'</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># /etc/postfix/mysql_relay_recipient_maps.cf</span>
<span style="color: #000080; font-weight:bold;">hosts</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> 127.0.0.1</span>
<span style="color: #000080; font-weight:bold;">user</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfix-read</span>
<span style="color: #000080; font-weight:bold;">password</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfixpassword</span>
<span style="color: #000080; font-weight:bold;">dbname</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfix</span>
<span style="color: #000080; font-weight:bold;">query</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> SELECT email FROM relay_recipients WHERE email='%s' AND active='y'</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># /etc/postfix/mysql_transport_maps.cf</span>
<span style="color: #000080; font-weight:bold;">hosts</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> 127.0.0.1</span>
<span style="color: #000080; font-weight:bold;">user</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfix-read</span>
<span style="color: #000080; font-weight:bold;">password</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfixpassword</span>
<span style="color: #000080; font-weight:bold;">dbname</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfix</span>
<span style="color: #000080; font-weight:bold;">query</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> SELECT relay FROM transport WHERE pattern='%s' AND active='y'</span></pre></div></div>

<p>Before we can now start testing our server, we need to compile these config files to Postfix compatible lookup tables. Do that by running the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ postmap <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>mysql_<span style="color: #000000; font-weight: bold;">*</span>.cf</pre></div></div>

<h5>3.2.3. Populate the database</h5>
<p>Now we have to fill Postfix&#8217; database with the domains and addresses we&#8217;d like to relay. In particular, that means we have to add <em>example.com</em> to <em>relay_domains</em> and <em>transport</em>, and the full addresses to <em>relay_recipients</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`postfix`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`relay_domains`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`domain`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`active`</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'example.com'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`postfix`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`relay_recipients`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`email`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`active`</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'john.doe@example.com'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`postfix`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`transport`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`pattern`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`relay`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`active`</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'example.com'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'smtp:[mx.my-e-mail-service-provider.tld]'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The entry structure for each table is different. Please refer to the Postfix manual for details (cp. <a href="http://www.postfix.org/transport.5.html">transport</a>, <a href="http://www.postfix.org/postconf.5.html#relay_domains">relay_domains</a>, and <a href="http://www.postfix.org/postconf.5.html#relay_recipient_maps">relay_recipient_maps</a>).</p>
<p><strong>Note</strong>: the database structure above is not optimal since it requires redundant entries in three different tables. Even though the structure is not perfect, I have chosen this layout to make it easily understandable!</p>
<h3>4. Test your server</h3>
<p>After this short configuration period it&#8217;s now time to finally start the Postfix server:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>postfix start</pre></div></div>

<p>To make sure you didn&#8217;t make any mistakes in the configuration, you should now check the log files. Postfix and SQLgrey both use syslog so that you should be able to determine the system&#8217;s status like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">20</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>syslog</pre></div></div>

<p>If the log doesn&#8217;t show any errors, we can now try if everything works as expected. To do so, simply connect to the server from your home computer via telnet:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ telnet relay.example.com 25
Connected to relay.example.com.
Escape character is '^]'.
220 relay.example.com ESMTP Postfix
HELO somebody
250 relay.example.com
MAIL FROM: some@address.tld
250 2.1.0 Ok
RCPT TO: john.doe@example.com
450 4.7.1 &lt;john.doe@example.com&gt;: 
   Recipient address rejected: Greylisted for 5 minutes</pre></div></div>

<p>If Postfix replies with a 450 error code, i.e., relay temporarily denied, everything works just fine. On the server side, the log should output something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">postfix/smtpd: connect from 1-2-3-4.your-isp.tld[4.3.2.1]
&nbsp;
sqlgrey: grey: new: 4.3.2(4.3.2.1), some@address.tld-&gt;john.doe@example.com 
postfix/smtpd: NOQUEUE: reject: RCPT from 1-2-3-4.your-isp.tld[4.3.2.1]: 
    450 4.7.1 &lt;john.doe@example.com&gt;: 
    Recipient address rejected: Greylisted for 5 minutes; 
    from=&lt;some@address.tld&gt; to=&lt;john.doe@example.com&gt; ....
&nbsp;
postfix/smtpd: disconnect from 1-2-3-4.your-isp.tld[4.3.2.1]</pre></div></div>

<p>Wait 5 minutes and try connecting again via telnet. This time, SQLgrey will detect that this is your second delivery attempt and add the sender e-mail and its IP address to the automatic white list (AWL). Postfix will accept your mail and forward it to your provider&#8217;s mail server (according to the <em>transport</em>-table):</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">postfix/smtpd: connect from 1-2-3-4.your-isp.tld[4.3.2.1]
&nbsp;
sqlgrey: grey: reconnect ok: 4.3.2(4.3.2.1), 
    some@address.tld -&gt; john.doe@example.com (00:22:42) 
sqlgrey: grey: from awl: 4.3.2, some@address.tld added 
&nbsp;
postfix/smtpd: client=1-2-3-4.your-isp.tld[4.3.2.1]
postfix/cleanup: message-id=&lt;201001...@relay.example.com&gt;
postfix/qmgr: from=&lt;some@address.tld&gt;, size=422, ...
postfix/smtp: to=&lt;john.doe@example.com&gt;, 
    relay=mx.my-esp.tld[12.34.56.78]:25, status=sent, ...
postfix/qmgr: removed
&nbsp;
postfix/smtpd: disconnect from 1-2-3-4.your-isp.tld[4.3.2.1]</pre></div></div>

<h3>5. Go live: change the DNS record</h3>
<p>Play around a little and make sure that everything works as expected. If it does, change the DNS record like described above, i.e., set the MX record of the domains to be relayed to your server&#8217;s IP address.</p>
<p><strong>Note</strong>: For the first few mails, you should definitely watch the logs. If anything goes wrong, you can always change back the MX record. But be aware that DNS changes might take up to 48h!</p>
<p>If you have any questions, please comment below. I am open for suggestions!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2010/01/28/how-to-postfix-as-mail-relay-with-greylisting-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dell Latitude E6400: the Ubuntu fan and noise problem</title>
		<link>http://blog.philippheckel.com/2009/09/21/dell-latitude-e6400-the-ubuntu-fan-and-noise-problem/</link>
		<comments>http://blog.philippheckel.com/2009/09/21/dell-latitude-e6400-the-ubuntu-fan-and-noise-problem/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 13:16:32 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Dell Latitude]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2009/09/21/dell-latitude-e6400-the-ubuntu-fan-and-noise-problem/</guid>
		<description><![CDATA[A couple of days ago, my 4 year old laptop (HP nx8220) decided that it was time to retire and refused to switch on a couple of times. Even though it works most of the time, I can&#8217;t rely on it anymore and will therefore look for new notebooks in the next week.
On my journey [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago, my 4 year old laptop (HP nx8220) decided that it was time to retire and refused to switch on a couple of times. Even though it works most of the time, I can&#8217;t rely on it anymore and will therefore look for new notebooks in the next week.</p>
<p>On my journey through the Web I looked into the details of various business notebooks. I stumbled across the <strong>Dell Latitude E6400</strong>, which looks nice and has everything I wanted. Unfortunately, it also seems to have problems with <strong>Ubuntu</strong>. In particular, the fan seems to run all the time (and not too slow, but very loud) &#8211; as many forum posts and user reviews prove [<a href="http://www.linlap.com/wiki/dell+latitude+e6400">1</a>,<a href="http://karussell.wordpress.com/2009/07/03/dell-latitude-e6400-the-perfect-linux-notebook-or-is-ubuntu-the-perfect-linux/">2</a>,<a href="http://en.community.dell.com/forums/t/19282841.aspx">3</a>,<a href="http://en.community.dell.com/forums/t/19249116.aspx">4</a>].</p>
<p>Since I couldn&#8217;t find a solution, I decided to ask the Dell support via their support chat.<br />
<span id="more-25"></span></p>
<p><strong>Update Nov/09</strong>: It appears that a BIOS update addresses the heat problem. Please refer to the <a href="http://en.community.dell.com/forums/t/19247293.aspx?PageIndex=12">community forum post</a> (thanks to <a href="#comment-12920">chato</a>) for details. </p>
<p>Here&#8217;s what I found out. Note: This is a chat with the German Dell support from September 21, 2009, translated into English.</p>
<blockquote><p>
<strong>Me</strong>:<br />
The Latitude E6400 has (like many forum posts say) a big problem with Ubuntu. In particular, the fan is always on and makes a lot of noise.</p>
<p><strong>Agent</strong>:<br />
Welcome to the Dell Chat.</p>
<p><strong>Me</strong>:<br />
Hallo. I&#8217;d like to know if there already is a solution for this problem. I was thinking about buying a E6400, but I couldn&#8217;t find any solutions for the fan/noise problem in Ubuntu.</p>
<p><strong>Agent</strong>:<br />
Since we do not support Ubuntu on this device, Dell does not work on a solution. Ubuntu is currently only supported on netbooks. There is no solution.</p>
<p><strong>Me</strong>:<br />
Okay. Do you think there will be a solution in the future? Is Dell planning to support Ubuntu on the E6400? Or never?!</p>
<p><strong>Agent</strong>:<br />
As I said, we don&#8217;t sell the device with Ubuntu.</p>
<p><strong>Me</strong>:<br />
Okay. Thank you for the honest answer. I&#8217;m gonna have to buy a Thinkpad then &#8230; Have a nice day.</p>
<p><strong>Agent</strong>:<br />
I&#8217;m sorry. But we don&#8217;t support Linux.</p>
<p><strong>Me</strong>:<br />
It&#8217;s not your fault. Thanks anyway. Good bye.</p>
<p><strong>Agent</strong>:<br />
I&#8217;m so sorry.
</p></blockquote>
<p>So the outcome is: <strong>The Dell Latitude E6400 doesn&#8217;t support Ubuntu and is NOT planning to solve the fan/noise problem.</strong>. That means, I&#8217;m gonna have to buy one of those ugly Thinkpads. But what other solutions are there?! None!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2009/09/21/dell-latitude-e6400-the-ubuntu-fan-and-noise-problem/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Extract text from PDF files</title>
		<link>http://blog.philippheckel.com/2009/08/09/extract-text-from-pdf-files/</link>
		<comments>http://blog.philippheckel.com/2009/08/09/extract-text-from-pdf-files/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 17:17:05 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2009/08/09/extract-text-from-pdf-files/</guid>
		<description><![CDATA[Adobe&#8217;s Portable Document Format (PDF) has reached great popularity over the last years and is the number one format for easy document exchange. It comes with great features such as embeddable images and multimedia, but also has rather unpleasant properties. The so called Security Features represent a simple Digital Rights Management (DRM) system and allow [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe&#8217;s Portable Document Format (PDF) has reached great popularity over the last years and is the number one format for easy document exchange. It comes with great features such as embeddable images and multimedia, but also has rather unpleasant properties. The so called <em>Security Features</em> represent a simple Digital Rights Management (DRM) system and allow PDF authors to restrict the file usage. Using the DRM system, authors can allow or deny actions such as printing a file, commenting or copying content.</p>
<p>Even though this is a good idea for some situations, most of the times, it&#8217;s just annoying: Collecting ideas for seminar papers or a thesis, for instance, is almost impossible without being able to Copy &amp; Paste certain paragraphs from the PDF. </p>
<p><span id="more-24"></span></p>
<p>Fortunately, Linux can solve this problem with a simple tool called <strong>pdf to text</strong>. This command line tool simply strips all text from the PDF file and saves it to a given text-file.</p>
<h3>Installation</h3>
<p>The tool is part of the package <strong>poppler-utils</strong> and can be installed via your favorite package manager, e.g. apt-get:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> poppler-utils</pre></div></div>

<h3>Extract text from PDF files</h3>
<p>This is also pretty simple and the man-page gives the instructions: <em>pdftotext [options] &lt;PDF&gt; [&lt;text-file&gt;]</em>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ pdftotext PDF-file-with-copy-and-paste-restriction.pdf</pre></div></div>

<p>In case you&#8217;d like to perform this for every PDF-file in a folder (recursive search), simple do that:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.pdf'</span> <span style="color: #660033;">-exec</span> pdftotext <span style="color: #ff0000;">&quot;{}&quot;</span> \;</pre></div></div>

<p>After executing the command, there will be a *.txt-file for each PDF file in the folder, &#8211; containing the plain-text of the corresponding PDF file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2009/08/09/extract-text-from-pdf-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simsafe: Simple command-line password safe</title>
		<link>http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/</link>
		<comments>http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 00:20:29 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[GPG]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/</guid>
		<description><![CDATA[Nowadays, it appears to me as if almost everything in the big and fancy world of IT comes with the need to sign up and create an account. Every little online tool, every social networking site and of course every instant messenger account. System administrators hits it even harder: The setup of a server machine [...]]]></description>
			<content:encoded><![CDATA[<p>Nowadays, it appears to me as if almost everything in the big and fancy world of IT comes with the need to sign up and create an account. Every little online tool, every social networking site and of course every instant messenger account. System administrators hits it even harder: The setup of a server machine requires to create lots of different users for every kind of service, &#8212; be it Postfix, Sendmail, Courier, MySQL, PostgreSQL, etc. Most of them require some kind of super-user password or account.</p>
<p>This is where a password manager comes in handy: Open the password vault by typing in the master password, put in all you secrets and crucial information, save it and be happy. <em>As if!</em></p>
<p>Almost every password manager I found on the Web was crowded out by details so that it took minutes to add a single account. What I wanted was something like a text-file with password &#8212; and that&#8217;s what I made: <strong>A simple command-line password safe</strong>.</p>
<p><span id="more-22"></span></p>
<h3>How it works</h3>
<p>Simsafe is nothing else but a simple Perl script wrapped around the symmetric encryption functions of GPG. Every box with GPG and Perl installed can hence use the script (= every linux box!). And even if the <em>simsafe</em>-script is not installed on the system, a simple <em>gpg &#8211;decrypt FILE</em> shows the plain text contents. That is, Simsafe files are nothing more but <strong>text-files with password!</strong></p>
<h3>Usage</h3>
<p>It&#8217;s simple and really easy to use.<br />
Syntax:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ simsafe FILE</pre></div></div>

<h4>Create a new password safe file</h4>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ simsafe mySafe
simsafe: Creating a new password safe 'mySafe'
simsafe: Please enter the new password: (type in your password)
simsafe: Please confirm the password: (confirm your password)
simsafe: Executing editor vi ...
  // VI or your favourite editor opens
  // and you can edit the plain text file
simsafe: Encrypting with GPG ...</pre></div></div>

<h4>Adding/Removing entries to the password vault</h4>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ simsafe mySafe
simsafe: Please enter the safe password: (type in your password)
simsafe: Decrypting with GPG ...
simsafe: Executing editor vi ...
  // VI or your favourite editor opens
  // and you can edit the plain text file
simsafe: Safe unchanged.</pre></div></div>

<h3>Get it!</h3>
<p>It&#8217;s a reeeaallly small script and this post is possible longer than the perl-file itself, but here it is. Simply download it, make it executable and put it somewhere in your PATH.</p>
<p><strong>Download:</strong> <a href="/uploads/2009/04/simsafe">Simsafe v0.1, Apr. 2009</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>KadS: a secure version of the Kademlia protocol</title>
		<link>http://blog.philippheckel.com/2009/03/16/kads-a-secure-version-of-the-kademlia-protocol/</link>
		<comments>http://blog.philippheckel.com/2009/03/16/kads-a-secure-version-of-the-kademlia-protocol/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 15:56:40 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Kademlia]]></category>
		<category><![CDATA[Peer-to-Peer]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2009/03/16/kads-a-secure-version-of-the-kademlia-protocol/</guid>
		<description><![CDATA[There are various peer-to-peer protocols out there. All of them focus the decentralisation of storage and other system resources. Most implement a distributed hash table (DHT) to store information. That is, each node of the network only holds a small part of the hash table but is able to locate and retrieve any requested entry. [...]]]></description>
			<content:encoded><![CDATA[<p>There are various peer-to-peer protocols out there. All of them focus the decentralisation of storage and other system resources. Most implement a distributed hash table (DHT) to store information. That is, each node of the network only holds a small part of the hash table but is able to locate and retrieve any requested entry. <a href="http://pdos.csail.mit.edu/~petar/papers/maymounkov-kademlia-lncs.pdf">Kademlia</a>, a protocol designed by two <a href="http://www.nyu.edu/">NYU</a> students in 2002, is one of them.</p>
<p><span id="more-21"></span></p>
<h3>The Kademlia Protocol</h3>
<p>Kademlia is based on four simple remote procedure calls (RPCs) and guarantees a very fast and lightweight exchange of information by using the connection-less UDP instead of TCP. Every node as well as every entry of the DHT is tagged with an identifier, called <em>node ID</em> or <em>key</em>. By XORing identifiers, one can calculate the distance between them and is hence able to walk through the network knowing whether one is near or far to a specific node. This so called <em>XOR metric</em> makes it possible to group the entries of the DHT around the K closest nodes to the entry&#8217;s key. An entry with the key 10, for instance, will be stored at the nodes with a node ID close to 10.</p>
<h3>Kademlia + PKI = KadS: The Secure Extension</h3>
<p>In my Bachelor thesis, I am going to extend Kademlia from a simple peer-to-peer protocol to a <em>trusted</em> and <em>secure</em> network. The proposed KadS network is almost identical to the Kademlia network, i.e. it consists of the described RPCs and implements the same XOR metric. The major extension to the protocol is that every node is equipped with a public/private key-pair signed by a trusted CA. This extends the normal Kademlia network to a public key infrastructure (PKI) in which every communication is encrypted, every node can be trusted and only verified nodes can participate in the network.</p>
<p>Every connection is synchronously encrypted with a session key which is created and exchanged in a handshake procedure when two nodes first meet. That is, a node has a different session key for the connection with each node it knows in the network. The handshake is similar to the one used in other software except for the fact that both clients exchange their public key and need to verify each others identity. After a successful handshake, two nodes are able to exchange lightweight encrypted messages using the session key and the basic protocol applies</p>
<h3>An application: The distributed URL blacklisting service</h3>
<p>As an application to the proposed KadS network, I chose a distributed URL blacklisting service. Please read more in my <a href="/uploads/2009/03/kads-url-blacklisting-2009-thesis-expose.pdf">Bachelor thesis exposé</a>, or simply download the whole thesis: </p>
<p><a href="/uploads/2009/05/Blacklisting-Malicious-Web-Sites-using-a-Secure-Version-of-the-DHT-Protocol-Kademlia.pdf">Blacklisting Malicious Web Sites using a Secure Version of the DHT Protocol Kademlia</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2009/03/16/kads-a-secure-version-of-the-kademlia-protocol/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prevent Nautilus from opening when plugging in an external disk</title>
		<link>http://blog.philippheckel.com/2008/11/24/prevent-nautilus-from-opening-when-plugging-in-an-external-disk/</link>
		<comments>http://blog.philippheckel.com/2008/11/24/prevent-nautilus-from-opening-when-plugging-in-an-external-disk/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 03:03:08 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Nautilus]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2008/11/24/prevent-nautilus-from-opening-when-plugging-in-an-external-disk/</guid>
		<description><![CDATA[Nautilus, the standard file manager of Ubuntu, has a feature which automatically opens a new window when an external media such as a USB flash drive or an external disk is plugged in. Generally a great idea, because usually you want to work with the stuff you are connecting to your computer. However, it can [...]]]></description>
			<content:encoded><![CDATA[<p>Nautilus, the standard file manager of Ubuntu, has a feature which automatically opens a new window when an external media such as a USB flash drive or an external disk is plugged in. Generally a great idea, because usually you want to work with the stuff you are connecting to your computer. However, it can get pretty annoying when the external disk or mass media device is partitioned in many parts and Nautilus opens that amount of windows.</p>
<p><span id="more-16"></span></p>
<p>In my case, my external disk has four partitions. Every time I plug in the disk, Nautilus opens four windows. Each of them is blinking in the panel, &#8212; really annoying! </p>
<h3>How to disable it?</h3>
<p><strong>Open Nautilus &#8211;&gt; Edit &#8211;&gt; Preferences &#8211;&gt; Media</strong><br />
Now disable <strong>Browse media when inserted</strong>. That&#8217;s it.</p>
<p>I know, it&#8217;s pretty easy but it took me a while to figure it out. So I thought I save you guys the effort of searching the Web.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2008/11/24/prevent-nautilus-from-opening-when-plugging-in-an-external-disk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unison &amp; multiple hosts: &#8220;Warning: inconsistent state.&#8221;</title>
		<link>http://blog.philippheckel.com/2008/10/25/unison-and-multiple-hosts-warning-inconsistent-state/</link>
		<comments>http://blog.philippheckel.com/2008/10/25/unison-and-multiple-hosts-warning-inconsistent-state/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 16:18:34 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Synchronization]]></category>
		<category><![CDATA[Unison]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2008/10/25/unison-and-multiple-hosts-warning-inconsistent-state/</guid>
		<description><![CDATA[As some of you might know, Unison is this great tool that allows bidirectional synchronisation of two hosts, &#8211; no matter which operating system they&#8217;re running&#8230; Well, at least the well known ones are supported.
Since Unison can also be used to sychronise more than two hosts, it&#8217;s perfect for big amounts of data that has [...]]]></description>
			<content:encoded><![CDATA[<p>As some of you might know, <a href="http://www.cis.upenn.edu/~bcpierce/unison/">Unison</a> is this great tool that allows bidirectional synchronisation of two hosts, &#8211; no matter which operating system they&#8217;re running&#8230; Well, at least the well known ones are supported.</p>
<p>Since Unison can also be used to sychronise more than two hosts, it&#8217;s perfect for big amounts of data that has to be shared in a team. </p>
<p>A scenario like this is possible and works for me: UserA &lt;-&gt; Server &lt;-&gt; UserB.<br />
But of course, also other users could sync with the server. Unison rocks!</p>
<p>Today, after reinstalling his OS, my friend got the following error message:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Warning: inconsistent state.  
The archive file is missing on some hosts.
For safety, the remaining copies should be deleted.
  Archive are96968da50882488164ef52510703a8e on 
     host &amp;lt;UserAs-local-hostname&amp;gt; is MISSING
  Archive ar664775fc717afcf6cc46edbc47d25641 on ...</pre></div></div>

<p><span id="more-15"></span></p>
<h3>The easy solution</h3>
<p>Unison keeps archive-files for each pair it synchronises with. One on each host, i.e. one on your local PC (UserA) and one on the server, both stored in a folder called <em>~/.unison</em> and looking like the files above.</p>
<p>The easiest solution would be to just <strong>delete all archive-files</strong> on the server as unison suggests. <strong>But</strong> that would result in a situation where all the other users that sync their files with the server would have to do a slow sync which is <em>extremely slow</em> and sometimes takes more than 20 minutes for large folders (e.g. > 10 GB).</p>
<h3>The best solution &#8230;</h3>
<p>&#8230; is to just delete the required archive-files on the server. Pretty easy, that&#8217;s how it works:</p>
<p>Log on to the server (assuming that it&#8217;s a Linux machine, but it certainly works similar for any other system) and find the relevant archive files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> mysyncuser<span style="color: #000000; font-weight: bold;">@</span>mysyncserver.com
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>.unison
$ <span style="color: #c20cb9; font-weight: bold;">fgrep</span> <span style="color: #ff0000;">'//UserAs-local-hostname/'</span> <span style="color: #c20cb9; font-weight: bold;">ar</span><span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

<p>You should get something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Binary file ar664775fc717afcf6cc46edbc47d25641 matches</pre></div></div>

<p>Delete the listed files and it should work like a charm. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2008/10/25/unison-and-multiple-hosts-warning-inconsistent-state/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>GCALDaemon deb-package for Ubuntu/Kubuntu</title>
		<link>http://blog.philippheckel.com/2008/09/30/gcaldaemon-deb-package-for-ubuntu-kubuntu/</link>
		<comments>http://blog.philippheckel.com/2008/09/30/gcaldaemon-deb-package-for-ubuntu-kubuntu/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 16:50:38 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Synchronization]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Kubuntu]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2008/09/30/gcaldaemon-deb-package-for-ubuntu-kubuntu/</guid>
		<description><![CDATA[GCALDaemon is a great tool to synchronise many of Google&#8217;s services such as Google Calendar and Contacts with your local PC. 
Unfortunately, the installation on Ubuntu/Kubuntu and any other Linux distribution is still not the most comfortable. For this reason, I sat down some hours and packed the tool into a deb-package and additionally added [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://gcaldaemon.sourceforge.net/">GCALDaemon</a> is a great tool to synchronise many of Google&#8217;s services such as Google Calendar and Contacts with your local PC. </p>
<p>Unfortunately, the installation on Ubuntu/Kubuntu and any other Linux distribution is still not the most comfortable. For this reason, I sat down some hours and packed the tool into a <strong>deb-package</strong> and additionally added a nice command line tool to simplify some of the basics.</p>
<p><span id="more-12"></span></p>
<p>For those who can&#8217;t wait, here&#8217;s the package: <a href="/uploads/2008/09/gcaldaemon_1.0beta16~ubuntu0_all.deb">gcaldaemon_1.0beta16~ubuntu0_all.deb</a></p>
<p><strong>Update Nov/08: Ubuntu Intrepid</strong>: I just re-installed my Ubuntu and successfully tested the provided version for the new system. Works like a charm for Hardy and for Intrepid.<br />
~ 150 downloads so far, no complains/malfunctions!</p>
<p><strong>Update Feb/09: Launchpad</strong>: I just uploaded the code that creates the deb-package on <a href="https://code.launchpad.net/~binwiederhier/+junk/gcaldaemon">Launchpad</a>. Maybe somebody of the Ubuntu team will pick it up and integrate it into the distribution. There is also a <a href="https://bugs.launchpad.net/ubuntu/+bug/305446">bug report</a> for this issue, &#8211; feel free to contribute. </p>
<p>For all of you interested how to create your own package from my sources, follow these steps:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ bzr branch <span style="color: #c20cb9; font-weight: bold;">lp</span>:~binwiederhier<span style="color: #000000; font-weight: bold;">/</span>+junk<span style="color: #000000; font-weight: bold;">/</span>gcaldaemon
$ <span style="color: #7a0874; font-weight: bold;">cd</span> gcaldaemon
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>downloads.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>gcaldaemon<span style="color: #000000; font-weight: bold;">/</span>gcaldaemon-linux-<span style="color: #000000;">1.0</span>-beta16.zip
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>create-package.sh gcaldaemon-linux-<span style="color: #000000;">1.0</span>-beta16.zip <span style="color: #ff0000;">'gcaldaemon_1.0beta16~ubuntu0_all.deb'</span>
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> gcaldaemon_1.0beta16~ubuntu0_all.deb</pre></div></div>

<p><strong>Update Apr/09: Ubuntu 9.04, Jaunty Jackalope</strong>: As <a href="#comment-4872">Jens</a> just wrote in the comments-section, the deb-package seems to work for Jaunty as well without complications. Yeyy!</p>
<h3>Download and install</h3>
<p>Alternatively to creating the package from my source, you can just download and install it from my deb-file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>blog.philippheckel.com<span style="color: #000000; font-weight: bold;">/</span>uploads<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2008</span><span style="color: #000000; font-weight: bold;">/</span>09<span style="color: #000000; font-weight: bold;">/</span>gcaldaemon_1.0beta16~ubuntu0_all.deb
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> gcaldaemon_1.0beta16~ubuntu0_all.deb</pre></div></div>

<p>The following tools will be available:</p>
<ul>
<li><strong>gcaldaemon</strong><br />Start/stop/restart the daemon.</li>
<li><strong>gcaldaemon-sync-now</strong><br />For immediate synchronization.</li>
<li><strong>gcaldaemon-config</strong><br />Open the graphical config editor.<br />Also available via the menu â€žUtilities -> Configure GCALDaemonâ€.</li>
<li><strong>gcaldaemon-password-encoder</strong><br />Encode passwords for the config file.</li>
</ul>
<h3>Configuration</h3>
<p>Each user of the system can have his or her own instance of the daemon running.<br />
The config file is located at <strong>~/.gcaldaemon/conf/gcal-daemon.cfg</strong>.</p>
<p>To edit the config file, you can either use your favorite editor, e.g. <em>vi</em> or use the GCALDaemon config editor GUI:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ gcaldaemon-config</pre></div></div>

<p>You can also open the config editor via the menu:  &bdquo;Utilities -&gt; Configure GCALDaemon&rdquo;.</p>
<p>To create passwords for the config file use the <em>gcaldaemon-password-encoder</em>-script. For details about the config options, please read the <a href="http://gcaldaemon.sourceforge.net/usage.html">GCALDaemon documentation</a>.</p>
<h3>Running GCALDaemon</h3>
<p>I have simplified the way how to start/stop the daemon with a small script. Simply type &#8220;gcaldaemon&#8221; to see what it can do. </p>
<p>To start, restart, stop and check the status (just like in an init-script), type:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ gcaldaemon start
Starting GCALDaemon ... ok
&nbsp;
$ gcaldaemon status
GCALDaemon is running <span style="color: #c20cb9; font-weight: bold;">as</span> PID 30543.
&nbsp;
$ gcaldaemon restart
Stopping GCALDaemon ... ok
Starting GCALDaemon ... ok
&nbsp;
$ gcaldaemon stop
Stopping GCALDaemon ... ok</pre></div></div>

<h3>Enable autostart for GCALDaemon</h3>
<p>To enable the autostart-option for GNOME or KDE, type:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ gcaldaemon <span style="color: #7a0874; font-weight: bold;">enable</span> kde
$ gcaldaemon <span style="color: #7a0874; font-weight: bold;">enable</span> kde4
$ gcaldaemon <span style="color: #7a0874; font-weight: bold;">enable</span> gnome</pre></div></div>

<p>As a GNOME user, it&#8217;s also possible to enable/disable the daemon autostart via the menu &bdquo;System -&gt; Settings -&gt; Sessions&rdquo;</p>
<h2>Finally &#8230;</h3>
<p>I know that the package is far from perfect, but it&#8217;s a lot easier to install/configure than the original package. Feedback is always welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2008/09/30/gcaldaemon-deb-package-for-ubuntu-kubuntu/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>Copy videos from Youtube &amp; Co. to your iPod Video with Ubuntu</title>
		<link>http://blog.philippheckel.com/2008/07/29/copy-videos-from-youtube-to-your-ipod-video-with-ubuntu/</link>
		<comments>http://blog.philippheckel.com/2008/07/29/copy-videos-from-youtube-to-your-ipod-video-with-ubuntu/#comments</comments>
		<pubDate>Tue, 29 Jul 2008 16:22:04 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Multimedia]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2008/07/30/copy-videos-from-youtube-co-to-your-ipod-video-with-ubuntu/</guid>
		<description><![CDATA[Since nearly everybody in the US and more and more Europeans have an iPod and the whole world loves Youtube, wouldn&#8217;t it be nice to copy these flash streaming videos (flv-files) to your iPod Video? &#8212; Yes, it is possible. And I will tell you how.

1st step: Copy the flash video files (capture the FLV-files)
Ubuntu [...]]]></description>
			<content:encoded><![CDATA[<p>Since nearly everybody in the US and more and more Europeans have an iPod and the whole world loves Youtube, wouldn&#8217;t it be nice to copy these flash streaming videos (flv-files) to your iPod Video? &#8212; Yes, it is possible. And I will tell you how.</p>
<p><span id="more-8"></span></p>
<h3>1<sup>st</sup> step: Copy the flash video files (capture the FLV-files)</h3>
<p>Ubuntu (and I guess nearly every Linux distribution) makes it really easy to download the flash videos which can be streamed on platforms like Youtube and all the others. <em>Bad luck for Windows users.</em></p>
<ul>
<li>Just open your browser (Opera in my case, Firefox does it too)</li>
<li>Go to the website with the video you want to stream</li>
<li>Hit &#8220;Play&#8221;, wait a few seconds and push &#8220;Pause&#8221; so that the video starts to buffer</li>
<li>Now open the <em>/tmp</em>-folder in a file manager like Nautilus or Konquerer</li>
<li>You will find a file with a name like &#8220;Flashzad23&#8243;, in any case something starting with &#8220;Flash&#8221;</li>
<li>Rename this file to &#8220;my-youtube-video.flv&#8221;. This also works when the buffering process has not been finished yet</li>
</ul>
<p>That&#8217;s it. </p>
<p>If you just want to watch the video, it&#8217;s possible to just open it with your favourite player such as VLC, Totem, MPlayer, etc. This also works while it is still buffering! But since you want to copy it to the iPod Video, you need to resize/re-encode it to a <em>m4v</em>- or <em>mov</em>-file.</p>
<h3>2<sup>nd</sup> step: Resize/Re-encode the flv-file for the iPod Video</h3>
<p>Unfortunately, I didn&#8217;t find a perfect <em>and</em> fast solution to re-encode flv-videos for the iPod. I will demonstrate two ways, the <em>fast</em> one for movies and series you only want to watch once. And the <em>perfect</em> one for videos you want to keep on the iPod for a longer time.</p>
<h4>Install &#8220;ffmpeg&#8221; from the Medibuntu repository</h4>
<p>For both ways it is at least necessary to install the packages <em>ffmpeg</em> and <em>libavcodec0</em> from the Medibuntu Repository instead of the regular Ubuntu reps. </p>
<p>You can find out how to do this on the <a href="https://help.ubuntu.com/community/Medibuntu">Ubuntu help pages</a>.</p>
<h4>The fast way</h4>
<p>The fast way a one big <em>disadvantage</em>: The iPod isn&#8217;t able to estimate the length of the video. That means it&#8217;s not possible to use the nice diamond control to jump within the video. Regular rewind and fast-forward is still possible anyway.</p>
<p>Luckily, you only need one tool: ffmpeg. Just install it via apt-get:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">ffmpeg</span></pre></div></div>

<p>Basically, just use this command to convert a flv-file to a mov-file (readable/playable by the iPod Video):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ffmpeg</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">&quot;my-youtube-video.flv&quot;</span> <span style="color: #660033;">-f</span> mp4 <span style="color: #660033;">-vcodec</span> mpeg4 <span style="color: #660033;">-maxrate</span> 1000k \
   <span style="color: #660033;">-b</span> 700k <span style="color: #660033;">-qmin</span> <span style="color: #000000;">3</span> <span style="color: #660033;">-qmax</span> <span style="color: #000000;">5</span> <span style="color: #660033;">-bufsize</span> <span style="color: #000000;">4096</span> <span style="color: #660033;">-g</span> <span style="color: #000000;">300</span> <span style="color: #660033;">-acodec</span> aac <span style="color: #660033;">-ab</span> 192k \
   <span style="color: #660033;">-s</span> 320x240 <span style="color: #660033;">-aspect</span> <span style="color: #000000;">4</span>:<span style="color: #000000;">3</span> <span style="color: #ff0000;">&quot;my-youtube-video.mov&quot;</span></pre></div></div>

<p>To simplify the mass-conversion, I wrote a tiny script which can be copied to your own &#8220;.bin&#8221;-directory (cp. <a href="/2008/05/16/launch-nautilus-with-the-current-working-directory/">this article</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #000000; font-weight: bold;">@</span>; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #c20cb9; font-weight: bold;">ffmpeg</span> <span style="color: #660033;">-i</span> <span style="color: #007800;">$file</span> <span style="color: #660033;">-f</span> mp4 <span style="color: #660033;">-vcodec</span> mpeg4 <span style="color: #660033;">-maxrate</span> 1000k <span style="color: #660033;">-b</span> 700k <span style="color: #660033;">-qmin</span> <span style="color: #000000;">3</span> <span style="color: #660033;">-qmax</span> <span style="color: #000000;">5</span> \
           <span style="color: #660033;">-bufsize</span> <span style="color: #000000;">4096</span> <span style="color: #660033;">-g</span> <span style="color: #000000;">300</span> <span style="color: #660033;">-acodec</span> aac <span style="color: #660033;">-ab</span> 192k <span style="color: #660033;">-s</span> 320x240 <span style="color: #660033;">-aspect</span> <span style="color: #000000;">4</span>:<span style="color: #000000;">3</span> <span style="color: #007800;">$file</span>.mov
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<h4>The perfect (and slow) way</h4>
<p>Well, this way might be the better one since the disadvantage from above doesn&#8217;t occur. Unfortunately, it does take <em>a lot longer</em>. A LOT! But just try it out by yourself.</p>
<p>I found an <a href="/uploads/2008/07/flv2ipod.sh">flv-to-iPod (m4v) encoding script</a> on ubuntu.com written by John Dong. Find instructions and installation hints to the script on the <a href="https://help.ubuntu.com/community/iPodVideoEncoding#Script 1: pypodconv Script">Ubuntu Wiki</a></p>
<h3>3<sup>rd</sup> and last step: Transfer the video to the iPod</h3>
<p>Use gtkpod or your favorite iPod managing software to transfer the video to your iPod.<br />
I hope this helped a little. Please let me know if you have difficulties or found a better (easier) way to do the conversion!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2008/07/29/copy-videos-from-youtube-to-your-ipod-video-with-ubuntu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
