<?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>Crafting software&#187; Ubuntu</title>
	<atom:link href="http://davidlaing.com/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidlaing.com</link>
	<description>David Laing&#039;s thoughts on software development</description>
	<lastBuildDate>Wed, 01 Feb 2012 11:02:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Apache2 on Ubuntu 8.04LTS; restrict access to PAM authenticated users</title>
		<link>http://davidlaing.com/2008/12/27/apache2-on-ubuntu-804lts-restrict-access-to-pam-authenticated-users/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=apache2-on-ubuntu-804lts-restrict-access-to-pam-authenticated-users</link>
		<comments>http://davidlaing.com/2008/12/27/apache2-on-ubuntu-804lts-restrict-access-to-pam-authenticated-users/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 19:40:26 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[pam]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=140</guid>
		<description><![CDATA[I have a couple of static pages that I want to restrict access to. I don&#8217;t want to manage another set of usernames &#38; passwds, so I&#8217;d like apache2 to authenticate off the standard users on my system, via PAM. To get this to work, you need to install and configure mod_auth_pam and mod_auth_shadow aptitude [...]]]></description>
			<content:encoded><![CDATA[<p>I have a couple of static pages that I want to restrict access to.</p>
<p>I don&#8217;t want to manage another set of usernames &amp; passwds, so I&#8217;d like apache2 to authenticate off the standard users on my system, via PAM.</p>
<p>To get this to work, you need to install and configure mod_auth_pam and mod_auth_shadow</p>
<pre>aptitude install libapache2-mod-auth-pam libapache2-mod-auth-shadow</pre>
<p>Ensure the <a href="http://ubuntuforums.org/showthread.php?t=275996">www-data user is part of the shadow group</a>, so apache2 can read the passwords</p>
<pre>usermod -G shadow www-data</pre>
<p>And set up the relevent virtual host:</p>
<pre>

                AuthPAM_Enabled On
                AuthShadow on
                AuthPAM_FallThrough Off
                AuthBasicAuthoritative Off
                AuthType Basic
                AuthName "Restricted to group: sysadmins"
                AuthUserFile /dev/null
                Require group sysadmins</pre>
<p>Restart apache, and you&#8217;re done!</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2008/12/27/apache2-on-ubuntu-804lts-restrict-access-to-pam-authenticated-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Self Cert SSL certificate for Apache2 on Ubuntu 8.04LTS</title>
		<link>http://davidlaing.com/2008/12/27/self-cert-ssl-certificate-for-apache2-on-ubuntu-804lts/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=self-cert-ssl-certificate-for-apache2-on-ubuntu-804lts</link>
		<comments>http://davidlaing.com/2008/12/27/self-cert-ssl-certificate-for-apache2-on-ubuntu-804lts/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 00:42:02 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=136</guid>
		<description><![CDATA[Generate a self cert certificate: https://help.ubuntu.com/8.04/serverguide/C/certificates-and-security.html Create a new virtual host (you can only have one SSL virtual host / IP) sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl Edit ssl sothat it looks like this: NameVirtualHost *:443 ServerName webangle-www1.everyangle.co.uk ServerAdmin webmaster@localhost DocumentRoot /var/www/ SSLEngine on SSLOptions +StrictRequire SSLCertificateFile /etc/ssl/certs/server.crt SSLCertificateKeyFile /etc/ssl/private/server.key Finally, if you want to force redirect [...]]]></description>
			<content:encoded><![CDATA[<p>Generate a self cert certificate:</p>
<p><a href="https://help.ubuntu.com/8.04/serverguide/C/certificates-and-security.html">https://help.ubuntu.com/8.04/serverguide/C/certificates-and-security.html</a></p>
<p>Create a new virtual host (you can only have one SSL virtual host / IP)</p>
<pre>sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl</pre>
<p>Edit ssl sothat it looks like this:<br />
<code>NameVirtualHost *:443</p>
<p>        ServerName webangle-www1.everyangle.co.uk<br />
        ServerAdmin webmaster@localhost</p>
<p>        DocumentRoot /var/www/</p>
<p>        SSLEngine on</p>
<p>        SSLOptions +StrictRequire</p>
<p>        SSLCertificateFile /etc/ssl/certs/server.crt<br />
        SSLCertificateKeyFile /etc/ssl/private/server.key<br />
</code></p>
<p>Finally, if you want to force redirect of all traffic to a certain folder via SSL (e.g, /phpmyadmin), add the following to /etc/apache2/sites-available/default</p>
<pre>
#Redirect traffic to /phpmyadmin through https
        RewriteEngine   on
        RewriteCond     %{SERVER_PORT} ^80$
        RewriteRule     ^/phpmyadmin(.*)$ https://%{SERVER_NAME}/phpmyadmin$1 [L,R]
</pre>
<p>Enable it:</p>
<pre>sudo a2ensite ssl
sudo /etc/init.d/apache2 reload
</pre>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2008/12/27/self-cert-ssl-certificate-for-apache2-on-ubuntu-804lts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automount remote filesystem over SSH</title>
		<link>http://davidlaing.com/2008/12/27/automount-remote-filesystem-over-ssh/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=automount-remote-filesystem-over-ssh</link>
		<comments>http://davidlaing.com/2008/12/27/automount-remote-filesystem-over-ssh/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 23:08:31 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[autofs]]></category>
		<category><![CDATA[sshfs]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=132</guid>
		<description><![CDATA[Previously I posted on how I backup my server&#8217;s data to rsync.net&#8217;s remote storage. A convienient way to access that remote storage is to configure rsync over sshfs: sudo aptitude install sshfs mkdir /mnt/sshfs mkdir /mnt/sshfs/rsync.net sshfs **username**@ch-s011.rsync.net: /mnt/rsync.net Now, test that you can access /mnt/rsync.net, and copy a few files to your remote storage.  if [...]]]></description>
			<content:encoded><![CDATA[<p>Previously I posted on how I backup my server&#8217;s data to rsync.net&#8217;s remote storage.</p>
<p>A convienient way to access that remote storage is to configure rsync over sshfs:</p>
<pre>sudo aptitude install sshfs
mkdir /mnt/sshfs
mkdir /mnt/sshfs/rsync.net
sshfs **username**@ch-s011.rsync.net: /mnt/rsync.net</pre>
<div>Now, test that you can access /mnt/rsync.net, and copy a few files to your remote storage.  if all works well, the next step is to <a href="http://www.tjansson.dk/?p=84">have sshfs automatically connect whenever we try to access the directory</a></div>
<p>First, unmount</p>
<pre>fusermount -u /mnt/rsync.net</pre>
<p>Then, install autofs, and edit the config file</p>
<pre>sudo aptitude install autofs
sudo vi /etc/auto.master</pre>
<p>Add the following line </p>
<pre>/mnt/sshfs /etc/auto.sshfs --timeout=30,--ghost</pre>
<p>Then,  </p>
<pre>sudo vi /etc/auto.sshfs</pre>
<p>Add</p>
<pre>rsync.net -fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs#**username**@ch-s011.rsync.net:</pre>
<p> </p>
<p>And finally restart autofs </p>
<pre>sudo /etc/init.d/autofs restart</pre>
<p> </p>
<p>Now, when you cd /mnt/sshfs/rsync.net, after a short delay you will automatically be connected to the remote filesystem over SSH.  After 30 seconds of inactivity, the connection will be closed.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2008/12/27/automount-remote-filesystem-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup Ubuntu 8.04LTS to rsync.net using backup-manager (at linode.com)</title>
		<link>http://davidlaing.com/2008/12/26/backup-ubuntu-804lts-to-amazon-s3-using-backup-manager-at-linodecom/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=backup-ubuntu-804lts-to-amazon-s3-using-backup-manager-at-linodecom</link>
		<comments>http://davidlaing.com/2008/12/26/backup-ubuntu-804lts-to-amazon-s3-using-backup-manager-at-linodecom/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 22:09:21 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[backup-manager]]></category>
		<category><![CDATA[rsync.net]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=116</guid>
		<description><![CDATA[I&#8217;m setting up a new linode360 VPS, based of the Ubuntu 8.04LTS image. For backups, I want to do weekly backups and daily incrementals of the data files, and sync these off to an external backup location. Broadly, there are two parts to the backup, creating the backed up files, and then copying them offsite. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m setting up a new linode360 VPS, based of the Ubuntu 8.04LTS image.</p>
<p>For backups, I want to do weekly backups and daily incrementals of the data files, and sync these off to an external backup location.</p>
<p>Broadly, there are two parts to the backup, creating the backed up files, and then copying them offsite.</p>
<p><strong>Creating the backups</strong></p>
<p>I&#8217;m using backup-manager 0.7.6-debian1, which handles backing up sets of files and MySQL databases to tar.gz files.</p>
<pre>sudo aptitude install backup-manager
sudo /usr/sbin/backup-manager --version</pre>
<p>The comments in the config file make editing it quite straight forward.</p>
<pre>sudo vi /etc/backup-manager.conf</pre>
<p>One minor points:</p>
<ul>
<li>Separate multiple backup methods with a space, eg:
<pre>export BM_ARCHIVE_METHOD="tarball-incremental mysql"</pre>
</li>
</ul>
<p>To test:</p>
<pre>sudo /usr/sbin/backup-manager --verbose</pre>
<p>The output folder you specified (/var/archives) should now contain some .tar.gz versions of your data.  Hurrah!</p>
<p><strong>Getting the files offsite</strong></p>
<p>Originally I intended to use Amazon&#8217;s S3 as a backup store, following <a href="http://www.zepan.org/2007/02/10/installing-backup-manager-with-the-s3-upload-method-on-debianubuntu/">Michael Zehrer&#8217;s instructions on how to rsync with S3</a>.  However, I couldn&#8217;t get this to work reliably; so I opted instead for <a href="http://rsync.net">rsync.net</a> which offers standard scp, ftp, WebDav and sshfs access to their geographic backup locations.</p>
<p>Backup-manager can rsync over ssh, which is a quick and efficient way to sync changes over to the remote host..</p>
<p>The first step is get your <a href="http://rsync.net">rsync.net</a> account setup; and <a href="http://rsync.net/resources/howto/ssh_keys.txt">set up your ssh so you can access without typing in a password</a></p>
<p>Then, set the BM_UPLOAD_METHOD to rsync, and configure both the scp <em>and </em>the rsync settings in /etc/backup-manager.conf (pay attention not to prefix remote folders with / ).</p>
<p>Test with:</p>
<pre>sudo /usr/sbin/backup-manager --verbose</pre>
<p>Once its all working, set up a cron job to call backup-manager daily.</p>
<pre>crontab -e</pre>
<p>I run backup-manager once per day in the wee hours, and log output to /root/crontab/daily_backup-manager.logs</p>
<pre>  0 3   *   *   *    /usr/sbin/backup-manager -v &gt; /root/cronlogs/daily_backup-manager.log</pre>
<p>Viola!</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2008/12/26/backup-ubuntu-804lts-to-amazon-s3-using-backup-manager-at-linodecom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Domain mapping with WordPress MU, Plesk, Apache2 &amp; Ubuntu</title>
		<link>http://davidlaing.com/2008/07/24/domain-mapping-with-wordpress-mu-plesk-apache2-ubuntu/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=domain-mapping-with-wordpress-mu-plesk-apache2-ubuntu</link>
		<comments>http://davidlaing.com/2008/07/24/domain-mapping-with-wordpress-mu-plesk-apache2-ubuntu/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 08:11:36 +0000</pubDate>
		<dc:creator>mrdavidlaing</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[plesk]]></category>
		<category><![CDATA[wordpressmu]]></category>
		<category><![CDATA[wpmu]]></category>

		<guid isPermaLink="false">http://davidlaing.com/?p=80</guid>
		<description><![CDATA[Given a WordPress MU install on Plesk running on Ubuntu with Apache2, we want to configure domain mapping so that user1 can have myblog1.com mapping to their wordpress blog (myblog1.masterwpmu.com) and user2 can have myblog2.com mapping to their wordpress blog (myblog2.masterwpmu.com) We need to configure quite a few moving parts: DNS for masterwpmu.com &#8211; this [...]]]></description>
			<content:encoded><![CDATA[<p>Given a WordPress MU install on Plesk running on Ubuntu with Apache2, we want to configure domain mapping so that</p>
<p>user1 can have myblog1.com mapping to their wordpress blog (myblog1.masterwpmu.com) and<br />
user2 can have myblog2.com mapping to their wordpress blog (myblog2.masterwpmu.com)</p>
<p>We need to configure quite a few moving parts:</p>
<ol>
<li>DNS for masterwpmu.com &#8211; this should be an A record, pointing to the IP of your server</li>
<li>DNS for myblog1.com &amp; myblog2.com &#8211; these should be CNAME records, pointing to the A record in (1) &#8211; eg. masterwpmu.com</li>
<li>Apache2 &#8211; we need to alter the apache vhost conf created by Plesk to setup a wildcard alias</li>
<li>WordPressMU &#8211; we need to configure it to serve the right content when receiving a request for myblog2.com or myblog2.com</li>
</ol>
<p>When someone makes a browser request for myblog2.com, the following sequence happens:</p>
<ol>
<li>myblog2.com is resolved to masterwpmu.com, which is resolved to the IP of your server.</li>
<li>the browser makes a request to the IP, port 80, passing the host header of myblog2.com</li>
<li>Apache intercepts the request to point 80, checks through all its known vhost server aliases, and not finding a match redirects to the wildcard alias pointing to our WPMU install</li>
<li>WPMU gets the request, matches the host header to the correct blog content, and returns the relevant page.</li>
</ol>
<p>So, how do we configure this?</p>
<ol>
<li>Create a new Plesk site, with its own domain name (eg. masterwpmu.com) &amp; install WPMU.  Ensure this works.</li>
<li>Create a new CNAME record myblog2.com which resolves to masterwpmu.com (Its also possible to setup an A record pointing to the same IP as masterwpmu.com; although this will break if the IP of masterwpmu.com ever changes).  Google has a<a href="http://www.google.com/support/a/bin/answer.py?hl=en&amp;answer=47283"> nice set of instructions</a> for doing this on most major DNS providers (obviously you&#8217;ll want to point to masterwpmu.com rather than ghs.google.com <img src='http://davidlaing.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</li>
<li>Edit the Apache2 vhost conf created by Plesk at: /var/www/vhosts/masterwpmu.com/conf/httpd.include, changing:<br />
ServerAlias *<br />
&lt;Directory&gt;<br />
AllowOverride FileInfo Options</li>
<li>restart Apache2 ( /etc/init.d/apache2 restart)</li>
<li>Log in to the WPMU install as admin, and create a new blog.  Edit the new blog, and change the Domain &amp; FileUpload Url to myblog2.com and http://myblog2.com/files (all the other Urls are automatically updated when you save)</li>
<li>Browse to http://myblog2.com !</li>
</ol>
<p>Gotchas:</p>
<ul>
<li>You can only have 1 wildcard Apache ServerAlias per IP</li>
</ul>
<p>Hope that helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlaing.com/2008/07/24/domain-mapping-with-wordpress-mu-plesk-apache2-ubuntu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

