<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Straight Ornamental: Category Linux</title>
    <link>http://grahamstratton.org/blog/public/articles/category/linux</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Ramblings from a rambler</description>
    <item>
      <title>Reasonably secure automated rsync backups</title>
      <description>&lt;p&gt;Rsync is one of those wondrous unix utilities that it&amp;#8217;s difficult to imagine a world without.  Amongst many other uses, it&amp;#8217;s a really good way to do daily backups.&lt;/p&gt;


	&lt;p&gt;Using &lt;span class="caps"&gt;SSH&lt;/span&gt;, rsync is secure too.  But for automated access it&amp;#8217;s a bit tricky.  In order to do automated backups, one needs to set up some sort of passwordless login. This is done by generating an &lt;span class="caps"&gt;RSA&lt;/span&gt; key pair on machine A, and copying the public key to machine B.  Now when A tries to log in to B, B has a way to test that A really is A. Cool. But that means that A being compromised leads trivally to B being compromised.&lt;/p&gt;


	&lt;p&gt;The solution is to limit the range of commands that A can execute on B using a particular &lt;span class="caps"&gt;SSH&lt;/span&gt; key. One can limit it to a single command by prefixing a line of authorized_keys like this:&lt;/p&gt;


&lt;pre&gt;
command="/bin/echo You may not do anything useful" 
&lt;/pre&gt;

	&lt;p&gt;Now whatever command is sent, this is the command that will be executed.&lt;/p&gt;


	&lt;p&gt;More about restricting &lt;span class="caps"&gt;SSH&lt;/span&gt; is available in chapter 8 of O&amp;#8217;Reilly&amp;#8217;s book at http://www.oreilly.com/catalog/sshtdg/chapter/ch08.html  There are a number of other useful options such as no-port-forwarding, no-X11-forwarding, no-agent-forwarding and no-pty &amp;#8211; don&amp;#8217;t forget options should be separated by commas but no whitespace.&lt;/p&gt;


	&lt;p&gt;So it&amp;#8217;s quite easy to ensure that only a single command is run.  But it&amp;#8217;s not so easy if you don&amp;#8217;t know exactly what the command will be, as with rsync.  In this case, the trick is to run a script which decides whether the original command is permissible.  The requested command is available as the environment variable $SSH_ORIGINAL_COMMAND (or $SSH2_ORIGINAL_COMMAND if you&amp;#8217;re using &lt;span class="caps"&gt;SSH2&lt;/span&gt;, I believe).&lt;/p&gt;


	&lt;p&gt;There is a useful script here: http://servers.linux.com/article.pl?sid=04/11/04/0346256
It checks that the command doesn&amp;#8217;t contain ; or &amp;#38; characters (ie, there is only one command, and that it begins with &amp;#8216;rsync&amp;#8212;server&amp;#8217;.  If the command matches, it runs it, otherwise it rejects it.  This means that you can&amp;#8217;t do anything else with the key you are using for backups (which is good).  But what if you want an &lt;span class="caps"&gt;SSH&lt;/span&gt; identity that you can use for manual logins, which is password protected and stored in your keychain? Easy enough, just create to &lt;span class="caps"&gt;RSA&lt;/span&gt; keys.&lt;/p&gt;


	&lt;p&gt;To specify which key ssh should use, use the -i option:&lt;/p&gt;


