<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://scox.info/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
  <title>scox.info - Random Thoughts</title>
  <link>http://scox.info/</link>
  <description></description>
  <language>en</language>
  <pubDate>Tue, 21 Oct 2008 19:14:45 +0200</pubDate>
  <copyright></copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Migrating from Mephisto to Dotclear 2</title>
    <link>http://scox.info/post/2008/06/10/Migrating-from-Mephisto-to-Dotclear-2</link>
    <guid isPermaLink="false">urn:md5:977d6bfa842850f31311d1d3a130f3e6</guid>
    <pubDate>Tue, 10 Jun 2008 02:42:00 +0200</pubDate>
    <dc:creator>scox</dc:creator>
        <category>code</category>
        <category>dotclear</category><category>mephisto</category>    
    <description>    &lt;p&gt;It's been a while since my last post. Beside the fact that I was busy, the reason preventing me from posting is that the blogging engine I was using (&lt;a href=&quot;http://mephistoblog.com/&quot; hreflang=&quot;en&quot;&gt;Mephisto&lt;/a&gt;) was in a bad shape.
It seemed &lt;a href=&quot;http://mephistoblog.com/2007/3/22/is-mephisto-dead&quot; hreflang=&quot;en&quot;&gt;unmaintaned&lt;/a&gt;, managed to consume all the server memory and didn't survive a rails upgrade.&lt;/p&gt;


