<?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>No pain no gain &#187; Linux</title>
	<atom:link href="http://www.dikant.de/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dikant.de</link>
	<description>Personal blog of Peter Dikant</description>
	<lastBuildDate>Sun, 23 May 2010 20:57:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Setting up PureFTPD on a virtual server</title>
		<link>http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/</link>
		<comments>http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 19:21:46 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[FTP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PureFTP]]></category>

		<guid isPermaLink="false">http://www.dikant.de/?p=56</guid>
		<description><![CDATA[PureFTPD is a secure and easy to configure FTP server. It has all the features you usually need, like TLS encryption, virtual users, quotas and limits. The only downside is that PureFTPD is not easy to install on a virtual &#8230; <a href="http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.dikant.de/wp-content/uploads/2009/01/pure-ftpd.png" alt="PureFTPD Logo" title="PureFTPD Logo" width="224" height="64" class="alignleft size-full wp-image-55" /> <a href="http://www.pureftpd.org">PureFTPD</a> is a secure and easy to configure FTP server. It has all the features you usually need, like TLS encryption, virtual users, quotas and limits. The only downside is that PureFTPD is not easy to install on a virtual server because the default Debian package is compiled with some options that are not supported by the standard OpenVZ and Virtuozzo kernels. Therefore you need to recompile PureFTPD with some reasonable settings. In This post I will explain how to do that and do a basic service setup.</p>
<p><span id="more-56"></span></p>
<p>First you could try to install the default Debian package to check whether you need to recompile PureFTPD. This can be done via:</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> pure-ftpd-common pure-ftpd</pre></div></div>

<p>The following steps are needed to recompile the package with the necessary options to make it run on a virtual server. You only need to do these steps if you find the following message in your syslog when trying to connect to the ftp server:</p>

<div class="wp_syntax"><div class="code"><pre class="syslog" style="font-family:monospace;"> pure-ftpd: (?@?) [ERROR] Unable to switch capabilities : Operation not permitted</pre></div></div>

<p>In that case, make sure that you have enabled the Debian source repositories in your <code>/etc/apt/sources.list</code> and fetch the source files via:</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: #7a0874; font-weight: bold;">source</span> pure-ftpd</pre></div></div>

<p>The source files have now been downloaded to your current directory. There should now some new files and a directory <code>pure-ftpd-1.0.21</code>. Enter this directory and edit the file <code>debian/rules</code> you should change the line starting with <code>optflags</code> and add <code>--without-capabilities</code> to that line, so that it looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="make" style="font-family:monospace;">optflags<span style="color: #004400;">=--</span>with<span style="color: #004400;">-</span>everything <span style="color: #004400;">--</span>with<span style="color: #004400;">-</span>largefile <span style="color: #004400;">--</span>with<span style="color: #004400;">-</span>pam <span style="color: #004400;">--</span>with<span style="color: #004400;">-</span>privsep <span style="color: #004400;">--</span>with<span style="color: #004400;">-</span>tls <span style="color: #004400;">--</span>without<span style="color: #004400;">-</span>capabilities</pre></div></div>

<p>Now grab the dependencies needed to build the source and compile the Debian installation package:</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> build-dep pure-ftpd
dpkg-buildpackage <span style="color: #660033;">-uc</span> <span style="color: #660033;">-b</span></pre></div></div>

<p>The resulting Debian package should now have been built without errors and you can install it via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> ..<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd_1.0.1-<span style="color: #000000;">8</span>_i386.deb</pre></div></div>

<p>The filename of the package might vary depending on the current patch level in the Debian repository.</p>
<p>When installing the package you will be asked whether to use a chrooted setup which you should do and if you prefer a standalone installation or inetd-based operation. For low volume sites I would prefer the inetd installation.</p>
<p>Now let&#8217;s get on to the configuration of PureFTPD. I prefer a setup using virtual users which are mapped to a central user account on the server. So I usually create a new account without a shell or home directory which belongs to the Apache user group to have access to hosted webs:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">useradd <span style="color: #660033;">-g</span> www-data <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">false</span> ftpuser</pre></div></div>

<p>The configuration of PureFTP is done via distinct files in the directory <code>/etc/pure-ftpd/conf</code>. Each file contains a single configuration setting and we can setup a decent configuration with the following commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd<span style="color: #000000; font-weight: bold;">/</span>conf
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #000000; font-weight: bold;">&gt;</span> ChrootEveryone
<span style="color: #7a0874; font-weight: bold;">echo</span> no <span style="color: #000000; font-weight: bold;">&gt;</span> PAMAuthentication
<span style="color: #7a0874; font-weight: bold;">echo</span> no <span style="color: #000000; font-weight: bold;">&gt;</span> UnixAuthentication
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&gt;</span> TLS
<span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>auth
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> ..<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>PureDB 50pure</pre></div></div>

<p>With the above settings we disable all authentication methods except the internal PureFTPD user database. We also lock down each user into a chroot-environment and enable secure authentication via TLS. PureFTPD excepts a certificate in the file <code>/etc/ssl/private/pure-ftpd.pem</code>. You could copy your apache certificate to that file, or generate a new one via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-x509</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">4312</span> <span style="color: #660033;">-nodes</span> <span style="color: #660033;">-keyout</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd.pem <span style="color: #660033;">-out</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>pure-ftpd.pem</pre></div></div>

<p>The user administration and setup is now done with the PureFTPD tool <code>pure-pw</code>. You can add a new user via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pure-pw useradd myusername <span style="color: #660033;">-u</span> ftpuser <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>homedir</pre></div></div>

<p>The above command will ask you for a password and register the user which is mapped to the system user <code>ftpuser</code> within PureFTPD. Every time you modify the user database you need to rebuild the PureFTPD user configuration via:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pure-pw mkdb</pre></div></div>

<p>Now you should be able to connect to your server with secure authorization with the newly created user.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dikant.de/2009/01/22/setting-up-pureftpd-on-a-virtual-server/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Hosting OpenVZ on Ubuntu 8.04</title>
		<link>http://www.dikant.de/2008/06/15/hosting-openvz-on-ubuntu-804/</link>
		<comments>http://www.dikant.de/2008/06/15/hosting-openvz-on-ubuntu-804/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 18:10:49 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.dikant.de/?p=46</guid>
		<description><![CDATA[The long term support edition 8.04 of Ubuntu Linux will provide security updates until 2013. Therefore it is an ideal distribution for building the base of a secure hosting solution. In this article I will describe how you can setup &#8230; <a href="http://www.dikant.de/2008/06/15/hosting-openvz-on-ubuntu-804/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The long term support edition 8.04 of <a href="http://www.ubuntu.com/">Ubuntu Linux</a> will provide security updates until 2013. Therefore it is an ideal distribution for building the base of a secure hosting solution. In this article I will describe how you can setup the virtualization software <a href="http://wiki.openvz.org/">OpenVZ</a> on Ubuntu 8.04. OpenVZ allows you to run multiple virtual Linux servers on top of your Ubuntu system. It is extremely performant and OpenVZ is also the base of the well known <a href="http://www.parallels.com/en/products/virtuozzo/">Virtuozzo</a> solution which is widely used in the web hosting market. Compared to <a href="http://xen.org/">Xen</a>, OpenVZ is more limited in regards to different operating system you can run, but on the other hand it has a lower overhead and is therefore more performant. It is also possible to run OpenVZ inside of <a href="http://www.virtualbox.org/">VirtualBox</a> which is not possible with Xen.</p>
<p><span id="more-46"></span></p>
<p>The first step in setting up an OpenVZ server is to install a minimal setup of Ubuntu server 8.04. When installing Ubuntu you should select LVM in the partitioning options as this will enable backups of your OpenVZ containers without downtime while they are running. The only service that we will install is OpenSSH to access the installation remotely.</p>
<p>Once the base system is setup and you can login remotely via SSH you could update the whole system to make sure you have the latest versions of all installed applications:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> dist-upgrade</pre></div></div>

<p>The OpenVZ-Kernel does not work well with the AppArmor package, which is installed by default, so disable it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> update-rc.d <span style="color: #660033;">-f</span> apparmor remove</pre></div></div>

<p>Now it is time to install the OpenVZ-kernel:</p>

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

<p>The above package is a meta package which will install the kernel, the kernel modules and any required header-files and libraries. Now take a look at the file <code>/boot/grub/menu.lst</code> and make sure that the new OpenVZ kernel is the default kernel when booting. Now reboot and check that the correct kernel is loaded:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">uname</span> <span style="color: #660033;">-r</span></pre></div></div>

<p>If you can see something like <code>2.6.24-18-openvz</code> when running the above command, the correct kernel has been booted. If not, check your boot config.</p>
<p>The next step is to install the OpenVZ tools:</p>

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

<p>Now you can run the OpenVZ daemon:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <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>vz start</pre></div></div>

<p>Basically that&#8217;s it. OpenVZ is now running and you can setup your VZ containers. The OpenVZ project page has a lot of different container templates you can use as a starting point. Take a look at the list on <a href="http://wiki.openvz.org/Download/template/precreated">http://wiki.openvz.org/Download/template/precreated</a> and download all templates you want to use to <code>/var/lib/vz/template/cache</code>. You can choose from a wide selection of Linux distributions.</p>
<p>You can now start creating your virtual machine containers and run them:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> vzctl create <span style="color: #000000;">101</span> <span style="color: #660033;">--ostemplate</span> ubuntu-<span style="color: #000000;">8.04</span>-i386-minimal
<span style="color: #c20cb9; font-weight: bold;">sudo</span> vzctl start <span style="color: #000000;">101</span></pre></div></div>

<p>Of course you need to configure your containers, but this is a different topic which I will describe in a followup to this article.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dikant.de/2008/06/15/hosting-openvz-on-ubuntu-804/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
