<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>The player of games</title>
        <link>http://damien.krotkine.com/blog/</link>
        <description></description>
        <language>en</language>
        <copyright>Copyright 2008</copyright>
        <lastBuildDate>Thu, 13 Nov 2008 15:07:42 +0100</lastBuildDate>
        <generator>http://www.sixapart.com/movabletype/</generator>
        <docs>http://www.rssboard.org/rss-specification</docs>
        
        <item>
            <title>Deny database listing in postgresql</title>
            <description><![CDATA[<p><b><font style="font-size: 1.25em;">The question</font></b><br /></p><p>Few days ago I wanted to configure a postgresql server so that users connecting to their database would not be able to see other databases. Among other things, I wanted to restrict the usage of :</p>

<pre>psql -l database user</pre>

<p>This command will retrieve the list of database on the server, even if the user has no access right to them. If you issue this command, you'll et something like :</p>

<pre>                   List of databases
              Name               |  Owner   | Encoding  
---------------------------------+----------+-----------
 database_1                      | postgres | UTF8
 database_2                      | user_foo | UTF8
 ...
</pre>

<p><font style="font-size: 1.25em;"><b>The solution</b></font></p>

<p>Well at least one solution : in each database, the special virtual table <code>pg_database</code> (see <a href="http://www.postgresql.org/docs/8.3/static/catalog-pg-database.html">here</a> for the documentation) contains the list of all the databases hosted on the server. So if we remove access rights on this table, users won't be able to list the databases anymore.</p>

<p>But wait, this table is available in every databases. So we need to remove these access rights on all databases. So far so good.</p>

<p>Oh but what if a user creates a new database ? Yes, this new database will have this <code>pg_database</code> table, with default access rights, which allow anybody to list its content, thus getting the list of existing databases on the server.</p>

<p>So what we need is to change the access rights of the <code>pg_database</code> on newly crated databases. How do we do that ? by connecting to the special database <code>template1</code> (see <a href="http://www.postgresql.org/docs/8.3/interactive/manage-ag-templatedbs.html">here</a> for the documentation). This database contains the default content (and their associated rights) that are used to populate newly created databases. So in addition to changing the access rights of <code>pg_database</code> on every databases, we'll need to do the same on <code>template1</code>.</p>

<p>Now how do we change the access right? What we want is deny users the right to get the database list. That is, extracting the database list from pg_database. That is, <code>select</code>'ing the data of this table. So we simply need to <b>revoke</b> the <b>select</b> permission on the table, for everybody. We do that with this command :</p>

<p></p><pre>revoke select on pg_database from public;
</pre>

<p>Execute this query on all the databases of your server, plus on the special <code>template1</code> database. Then, trying to list the databases will return :</p>

<p></p><pre>psql -l database user
ERROR:  permission denied for relation pg_database
</pre>

Problem solved.]]></description>
            <link>http://damien.krotkine.com/blog/2008/11/deny-database-listing-in-postg.html</link>
            <guid>http://damien.krotkine.com/blog/2008/11/deny-database-listing-in-postg.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">en</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">linux</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">sql postgresql postgres</category>
            
            <pubDate>Thu, 13 Nov 2008 15:07:42 +0100</pubDate>
        </item>
        
        <item>
            <title>Geek diagram</title>
            <description><![CDATA[<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://damien.krotkine.com/blog/fun/home.png"><img alt="home.png" src="http://damien.krotkine.com/blog/fun/home-thumb-200x136.png" width="200" height="136" class="mt-image-right" style="float: right; margin: 0 0 20px 20px;" /></a></span>
Some time ago I played with <a href="http://www.omnigroup.com/applications/OmniGraffle/">Omnigraffle</a> because they were offering free beta licenses. I draw the electronic installation diagram of my living room, check it out.</p>]]></description>
            <link>http://damien.krotkine.com/blog/2008/07/geek-diagram.html</link>
            <guid>http://damien.krotkine.com/blog/2008/07/geek-diagram.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">en</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">fun</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">linux</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">mac</category>
            
            
            <pubDate>Sun, 27 Jul 2008 12:53:39 +0100</pubDate>
        </item>
        
        <item>
            <title>Apache RewriteRule nightmare</title>
            <description><![CDATA[<p>I spent 2 hours banging my head against the wall regarding <em>Apache RewriteRule</em>. What I wanted was simple :</p>


<ul>
<li>Redirect every <em>http://</em> <span class="caps">URL</span>s to <em>https://</em></li>
<li>Except if it's the <em>atom</em> or <em><span class="caps">RSS</span></em> <span class="caps">URL</span></li>
<li>Redirect the <em>https://.*atom.xml</em> or rss <span class="caps">URL </span>to <em>http://</em></li>
</ul>



<p>And I failed. I couldn't make a pattern that says : "that doesn't end with atom.xml" or similar...</p>

<p>So I ended up with a compromise : only redirect <em>/cgi-bin/mt</em> <span class="caps">URL</span>s to <em>https://</em>. It works but I'm not quite satisfied. I'll give it another try later</p>]]></description>
            <link>http://damien.krotkine.com/blog/2008/07/apace-rewriterule-nightmare.html</link>
            <guid>http://damien.krotkine.com/blog/2008/07/apace-rewriterule-nightmare.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">linux</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">mt</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">apache</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">rewriterule</category>
            
            <pubDate>Tue, 15 Jul 2008 03:14:20 +0100</pubDate>
        </item>
        
        <item>
            <title>booh 0.9.1 ebuild</title>
            <description><![CDATA[<p>It's been a long time since my last commit in the gentoo tree ! I had lost motivation and interest. But now I'm back with one simple goal for now : just maintain my ebuilds, don't get involved in any discussion, and take it easy :)</p>

<p>So I'm happy to celebrate my comeback with the much awaited ebuild for the new version of <a href="http://booh.org/">booh</a> : <a href="http://www.gentoo-portage.com/app-misc/booh">0.9.1</a>. </p>

<p>This new version (well actually 0.9.0) brings a lot of new features and programs : album2booh booh-classifier booh-fix-whitebalance booh-gamma-correction webalbum2booh</p>

<p>Enjoy!</p>]]></description>
            <link>http://damien.krotkine.com/blog/2008/07/booh-091-ebuild.html</link>
            <guid>http://damien.krotkine.com/blog/2008/07/booh-091-ebuild.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">en</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">gentoo</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">linux</category>
            
            
            <pubDate>Mon, 07 Jul 2008 14:52:23 +0100</pubDate>
        </item>
        
        <item>
            <title>server reinstallation</title>
            <description><![CDATA[<p>The server I'm paying for (dedibox) crashed for unknown reason, I had to reinstall it. Luckilly enough I could boot in rescue mode and archive my important data, it helped to get everything up and running again, or at least the important bits (gentoo, apache, this blog, postgresql)</p>

<p>The newest addition on this server :</p>


<ul>
<li>squid to act as proxy</li>
<li>backup-manager as a backup solution</li>
</ul>



<p>backup-manager is not very powerful, but it's small, light and simple to install and configure. All you need is Perl and gettext :) It'll do until I migrate to bacula.</p>]]></description>
            <link>http://damien.krotkine.com/blog/2008/07/server-reinstallation.html</link>
            <guid>http://damien.krotkine.com/blog/2008/07/server-reinstallation.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">en</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">gentoo</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">linux</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">mt</category>
            
            
            <pubDate>Fri, 04 Jul 2008 01:09:07 +0100</pubDate>
        </item>
        
        <item>
            <title>ssh, keychain</title>
            <description><![CDATA[<p>On our way back from <span class="caps">FOSDEM,</span> I had a quick discussion about ssh with Chris, and it motivated me to clean up all my ssh keys, passphrases, agents.</p>

<p>So now I use different keys for work and home, and ssh keychain on both.</p>

<p>Next move is to add my work identity to my home session to be able to connect directly to servers at work without having to go through my workstation at work. Without putting my home private id on my machine at work, nor copying my home public id on all servers at work. It should be possible I've heard :)</p>

<p>Anyway, here is briefly how I did it : ssh-keygen (dsa as main key). Then install keychain (see <a href="http://www.gentoo.org/proj/en/keychain/">http://www.gentoo.org/proj/en/keychain/</a> and configure it a bit. I added the following script in /etc/profile.d/keychain.sh (gentoo host), and I use the built in keychain on my mac.</p>

<p>#!/bin/bash<br />
# start keychain, with the private keys to be cached<br />
/usr/bin/keychain ~/.ssh/id_dsa<br />
# then load the generated files<br />
for i in ~/.keychain/*-sh*; do<br />
echo "sourcing $i"<br />
source $i<br />
done</p>

<p>I know, I know, everybody is supposed to know everything about ssh, but I'm happy to admit that I learnt 2 or 3 things while setting up everything properly. Besides, how many of you have no passphrase on your ssh key ? :)</p>]]></description>
            <link>http://damien.krotkine.com/blog/2008/05/ssh-keychain.html</link>
            <guid>http://damien.krotkine.com/blog/2008/05/ssh-keychain.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">en</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">gentoo</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">linux</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">mac</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">keychain</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">ssh</category>
            
            <pubDate>Fri, 16 May 2008 12:07:28 +0100</pubDate>
        </item>
        
        <item>
            <title>FastCgi and Movable Type</title>
            <description><![CDATA[This blog now runs on apache + mod_fastcgi. I can feel the difference, especially given the fact that the hardware is not that powerful. I was curious aboud mod_fcgid, which claims to be better but compatible, but I'm not sure why exactly (I think something to do with better timing in spawning / killing cgi persistents processes).<br /><br />I was willing to move to lighttpd as well, but it looks like it's more work than just installing and configuring mod_fastcgi for apache. By the way, you have to make sure that FCGI (the Perl module) is installed otherwise Movable Type will refuse to work.<br />]]></description>
            <link>http://damien.krotkine.com/blog/2008/04/fastcgi-and-movable-type.html</link>
            <guid>http://damien.krotkine.com/blog/2008/04/fastcgi-and-movable-type.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">en</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">gentoo</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">linux</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">apache</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">fastcgi</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">mt</category>
            
            <pubDate>Sun, 06 Apr 2008 05:14:37 +0100</pubDate>
        </item>
        
        <item>
            <title>padlock encryption</title>
            <description><![CDATA[<p>This server this site is running on has a <span class="caps">VIA CPU</span>with PadLock features enabled. That allows fast hardware accelerated encryption, namely <span class="caps">AES, SHA1, SHA256.</span> With modern kernel and openssl, there is no special patch needed. However, some application using encryption still need a patch to use the hardware feature.</p>

<p>If you are running a PadLock enabled Via <span class="caps">CPU, </span><a href="http://www.logix.cz/michal/devel/padlock/">this page</a> has a list of patches for various linux programs. Look at the bottom of the page for contributions, and see if you're using any of these software. Even if you are using the same version, I recommend you to check if the patch hasn't been already applied by the maintainers of your linux distribution.</p>

<p>I applied the patchs for openssh, lighthttpd and a couple of other software.</p>]]></description>
            <link>http://damien.krotkine.com/blog/2008/04/padlock-encryption.html</link>
            <guid>http://damien.krotkine.com/blog/2008/04/padlock-encryption.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">en</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">linux</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">crypto</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">openssh</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">padlock</category>
            
            <pubDate>Sat, 05 Apr 2008 15:00:00 +0100</pubDate>
        </item>
        
    </channel>
</rss>