&lt;pre&gt;
rsync -e "ssh -i .ssh/id_rsa_backup" --recursive -L /home/graham/tobackup/* back.up/server/
&lt;/pre&gt;</description>
      <pubDate>Mon, 12 Feb 2007 15:13:30 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:e2e9c1e9-fc90-4fc1-997e-cc89e3f7469c</guid>
      <author>Graham Stratton</author>
      <link>http://grahamstratton.org/blog/public/articles/2007/02/12/reasonably-secure-automated-rsync-backups</link>
      <category>Linux</category>
    </item>
    <item>
      <title>Fixing fonts</title>
      <description>&lt;p&gt;After upgrading X to x.org 7.0, I found that some fonts which had previously been anti-aliased were no longer.&lt;/p&gt;


	&lt;p&gt;By running &amp;#8216;dpkg-reconfigure fontconfig-config&amp;#8217; I restored my display to its former glory.  Now all I need to do is to get suspend to work, and I won&amp;#8217;t need a Mac.&lt;/p&gt;</description>
      <pubDate>Wed, 03 May 2006 14:07:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:c37e4c9430d717b76ca7cd87638c6052</guid>
      <author>Graham Stratton</author>
      <link>http://grahamstratton.org/blog/public/articles/2006/05/03/fising-fonts</link>
      <category>Debian</category>
      <category>Linux</category>
    </item>
    <item>
      <title>debian keys</title>
      <description>&lt;p&gt;I just installed kanotix 2005-4, but when I came to install some new packages, I got a warning saying that the packages cannot be authenticated.&lt;/p&gt;


	&lt;p&gt;A bit of googling suggested that I needed to update the debian keys.  This should easily be done with &amp;#8216;apt-key update&amp;#8217;, but that returned an error saying:&lt;/p&gt;


	&lt;p&gt;&lt;span class="caps"&gt;ERROR&lt;/span&gt;: Can&amp;#8217;t find the archive-keyring
Is the debian-keyring package installed?&lt;/p&gt;


	&lt;p&gt;I installed the package, but the error remained.  It seems this is a bug in debian.  Changing&lt;/p&gt;


	&lt;p&gt;&lt;span class="caps"&gt;ARCHIVE&lt;/span&gt;_KEYRING=/usr/share/keyrings/debian-keyring.gpg&lt;/p&gt;


	&lt;p&gt;to&lt;/p&gt;


	&lt;p&gt;&lt;span class="caps"&gt;ARCHIVE&lt;/span&gt;_KEYRING=/usr/share/keyrings/debian-archive-keyring.gpg&lt;/p&gt;


	&lt;p&gt;in /usr/bin/apt-key line 12&lt;/p&gt;


	&lt;p&gt;allowed me to run &amp;#8216;apt-key update&amp;#8217;, which downloaded 903 keys but then hung.  But apt-get update still reported&lt;/p&gt;


	&lt;p&gt;E: Some packages could not be authenticated&lt;/p&gt;


	&lt;p&gt;and apt-get install still gave the error&lt;/p&gt;


	&lt;p&gt;The following signatures couldn&amp;#8217;t be verified because the public key is not available: NO_PUBKEY 010908312D230C5F&lt;/p&gt;


	&lt;p&gt;gpg&amp;#8212;keyserver wwwkeys.eu.pgp.net&amp;#8212;recv-keys 2D230C5F&lt;/p&gt;


	&lt;p&gt;fetches the relevant key successfully.&lt;/p&gt;


	&lt;p&gt;It should then be possible to it them to the keychain with&lt;/p&gt;


	&lt;p&gt;gpg&amp;#8212;armor&amp;#8212;export 2D230C5F | apt-key add -&lt;/p&gt;


	&lt;p&gt;but that command returns&lt;/p&gt;


	&lt;p&gt;gpg: no writable keyring found: eof
gpg: error reading `-&amp;#8217;: general error
gpg: import from `-&amp;#8217; failed: general error&lt;/p&gt;


	&lt;p&gt;Eventually I realised that this is an environment issue. If I ran these commands as root instead of using sudo, the keys can be added.&lt;/p&gt;</description>
      <pubDate>Fri, 10 Feb 2006 14:53:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:e720f648058127487c728ab06ab9ebb5</guid>
      <author>Graham Stratton</author>
      <link>http://grahamstratton.org/blog/public/articles/2006/02/10/debian-keys</link>
      <category>Debian</category>
      <category>Linux</category>
    </item>
    <item>
      <title>Suspend to RAM on C840</title>
      <description>&lt;p&gt;Someone has reported that the instructions at https://wiki.ubuntu.com/HoaryPM work for getting suspend to &lt;span class="caps"&gt;RAM&lt;/span&gt; to work on a Dell Latitude &lt;span class="caps"&gt;C840&lt;/span&gt;.  I&amp;#8217;ll try it with Breezy and report what happens.&lt;/p&gt;</description>
      <pubDate>Sun, 22 Jan 2006 11:50:38 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:c794903379fec4944e72c671392b52aa</guid>
      <author>Graham Stratton</author>
      <link>http://grahamstratton.org/blog/public/articles/2006/01/22/suspend-to-ram-on-c840</link>
      <category>Linux</category>
      <category>Ubuntu</category>
    </item>
  </channel>
</rss>