&lt;p&gt;That's why I've decided to migrate to &lt;a href=&quot;http://dev.dotclear.net/2.0/&quot; hreflang=&quot;fr&quot;&gt;Dotclear 2&lt;/a&gt;, which seems to be a nice and clean blogging engine.
However, in the migration process, I didn't want to lose:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All my previsous posts (both published and pending)&lt;/li&gt;
&lt;li&gt;All the comments&lt;/li&gt;
&lt;li&gt;Associated metadata (categories, tags and so on)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dotclear has a nice builtin plugin called &lt;em&gt;Import/Export&lt;/em&gt; which let you save and restore backups of your blog.
All I did was writing a Ruby script that generates a dump of the Mephisto database using &lt;em&gt;ActiveRecord&lt;/em&gt; in the same format as &lt;em&gt;Import/Export&lt;/em&gt;, ready to be imported.
It is available &lt;a href=&quot;http://scox.info/public/code/export_to_dc2.rb&quot;&gt;here&lt;/a&gt; and works in the following way:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Place it under the &lt;em&gt;script&lt;/em&gt; directory of your Mephisto rails root&lt;/li&gt;
&lt;li&gt;Edit the first lines (set your Dotclear 2 &lt;strong&gt;login&lt;/strong&gt; and &lt;strong&gt;blog id&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;Run it and redirect the output to your favorite location:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;ruby script/migrate_to_dc2.rb &amp;gt; public/dump.dc2&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Retrieve the dump file (e.g. dump.dc2) and import it in the &quot;Import/Export&quot; area, under the &lt;em&gt;Import a single blog&lt;/em&gt; section.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That's it, you're done. It should have imported all your blog posts (and preserved publish dates as well as many other attributes), comments, metadatas etc.&lt;/p&gt;


&lt;p&gt;I also wanted to maintain backward URL compatibility with Mephisto. A couple of &lt;em&gt;mod_rewrite&lt;/em&gt; rules did the trick:&lt;/p&gt;
&lt;pre&gt;
# Mephisto URL compatiblity
RewriteEngine On
# Feeds
RewriteRule ^/feed/atom.xml /feed/atom [L,R=301]
RewriteRule ^/feed/all_comments.xml$ /feed/atom/comments [L,R=301]
# Posts
RewriteRule (^/200\d.*) /post$1 [QSA,L,R=301]
&lt;/pre&gt;


&lt;p&gt;That's all. I hope it will be useful to anyone wishing to migrate to Dotclear 2, as the process of creating that script is quite annoying :)&lt;/p&gt;</description>
    
          <enclosure url="http://scox.info/public/code/export_to_dc2.rb"
      length="4598" type="text/plain" />
    
    
          <comments>http://scox.info/post/2008/06/10/Migrating-from-Mephisto-to-Dotclear-2#comment-form</comments>
      <wfw:comment>http://scox.info/post/2008/06/10/Migrating-from-Mephisto-to-Dotclear-2#comment-form</wfw:comment>
      <wfw:commentRss>http://scox.info/feed/rss2/comments/7</wfw:commentRss>
      </item>
    
  <item>
    <title>Yet another release of pam_usb</title>
    <link>http://scox.info/post/2007/9/15/yet-another-release-of-pam_usb</link>
    <guid isPermaLink="false">urn:md5:f8df94c6ff1a0e70bc4f455db67b77bc</guid>
    <pubDate>Sat, 15 Sep 2007 01:24:00 +0000</pubDate>
    <dc:creator>scox</dc:creator>
        <category>security</category>
        <category>pam_usb</category>    
    <description>    &lt;p&gt;Just a quick blog entry to introduce you to the new version of pam_usb (0.4.2), which I've just released a few minutes ago.&lt;/p&gt;
&lt;p&gt;This release focuses on bugfixes and small enhancements. Here's a non exhaustive list of them:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Better hardware support: Thanks to user feedback, a lot of improvements have been made in hardware support. Now devices without vendor and model informations can be used for authentication.&lt;/li&gt;
&lt;li&gt;Support for non USB devices: You can now use every kind of removable storage devices, such as SD or MMC cards.&lt;/li&gt;
&lt;li&gt;Reduced writing to the device: &lt;a href=&quot;http://scox.info/2007/4/8/one-time-pads-the-new-authentication-model-of-pam_usb&quot;&gt;Pads&lt;/a&gt; aren't updated everytime you authenticate anymore, but (by default) only once an hour. This feature can be turned off by setting &lt;em&gt;pads_expiration&lt;/em&gt; to &lt;em&gt;0&lt;/em&gt;, or you can adjust it to a more suitable value (2h, 10m etc are valid options).&lt;/li&gt;
&lt;li&gt;Many other smaller bugfixes and features have been included, such as the &lt;a href=&quot;http://scox.info/2007/8/25/using-dbus-from-setuid-applications&quot;&gt;DBUS workaround&lt;/a&gt; and support for Python 2.5.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;I'd like to thank all the users who contributed by sending their feedback and patches.&lt;/p&gt;</description>
    
    
    
          <comments>http://scox.info/post/2007/9/15/yet-another-release-of-pam_usb#comment-form</comments>
      <wfw:comment>http://scox.info/post/2007/9/15/yet-another-release-of-pam_usb#comment-form</wfw:comment>
      <wfw:commentRss>http://scox.info/feed/rss2/comments/6</wfw:commentRss>
      </item>
    
  <item>
    <title>Using D-Bus from setuid applications</title>
    <link>http://scox.info/post/2007/8/25/using-dbus-from-setuid-applications</link>
    <guid isPermaLink="false">urn:md5:7096cfdf61cec980749d348fba4c8ca1</guid>
    <pubDate>Sat, 25 Aug 2007 15:00:00 +0000</pubDate>
    <dc:creator>scox</dc:creator>
        <category>code</category>
        <category>DBUS</category><category>HAL</category>    
    <description>    &lt;p&gt;When trying to connect to the system bus from a setuid application, D-Bus throws back the following error:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;After some debugging, I found that the problem is a bug in the D-Bus EXTERNAL authentication method: the library sends the real UID while the daemon checks the effective UID, which of course doesn't work at all in setuid applications.&lt;/p&gt;
&lt;p&gt;I filed a &lt;a href=&quot;https://bugs.freedesktop.org/show_bug.cgi?id=11876&quot;&gt;bug report&lt;/a&gt; in the &lt;a href=&quot;https://bugs.freedesktop.org/show_bug.cgi?id=11876&quot;&gt;Freedesktop Bugzilla&lt;/a&gt; and provideda &lt;a href=&quot;https://bugs.freedesktop.org/attachment.cgi?id=11021&quot;&gt;patch&lt;/a&gt; which is yet to be merged.&lt;/p&gt;
&lt;p&gt;In the meantime, if you need to use D-Bus in a setuid application, the following code might help:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;DBusConnection *my_dbus_bus_get(DBusBusType type, DBusError *error)&lt;br /&gt;{&lt;br /&gt;        DBusConnection  *bus = NULL;&lt;br /&gt;&lt;br /&gt;        if (!(bus = dbus_bus_get(type, error)))&lt;br /&gt;        {&lt;br /&gt;                /* The connection to the BUS failed, we now check&lt;br /&gt;                 * if we are running as setuid. */&lt;br /&gt;                uid_t                   ruid;&lt;br /&gt;                uid_t                   euid;&lt;br /&gt;&lt;br /&gt;                if (!(euid = geteuid()) &amp;amp;&amp;amp; (ruid = getuid()))&lt;br /&gt;                {&lt;br /&gt;                        /* In that case, we temporary change our&lt;br /&gt;                         * real uid to the effective uid and try again */&lt;br /&gt;                        dbus_error_free(error);&lt;br /&gt;                        setreuid(euid, euid);&lt;br /&gt;                        bus = dbus_bus_get(type, error);&lt;br /&gt;                        setreuid(ruid, euid);&lt;br /&gt;                }&lt;br /&gt;        }&lt;br /&gt;        return bus;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This workaround is a function you'll have to call instead of the regular &lt;em&gt;dbus_bus_get()&lt;/em&gt;. In case the connection fails and it's running on a setuid application, it will change the real UID to match the effective UID so the authentication process will succeed, make a connection to D-Bus and restore everything back.&lt;/p&gt;</description>
    
    
    
          <comments>http://scox.info/post/2007/8/25/using-dbus-from-setuid-applications#comment-form</comments>
      <wfw:comment>http://scox.info/post/2007/8/25/using-dbus-from-setuid-applications#comment-form</wfw:comment>
      <wfw:commentRss>http://scox.info/feed/rss2/comments/4</wfw:commentRss>
      </item>
    
  <item>
    <title>Mephisto Obfuscation Plugin</title>
    <link>http://scox.info/post/2007/4/23/mephisto-obfuscation-plugin</link>
    <guid isPermaLink="false">urn:md5:8831feb025fcf80055ac81337edac174</guid>
    <pubDate>Sun, 22 Apr 2007 20:42:00 +0000</pubDate>
    <dc:creator>scox</dc:creator>
        <category>spam</category>
        <category>mephisto</category><category>obfuscation</category><category>spam</category>    
    <description>    &lt;p&gt;Being tired of receiving &lt;strong&gt;tons&lt;/strong&gt; of spam everyday, I wanted to hide my e-mail address in a more efficient way than the usual &lt;em&gt;user at example dot com&lt;/em&gt;. I needed to obfuscate my address to spam crawlers while keeping it readable by human beings. I've created a simple &lt;a href=&quot;http://mephistoblog.com/&quot;&gt;Mephisto&lt;/a&gt; plugin to help me do so, called &lt;em&gt;MephistoObfuscate&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Basically, this plugin encodes email addresses (or any text you'd like) into &lt;a href=&quot;http://en.wikipedia.org/wiki/Base64&quot;&gt;Base64&lt;/a&gt; and lets the browser decode them using some JavaScript on the client side. That way, the address is protected from crawlers blindly scanning the HTML page but is still readable by JavaScript-enabled browsers.&lt;/p&gt;
&lt;h3&gt;Example&lt;/h3&gt;
&lt;p&gt;Using &lt;em&gt;MephistoObfuscate&lt;/em&gt; is pretty straightforward, you can either use a Liquid filter on your templates (useful to show a contact address on the layout, just like the one on the right sidebar of this page):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{{ &quot;user@example.com&quot; | obfuscate }}&lt;/code&gt;&lt;/pre&gt;Or you can use a macro filter within your blog posts:
&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;filter:obfuscate&amp;gt;user@example.com&amp;lt;/filter:obfuscate&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Both of these will be obfuscated into something like:
&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;span class=&quot;obfuscated&quot;&amp;gt;dXNlckBleGFtcGxlLmNvbQ==l&amp;lt;/span&amp;gt;&lt;/code&gt;
&lt;br /&gt;&lt;br /&gt;Which is not something most if not all spam crawlers will understand. While loading the page the JavaScript code will restore the address back into a human readable fashion.
&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Installing&lt;/h3&gt;
To install just run
&lt;br /&gt;&lt;code&gt;&lt;br /&gt;script/plugin install svn://svn.sig11.org/mephisto_obfuscate&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;After this, add the javascript include statements into your layout:
&lt;br /&gt;&lt;code&gt;&lt;br /&gt;{{ 'obfuscate' | javascript }}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;That's it, you're done.</description>
    
    
    
          <comments>http://scox.info/post/2007/4/23/mephisto-obfuscation-plugin#comment-form</comments>
      <wfw:comment>http://scox.info/post/2007/4/23/mephisto-obfuscation-plugin#comment-form</wfw:comment>
      <wfw:commentRss>http://scox.info/feed/rss2/comments/3</wfw:commentRss>
      </item>
    
  <item>
    <title>pam_usb: Finally a new release</title>
    <link>http://scox.info/post/2007/4/9/pam_usb-finally-a-new-release</link>
    <guid isPermaLink="false">urn:md5:8b17ecfe568f3f381a8b980c6014abd7</guid>
    <pubDate>Mon, 09 Apr 2007 22:22:00 +0000</pubDate>
    <dc:creator>scox</dc:creator>
        <category>security</category>
        <category>pam_usb</category>    
    <description>    &lt;p&gt;After way too much time, I have finally released &lt;a href=&quot;http://www.pamusb.org/&quot;&gt;pam_usb&lt;/a&gt; &lt;strong&gt;0.4.0&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For those of you not familiar with the project, it &quot;&lt;em&gt;provides hardware authentication for Linux using ordinary USB Flash Drives&lt;/em&gt;&quot;.Basically, it makes applications such as GDM/KDM, gnome-screensaver/kscreensaver, su/sudo and so forth authenticate users using a USB stick instead of askingfor a password over and over. If you're lazy like me, you'll appreciate it.&lt;/p&gt;
&lt;p&gt;So, what's new with this release ? Well, everything. For starters, I've rewritten everything from scratch. It contains many new features,including &lt;a href=&quot;http://scox.info/2007/4/8/one-time-pads-the-new-authentication-model-of-pam_usb&quot;&gt;one time pads authentication&lt;/a&gt; and support for hardware detection through&lt;a href=&quot;http://freedesktop.org/wiki/Software_2fhal&quot;&gt;HAL&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I've also written a set of tools in Python:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;pamusb-agent&lt;/strong&gt;, a daemon that can trigger actions (such as locking the screen) upon device authentication and removal.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;pamusb-conf&lt;/strong&gt;, a tool that can save you the hassle of editing &lt;em&gt;pamusb.conf&lt;/em&gt; by hand. As for now, it supports the &lt;em&gt;--add-device&lt;/em&gt; and &lt;em&gt;--add-user&lt;/em&gt; options.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;The project has now a brand new website powered by the &lt;a href=&quot;http://wiki.splitbrain.org/wiki:dokuwiki&quot;&gt;Dokuwiki&lt;/a&gt; wiki engine.I have also reworked the documentation as the old one seemed to scare people. Someday I'll probably do a screencast to show how to setup pam_usb in 5 minutes. Until then, have fun with the documentation :)&lt;/p&gt;</description>
    
    
    
          <comments>http://scox.info/post/2007/4/9/pam_usb-finally-a-new-release#comment-form</comments>
      <wfw:comment>http://scox.info/post/2007/4/9/pam_usb-finally-a-new-release#comment-form</wfw:comment>
      <wfw:commentRss>http://scox.info/feed/rss2/comments/2</wfw:commentRss>
      </item>
    
  <item>
    <title>One Time Pads: The new authentication model of pam_usb</title>
    <link>http://scox.info/post/2007/4/8/one-time-pads-the-new-authentication-model-of-pam_usb</link>
    <guid isPermaLink="false">urn:md5:17e607bdb7a1385dacf624dd75d3e65e</guid>
    <pubDate>Sun, 08 Apr 2007 22:46:00 +0000</pubDate>
    <dc:creator>scox</dc:creator>
        <category>security</category>
        <category>one time pads</category><category>pam_usb</category>    
    <description>    &lt;p&gt;The way &lt;a href=&quot;http://www.pamusb.org/&quot;&gt;pam_usb&lt;/a&gt; performed authentication was inspired by smartcards: a private key was stored inside the device and the public part of the key inside the computer. The problem is that, unlike smartcards, the content of a USB device is readable meaning that the private key could be stolen by anyone borrowing your flash drive. Sure, the device is also identified by its manufacturer attributes (serial number and alike), but I'm pretty much sure those informations can be forged.&lt;/p&gt;
&lt;p&gt;Knowing that the content of the USB device is unreliable (as it can be stolen), I came up with a different approach for authenticating a device called &lt;em&gt;One Time Pads authentication&lt;/em&gt;. Basically, a &lt;em&gt;pad&lt;/em&gt; is just a bunch of random bytes stored on both the USB device and the computer. Every time you authenticate, those &lt;em&gt;pads&lt;/em&gt; are compared. If they match, access is granted and the pads are regenerated, otherwise access is denied.&lt;/p&gt;
&lt;p&gt;This means that even if someone manages to fake your device's manufacturer attributes and to steal your pads, as soon as you authenticate the pads will be regenerated, making the one they have stolen invalid.It's like having a very long random generated one time password, except the fact you don't have to remember such password.&lt;/p&gt;
&lt;p&gt;Let's see one time pads in action:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;First, just as our attacker, we start by stealing our own pad:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;        scox@helium ~ $ cp /media/disk/.pamusb/root.helium.pad /tmp&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;Then we authenticate. As you can see, the pads are verified, then &lt;strong&gt;updated&lt;/strong&gt;:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;        scox@helium ~ $ su&lt;br /&gt;        * pam_usb vSVN&lt;br /&gt;        * Authentication request for user &quot;root&quot; (su)&lt;br /&gt;        * Device &quot;sandisk&quot; is connected (good).&lt;br /&gt;        * Performing one time pad verification...&lt;br /&gt;        * Verification match, updating one time pads...&lt;br /&gt;        * Access granted.&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;Now we are the attacker. We start by putting the stolen pad back into a device (assuming the device has the same serial number as ours) and try to authenticate:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;        scox@helium ~ $ cp /tmp/root.helium.pad /media/disk/.pamusb/&lt;br /&gt;        scox@helium ~ $ su&lt;br /&gt;        * pam_usb vSVN&lt;br /&gt;        * Authentication request for user &quot;root&quot; (su)&lt;br /&gt;        * Device &quot;sandisk&quot; is connected (good).&lt;br /&gt;        * Performing one time pad verification...&lt;br /&gt;        * Pad checking failed !&lt;br /&gt;        * Access denied.&lt;br /&gt;        Password: &lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It may not be the safest authentication ever, but it's cheap (everyone has a USB flash drive nowadays), pretty much secure for common usage and avoids the hassle of remembering and typing passwords.I'll be releasing pam_usb 0.4.0 which contains one time pads authentication in the next few days, so stay tuned.&lt;/p&gt;</description>
    
    
    
          <comments>http://scox.info/post/2007/4/8/one-time-pads-the-new-authentication-model-of-pam_usb#comment-form</comments>
      <wfw:comment>http://scox.info/post/2007/4/8/one-time-pads-the-new-authentication-model-of-pam_usb#comment-form</wfw:comment>
      <wfw:commentRss>http://scox.info/feed/rss2/comments/1</wfw:commentRss>
      </item>
    
</channel>
</rss>