<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<?asciidoc-toc?>
<?asciidoc-numbered?>
<book lang="en">
  <bookinfo>
    <title>Bytemark Symbiosis</title>
    <authorgroup>
      <author>
        <firstname>Patrick</firstname>
        <othername role="middle">J.</othername>
        <surname>Cherry</surname>
      </author>
      <author>
        <firstname>Steve</firstname>
        <surname>Kemp</surname>
      </author>
      <author>
        <firstname>David</firstname>
        <surname>Edwards</surname>
      </author>
      <author>
        <firstname>James</firstname>
        <surname>Carter</surname>
      </author>
    </authorgroup>
    <pubdate>2018</pubdate>
    <copyright>
      <year>2010-8</year>
      <holder>Bytemark Ltd.</holder>
    </copyright>
    <legalnotice id="_legalnotice">
      <para>
  Permission is granted to copy, distribute and/or modify this
  documentation under the terms of the GNU Free Documentation Licence, Version
  1.3 or any later version published by the Free Software Foundation; with no
  Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of
  the licence is included in <xref linkend="appendix-gnu-fdl"/>.
  </para>
    </legalnotice>


    <revhistory id="_revisionhistory">
      <revision>
        <revnumber>2009:1112</revnumber>
        <date>2009-11-12</date>
        <authorinitials>PJC</authorinitials>
        <revremark>Initial release.</revremark>
      </revision>
      <revision>
        <revnumber>2010:0427</revnumber>
        <date>2010-04-26</date>
        <authorinitials>SKX</authorinitials>
        <revremark>Renamed the project, and updated the documentation to match.</revremark>
      </revision>
      <revision>
        <revnumber>2012:0302</revnumber>
        <date>2012-03-02</date>
        <authorinitials>PJC</authorinitials>
        <revremark>Rewritten for the Squeeze release&gt;</revremark>
      </revision>
      <revision>
        <revnumber>2012:0305</revnumber>
        <date>2012-03-05</date>
        <authorinitials>PJC</authorinitials>
        <revremark>Updated release notes for the Squeeze release.</revremark>
      </revision>
      <revision>
        <revnumber>2012:0420</revnumber>
        <date>2012-04-20</date>
        <authorinitials>PJC</authorinitials>
        <revremark>Added information about PostgreSQL backups, apache2 logging, and fixed the erroneous reference to exim_rewrite_scan in the release notes.</revremark>
      </revision>
      <revision>
        <revnumber>2014:1118</revnumber>
        <date>2014-11-18</date>
        <authorinitials>JFC</authorinitials>
        <revremark>Updated for Wheezy release.</revremark>
      </revision>
      <revision>
        <revnumber>2015:0909</revnumber>
        <date>2016-02-29</date>
        <authorinitials>PJC</authorinitials>
        <revremark>Updated for Jessie release.</revremark>
      </revision>
      <revision>
        <revnumber>2018:0621</revnumber>
        <date>2018-06-21</date>
        <authorinitials>AL</authorinitials>
        <revremark>Updated for Stretch release.</revremark>
      </revision>
    </revhistory>
  </bookinfo>
  <chapter id="ch-whatsnew">
    <title>What’s new since the last release</title>
    <simpara>The current release is based on Debian 9.0, code-name Stretch.  Since
the last release of Symbiosis, the following features have been
implemented.</simpara>
    <itemizedlist>
      <listitem>
        <simpara>
<command>symbiosis-httpd-configure</command> now includes a <command>--diff-only</command> option,
  allowing potential changes between Apache configurations to be compared without
  disrupting active domains.
</simpara>
      </listitem>
      <listitem>
        <simpara>
<ulink url="https://github.com/BytemarkHosting/symbiosis/issues/12">#12</ulink> SSL hooks have
  been implemented in <filename class="devicefile">/etc/symbiosis/ssl-hooks.d</filename>. These are triggered
  when SSL certificates are updated, meaning other running services can be
  notified to act accordingly. As an example, Apache configurations will now be
  regenerated and the Apache service will be reloaded automatically when new SSL
  certificates are added using <command>symbiosis-ssl</command>.
</simpara>
      </listitem>
      <listitem>
        <simpara>
<command>symbiosis-monit</command> checks are now launched using systemd timers, rather than
  as cron tasks.
</simpara>
      </listitem>
      <listitem>
        <simpara>
Skeleton directories are automatically created for new domains when a top
  level  directory is created within <command>/srv</command> and owned by the <emphasis role="strong">admin</emphasis> user.
</simpara>
      </listitem>
      <listitem>
        <simpara>
The default Apache logger, written in Ruby, has been replaced with a new Golang
  version for improved performance.
</simpara>
      </listitem>
      <listitem>
        <simpara>
A new "message of the day" has been added, with an appropriate Stretch theme!
</simpara>
      </listitem>
    </itemizedlist>
    <simpara>Additionally, a <ulink url="https://github.com/BytemarkHosting/symbiosis/issues?q=is%3Aissue+is%3Aclosed">number of bugs</ulink> have been fixed, including:</simpara>
    <itemizedlist>
      <listitem>
        <simpara>
<ulink url="https://github.com/BytemarkHosting/symbiosis/issues/51">#51</ulink> Website
  stats are now disabled by default. They can be enabled with the
  creation of a <command>config/stats</command> file on a per-website basis.
</simpara>
      </listitem>
      <listitem>
        <simpara>
<ulink url="https://github.com/BytemarkHosting/symbiosis/issues/76">#76</ulink>
  The <command>50-reject-www-data</command> firewall rule has been removed from the default
  firewall configuration.
</simpara>
      </listitem>
      <listitem>
        <simpara>
<ulink url="https://github.com/BytemarkHosting/symbiosis/issues/107">#107</ulink> The <filename class="devicefile">.well-known</filename>
  directory path for domains is now excluded from rewrites by default, meaning
  it should always be accessible for verification with Let’s Encrypt.
</simpara>
      </listitem>
      <listitem>
        <simpara>
<ulink url="https://github.com/BytemarkHosting/symbiosis/issues/113">#113</ulink>
  <command>symbiosis-httpd-logger</command> no longer uses the <command>--sync</command> flag by default,
  improving performance for servers which host a large amount of websites.
</simpara>
      </listitem>
      <listitem>
        <simpara>
<ulink url="https://github.com/BytemarkHosting/symbiosis/issues/114">#114</ulink>
  Exim no longer returns a <command>Warning: purging the environment</command> message
  when it’s restarted.
</simpara>
      </listitem>
      <listitem>
        <simpara>
<ulink url="https://github.com/BytemarkHosting/symbiosis/issues/115">#115</ulink>
  The <command>admin</command> user is now added to the <command>www-data</command> group by default on
</simpara>
      </listitem>
      <listitem>
        <simpara>
<ulink url="https://github.com/BytemarkHosting/symbiosis/issues/120">#120</ulink>
  A number of frequently used packages are now installed by default.
</simpara>
      </listitem>
      <listitem>
        <simpara>
<ulink url="https://github.com/BytemarkHosting/symbiosis/issues/123">#123</ulink>
  PHP variables <command>post_max_size</command> and <command>upload_max_filesize</command> now default to
  64MB each. These can be overridden in the <command>/etc/php/7.0/apache2/conf.d/00-symbiosis-httpd.ini</command>
  configuration file.
</simpara>
      </listitem>
      <listitem>
        <simpara>
<ulink url="https://github.com/BytemarkHosting/symbiosis/issues/126">#126</ulink> A new MySQL user, <emphasis role="strong">admin@localhost</emphasis>, is created
  for new installations of Symbiosis Stretch, to be used with <application class="software">phpMyAdmin</application>
  following the inclusion of MariaDB which uses unix socket auth for <emphasis role="strong">root@localhost</emphasis>
  by default. Servers which have been upgraded from Symbiosis Jessie are unaffected.
</simpara>
      </listitem>
    </itemizedlist>
    <simpara>Thank you to all those who reported those issues.</simpara>
  </chapter>
  <chapter id="ch-installing-and-upgrading">
    <title>Installing and administering Symbiosis</title>
    <simpara>Symbiosis will install well on a freshly-installed Debian 9.0 system.
Currently it is only available for <emphasis>i386</emphasis> and <emphasis>amd64</emphasis> architectures,
running on the Linux kernel.</simpara>
    <simpara>It is designed to be as friendly as possible for beginners, whilst
maintaining flexibility for more experienced systems administrators.
Later in this chapter we’ll spell out a few basics to bear in mind
when working with a system running Symbiosis.</simpara>
    <section id="s-installing-on-stretch">
      <title>Installing Symbiosis running on Debian 9.0 (Stretch)</title>
      <simpara>
        <indexterm>
          <primary>Symbiosis</primary>
          <secondary>installing</secondary>
        </indexterm>
      </simpara>
      <simpara>Installing on a fresh Stretch system is relatively simple. First, add
the Bytemark package signing key:</simpara>
      <screen>curl -sSL https://secure.bytemark.co.uk/key/repositories-2014.key | sudo apt-key add -</screen>
      <simpara>Second, add the following to <literal>/etc/apt/sources.list.d/symbiosis.list</literal>:</simpara>
      <screen>#
# Bytemark Symbiosis Packages
#
deb     http://symbiosis.bytemark.co.uk/stretch/ ./
deb-src http://symbiosis.bytemark.co.uk/stretch/ ./</screen>
      <simpara>Once that is in your sources, run:</simpara>
      <screen>apt-get update
apt-get install --install-recommends bytemark-symbiosis</screen>
      <simpara>At the end of this process, you should have a fully functioning
Symbiosis system with all of the features documented here available
to you for use.</simpara>
    </section>
    <section id="_installing_symbiosis_stretch_using_the_cloud_server_control_panel">
      <title>Installing Symbiosis Stretch using the Cloud Server control panel</title>
      <simpara>Users of Bytemark’s Cloud Servers can get a fresh install of Symbiosis by
simply selecting the image at VM install time. The panel is accessed at
<ulink url="https://panel.bytemark.co.uk">https://panel.bytemark.co.uk</ulink>. Once logged in, using the <filename class="devicefile">Add a cloud server</filename>
button, a machine can be installed within a few seconds. Select the Stretch Symbiosis
image as per the screenshot below.</simpara>
      <screenshot>
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/bigv-install.png"/>
          </imageobject>
        </mediaobject>
      </screenshot>
    </section>
    <section id="s-upgrading-from-jessie">
      <title>Upgrading from Symbiosis 8 (Jessie) to Symbiosis 9 (Stretch)</title>
      <simpara>
        <indexterm>
          <primary>Symbiosis</primary>
          <secondary>upgrading</secondary>
        </indexterm>
      </simpara>
      <simpara>Debian have <ulink url="http://www.debian.org/releases/stretch/releasenotes">comprehensive release
notes</ulink>, of which chapter 4 covers the recommended upgrade procedure. We have
provided a shorter version for this, which is immediately below:</simpara>
      <simpara>The first thing to do is make sure that you have backups. These
should be kept in /var/backups/localhost, and they should be up to date.</simpara>
      <note>
        <simpara>Any modifications you may have made to Symbiosis scripts will likely be
lost during the upgrade, so you should be prepared to reapply these
changes after the upgrade.</simpara>
      </note>
      <simpara>Next, alter /etc/apt/sources.list.  Change all instances of the word
<filename class="devicefile">jessie</filename> to <filename class="devicefile">stretch</filename>. If you have backports, you can remove them, and
any entries for Jessie LTS should also be removed.  Then change the
Symbiosis repository lines to match those shown in the previous
section.</simpara>
      <simpara>You can then proceed with the upgrade by running:</simpara>
      <screen>apt-get update
apt-get dist-upgrade</screen>
      <simpara>Following the upgrade, to use PHP7  you will need to disable and enable
the appropriate Apache modules:</simpara>
      <screen>a2dismod php5
a2enmod php7.0
systemctl restart apache2</screen>
      <simpara>You can swap back at any time by disabling the php7.0 module and enabling
the php5 module instead.</simpara>
      <simpara>The updated version of Roundcube relies on PHP7.0 by default. If you
would like to continue using PHP5, you will need to install the
<filename class="devicefile">php-net-idna2</filename> package by running:</simpara>
      <screen>apt-get install php-net-idna2</screen>
      <simpara>As this is an upgrade for <emphasis role="strong">all</emphasis> the software on the system, a large
number of questions may be asked about configuration files during the
upgrade.  Some of these will relate to packages Symbiosis has
installed as dependencies, and the answers to these questions are
given below.</simpara>
      <qandaset>
        <title>Questions asked during the upgrade</title>
        <qandaentry>
          <question>
            <simpara>
Configuring roundcube-core: Configure database for roundcube with dbconfig-common?
</simpara>
          </question>
          <answer>
            <simpara>
    Yes
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuring roundcube-core: Database type to be used by roundcube
</simpara>
          </question>
          <answer>
            <simpara>
    mysql
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuring roundcube-core: Host running the server for roundcube
</simpara>
          </question>
          <answer>
            <simpara>
    localhost
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuring roundcube-core: Password of the database’s administrative user
</simpara>
          </question>
          <answer>
            <simpara>
    Enter your MySQL root password
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuring roundcube-core: MySQL application password for roundcube
</simpara>
          </question>
          <answer>
            <simpara>
    User preference (Leave blank to generate a random password)
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuring phpmyadmin: Configure database for phpmyadmin with dbconfig-common?
</simpara>
          </question>
          <answer>
            <simpara>
    Yes
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuring phpmyadmin: Host running the MySQL server for phpmyadmin
</simpara>
          </question>
          <answer>
            <simpara>
    localhost
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuring phpmyadmin: Web server to reconfigure automatically
</simpara>
          </question>
          <answer>
            <simpara>
    apache2
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuring libc6:amd64: Restart services during package upgrades without asking?
</simpara>
          </question>
          <answer>
            <simpara>
    Yes
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuration file <filename class="devicefile">/etc/sysctl.conf</filename> modified since installation
</simpara>
          </question>
          <answer>
            <simpara>
    Install the package maintainer’s version
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuring openssh-server
</simpara>
          </question>
          <answer>
            <simpara>
    Install the package maintainer’s version
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuring grub-pc
</simpara>
          </question>
          <answer>
            <simpara>
    Keep the local version currently installed
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuration file <filename class="devicefile">/etc/ntp.conf</filename> modified since installation
</simpara>
          </question>
          <answer>
            <simpara>
    Keep your currently-installed version
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuration file <filename class="devicefile">/etc/phpmyadmin/config.inc.php</filename> modified since installation
</simpara>
          </question>
          <answer>
            <simpara>
    Install the package maintainer’s version
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuring phpmyadmin: Perform upgrade on database for phpmyadmin with dbconfig-common?
</simpara>
          </question>
          <answer>
            <simpara>
    Yes
</simpara>
          </answer>
        </qandaentry>
        <qandaentry>
          <question>
            <simpara>
Configuring unattended-upgrades
</simpara>
          </question>
          <answer>
            <simpara>
    Install the package maintainer’s version
</simpara>
          </answer>
        </qandaentry>
      </qandaset>
      <simpara>That should be everything; you may have been asked other questions if you have
installed extra packages on your system - answer them as you see fit.</simpara>
    </section>
    <section id="s-upgrade-to-stretch-release-notes">
      <title>Release notes</title>
      <simpara>
        <indexterm>
          <primary>Symbiosis</primary>
          <secondary>stretch release</secondary>
        </indexterm>
      </simpara>
      <simpara>This release of Symbiosis includes a number of new features that are
summarised in <xref linkend="ch-whatsnew"/>.</simpara>
      <section id="_apache_httpd_upgrade_from_2_4_10_to_2_4_25">
        <title>Apache HTTPd upgrade from 2.4.10 to 2.4.25</title>
        <simpara>
          <indexterm>
            <primary>HTTP</primary>
            <secondary>new apache</secondary>
          </indexterm>
        </simpara>
        <simpara>Apache has undergone a significant version change in Stretch. If you’ve made any
custom Apache config changes, you may need to look at the docs. As of 2.4.17, HTTP2
is supported. Further information is available <ulink url="https://httpd.apache.org/docs/2.4/mod/mod_http2.html">here</ulink>.</simpara>
      </section>
      <section id="_php_upgrade_from_5_6_to_7_0">
        <title>PHP upgrade from 5.6 to 7.0</title>
        <simpara>
          <indexterm>
            <primary>PHP</primary>
            <secondary>new PHP version</secondary>
          </indexterm>
        </simpara>
        <simpara>The version of PHP included with Symbiosis Stretch has been upgraded to 7.0 from
5.6. This new version is enabled by default on both new installations, and
following a dist-upgrade. Further information on the changes between 5.6 and 7.0
is available <ulink url="http://php.net/manual/en/migration70.php">here</ulink>.</simpara>
      </section>
    </section>
    <section id="s-symbiosis-components">
      <title>Packages installed by Symbiosis</title>
      <simpara>
        <indexterm>
          <primary>Symbiosis</primary>
          <secondary>components</secondary>
        </indexterm>
      </simpara>
      <simpara>Each component that makes up Symbiosis is separately packaged as
follows.  Each package can be installed individually if needed.</simpara>
      <variablelist>
        <varlistentry>
          <term>
bytemark-symbiosis
</term>
          <listitem>
            <simpara>
Meta-package that pulls in the core requirements
for a Symbiosis system, and as well as recommending all packages
needed for a complete Symbiosis system.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-backup
</term>
          <listitem>
            <simpara>
Organises and configures backup2l to backup vital
parts of the system, and rsync them to a remote location.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-common
</term>
          <listitem>
            <simpara>
Contains the core libraries that Symbiosis uses to
operate.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-dns
</term>
          <listitem>
            <simpara>
Adds automatic DNS generation and upload to the
system.  Ties in with the Bytemark DNS service.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-email
</term>
          <listitem>
            <simpara>
Configures <application class="software">Exim</application> and <application class="software">Dovecot</application> for use with
Symbiosis.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-email-activesync
</term>
          <listitem>
            <simpara>
- Provides email access using the
Microsoft Exchange ActiveSync protocol
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-firewall
</term>
          <listitem>
            <simpara>
Maintains the <application class="software">iptables</application> and <application class="software">ip6tables</application>
firewalls, as well as providing automatic blacklisting and
whitelisting.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-ftpd
</term>
          <listitem>
            <simpara>
Configures <application class="software">pure-ftpd</application> to work with Symbiosis.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-httpd
</term>
          <listitem>
            <simpara>
Configures the <application class="software">Apache</application> web server.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-key
</term>
          <listitem>
            <simpara>
Adds the Bytemark Symbiosis key to <application class="software">apt</application>.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-monit
</term>
          <listitem>
            <simpara>
Provides service monitoring.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-mysql
</term>
          <listitem>
            <simpara>
Brings in <application class="software">MariaDB</application> version 10.1, and configures it to
bind to all interfaces, not just localhost, for remote access. MariaDB
is a fork of MySQL, and is designed to be a drop-in replacement.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-pam
</term>
          <listitem>
            <simpara>
Brings in two PAM dependencies to make the system more
secure — one checks passwords and warns when they are weak, the other
sets per-user temporary directories.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-phpmyadmin
</term>
          <listitem>
            <simpara>
Brings in <application class="software">phpMyAdmin</application>, and configures it to
use HTTP authentication.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-webmail
</term>
          <listitem>
            <simpara>
Adds webmail functionality, using Roundcube. Includes one additional package:
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-webmail-roundcube
</term>
          <listitem>
            <simpara>
Provide webmail access to Symbiosis using Roundcube
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
symbiosis-xmpp
</term>
          <listitem>
            <simpara>
Adds an XMPP server, which can be used to chat to people on the global XMPP network.
</simpara>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>
    <section id="_systems_administration_and_symbiosis">
      <title>Systems administration and Symbiosis</title>
      <simpara>
        <indexterm>
          <primary>Sysadmin</primary>
        </indexterm>
      </simpara>
      <simpara>Symbiosis is an attempt to encourage best practice at all times in
systems administration, whilst keeping things as simple as possible,
and free of surprises.  As a result there are a few general rules to
bear in mind when tinkering with your system.</simpara>
      <section id="_use_of_literal_root_literal_and_other_users">
        <title>Use of <literal>root</literal>, and other users</title>
        <simpara>
          <indexterm>
            <primary>root user</primary>
          </indexterm>
        </simpara>
        <simpara>As far as possible Symbiosis will discourage you from using <literal>root</literal>
when logging in and configuring the system.  This primarily applies to</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Anything in the <filename class="directory">/srv/</filename> directory
</simpara>
          </listitem>
          <listitem>
            <simpara>
The firewall configuration in <filename class="directory">/etc/symbiosis/firewall</filename>
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>For example, if a directory in <filename class="directory">/srv</filename> is owned by a system
user or group, i.e. one with a UID/GID less than 1000, then it will
not show up to various tasks, including, but not limited to,</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Email and FTP logins
</simpara>
          </listitem>
          <listitem>
            <simpara>
Cron tasks in <filename class="devicefile">config/crontab</filename>
</simpara>
          </listitem>
          <listitem>
            <simpara>
Apache logging to <filename class="directory">public/logs/</filename>
</simpara>
          </listitem>
          <listitem>
            <simpara>
Mail delivery to mailboxes.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>In short, try not to use <literal>root</literal> if at all possible.</simpara>
        <simpara>However it is perfectly possible to configure separate domains in
<filename class="directory">/srv/</filename> to be owned by different users, as long as they are
non-system users, i.e. ones with user IDs greater than 1000.  All
programs will respect these permissions.</simpara>
      </section>
      <section id="_customising_configurations">
        <title>Customising configurations</title>
        <simpara>Lots of configuration on the system is automatically generated to make
Symbiosis work as it does.  In previous releases of Symbiosis this
meant that files would get overwritten without notice.  However as of
the Squeeze release in February 2012 configuration files are handled
more conservatively.</simpara>
        <simpara>Two things to watch out for.  If a configuration file has</simpara>
        <screen># DO NOT EDIT THIS FILE - CHANGES WILL BE OVERWRITTEN</screen>
        <simpara>written in it, then there is a high chance that any changes will be
overwritten.  It has to be the exact wording and spacing above for
overwriting to take place, so if that sentence is removed from the
configuration then it <emphasis role="strong">will not</emphasis> get overwritten.</simpara>
        <simpara>Similarly many files are generated from templates, for example DNS and
apache snippets.  These will now have a checksum at the bottom of the
file.</simpara>
        <screen># Checksum MD5 586732ff59e60115d0ec1c4905c72773</screen>
        <simpara>This checksum allows Symbiosis scripts to establish if the template
used to generate the snippet has changed, if the data used in the
generation has changed, or if the file itself has been edited.  For
example if an IP address is changed by editing <filename class="devicefile">config/ip</filename>, then that
would allow the apache snippet for that domain can be updated, as can
the DNS snippet.</simpara>
        <simpara>This also means that sysadmins can edit the templates, and allow them
to regenerate, or edit the snippets themselves safe in the knowledge
that their changes will not get overwritten.</simpara>
      </section>
      <section id="_other_configuration_styles">
        <title>Other configuration styles</title>
        <simpara>The Backup2l, Dovecot, and Exim configuration files are generated not
with a template, but with a collection of snippets, which are joined
and checked using a Makefile.  This allows extra configuration
snippets to be added in to the configuration.</simpara>
        <simpara>If it is deemed necessary, sysadmins can add extra snippets to these
configurations.  The basic procedure is to read the configuration
file, and decide where the extra directives need to go.  This is made
easier by the fact that through the configuration files comments are
added showing where each part comes from.</simpara>
        <screen># ------------------------------------------------------------------------------
# /etc/exim4/symbiosis.d/10-acl/40-acl-check-mail/00-header
# ------------------------------------------------------------------------------

# ACL that is used after the MAIL command
acl_check_mail:

# ------------------------------------------------------------------------------
# /etc/exim4/symbiosis.d/10-acl/40-acl-check-mail/90-default
# ------------------------------------------------------------------------------

# Allow anything not already denied to connect
  accept</screen>
        <simpara>In this example, if an extra directive were required in this ACL,
then a file could be created in
<filename class="directory">/etc/exim4/symbiosis.d/10-acl/40-acl-check-mail/</filename>, maybe
with the filename <filename class="devicefile">10-do-stuff</filename>.  To create the new configuration,
we’d then need to run <application class="software">make</application> in <filename class="directory">/etc/exim4/</filename>.  This would
regenerate <filename class="devicefile">/etc/exim4/exim4.conf</filename>, and perform a basic syntax check.
If happy with the new configuration, then exim4 could be restarted.</simpara>
        <simpara>The equivalent Dovecot configuration is in <filename class="devicefile">/etc/dovecot/symbiosis.d/</filename>
which generates <filename class="devicefile">/etc/dovecot/dovecot.conf</filename>.  The Backup2l
configuration is in <filename class="directory">/etc/symbiosis/backup.d/conf.d/</filename>, which
generates <filename class="devicefile">/etc/symbiosis/backup.d/backup2l.conf</filename>.</simpara>
      </section>
    </section>
  </chapter>
  <chapter id="ch-webreference">
    <title>Website Configuration</title>
    <simpara>
      <indexterm>
        <primary>Website</primary>
        <secondary>Configuration</secondary>
      </indexterm>
    </simpara>
    <simpara>This is a detailed break down of all the configuration options and
files available when configuring website hosting for a domain.</simpara>
    <simpara>Throughout this chapter, as with the rest of this documentation, the domain
<literal>my-brilliant-site.com</literal> is used as an example.</simpara>
    <simpara>All configuration for the domain <literal>my-brilliant-site.com</literal> will be performed
inside the <filename class="directory">/srv/my-brilliant-site.com/</filename> directory.</simpara>
    <simpara>The Bytemark Symbiosis project uses the popular Apache HTTPD software for
serving your websites, and this comes complete with PHP7 along with many
of the most popular PHP extensions.</simpara>
    <section id="_getting_started">
      <title>Getting started</title>
      <simpara>All the files required for a website for the domain
<emphasis role="strong">my-brilliant-site.com</emphasis> are kept in
<filename class="directory">/srv/my-brilliant-site.com/public/htdocs/</filename>.</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
If this directory does not exist, a <emphasis role="strong">404 Not Found</emphasis> error will be
   returned.
</simpara>
        </listitem>
        <listitem>
          <simpara>
If this directory exists, but is empty, then a default page is
   shown.
</simpara>
        </listitem>
        <listitem>
          <simpara>
The index file can be written in <glossterm linkend="HTML">HTML</glossterm> or
   <glossterm linkend="PHP">PHP</glossterm>, and should be called <filename class="devicefile">index.html</filename> or
   <filename class="devicefile">index.php</filename> respectively.
</simpara>
        </listitem>
        <listitem>
          <simpara>
Once this directory is present, both <ulink url="http://my-brilliant-site.com">http://my-brilliant-site.com</ulink> and
   <ulink url="http://www.my-brilliant-site.com">http://www.my-brilliant-site.com</ulink> will show the same content, i.e.
   there is no need to name the site with a <emphasis role="strong">www</emphasis> prefix.
</simpara>
        </listitem>
        <listitem>
          <simpara>
If different content is required for
   <ulink url="http://www.my-brilliant-site.com">http://www.my-brilliant-site.com</ulink> then that should be put in
   <filename class="directory">/srv/www.my-brilliant-site.com/public/htdocs/</filename>.
</simpara>
        </listitem>
      </itemizedlist>
    </section>
    <section id="s-web-cgi-scripts">
      <title>CGI scripts</title>
      <simpara>
        <indexterm>
          <primary>Website</primary>
          <secondary>CGI scripts</secondary>
        </indexterm>
      </simpara>
      <simpara>If you wish to use CGI scripts for your domain, then simply copy them
to a directory named <filename class="directory">cgi-bin/</filename> beneath the
<filename class="directory">public/</filename> directory.  They must all be marked as
executable.  This means setting the permissions to <emphasis role="strong">755</emphasis>.  In
<application class="software">FileZilla</application>, right click the file and select <guimenuitem>File
Permissions…</guimenuitem> from the menu.  The file should have <emphasis role="strong">Execute</emphasis>
set for the owner, group, and public permissions.</simpara>
      <simpara>For example, for <emphasis role="strong">my-brilliant-site.com</emphasis> the scripts would live in
<filename class="directory">/srv/my-brilliant-site.com/public/cgi-bin/</filename>.
<indexterm><primary>public/</primary><secondary>cgi-bin/</secondary></indexterm></simpara>
      <simpara>Any <emphasis role="strong">executable</emphasis> files in that directory will now be treated as CGI
scripts for your domain. For example if you created the file
<filename class="devicefile">/srv/my-brilliant-site.com/public/cgi-bin/test.cgi</filename> This would be
referred to as: <ulink url="http://my-brilliant-site.com/cgi-bin/test.cgi">http://my-brilliant-site.com/cgi-bin/test.cgi</ulink></simpara>
    </section>
    <section id="s-web-statistics">
      <title>Statistics</title>
      <simpara>
        <indexterm>
          <primary>Website</primary>
          <secondary>statistics</secondary>
        </indexterm>
      </simpara>
      <simpara>Each hosted website can have visitor statistics automatically
generated and accessible at <ulink url="http://my-brilliant-site.com/stats/">http://my-brilliant-site.com/stats/</ulink>. These
statistics will be updated once per day, and the raw access logs will
be made available as
<filename class="directory">/srv/my-brilliant-site.com/public/logs/</filename>.</simpara>
      <simpara><indexterm><primary>Website</primary><secondary>statistics</secondary><tertiary>enabling</tertiary></indexterm>
As of the Stretch release of Symbiosis, these daily statistics are disabled by default. If you wish to continue using them, you’ll need to enable them explicitly with the creation of a <filename class="devicefile">stats</filename> file in the website’s configuration directory. For example, for <emphasis role="strong">my-brilliant-site.com</emphasis>, the <filename class="devicefile">stats</filename> file should exist at <filename class="devicefile">/srv/my-brilliant-site.com/config/stats</filename>.</simpara>
      <simpara>If you had previously disabled stats with the creation of a file <filename class="devicefile">config/no-stats</filename>, this should be removed automatically following a dist-upgrade.
<indexterm><primary>config/</primary><secondary>no-stats</secondary></indexterm></simpara>
      <simpara><indexterm><primary>Website</primary><secondary>statistics</secondary><tertiary>customising</tertiary></indexterm>
It is also possible to customise the statistics generated by editing
the file <filename class="devicefile">config/webalizer.conf</filename>.  This file is
documented at <ulink url="http://www.webalizer.org/">the Webalizer project
website</ulink>.
<indexterm><primary>config/</primary><secondary>webalizer.conf</secondary></indexterm></simpara>
      <simpara>If there are many sites on the same machine, then it is possible to
customise all the sites' Webalizer configurations by editing the
template that is available at
<filename class="devicefile">/etc/symbiosis/apache.d/webalizer.conf.erb</filename>.  Configuration files
will be updated when the statistics are next generated, but only for
sites whose configurations either do not exist, or have not been
edited by hand.</simpara>
    </section>
    <section id="s-web-testing-new-sites">
      <title>Testing new websites</title>
      <simpara>
        <indexterm>
          <primary>Website</primary>
          <secondary>testing new sites</secondary>
        </indexterm>
      </simpara>
      <simpara>You can view new websites before any DNS changes are made.</simpara>
      <simpara>For example, if the virtual machine <emphasis role="strong">example.default.bytemark.uk0.bigv.io</emphasis> is hosting
<emphasis role="strong">www.my-brilliant-site.com</emphasis>, i.e. the directory
<filename class="directory">/srv/my-brilliant-site.com/public/htdocs/</filename> has been
created, then the website can immediately be viewed at
<ulink url="http://my-brilliant-site.com.testing.example.default.bytemark.uk0.bigv.io">http://my-brilliant-site.com.testing.example.default.bytemark.uk0.bigv.io</ulink>.</simpara>
      <simpara>There are some important things to note though:
    - There is no <emphasis role="strong">www</emphasis> part added to the domain name — it is just
      the directory name prepended to
      <emphasis role="strong">.testing.example.default.bytemark.uk0.bigv.io</emphasis>.
    - This testing alias isn’t guaranteed to work in all cases, for
      complex site setups it might not work entirely as expected.
    - The testing alias only allows the testing of websites. Therefore
      FTP logins, email delivery, or checking is explicitly
      unsupported.</simpara>
    </section>
    <section id="_displaying_the_same_content_under_two_domains">
      <title>Displaying the same content under two domains</title>
      <simpara>In this scenario, you have registered two domains for example
<emphasis role="strong">my-brilliant-site.com</emphasis> and  <emphasis role="strong">my-brilliant-site.co.uk</emphasis>, but you want the same content
to be served at both addresses.  There is no need to create two
separate directory structures, you can just set up one directory
structure and then create a soft link (aka symbolic link or symlink)
to the second.</simpara>
      <procedure>
        <step>
          <simpara>
Once the my-brilliant-site.com directory structure has been completed, log
  on to your machine as admin over SSH.
</simpara>
        </step>
        <step>
          <simpara>
Run the command <command>ln -s /srv/my-brilliant-site.com /srv/my-brilliant-site.co.uk</command>
</simpara>
        </step>
      </procedure>
      <simpara>This creats a symbolic link of <filename class="devicefile">my-brilliant-site.co.uk</filename> pointing at <filename class="devicefile">my-brilliant-site.com</filename>.
Now browsing to my-brilliant-site.co.uk will show the same content that appears at
my-brilliant-site.com.</simpara>
    </section>
    <section id="s-preferred-website-domain">
      <title>Redirecting to the preferred website domain</title>
      <simpara>
        <indexterm>
          <primary>Website</primary>
          <secondary>redirecting to a preferred hostname</secondary>
        </indexterm>
      </simpara>
      <simpara>If a document tree were created in
<filename class="directory">/srv/my-brilliant-site.com/public/</filename> then that site would be
available under two hostnames:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
<ulink url="http://my-brilliant-site.com/">http://my-brilliant-site.com/</ulink>
</simpara>
        </listitem>
        <listitem>
          <simpara>
<ulink url="http://www.my-brilliant-site.com/">http://www.my-brilliant-site.com/</ulink>
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>There are people who prefer to use only a single name, and to
automatically redirect visitors using the <emphasis>wrong</emphasis> name to using the
preferred name.  This can easily be achieved by using Apache’s
mod_rewrite facility.</simpara>
      <simpara>If you prefer all visitors see the www-based site you could create the
file <filename class="devicefile">/srv/my-brilliant-site.com/public/htdocs/.htaccess</filename> with the
following contents:</simpara>
      <screen>RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.*$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]</screen>
      <simpara>This examines each incoming request, and if the hostname doesn’t begin
with "www." then it is prepended to the request and a redirect is
issued.</simpara>
    </section>
    <section id="s-web-custom-configuration">
      <title>Custom Apache configuration</title>
      <simpara>
        <indexterm>
          <primary>Website</primary>
          <secondary>Custom configuration</secondary>
        </indexterm>
      </simpara>
      <simpara>It is perfectly possible to alter the way Symbiosis configures Apache,
either for an individual domain, or for all domains hosted on the
server.</simpara>
      <simpara>Symbiosis hosts sites on a server in one of two ways, based on the IP
address that site has configured.  If it uses one of the server’s
primary IP addresses, then it is assumed that the site is hosted using
the "mass-hosting" configuration.  If the site has a secondary IP
assigned then Symbiosis generates an individual snippet for that site,
and Apache is configured to use that snippet when dealing with HTTP
requests for that domain.  Both configuration techniques are
configured using a template, which allows the server’s administrator
to fiddle with, and tweak the configuration.</simpara>
      <simpara>In <filename class="directory">/etc/symbiosis/apache.d/</filename> there are a number of
templates that are used to generate configuration snippets for both
the mass-hosting, as well as individual sites.</simpara>
    </section>
    <section id="_logging">
      <title>Logging</title>
      <simpara><indexterm><primary>Website</primary><secondary>access logs</secondary></indexterm>
<indexterm><primary>Website</primary><secondary>error logs</secondary></indexterm></simpara>
      <simpara>By default, access requests for each site on a machine will go to
<filename class="devicefile">public/logs/access.log</filename>.  If the site has SSL enabled, the request
logs will go to <filename class="devicefile">public/logs/ssl_access.log</filename>.  These logs get rotated
once a day, and compressed after two days.</simpara>
      <simpara>The error logs for a site will go to one of two places, depending on
how the site is configured.  If the site has its own SSL certificate,
or otherwise has its own IP address, then the error logs will go to
<filename class="devicefile">public/logs/error.log</filename>, or <filename class="devicefile">public/logs/ssl_error.log</filename>.  Otherwise
the error logs will go to
<filename class="devicefile">/var/log/apache2/zz-mass-hosting.error.log</filename>.</simpara>
      <simpara>Finally, if a request is received for a domain that is not present on
the box, then it is logged to <filename class="devicefile">zz-mass-hosting.access.log</filename> if it
received on the primary IP of the machine.  If the request comes on
any other IP then it is logged to <filename class="devicefile">other_vhosts_access.log</filename>.  Both of
these last two files are located in <filename class="directory">/var/log/apache2</filename> .</simpara>
    </section>
    <section id="s-web-configuration-layout">
      <title>Web configuration layout</title>
      <simpara>
        <indexterm>
          <primary>Website</primary>
          <secondary>configuration layout</secondary>
        </indexterm>
      </simpara>
      <simpara>Here is an example configuration layout for the domain
<literal>my-brilliant-site.com</literal>, all of which is contained under
<filename class="directory">/srv/my-brilliant-site.com/</filename>.</simpara>
      <variablelist>
        <varlistentry>
          <term>
<filename class="devicefile">config/stats</filename>
</term>
          <listitem>
            <simpara>
If this file exists, statistics will be
generated for this domain.
<indexterm><primary>config/</primary><secondary>stats</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/ssl-only</filename>
</term>
          <listitem>
            <simpara>
If this file exists, traffic will be redirected
to the SSL version of the website.  This will also configure your site
to use
<ulink url="https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security">Strict
Transport Security</ulink> (HSTS). Ensure your website functions as expected over HTTPS
<emphasis role="strong">before</emphasis> adding this file. Once HSTS is enabled, browsers are issued a forced
redirect to HTTPS until HSTS expires (default age of 6 months) — even if the <command>ssl-only</command> file is removed!
<indexterm><primary>config/</primary><secondary>ssl-only</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/webalizer.conf</filename>
</term>
          <listitem>
            <simpara>
This is the Webalizer configuration file
for this domain.
<indexterm><primary>config/</primary><secondary>webalizer.conf</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">public/cgi-bin/</filename>
</term>
          <listitem>
            <simpara>
This is the
directory which may be used to hold <link linkend="s-web-cgi-scripts">CGI scripts</link>
for your domain.
<indexterm><primary>public/</primary><secondary>cgi-bin/</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">public/htdocs/</filename>
</term>
          <listitem>
            <simpara>
This is the
directory from which content is served for the URLs
<ulink url="http://my-brilliant-site.com/">http://my-brilliant-site.com/</ulink> <emphasis>and</emphasis> <ulink url="http://www.my-brilliant-site.com/">http://www.my-brilliant-site.com/</ulink>.
If this directory does not exist visitors will be shown an error page.
<indexterm><primary>public/</primary><secondary>htdocs/</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">public/htdocs/stats/</filename>
</term>
          <listitem>
            <simpara>
This directory will be
automatically created, if it isn’t already present, and updated with
statistics referring to the number of visitors to your website.
<indexterm><primary>public/</primary><secondary>htdocs/</secondary><tertiary>stats/</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">public/logs/access.log</filename>
</term>
          <listitem>
            <simpara>
This file contains the Apache webserver
access log for the domain.  It will be archived daily, and removed
after 30 days.
<indexterm><primary>public/</primary><secondary>logs/</secondary><tertiary>access.log</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">public/logs/ssl_access.log</filename>
</term>
          <listitem>
            <simpara>
This file contains the Apache
webserver access log for the domain when accessed over SSL.
<indexterm><primary>public/</primary><secondary>logs/</secondary><tertiary>ssl_access.log</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">public/logs/error.log</filename>
</term>
          <listitem>
            <simpara>
This file contains the Apache webserver
error log for the domain, if the domain has been configured to run
under its own IP address.  It will be archived daily, and removed
after 30 days.   If the site does not have its own IP address, then
errors are logged to <filename class="devicefile">/var/log/apache2/zz-mass-hosting.error.log</filename>.
<indexterm><primary>public/</primary><secondary>logs/</secondary><tertiary>error.log</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">public/logs/ssl_error.log</filename>
</term>
          <listitem>
            <simpara>
This file contains the Apache
webserver error log for the domain when accessed over SSL, if the
domain has been configured with its own IP address.
<indexterm><primary>public/</primary><secondary>logs/</secondary><tertiary>ssl_error.log</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>
  </chapter>
  <chapter id="ch-sslreference">
    <title>SSL configuration</title>
    <simpara>
      <indexterm>
        <primary>SSL</primary>
        <secondary>Configuration</secondary>
      </indexterm>
    </simpara>
    <simpara><glossterm linkend="SSL">Secure Sockets Layer</glossterm> is a technique used to encrypt
communication between two machines on a network.  It uses a system of
public and private keys to encrypt and decrypt the connection — the public
key is used by the sender to encrypt, and the private key is used by
the receiver to decrypt.  This protocol is used not only for
transactions involving a web server and browser, but also by the email
servers and their clients.</simpara>
    <simpara>In addition to the public key encryption, there is a system of trust
that validates that the certificate presented actually belongs to the
server that is presenting it.  This system involved having the
certificate signed by a trusted authority.  Web browsers and email
clients tend to come with a selection of certificates from trusted
authorities pre-installed, which allows them to verify a previously
unseen certificate as valid.</simpara>
    <section id="_ssl_providers">
      <title>SSL providers</title>
      <simpara>Until recently, having a certificate signed by a trusted authority
involved having varying degrees of identity checks made, and paying a
fee.  Vendors that are able to sell you a certificate include
<ulink url="https://www.rapidssl.com">Rapid SSL</ulink> and
<ulink url="https://www.comodo.com">Comodo</ulink>.</simpara>
      <simpara>In December 2015, a new, free, automatic SSL certificate service
started issuing certificates.  This servers is called
<ulink url="https://letsencrypt.org">LetsEncrypt</ulink>, and it is supported by a number
of big names on the internet, including Facebook and Mozilla.  This
service has now been successfully providing domain-verified
certificates for a few months, and is used by Symbiosis to generate
trusted certificates for all the domains on a machine.
<indexterm><primary>LetsEncrypt</primary></indexterm></simpara>
      <simpara>Symbiosis can also generate self-signed certificates on occasions
where it has not been possible to use LetsEncrypt.</simpara>
    </section>
    <section id="_ssl_provider_configuration">
      <title>SSL provider configuration</title>
      <simpara>Symbiosis has the idea of "providers" to generate SSL keys, requests,
and certificates.  By default Symbiosis will use the <emphasis role="strong">LetsEncrypt</emphasis>
provider, but you can specify another provider, e.g. *SelfSigned" by
putting the word "selfsigned" in <filename class="devicefile">config/ssl-provider</filename> for the domain
in question.</simpara>
      <simpara>If you wish to use LetsEncrypt, put "letsencrypt" in
<filename class="devicefile">config/ssl-provider</filename>.</simpara>
      <simpara>If you wish to disable automatic certificate provisioning entirely,
you can put the word <command>false</command> into <filename class="devicefile">config/ssl-provider</filename>.</simpara>
    </section>
    <section id="_generating_certificates_with_command_symbiosis_ssl_command">
      <title>Generating certificates with <command>symbiosis-ssl</command></title>
      <simpara>Symbiosis uses a command ‘symbiosis-ssl` to manage domains’
certificates.  It is run on a daily basis to check and replace
certificates that are due to expire in the next 10 days, or are
otherwise missing.</simpara>
      <simpara>This command can also be used to verify sites' certificates.</simpara>
      <screen>$ symbiosis-ssl --verbose
* Examining certificates for app.my-brilliant-site.com
  Current SSL set 0: signed by /C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X1, expires 2016-05-25 23:00:00 UTC
* Examining certificates for my-brilliant-site.com
  Current SSL set 0: signed by /C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X1, expires 2016-05-25 10:32:00 UTC
* Examining certificates for example.default.bytemark.uk0.bigv.io
  Current SSL set 4: signed by /C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X1, expires 2016-05-29 10:26:00 UTC</screen>
      <simpara>This command shows the current set in place for each site.  A set is a
collection of files, consisting of</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
the private key (<filename class="devicefile">ssl.key</filename>),
</simpara>
        </listitem>
        <listitem>
          <simpara>
certificate request (<filename class="devicefile">ssl.csr</filename>),
</simpara>
        </listitem>
        <listitem>
          <simpara>
signed certificate (<filename class="devicefile">ssl.crt</filename>),
</simpara>
        </listitem>
        <listitem>
          <simpara>
intermediate bundle (if required) (<filename class="devicefile">ssl.bundle</filename>),
</simpara>
        </listitem>
        <listitem>
          <simpara>
a combined private key, and certificate, (and bundle)
  (<filename class="devicefile">ssl.combined</filename>).
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>Each set is kept in its own directory in <filename class="directory">config/ssl/sets</filename>,
and the current set is symlinked to <filename class="devicefile">config/sets/current</filename>.</simpara>
      <simpara>In the above output the host <command>example.default.bytemark.uk0.bigv.io</command> is
currently using set 4.  That means its directory layout will look like:</simpara>
      <screen>/srv/example.default.bytemark.uk0.bigv.io/config/ssl/current -&gt; /srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/4
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/letsencrypt/account_key
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/0/ssl.combined
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/0/ssl.crt
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/0/ssl.csr
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/0/ssl.key
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/1 # (with a complete set of ssl.key etc)
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/2 #
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/3 #
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/4/ssl.bundle
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/4/ssl.combined
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/4/ssl.crt
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/4/ssl.csr
/srv/example.default.bytemark.uk0.bigv.io/config/ssl/sets/4/ssl.key</screen>
    </section>
    <section id="_generating_certificate_signing_requests">
      <title>Generating certificate signing requests</title>
      <simpara>If you wish to use a different certificate than the one Symbiosis has
generated for your domain, you can use the certificate signing request
that was created for the certificate that should already be in place.  You can
then go to your provider with this request, and ask them to generate a
certificate.</simpara>
      <simpara>The CSR generated will be for the "bare" domain, with all aliases as Subject
Alternative Names.</simpara>
      <simpara>If you wish to inspect the CSR, you can run</simpara>
      <literallayout class="monospaced">openssl req -in ssl.csr -text -noout</literallayout>
    </section>
    <section id="_applying_a_third_party_certificate">
      <title>Applying a third party certificate</title>
      <simpara>To add a third party SSL certificate for a website, upload your ssl.crt,
ssl.key, and ssl.bundle files from the certificate provider to your server.
For a domain <filename class="devicefile">example.com</filename>, these should be located at:</simpara>
      <literallayout class="monospaced">/srv/domain.com/config/ssl.crt
/srv/domain.com/config/ssl.key
/srv/domain.com/config/ssl.bundle</literallayout>
      <simpara>Ensure ssl-provider is set to false, by running:
  echo "false" &gt; /srv/domain.com/config/ssl-provider</simpara>
      <simpara>Remove the SSL <filename class="devicefile">current</filename> symlink if present, as this will otherwise take
precedence:
  rm /srv/domain.com/config/ssl/current</simpara>
      <simpara>Reconfigure the Apache vhost to activate the certificate:
  sudo symbiosis-httpd-configure -v domain.com</simpara>
    </section>
    <section id="s-ssl-configuration-layout">
      <title>SSL Configuration layout</title>
      <simpara>
        <indexterm>
          <primary>SSL</primary>
          <secondary>configuration layout</secondary>
        </indexterm>
      </simpara>
      <simpara>Here is an example configuration layout for the domain
<literal>my-brilliant-site.com</literal>, all of which is contained under
<filename class="directory">/srv/my-brilliant-site.com/</filename>.</simpara>
      <variablelist>
        <varlistentry>
          <term>
<filename class="devicefile">config/ssl-provider</filename>
</term>
          <listitem>
            <simpara>
The SSL provider to be used for this domain.
If this is set to <command>false</command> then no certificates will be generated for
the domain.
<indexterm><primary>config/</primary><secondary>ssl-provider</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/ssl.crt</filename>
</term>
          <listitem>
            <simpara>
Legacy SSL certificate.
<indexterm><primary>config/</primary><secondary>ssl.crt</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/ssl.key</filename>
</term>
          <listitem>
            <simpara>
Legacy SSL key.
<indexterm><primary>config/</primary><secondary>ssl.key</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/ssl.bundle</filename>
</term>
          <listitem>
            <simpara>
Legacy SSL certificate chain or bundle.
<indexterm><primary>config/</primary><secondary>ssl.bundle</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/ssl.combined</filename>
</term>
          <listitem>
            <simpara>
Legacy combined SSL certificate, chain, and
key.
<indexterm><primary>config/</primary><secondary>ssl.combined</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">config/ssl/</filename>
</term>
          <listitem>
            <simpara>
This is the SSL configuration directory
<indexterm><primary>config/</primary><secondary>ssl/</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">config/ssl/letsencrypt/</filename>
</term>
          <listitem>
            <simpara>
This is the LetsEncrypt
configuration directory.
<indexterm><primary>config/</primary><secondary>ssl/</secondary><tertiary>letsencrypt/</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">config/ssl/sets/</filename>
</term>
          <listitem>
            <simpara>
This is the directory that contains
all the various SSL certificate and key sets.
<indexterm><primary>config/</primary><secondary>ssl/</secondary><tertiary>sets/</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">config/ssl/current</filename>
</term>
          <listitem>
            <simpara>
This is a symbolic link to the
current SSL certificate and key set
<indexterm><primary>config/</primary><secondary>ssl/</secondary><tertiary>current</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
      </variablelist>
      <section id="_self_signed_ssl_provider_configuration">
        <title>Self-signed SSL provider configuration</title>
        <simpara>These files can go in the domain’s <filename class="directory">config/</filename> directory, or
in <filename class="directory">/etc/symbiosis/</filename>, if you want to set host-wide
defaults.</simpara>
        <variablelist>
          <varlistentry>
            <term>
<filename class="devicefile">ssl/selfsigned/rsa_key_size</filename>
</term>
            <listitem>
              <simpara>
The size of RSA key generated for both
the SSL certificates, as well as the account.  Defaults to 2048.
<indexterm><primary>ssl/</primary><secondary>selfsigned/</secondary><tertiary>rsa_key_size</tertiary></indexterm>
</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>
<filename class="devicefile">ssl/selfsigned/lifetime</filename>
</term>
            <listitem>
              <simpara>
The length of time in days the certificate
should be valid for.  Defaults to 365.
<indexterm><primary>ssl/</primary><secondary>selfsigned/</secondary><tertiary>lifetime</tertiary></indexterm>
</simpara>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section id="_letsencrypt_ssl_provider_configuration">
        <title>LetsEncrypt SSL provider configuration</title>
        <simpara>These files can go in the domain’s <filename class="directory">config/</filename> directory, or
in <filename class="directory">/etc/symbiosis/</filename> if you want to set host-wide defaults.</simpara>
        <variablelist>
          <varlistentry>
            <term>
<filename class="devicefile">ssl/letsencrypt/rsa_key_size</filename>
</term>
            <listitem>
              <simpara>
The size of RSA key generated for both
the SSL certificates, as well as the account.  Defaults to 2048.
<indexterm><primary>ssl/</primary><secondary>letsencrypt/</secondary><tertiary>rsa_key_size</tertiary></indexterm>
</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>
<filename class="devicefile">ssl/letsencrypt/email</filename>
</term>
            <listitem>
              <simpara>
The email address associated with the
account.  Defaults to <ulink url="mailto:root@example.default.bytemark.uk0.bigv.io">root@example.default.bytemark.uk0.bigv.io</ulink>, where
example.default.bytemark.uk0.bigv.io is the hostname of the machine.
<indexterm><primary>ssl/</primary><secondary>letsencrypt/</secondary><tertiary>email</tertiary></indexterm>
</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>
<filename class="devicefile">ssl/letsencrypt/endpoint</filename>
</term>
            <listitem>
              <simpara>
The LetsEncrypt endpoint to use. Defaults to
<ulink url="https://acme-v01.api.letsencrypt.org/directory">https://acme-v01.api.letsencrypt.org/directory</ulink>.
<indexterm><primary>ssl/</primary><secondary>letsencrypt/</secondary><tertiary>endpoint</tertiary></indexterm>
</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>
<filename class="devicefile">ssl/letsencrypt/docroot</filename>
</term>
            <listitem>
              <simpara>
The document root for this domain.
Defaults to <filename class="directory">/srv/domain.com/public/htdocs</filename>. This is
required for the LetsEncrypt domain verification to take place.
<indexterm><primary>ssl/</primary><secondary>letsencrypt/</secondary><tertiary>docroot</tertiary></indexterm>
</simpara>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>
<filename class="devicefile">ssl/letsencrypt/account_key</filename>
</term>
            <listitem>
              <simpara>
The private RSA key for this
LetsEncrypt account.  A new one is generated if not present.
<indexterm><primary>ssl/</primary><secondary>letsencrypt/</secondary><tertiary>account_key</tertiary></indexterm>
</simpara>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
    </section>
  </chapter>
  <chapter id="ch-mailreference">
    <title>Email Configuration</title>
    <simpara>This is a detailed break-down of all the configuration options and
files available when configuring how email is handled for a domain.
Throughout this chapter, the domain <literal>my-brilliant-site.com</literal> is used as an
example.  Thus all the configuration for <literal>my-brilliant-site.com</literal> will be inside
the <filename class="directory">/srv/my-brilliant-site.com/</filename> directory.</simpara>
    <section id="s-mail-port-configuration">
      <title>Port Configuration</title>
      <simpara>
        <indexterm>
          <primary>Email</primary>
          <secondary>port numbers</secondary>
        </indexterm>
      </simpara>
      <simpara>The mail servers have been set up with standard port assignments as
follows.  These are all the standard ports for the protocols.</simpara>
      <informaltable frame="all" rowsep="1" colsep="1">
        <tgroup cols="3">
          <colspec colname="col_1" colwidth="33*"/>
          <colspec colname="col_2" colwidth="33*"/>
          <colspec colname="col_3" colwidth="33*"/>
          <thead>
            <row>
              <entry align="left" valign="top"> Service </entry>
              <entry align="left" valign="top"> Port      </entry>
              <entry align="left" valign="top"> Encryption</entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry align="left" valign="top">
                <simpara>POP3</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>110</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>TLS (using STARTTLS)</simpara>
              </entry>
            </row>
            <row>
              <entry align="left" valign="top">
                <simpara>IMAP</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>143</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>TLS (using STARTTLS)</simpara>
              </entry>
            </row>
            <row>
              <entry align="left" valign="top">
                <simpara>SMTP</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>25 or 587</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>TLS (using STARTTLS)</simpara>
              </entry>
            </row>
            <row>
              <entry align="left" valign="top">
                <simpara>POP3</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>995</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>TLS (on connect)</simpara>
              </entry>
            </row>
            <row>
              <entry align="left" valign="top">
                <simpara>IMAP</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>993</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>TLS (on connect)</simpara>
              </entry>
            </row>
            <row>
              <entry align="left" valign="top">
                <simpara>SMTP</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>465</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>TLS (on connect)</simpara>
              </entry>
            </row>
            <row>
              <entry align="left" valign="top">
                <simpara>Sieve</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>4190</simpara>
              </entry>
              <entry align="left" valign="top">
                <simpara>TLS (using STARTTLS)</simpara>
              </entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>
    </section>
    <section id="s-mail-accepting">
      <title>Accepting email for a domain</title>
      <simpara>
        <indexterm>
          <primary>Email</primary>
          <secondary>accepting</secondary>
        </indexterm>
      </simpara>
      <simpara>In order for a domain to be configured to accept email, one of two
things must be present.  Either the domain must have a
<filename class="directory">mailboxes/</filename> directory present, or one of the files
<filename class="devicefile">config/default_forward</filename> or <filename class="devicefile">config/aliases</filename> must be present.</simpara>
      <simpara>For example, if the domain <emphasis role="strong">my-brilliant-site.com</emphasis> would like to host
mail normally, i.e. one mailbox per user hosted on the same machine,
then the directory <filename class="directory">/srv/my-brilliant-site.com/mailboxes/</filename>
should be created.  Then in there, one directory per user should be
created.  If <emphasis role="strong">bob@my-brilliant-site.com</emphasis> would like to receive mail,
then <filename class="directory">/srv/my-brilliant-site.com/mailboxes/bob/</filename>  should be
created.</simpara>
      <simpara>Once this directory has been created, this mailbox can be accessed via
IMAP/POP3, or Roundcube webmail. For example, the mailboxes
for <emphasis role="strong">mybrilliant-site.com</emphasis> would be accessible at <emphasis role="strong">mybrilliant-site.com/webmail</emphasis>.</simpara>
      <simpara>Assuming that this is the only directory inside
<filename class="directory">/srv/my-brilliant-site.com/mailboxes/</filename> then only mail
addressed to <emphasis role="strong">bob@my-brilliant-site.com</emphasis> will be accepted.  Any other
mail addressed to <emphasis role="strong">my-brilliant-site.com</emphasis> will be rejected.</simpara>
      <simpara><indexterm><primary>Email</primary><secondary>catching all</secondary></indexterm>
If you would like to accept all mail for <emphasis role="strong">my-brilliant-site.com</emphasis>,
regardless of who it is addressed to, then create the file
<filename class="devicefile">/srv/my-brilliant-site.com/config/default_forward</filename>.  The contents of
this file should be a single email address, or a comma-separated list
of email addresses.  For example, to forward all mail to
<emphasis role="strong">bob@my-brilliant-site.com</emphasis>, unless the recipient’s mailbox already exists,
then <filename class="devicefile">/srv/my-brilliant-site.com/config/default_forward</filename> should
contain <literal>bob@my-brilliant-site.com</literal>.
<indexterm><primary>config/</primary><secondary>default_forward</secondary></indexterm></simpara>
      <simpara><indexterm><primary>Email</primary><secondary>not accepting any</secondary></indexterm>
If you would like the domain <emphasis role="strong">nomail.my-brilliant-site.com</emphasis> not to
receive any mail at all, then remove the directory
<filename class="directory">/srv/nomail.my-brilliant-site.com/mailboxes/</filename> and ensure
that the file
<filename class="devicefile">/srv/nomail.my-brilliant-site.com/config/default_forward</filename> does not
exist.</simpara>
    </section>
    <section id="s-unix-mail-accepting">
      <title>Email for Unix users.</title>
      <simpara>
        <indexterm>
          <primary>Email</primary>
          <secondary>accepting</secondary>
          <tertiary>unix</tertiary>
        </indexterm>
      </simpara>
      <important>
        <title>Before you start this section</title>
        <orderedlist numeration="arabic">
          <listitem>
            <simpara>
Both a unix user and a <filename class="devicefile">normal</filename> Symbiosis email user
 can be set up to receive email to the same address. The <filename class="devicefile">normal</filename> user
 will always take precedence over the unix user and have their
 mail delivered to their inbox first, so take care  when using this feature!
</simpara>
          </listitem>
        </orderedlist>
      </important>
      <simpara>A new feature in this release is the ability to have unix users
with email accounts based in their home directories. These will receive emails
for the host name of the machine, which you can find out by running <filename class="devicefile">hostname</filename>
on the command line. The result of this will display the domain in the
email address the system users will get, eg, the part after the @.
The other half will be dictated by their username, eg, "admin" or "my-user".</simpara>
      <simpara>To start with, we create a <application class="software">.password</application> file in, eg, <application class="software">/home/my-user/</application>.
Initially this can contain the password in plain text.</simpara>
      <simpara>Once the password file is in place, the new user will be able to login
and collect email.  Logins over SMTP, IMAP, and POP3 will all work
identically to a normal email user, with the same ports and SSL/TLS
requirements.  The principal difference is the username is just their
bare username, without a domain.  E.g. for a user <command>clare</command>, her login
for SMTP/IMAP/POP3 etc, is just <command>clare</command>.</simpara>
      <simpara>Unix users' <application class="software">Maildir</application> directories will reside in /home/my-user/Maildir by default.
This allows these users to use system mail readers such as <application class="software">mutt</application> in order to
read and send email, obviating the need to use IMAP and SMTP.</simpara>
      <simpara>These users are also able to control the following files:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
<application class="software">.forward</application> - to control forwarding of emails.
</simpara>
        </listitem>
        <listitem>
          <simpara>
<application class="software">.vacation</application> - to set a vacation (holiday) message.
</simpara>
        </listitem>
        <listitem>
          <simpara>
<application class="software">.sieve</application> - to set up Sieve filters.
</simpara>
        </listitem>
      </itemizedlist>
    </section>
    <section id="s-email-passwords">
      <title>Password files</title>
      <simpara>
        <indexterm>
          <primary>Email</primary>
          <secondary>encrypting passwords</secondary>
        </indexterm>
      </simpara>
      <simpara>The password for a mailbox should be set by the contents of a file
named <filename class="devicefile">password</filename> inside a user’s mailbox directory.  The contents of
this file may be in plain text, or encrypted. If plain text is used,
the system will automatically encrypt the password.</simpara>
      <simpara>To encrypt all email passwords on the system, you can run</simpara>
      <literallayout class="monospaced">`symbiosis-email-encrypt-passwords --verbose`</literallayout>
      <simpara>The <command>--verbose</command> flag is there to provide more output.</simpara>
    </section>
    <section id="_allowing_users_to_change_their_own_password">
      <title>Allowing users to change their own password</title>
      <simpara>Users are able to change their own passwords through the webmail system, which by default
is Roundcube.</simpara>
      <simpara>To change a password in Roundcube, log in and select Options. This
will being up the Options page :</simpara>
      <screenshot>
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/SM-options.png"/>
          </imageobject>
        </mediaobject>
      </screenshot>
      <simpara>From there, select Change Password, where you must enter your current
password, and enter a new one. Passwords which are ether too weak or too
short will be rejected by the system.</simpara>
      <screenshot>
        <mediaobject>
          <imageobject>
            <imagedata fileref="figures/SM_changepass.png"/>
          </imageobject>
        </mediaobject>
      </screenshot>
    </section>
    <section id="_suffixes">
      <title>Suffixes</title>
      <simpara>
        <indexterm>
          <primary>Email</primary>
          <secondary>using suffixes</secondary>
        </indexterm>
      </simpara>
      <simpara>All email addresses can be used with a suffix.  This allows people to
filter their email by the To: address.  The separator between the
local part and suffix is the <literal>+</literal> sign.</simpara>
      <simpara>For example, Bob signs up to a shopping site at <ulink url="http://example.com">http://example.com</ulink>.
He might use <ulink url="mailto:bob+example@my-brilliant-site.com">bob+example@my-brilliant-site.com</ulink> his email
address when signing up, such that he can filter all email from that
shop.</simpara>
    </section>
    <section id="s-email-quotas">
      <title>Enforcing mailbox size with quotas</title>
      <simpara><indexterm><primary>Email</primary><secondary>quotas</secondary></indexterm>
<indexterm><primary>Quotas</primary><secondary>email</secondary></indexterm></simpara>
      <simpara>Symbiosis can enforce users' mailbox size with quotas.  This will prevent mail
from being delivered to a user if their mailbox grows too large.</simpara>
      <simpara>A default quota for each individual mailboxes in a domain can be specified in
<filename class="devicefile">config/mailbox-quota</filename>.  A per-mailbox quota can be defined in a file
named <filename class="devicefile">quota</filename> which resides in a user’s mailbox directory.
<indexterm><primary>config/</primary><secondary>mailbox-quota</secondary></indexterm></simpara>
      <simpara>These files both have the same format, which is just a number of bytes over
which mail should not be delivered.  This number can have a suffix of <literal>k</literal>, <literal>M</literal>,
or, <literal>G</literal> which represent kilobytes, megabytes, and gigabytes, or <literal>ki</literal>, <literal>Mi</literal>, or
<literal>Gi</literal> to represent kibibytes, mebibytes, and gibibytes, respectively.</simpara>
      <simpara>For example, to limit the size of each mailbox for the domain
<emphasis role="strong">my-brilliant-site.com</emphasis> to 200MB, i.e. 200,000,000 bytes, put <literal>200M</literal>
in <filename class="devicefile">/srv/my-brilliant-site.com/config/mailbox-quota</filename>.</simpara>
      <simpara>To grant <emphasis role="strong">bob@my-brilliant-site.com</emphasis> a 1GiB quota, i.e. 1,073,741,824 bytes,
put <literal>1Gi</literal> in <filename class="devicefile">/srv/my-brilliant-site.com/mailboxes/bob/quota</filename>.
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary><tertiary>quota</tertiary></indexterm></simpara>
      <simpara>Quotas in a user’s mailbox directory take precedence over the default quota.</simpara>
    </section>
    <section id="s-email-sieve">
      <title>Server-side filtering using Sieve</title>
      <simpara><application class="software">Sieve</application> is a <ulink url="http://sieve.info">standard language</ulink> that users can employ to
filter their email on the server.  Additionally using any one of a number of
<ulink url="http://sieve.info/clients">clients</ulink>, users can edit their filtering rules
without needing shell access to the server.</simpara>
      <simpara>Each user can create a number of scripts in a directory called
<filename class="directory">sieve.d/</filename>, with the current script being kept in a file called
<filename class="devicefile">sieve</filename>.
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary><tertiary>sieve</tertiary></indexterm></simpara>
      <simpara>Only one of these scripts can be active at a given time for each user; add to
an existing file rather than creating a new one if you require extra filters.</simpara>
    </section>
    <section id="s-email-forward-files">
      <title>Forward files</title>
      <simpara>
        <indexterm>
          <primary>Email</primary>
          <secondary>forwarding</secondary>
        </indexterm>
      </simpara>
      <simpara>There are two methods of forwarding email.  The first is a per-mailbox
forwarding service, and the second is a per-domain service.  For the
per-user service, a file named <filename class="devicefile">forward</filename> should
be put in a user’s mailbox directory.  The per-domain service uses the
same file format as the per-user service, but the file should be
uploaded to <filename class="devicefile">config/default_forward</filename> instead.
<indexterm><primary>config/</primary><secondary>default_forward</secondary></indexterm>
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary><tertiary>forward</tertiary></indexterm></simpara>
      <simpara>For example, <emphasis role="strong">bob@my-brilliant-site.com</emphasis> would set up a file called
<filename class="devicefile">/srv/my-brilliant-site.com/mailboxes/bob/forward</filename>.</simpara>
      <simpara>If all the mail for <emphasis role="strong">my-brilliant-site.com</emphasis> needed to be forwarded
elsewhere, then the file would be called
<filename class="devicefile">/srv/my-brilliant-site.com/config/default_forward</filename>.
<indexterm><primary>Email</primary><secondary>forwarding</secondary><tertiary>a whole domain</tertiary></indexterm></simpara>
      <simpara>Both of these files can be interpreted in two ways.  Firstly they can
be a comma separated list of email addresses.  For example, if Bob
wanted to forward his email onto Charlie and Dave, his forward file
might read</simpara>
      <screen>charlie@example.com, dave@example.com</screen>
      <simpara>The second way these files are interpreted is as an <application class="software">Exim</application> filter file.
The full specification is documented at
<ulink url="http://www.exim.org/exim-html-4.72/doc/html/filter.html#CHAPeximfilter">the
<application class="software">Exim</application> project site</ulink>.</simpara>
      <simpara>Here are some examples of what is possible.</simpara>
      <simpara>To forward mail on, but keep a copy</simpara>
      <screen># Exim filter
unseen deliver charlie@example.org
unseen deliver dave@example.com</screen>
      <simpara>
        <indexterm>
          <primary>Email</primary>
          <secondary>forwarding</secondary>
          <tertiary>keeping a copy</tertiary>
        </indexterm>
      </simpara>
      <simpara>To rewrite all mail for a domain to <emphasis role="strong">example.com</emphasis>. This is probably
best used in <filename class="devicefile">config/default_forward</filename>.</simpara>
      <screen># Exim filter
deliver $local_part@example.com</screen>
      <simpara>The
<ulink url="http://www.exim.org/exim-html-4.72/doc/html/filter.html#SECTex">Exim
documentation</ulink> has further examples of what is possible.</simpara>
    </section>
    <section id="s-email-vacation-messages">
      <title>Vacation messages</title>
      <simpara>
        <indexterm>
          <primary>Email</primary>
          <secondary>vacation messages</secondary>
        </indexterm>
      </simpara>
      <simpara>It is possible to set a vacation message for a user by putting a
message in file called <filename class="devicefile">vacation</filename> in the user’s mailbox directory.
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary><tertiary>vacation</tertiary></indexterm></simpara>
      <simpara>For example, for <emphasis role="strong">bob@my-brilliant-site.com</emphasis>, the message would go in
<filename class="devicefile">/srv/my-brilliant-site.com/mailboxes/bob/vacation</filename>.  On Bob’s return,
the people who received vacation messages are logged to
<filename class="devicefile">/srv/my-brilliant-site.com/mailboxes/bob/vacation.log</filename>.  Once he’s
read it, that file, along with
<filename class="devicefile">/srv/my-brilliant-site.com/mailboxes/bob/vacation</filename> and
<filename class="devicefile">/srv/my-brilliant-site.com/mailboxes/bob/vacation.db</filename> should <emphasis role="strong">all</emphasis> be
removed.
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary><tertiary>vacation.log</tertiary></indexterm>
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary><tertiary>vacation.db</tertiary></indexterm></simpara>
      <important>
        <simpara>Vacation messages can irritate other email users by
replying to mailing lists, email bounces, and so on.  Every effort is
made to stop this from happening, but it is by no means fool-proof.</simpara>
      </important>
    </section>
    <section id="s-email-aliases">
      <title>Email alias lists</title>
      <simpara>
        <indexterm>
          <primary>Email</primary>
          <secondary>aliases</secondary>
        </indexterm>
      </simpara>
      <simpara>Each domain can have a list of aliases.  This is just a file that
contains a list of local parts, and a list of places they should be
sent on to.  This file should be in the <filename class="directory">config/</filename> directory
and is named <filename class="devicefile">aliases</filename>.
<indexterm><primary>config/</primary><secondary>aliases</secondary></indexterm></simpara>
      <simpara>For example, <emphasis role="strong">my-brilliant-site.com</emphasis> has a list of dummy addresses
that should be sent on to Bob.  So the aliases file would be kept at
<filename class="devicefile">/srv/my-brilliant-site.com/config/aliases</filename> and contains the
following.</simpara>
      <screen>webmaster   bob@my-brilliant-site.com
chairman    charlie@example.com
staff       bob@my-brilliant-site.com, charlie@example.com, dave@example.com</screen>
      <simpara>This ensures that <ulink url="mailto:webmaster@my-brilliant-site.com">webmaster@my-brilliant-site.com</ulink> is sent to
<ulink url="mailto:bob@my-brilliant-site.com">bob@my-brilliant-site.com</ulink>; <ulink url="mailto:chairman@my-brilliant-site.com">chairman@my-brilliant-site.com</ulink> is sent to
<ulink url="mailto:charlie@example.com">charlie@example.com</ulink>; <ulink url="mailto:staff@my-brilliant-site.com">staff@my-brilliant-site.com</ulink> is sent to
<ulink url="mailto:bob@my-brilliant-site.com">bob@my-brilliant-site.com</ulink>, <ulink url="mailto:charlie@example.com">charlie@example.com</ulink>, and <ulink url="mailto:dave@example.com">dave@example.com</ulink>.</simpara>
    </section>
    <section id="s-email-spam-and-virus">
      <title>Spam and virus scanning</title>
      <simpara>Symbiosis comes with
<ulink url="http://wiki.apache.org/spamassassin/"><application class="software">SpamAssassin</application></ulink> and
<ulink url="http://www.clamav.net/"><application class="software">ClamAV</application></ulink> installed to protect your email users
against spam and virus in their inbox.  To enable these features,
simply create the files <filename class="devicefile">config/antispam</filename> or <filename class="devicefile">config/antivirus</filename> as
appropriate.  This will configure that domain to reject email if it is
considered to be spam, or if it contains a virus.</simpara>
      <simpara>If you’d rather accept all email and simply tag it as spam, put the
word <emphasis role="strong">tag</emphasis> in <filename class="devicefile">config/antispam</filename>.  This will also cause the email to be
delivered into the <filename class="devicefile">Spam/</filename> folder for that user.</simpara>
    </section>
    <section id="s-email-spamassassin-customisation">
      <title>Customising <application class="software">SpamAssassin</application></title>
      <simpara>
        <indexterm>
          <primary>SpamAssassin</primary>
        </indexterm>
      </simpara>
      <simpara>The configuration for <application class="software">SpamAssassin</application> for the <emphasis role="strong">admin</emphasis> user is kept in
<filename class="devicefile">/srv/.spamassassin/user_prefs</filename>.  Here you can adjust what score is needed to
reject spam, and which tests are used during scanning.  This file will only
appear after a mail has been received with spam detection turned on, but
one can be created and configured before this occurs.</simpara>
      <simpara>The file contains comments and instructions, and further tips can be
found on the
<ulink url="http://wiki.apache.org/spamassassin/UsingSpamAssassin"><application class="software">SpamAssassin</application>
wiki</ulink>.</simpara>
      <simpara>In brief, to cause <emphasis role="strong">more mail</emphasis> to be rejected, you need to reduce the
threshold score.  Therefore change the line reading <literal># required_score
5</literal> should be changed to <literal>required_score 4</literal>.  Notice that the <literal>#</literal> has
been removed at the start of the line to un-comment it.</simpara>
      <simpara>Similarly if mail is being rejected, you can increase the score.</simpara>
      <simpara>Further instructions can be found on the
<ulink url="http://wiki.apache.org/spamassassin/UsingSpamAssassin"><application class="software">SpamAssassin</application>
wiki</ulink>.</simpara>
      <simpara>There is no facility to train the SpamAssassin Bayesian learner yet.</simpara>
    </section>
    <section id="s-email-spam-virus-headers">
      <title>Filtering mail using headers</title>
      <simpara>
        <indexterm>
          <primary>Email</primary>
          <secondary>spam headers</secondary>
        </indexterm>
      </simpara>
      <simpara>Headers are added to messages when spam or virus scanning is enabled.  These
can be used by email clients to filter email, for example in to spam or
quarantine folders.</simpara>
      <simpara>With spam scanning enabled, any email that <emphasis role="strong">is</emphasis> accepted has the following
headers added</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
<literal>X-Spam-Score</literal>
</simpara>
        </listitem>
        <listitem>
          <simpara>
<literal>X-Spam-Bar</literal>
</simpara>
        </listitem>
        <listitem>
          <simpara>
<literal>X-Spam-Status</literal>
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>The score is determined by <application class="software">SpamAssassin</application>, and is the basis for
acceptance or rejection.  The higher the score, the more certain
<application class="software">SpamAssassin</application> is that the message is unwanted.  The default threshold
for rejection is 5.</simpara>
      <simpara>The bar is a length of pluses or minuses that provide an easy-to-parse
representation of the score.  A positive score is given pluses, a
negative score minuses.  For example a score of 5.6 would be
represented as <literal>++++++</literal>; a score of -2.2 would be represented as <literal>--</literal>.</simpara>
      <simpara>The status is always either <literal>innocent</literal> or <literal>spam</literal>, depending on the
score.</simpara>
      <simpara>When virus scanning is enabled,  the header <literal>X-Anti-Virus</literal> is added to messages
that have been scanned.  This is set to either <literal>infected</literal> or <literal>clean</literal>.</simpara>
      <simpara>The content of an email can be changed if it’s marked as spam by <application class="software">SpamAssassin</application>.
For example, you may wish to prepend an email’s subject with <command>SPAM</command> to highlight
it in your inbox. To do this, append the following code block to the end of the
<command>/etc/exim4/system_filter</command> file:</simpara>
      <screen>if $h_X-Spam-Status: contains "spam"
then
    headers add "Old-Subject: $h_subject"
    headers remove "Subject"
    headers add "Subject: *** SPAM *** $h_old-subject"
    headers remove "Old-Subject"
endif</screen>
    </section>
    <section id="_using_real_time_blacklists_from_spamhaus">
      <title>Using real-time blacklists from Spamhaus</title>
      <simpara><indexterm><primary>Email</primary><secondary>Spamhaus blocklists</secondary></indexterm>
<indexterm><primary>Spamhaus</primary></indexterm></simpara>
      <simpara>There are three lists from Spamhaus that can be used to reject email
based on the sender’s IP address, namely</simpara>
      <variablelist>
        <varlistentry>
          <term>
<ulink url="http://www.spamhaus.org/sbl">The Spamhaus Block List (SBL)</ulink>
</term>
          <listitem>
            <simpara>
a list of addresses from which Spamhaus does not recommend receiving email.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<ulink url="http://www.spamhaus.org/xbl">The Exploits Block List (XBL)</ulink>
</term>
          <listitem>
            <simpara>
a list of hijacked computers infected by third party exploits and viruses.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<ulink url="http://www.spamhaus.org/pbl">The Policy Block List (PBL)</ulink>
</term>
          <listitem>
            <simpara>
a list of addresses that should not be sending unauthenticated email at all.
</simpara>
          </listitem>
        </varlistentry>
      </variablelist>
      <simpara>These lists are combined to form the Zen list.</simpara>
      <simpara>The following instructions will enable use of these lists on our example domain
<emphasis role="strong">my-brilliant-site.com</emphasis>.</simpara>
      <procedure>
        <step>
          <simpara>
Connect to your machine using <application class="software">FileZilla</application>
</simpara>
        </step>
        <step>
          <simpara>
On the remote directory tree, navigate to
   <filename class="directory">/srv/my-brilliant-site.com/config/</filename>.
</simpara>
        </step>
        <step>
          <simpara>
In this directory, create another directory called
   <filename class="directory">blacklists/</filename>.  This is done by clicking the right mouse
   button on the <filename class="directory">config/</filename> directory, and selecting <guibutton>Create
   directory</guibutton> from the menu that pops up.
</simpara>
        </step>
        <step>
          <simpara>
On your local machine create a file called <filename class="devicefile">zen.spamhaus.org</filename>.
   This is just an empty file.
</simpara>
        </step>
        <step>
          <simpara>
Once this is done, navigate to the <filename class="devicefile">blacklists</filename> directory on the
   remote file system, and select
   <filename class="devicefile">zen.spamhaus.org</filename> from the local file system, and upload it.  Make
   sure that the remote file has the correct name, i.e. no extra
   <literal>.txt</literal> extension.
</simpara>
        </step>
      </procedure>
      <simpara>That is all that is needed to start using the Spamhaus Zen blacklist.
If you’d rather use a combination of lists create one or more of the
following files:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
<filename class="devicefile">sbl.spamhaus.org</filename> to enable the SBL list
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">xbl.spamhaus.org</filename> to enable the XBL list
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">pbl.spamhaus.org</filename> to enable the PBL list
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">sbl-xbl.spamhaus.org</filename> to enable the combined SBL and XBL list
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">zen.spamhaus.org</filename> to enable the combined SBL, XBL, and PBL list
</simpara>
        </listitem>
      </itemizedlist>
    </section>
    <section id="_manually_blocking_incoming_mail_from_specific_sources">
      <title>Manually blocking incoming mail from specific sources</title>
      <simpara>
        <indexterm>
          <primary>Email</primary>
          <secondary>Manually defined blocklists</secondary>
        </indexterm>
      </simpara>
      <simpara>While publicly maintained blacklists like spamhaus are much easier to rely on
and lower maintenance, at some point you might find occasion to block specific
email senders. Symbiosis allows blocking based on these criteria:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
Hostname of sender, which is matched against the reverse DNS of the sender’s IP. Example entry: <filename class="devicefile">*.bad-domain.com</filename>
</simpara>
        </listitem>
        <listitem>
          <simpara>
IP of sender, which can be a single IP or a range specified in CIDR notation (be wary of blocking too much if you use this option). Example entry: <filename class="devicefile">192.168.0.1</filename>
</simpara>
        </listitem>
        <listitem>
          <simpara>
Address of sender. This option may specify wildcard records, eg "*@example.com" will catch all emails from that domain. Please note this works on the "envelope from" rather than the "from" address. Example entry: <filename class="devicefile">bad_sender@example.com</filename>.
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>To block with one of these criteria, you can use:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
<filename class="devicefile">/etc/exim4/blacklist/by_hostname</filename> for eg <filename class="devicefile">.bad-domain.com</filename>
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">/etc/exim4/blacklist/by_ip</filename> for <filename class="devicefile">192.168.0.1</filename>
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">/etc/exim4/blacklist/by_sender</filename> for <filename class="devicefile">bad_sender@example.com</filename>
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>Each entry to these files should be on a new line.</simpara>
      <simpara>It is also possible to explicitly allow email from senders that would
otherwise be blacklisted by adding entries in similarly named files
under <filename class="devicefile">/etc/exim4/whitelist</filename>.</simpara>
    </section>
    <section id="s-mail-rate-limiting">
      <title>Rate limiting outbound email</title>
      <simpara>Symbiois can now easily be configured to limit the number of outbound emails, either per-user, or per-domain.
You might want to rate limit to prevent anyone taking advantage of your server, maybe using it
to send out SPAM. The limit can be configured on a per-user basis with the following file :</simpara>
      <simpara>
        <filename class="devicefile">/srv/domain.com/mailboxes/bob/ratelimit</filename>
      </simpara>
      <simpara>and on a per-domain basis with the following file :</simpara>
      <simpara>
        <filename class="devicefile">/srv/domain.com/config/mailbox-ratelimit</filename>
      </simpara>
      <simpara>In both cases, the contents of the file should be a number, which represents the allowed limit per day.
If the file is left blank, the default of 100 is applied. Senders who breach this limit will
be sent an error email to explain why their message has not been sent, and discarded.</simpara>
    </section>
    <section id="s-email-outbound-ip">
      <title>Setting an outbound IP for all email from a domain</title>
      <simpara>If the domain has a <filename class="devicefile">config/ip</filename> file in place then the IP in that file
will be used for outgoing email.  This can be useful if your machine
has a number of IP addresses and you’re suffering from deliverability
issues.
<indexterm><primary>config/</primary></indexterm>config/</simpara>
    </section>
    <section id="s-mail-configuraion-blocking">
      <title>Blocking email</title>
      <simpara>Symbiosis allows you to blacklist email senders by:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
email address (specific and wildcarded)
</simpara>
        </listitem>
        <listitem>
          <simpara>
by IP (specific and a range)
</simpara>
        </listitem>
        <listitem>
          <simpara>
by hostname (also specific or wildcarded).
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>Execute the following actions as <command>root</command> user rather than <command>admin</command>.</simpara>
      <simpara>To block a specific email address, simply add the address to the file
<command>/etc/exim4/blacklist/by_sender</command>.</simpara>
      <simpara>The <command>by_sender</command> list accepts email addresses like
<command>malefactor@example.com</command> or wildcarded ones like <command>*@example.com</command> to
block a whole domain. Note that this blacklist is matched against the
<emphasis>Envelope Sender</emphasis> address, rather than the <emphasis>From</emphasis> address.</simpara>
      <simpara>To block by IP, add the IP address to <command>/etc/exim4/blacklist/by_ip</command></simpara>
      <simpara>The <command>by_ip</command> list accepts IP addresses like <command>192.168.66.6</command> or ranges like
<command>10.66.6.0/24</command>. This is used to blacklist by the IP address of the
connecting machine.</simpara>
      <simpara>Finally the <command>by_hostname</command> list accepts hostnames like <command>bad.example.com</command>,
or wildcarded like <command>*.example.com</command>. This is used to blacklist against
the reverse DNS of the IP of the host connecting.</simpara>
    </section>
    <section id="s-mail-configuration-sni">
      <title>Enabling SNI for Exim and Dovecot</title>
      <simpara>
        <indexterm>
          <primary>Email SNI</primary>
        </indexterm>
      </simpara>
      <simpara>If you have multiple active domains with email hosted on your server,
enabling SNI will allow you to use a unique SSL certificate for each.
This will help avoid the "certificate mismatch" errors you may see when
attempting to login to one of your email accounts.</simpara>
      <simpara>To configure SNI support for Exim, please see
<ulink url="https://docs.bytemark.co.uk/article/enabling-sni-for-exim-on-symbiosis">this guide</ulink>.</simpara>
      <simpara>And to configure SNI support for Dovecot, please see
<ulink url="https://docs.bytemark.co.uk/article/enabling-sni-for-dovecot-on-symbiosis">this guide</ulink>.</simpara>
    </section>
    <section id="s-mail-configuration-layout">
      <title>Configuration layout</title>
      <simpara>
        <indexterm>
          <primary>Email</primary>
          <secondary>configuration layout</secondary>
        </indexterm>
      </simpara>
      <simpara>Here is an example configuration layout for the domain
<filename class="devicefile">my-brilliant-site.com</filename>.  All the following files are kept in
<filename class="directory">/srv/my-brilliant-site.com/</filename>.</simpara>
      <variablelist>
        <varlistentry>
          <term>
<filename class="directory">mailboxes/</filename>
</term>
          <listitem>
            <simpara>
This is where
individual mailboxes are defined.  If this directory does not exist,
then mail will not be accepted for <filename class="devicefile">my-brilliant-site.com</filename>, unless a
default forwarding address or filter has been set up.
<indexterm><primary>mailboxes/</primary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">mailboxes/bob/</filename>
</term>
          <listitem>
            <simpara>
Mail will be
accepted for the email address <ulink url="mailto:bob@my-brilliant-site.com">bob@my-brilliant-site.com</ulink>.
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">mailboxes/bob/Maildir/</filename>
</term>
          <listitem>
            <simpara>
This
is where the email for <ulink url="mailto:bob@my-brilliant-site.com">bob@my-brilliant-site.com</ulink> will be delivered. It
will be <emphasis role="strong">created automatically</emphasis> upon receipt of the first message to
that address.
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary><tertiary>Maildir/</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">mailboxes/bob/password</filename>
</term>
          <listitem>
            <simpara>
File containing
the password for <ulink url="mailto:bob@my-brilliant-site.com">bob@my-brilliant-site.com</ulink> allowing him to collect his
email over IMAP/POP3, and relay email using SMTP. His username is the
same as his email address.  See <xref linkend="s-email-passwords"/> for more
information.
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary><tertiary>password</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">mailboxes/bob/quota</filename>
</term>
          <listitem>
            <simpara>
File containing the quota for a user.  The quota
should a number of bytes.  This can be followed by one of <literal>k</literal>, <literal>M</literal>, or <literal>G</literal> to
specify kibibytes, mebibytes, or gibibytes respectively.  For example <literal>100M</literal>
would be 100 mebibytes, or 104857600 bytes.  See <xref linkend="s-email-quotas"/> for more
information.
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary><tertiary>quota</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">mailboxes/bob/forward</filename>
</term>
          <listitem>
            <simpara>
File containing
either a comma-separated list of addresses, or an Exim filter. All
mail addressed to <ulink url="mailto:bob@my-brilliant-site.com">bob@my-brilliant-site.com</ulink> will be forwarded to the
list of addresses, or processed by the filter. See <xref linkend="s-email-forward-files"/>
for more information.
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary><tertiary>forward</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">mailboxes/bob/vacation</filename>
</term>
          <listitem>
            <simpara>
File containing
a vacation message for Bob.  See <xref linkend="s-email-vacation-messages"/> for more
information.
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary><tertiary>vacation</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">mailboxes/bob/sieve</filename>
</term>
          <listitem>
            <simpara>
File containing a Sieve filter.  This can be edited by
the user without shell access to the server.  See <xref linkend="s-email-sieve"/> for more
information.
<indexterm><primary>mailboxes/</primary><secondary>user/</secondary><tertiary>sieve</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/aliases</filename>
</term>
          <listitem>
            <simpara>
This file contains a
list of aliases for a domain.  The format is the local username
followed by one or more spaces, and then comma separated list of email
addresses which should receive the mail.  See <xref linkend="s-email-aliases"/> for
more information.
<indexterm><primary>config/</primary><secondary>aliases</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/default_forward</filename>
</term>
          <listitem>
            <simpara>
File containing either a comma-separated list of
addresses, or an Exim filter. All mail addressed to the domain
my-brilliant-site.com for local parts without directories under mailboxes will
be forwarded to this address or processed by this filter. See
<xref linkend="s-email-forward-files"/> for more information.
<indexterm><primary>config/</primary><secondary>default_forward</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/antispam</filename>
</term>
          <listitem>
            <simpara>
If this file is
present, then all email for the domain my-brilliant-site.com will be
scanned by <ulink url="http://spamassassin.apache.org"><application class="software">SpamAssassin</application></ulink> to determine whether it is spam. If it is
spam, it will be rejected. If that file begins with the word tag, mail
will never be rejected, just tagged as usual.
<indexterm><primary>config/</primary><secondary>antispam</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/mailbox-quota</filename>
</term>
          <listitem>
            <simpara>
If this file is present, then all mailboxes
for this domain will have their quota determined by this file.  The quota
should a number of bytes.  This can be followed by one of <literal>k</literal>, <literal>M</literal>, or <literal>G</literal> to
specify kilobytes, megabytes, or gigabytes respectively.  For example <literal>100M</literal>
would be 100 megabytes, or 100,000,000 bytes.  See <xref linkend="s-email-quotas"/> for more
information.
<indexterm><primary>config/</primary><secondary>mailbox-quota</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/antivirus</filename>
</term>
          <listitem>
            <simpara>
If this file is
present, then all email for the domain my-brilliant-site.com will be
scanned for viruses by <ulink url="http://www.clamav.net"><application class="software">ClamAV</application></ulink>. If a message is determined to contain a
virus, it will be rejected. If that file begins with the word tag,
mail will never be rejected, just tagged.
<indexterm><primary>config/</primary><secondary>antivirus</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/blacklists/sbl.spamhaus.org</filename>
</term>
          <listitem>
            <simpara>
Reject mail for
this domain if the sending machine’s IP is listed in the
<ulink url="http://www.spamhaus.org/sbl">Spamhaus Block List</ulink>.
<indexterm><primary>config/</primary><secondary>blacklists/</secondary><tertiary>sbl.spamhaus.org</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/blacklists/xbl.spamhaus.org</filename>
</term>
          <listitem>
            <simpara>
Reject mail for
this domain if the sending machine’s IP is listed in the
<ulink url="http://www.spamhaus.org/xbl">Spamhaus Exploits Block List</ulink>.
<indexterm><primary>config/</primary><secondary>blacklists/</secondary><tertiary>xbl.spamhaus.org</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/blacklists/pbl.spamhaus.org</filename>
</term>
          <listitem>
            <simpara>
Reject mail for
this domain if the sending machine’s IP is listed in the
<ulink url="http://www.spamhaus.org/pbl">Spamhaus Policy Block List</ulink>.
<indexterm><primary>config/</primary><secondary>blacklists/</secondary><tertiary>pbl.spamhaus.org</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/blacklists/sbl-xbl.spamhaus.org</filename>
</term>
          <listitem>
            <simpara>
Reject mail
for this domain if the sending machine’s IP is listed in either the
Spamhaus or the Exploits block lists.
<indexterm><primary>config/</primary><secondary>blacklists/</secondary><tertiary>sbl-xbl.spamhaus.org</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/blacklists/zen.spamhaus.org</filename>
</term>
          <listitem>
            <simpara>
Reject mail for
this domain if the sending machine’s IP is listed in the
<ulink url="http://www.spamhaus.org/zen/">Spamhaus Zen Block List</ulink>, which is a
combination of the Spamhaus, Exploits, and Policy block lists.
<indexterm><primary>config/</primary><secondary>blacklists/</secondary><tertiary>zen.spamhaus.org</tertiary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>
  </chapter>
  <chapter id="ch-xmppreference">
    <title>XMPP Reference</title>
    <simpara>XMPP is a protocol that supports both private instant messages, and group
instant messages. The server also supports features such as roster management,
for keeping track of contacts and showing who is and is not online. Here is a
broad overview of what the symbiosis-xmpp package supports:</simpara>
    <itemizedlist>
      <listitem>
        <simpara>
Federation - this is where users of your XMPP server may communicate with
   users of any other correctly configured XMPP server, with their own, locally hosted account. This will
   also allow a user to connect to multiple user chats (see below) on the local server or remote
   servers, should they wish to do so.
</simpara>
      </listitem>
      <listitem>
        <simpara>
Roster (contact list) management - before receiving messages from a new
   contact, each user must add the other to their contact list. The server will
   then remember contacts, such that they will be known on all a user’s XMPP
   clients.
</simpara>
      </listitem>
      <listitem>
        <simpara>
Private messages - a user is able to speak to any of their online contacts
</simpara>
      </listitem>
      <listitem>
        <simpara>
Multiple user chat (MUC) - this feature enables users to communicate in groups,
   rather than one on one. These chats will often be named
   after the intended subject of discussion, eg "office" or "managers". If you
   wish, you can host a MUC that anyone else can connect to and use to chat.
   Think of this as being a cross between an instant message and a mailing list.
</simpara>
      </listitem>
    </itemizedlist>
    <simpara>Symbiosis uses <ulink url="http://prosody.im">Prosody</ulink> as its XMPP server.</simpara>
    <simpara>To configure your domain to start using XMPP, create the file
<filename class="devicefile">config/xmpp</filename>.
<indexterm><primary>config/</primary><secondary>xmpp</secondary></indexterm></simpara>
    <section id="_adjusting_the_xmpp_configuration">
      <title>Adjusting the XMPP configuration</title>
      <simpara>Domains' XMPP configuration is kept in
<filename class="directory">/etc/prosody/config.d</filename> with each domain having its own
snippet.  Feel free to edit these snippets as you see fit, as once
edited they will never get overwritten automatically.</simpara>
      <simpara>If you do wish to restore the configuration to the default, you can
run <command>symbiosis-xmpp-configure --force --verbose</command>.</simpara>
      <simpara>Symbiosis uses a configuration template for the XMPP server.  This is
kept in <filename class="devicefile">/etc/symbiosis/xmpp.d/prosody.template.erb</filename>.  This is the
place to adjust things for all domains running on the server.</simpara>
      <simpara>Once you’ve adjusted that to your liking, you can run
<command>symbiosis-xmpp-configure --verbose</command> to apply your changes.</simpara>
    </section>
  </chapter>
  <chapter id="ch-ftp-reference">
    <title>FTP configuration</title>
    <simpara>FTP users can be authenticated in two ways: on a per-domain basis, or
on a per-user-per-domain basis.  It is possible to enable other forms
of authentication too.</simpara>
    <section id="_per_domain_authentication">
      <title>Per-domain authentication</title>
      <simpara>
        <indexterm>
          <primary>config/</primary>
          <secondary>ftp-password</secondary>
        </indexterm>
      </simpara>
      <simpara>Basic per-domain authentication is controlled by the <filename class="devicefile">config/ftp-password</filename> file.
This file contains the plain-text or hashed password for the FTP user
whose username is the domain name.  This user is limited to accessing
the <filename class="directory">public</filename> directory for that domain.</simpara>
      <simpara>For example, <filename class="devicefile">/srv/my-brilliant-site.com/config/ftp-password</filename> contains
the password for the FTP user <emphasis role="strong">my-brilliant-site.com</emphasis>, and that user
will be limited to accessing
<filename class="directory">/srv/my-brilliant-site.com/public</filename>.</simpara>
    </section>
    <section id="_multi_user_authentication">
      <title>Multi-user authentication</title>
      <simpara>
        <indexterm>
          <primary>config/</primary>
          <secondary>ftp-users</secondary>
        </indexterm>
      </simpara>
      <simpara>This authentication method is controlled by the <filename class="devicefile">config/ftp-users</filename>
file.  This file contains more than just the password.  Each line in
the file represents a different user, and contains the username,
password, base directory, and quota.  Comments in the file start with
<emphasis role="strong">#</emphasis>.</simpara>
      <screen># username:password:directory:quota
bab:babs password:/path/to/base:10M</screen>
      <simpara>The directory and quota fields are optional.  If the password field is
empty, the user will not be able to log in.</simpara>
      <simpara>In the above example, if that file was kept at
<filename class="devicefile">/srv/my-brilliant-site.com/config/ftp-users</filename> then the user
<emphasis role="strong">babs@my-brilliant-site</emphasis> would be able to log in with the password
<emphasis role="strong">babs password</emphasis>.  She’d be limited to the accessing files and
directories below <filename class="directory">/path/to/base</filename>, and uploads to that that
directory would be prohibited if it contains more than 10 Megabytes of
data.</simpara>
    </section>
    <section id="_other_forms_of_authentication">
      <title>Other forms of authentication</title>
      <simpara>It is possible to use the other forms of authentication provided by
Pure-FTPd.  The
<ulink url="https://download.pureftpd.org/pub/pure-ftpd/doc/README.Virtual-Users">Pure-FTPd manual</ulink>
gives a good run down of all the various ways to do it.  Here the two
most common ways have been documented.</simpara>
      <section id="_puredb_authentication">
        <title>PureDB authentication</title>
        <simpara>To enable authentication for virtual users, but would rather not use
the Symbiosis method, you can create a Pure FTPd authentication DB,
and use that.  To tell the server to authenticate against it, you can
run the following commands, as root.</simpara>
        <screen>echo /etc/pure-ftpd/pureftpd.pdb &gt; /etc/pure-ftpd/conf/PureDB
touch /etc/pure-ftpd/pureftpd.pdb
ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/50puredb
service pure-ftpd restart</screen>
        <simpara>Then you can use the
<ulink url="http://manpages.debian.org/cgi-bin/man.cgi?query=pure-pw&amp;apropos=0&amp;sektion=0&amp;manpath=Debian+8+jessie&amp;format=html&amp;locale=en"><application class="software">pure-pw</application></ulink>
command to add new users.  For example to add the user <emphasis role="strong">foo</emphasis>, you can
run:</simpara>
        <screen>pure-pw useradd foo -u 1000 -g 1000 -d /path/to/home -m</screen>
        <simpara>It will prompt you for the password, and then rebuild the password
file <filename class="devicefile">/etc/pure-ftpd/pureftpd.pdb</filename> automatically.</simpara>
      </section>
      <section id="_pam_authentication">
        <title>Pam authentication</title>
        <simpara>If you would like to add normal PAM authentication, then you can run
the following commands as root.</simpara>
        <screen>echo 1 &gt; /etc/pure-ftpd/conf/PAMAuthentication
ln -s /etc/pure-ftpd/conf/PAMAuthentication /etc/pure-ftpd/auth/50pam
serivce pure-ftpd restart</screen>
        <simpara>Normal UNIX users should be able to log in now with their standard
passwords.</simpara>
      </section>
    </section>
    <section id="_quotas">
      <title>Quotas</title>
      <simpara>There are two ways of specifying a quota.  The default quota for a
domain goes in <filename class="devicefile">config/ftp-quota</filename>.  This controls the quota for the
per-domain user in <filename class="directory">public</filename>, as well as the default quota
for users specified in <filename class="devicefile">config/ftp-users</filename>.  Its format is the same as
that for <link linkend="s-email-quotas">email quotas</link>.</simpara>
      <simpara>For the multi-user configuration file, a user’s quota can be specified
in the final field, again in the same format as that used for email
quotas.</simpara>
    </section>
    <section id="_ftp_configuration_layout">
      <title>FTP configuration layout</title>
      <variablelist>
        <varlistentry>
          <term>
<filename class="devicefile">config/ftp-password</filename>
</term>
          <listitem>
            <simpara>
Domain-wide FTP user’s password.
<indexterm><primary>config/</primary><secondary>ftp-password</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/ftp-quota</filename>
</term>
          <listitem>
            <simpara>
Default FTP quota for the domain.
<indexterm><primary>config/</primary><secondary>ftp-quota</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">config/ftp-users</filename>
</term>
          <listitem>
            <simpara>
Per-user configuration for a domain.
<indexterm><primary>config/</primary><secondary>ftp-users</secondary></indexterm>
</simpara>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>
  </chapter>
  <chapter id="ch-reference-firewall">
    <title>Firewall Reference</title>
    <simpara>The firewall component of the Symbiosis system serves to protect the
system by controlling its inbound and outbound connections.  It
comprises of a set of rules, and automatic whitelist and blacklist
generation.</simpara>
    <simpara>The firewall should be configured over SFTP as the <emphasis role="strong">admin</emphasis> user, and
any changes made will take affect immediately.</simpara>
    <section id="s-firewall-normal-rules">
      <title>Allowing and denying access to services</title>
      <simpara>
        <indexterm>
          <primary>Firewall</primary>
          <secondary>accessing services</secondary>
        </indexterm>
      </simpara>
      <simpara>All usual firewall configuration can be carried out by creating and
deleting files in <filename class="directory">/etc/symbiosis/firewall/</filename>.  In this
directory there are a number of subdirectories.  Permissions for
inbound connections are stored in
<filename class="directory">/etc/symbiosis/firewall/incoming.d/</filename>, and outbound
connections in <filename class="directory">/etc/symbiosis/firewall/outgoing.d/</filename>.</simpara>
      <simpara>These files are all of the format <literal>number-name</literal>.  The number
determines the position of the rule in the firewall, the name is the
name of the service that we wish to permit.  These names are stored in
<filename class="devicefile">/etc/services</filename>.  There are also names that do not correspond to
services, which are documented in the next section.</simpara>
      <simpara>Additionally if the name is not known then the file format can be
<literal>number-number</literal> where the first number specifies the position of the
rule in the firewall, and the second number is the port that should be
opened.  For example, the files <filename class="devicefile">10-http</filename> and <filename class="devicefile">10-80</filename> achieve the same
effect.</simpara>
      <simpara>Finally, each file can contain a list of hostnames or IP addresses to
which that rule will apply, one per line.  For example, if addresses
were added to an incoming rule, named <filename class="devicefile">incoming.d/10-accept</filename>, all
connections <emphasis role="strong">from</emphasis> those addresses would be <emphasis role="strong">accepted</emphasis>.  If a file
were added named <filename class="devicefile">outgoing.d/20-reject</filename> and address added to that
file, then outgoing connections <emphasis role="strong">to</emphasis> those addresses would be
<emphasis role="strong">rejected</emphasis>.</simpara>
      <simpara>For example, to allow an incoming connection to arrive at your
machine, and be accepted, on port 22, you would create the file
<filename class="devicefile">/etc/symbiosis/firewall/incoming.d/10-ssh</filename>.  The firewall will update
as soon as the file has been created, so no commands are needed to be
run.</simpara>
      <simpara>If you were wishing to ensure that your host would only accept
incoming SSH requests from your office you might create the same file
with the contents <literal>office.my-brilliant-site.com</literal>.</simpara>
      <simpara>This would ensure that when the firewall was generated incoming
connections on the SSH port would be accepted from the host
<literal>office.my-brilliant-site.com</literal> but not from anywhere else.</simpara>
      <note>
        <simpara>If hostnames, rather than IP addresses are used, then they are
translated to IP addresses at the time the firewall is generated using
DNS.  If the IP address of a hostname changes, then the firewall may
not function as intended until any cached DNS entries have expired,
and the firewall has been regenerated.</simpara>
      </note>
    </section>
    <section id="s-firewall-special-rules">
      <title>Predefined special rules</title>
      <simpara>
        <indexterm>
          <primary>Firewall</primary>
          <secondary>predefined rules</secondary>
        </indexterm>
      </simpara>
      <simpara>There are a number of rules that don’t naturally fit the convention
described above.  This list describes rules that have been written
specially for Symbiosis to cope with these situations.  Each rule
described below can be used in both <filename class="directory">incoming.d/</filename> and
<filename class="directory">outgoing.d/</filename>, and for both IPv4 and IPv6 addresses, unless
otherwise specified.</simpara>
      <simpara>These rules are used in the same way as those described in the
previous chapter.  Files are added in the <filename class="directory">incoming.d/</filename> or
<filename class="directory">outgoing.d/</filename> directory with the name prefixed by a number
giving the position of the rule.  The files can contain addresses or
hostnames, one per line, against which the rule should be applied.</simpara>
      <variablelist>
        <varlistentry>
          <term>
accept
</term>
          <listitem>
            <simpara>
Accept all connections.  Uses the <application class="software">iptables</application> <literal>ACCEPT</literal> target.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
allow
</term>
          <listitem>
            <simpara>
Alias of <emphasis role="strong">accept</emphasis>.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
blacklist
</term>
          <listitem>
            <simpara>
Alias of <emphasis role="strong">reject</emphasis>.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
collector
</term>
          <listitem>
            <simpara>
Permit TCP connections on port 1919.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
dns
</term>
          <listitem>
            <simpara>
Accept incoming TCP and UDP connections from port 53 to
high-numbered, unprivileged ports.  Designed to allow replies to DNS
queries.  This rule can be removed in favour of <emphasis role="strong">related</emphasis>.  This is
for <emphasis role="strong">incoming</emphasis> connections only.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
drop
</term>
          <listitem>
            <simpara>
Drop all connections.  Uses the <application class="software">iptables</application> <literal>DROP</literal> target.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
essential-icmpv6
</term>
          <listitem>
            <simpara>
Accept ICMPv6 packets that are essential for IPv6
networking to operate.  Without this rule the machine IPv6 networking
<emphasis role="strong">will not work</emphasis>.  It permits ICMPv6 types destination-unreachable,
packet-too-big, parameter-problem, router-solicitation,
router-advertisement, neighbor-solicitation, and
neighbor-advertisement.  This is <emphasis role="strong">IPv6</emphasis> only.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
established
</term>
          <listitem>
            <simpara>
Permit connections that are already established.  Uses
the <application class="software">iptables</application> <literal>ESTABLISHED</literal> target.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
ftp
</term>
          <listitem>
            <simpara>
Permit TCP connections on both ports 20 and 21, i.e. ftp and
ftp-data.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
icmp
</term>
          <listitem>
            <simpara>
Permit all ICMP connections.  This <emphasis role="strong">IPv4</emphasis> only.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
icmpv6
</term>
          <listitem>
            <simpara>
Permit all ICMP6 connections.  This is <emphasis role="strong">IPv6</emphasis> only.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
imager
</term>
          <listitem>
            <simpara>
Permit TCP connections on port 5000.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
new
</term>
          <listitem>
            <simpara>
Permit new connections.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
ping
</term>
          <listitem>
            <simpara>
Permit ICMP types echo-request, echo-reply, and ttl-exceeded,
for allowing the machine to be pinged, and show up on traceroutes.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
reject
</term>
          <listitem>
            <simpara>
Reject all connections.  Uses the <application class="software">iptables</application> <literal>REJECT</literal> target.
For TCP connections a TCP reset is sent.  Otherwise it returns port
unreachable.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
related
</term>
          <listitem>
            <simpara>
Accept new connections, but only if they are associated with
an existing one, for example DNS queries, or FTP data transfer.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
whitelist
</term>
          <listitem>
            <simpara>
Alias of <emphasis role="strong">accept</emphasis>.
</simpara>
          </listitem>
        </varlistentry>
      </variablelist>
      <simpara>These rules are all contained in
<filename class="directory">/usr/share/symbiosis/firewall/rule.d/</filename>.  It is perfectly
possible to write your own rules based on those in this directory, but
they should be kept in
<filename class="directory">/usr/local/share/symbiosis/firewall/rule.d/</filename>.</simpara>
    </section>
    <section id="s-firewall-example">
      <title>An example firewall</title>
      <simpara>
        <indexterm>
          <primary>Firewall</primary>
          <secondary>example configuration</secondary>
        </indexterm>
      </simpara>
      <simpara>This example should be read in conjunction with the previous sections.
A machine has the following firewall rules defined for its incoming
connections.</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
<filename class="devicefile">incoming.d/00-related</filename>
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">incoming.d/00-established</filename>
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">incoming.d/05-essential-icmpv6</filename>
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">incoming.d/05-ping</filename>
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">incoming.d/07-ssh</filename> which contains <literal>1.2.3.4</literal>, and
   <literal>2001:41c8:1:dead:beef::/64</literal> on separate lines.
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">incoming.d/10-http</filename>
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">incoming.d/20-25</filename>
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">incoming.d/99-reject</filename>
</simpara>
        </listitem>
        <listitem>
          <simpara>
<filename class="devicefile">incoming.d/100-666</filename>
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>This would set up a firewall that would do the following tests, in
order:</simpara>
      <orderedlist numeration="arabic">
        <listitem>
          <simpara>
Accepted all packets from <emphasis role="strong">established</emphasis> connections.
</simpara>
        </listitem>
        <listitem>
          <simpara>
Accepted all packets from <emphasis role="strong">related</emphasis> connections
</simpara>
        </listitem>
        <listitem>
          <simpara>
Accepted all ICMPv6 packets required for IPv6 connectivity.
</simpara>
        </listitem>
        <listitem>
          <simpara>
Accepted ICMP/ICMPv6 packets required for pings and traceroutes.
</simpara>
        </listitem>
        <listitem>
          <simpara>
Accepted new TCP/UDP connections to port 22 (SSH), but only from 1.2.3.4
     or addresses in the 2001:41c8:1:dead:beef::/64 netblock.
</simpara>
        </listitem>
        <listitem>
          <simpara>
Accepted new TCP/UDP connections to port 666.  Note that this rule comes
     before <filename class="devicefile">10-http</filename>, even though it is called <filename class="devicefile">100-666</filename>.  This is because the
     order is given by the ASCII rather than numerical value of the filename.
</simpara>
        </listitem>
        <listitem>
          <simpara>
Accepted new TCP/UDP connections to port 80 (HTTP).
</simpara>
        </listitem>
        <listitem>
          <simpara>
Accepted new TCP/UDP connections to port 25 (SMTP).
</simpara>
        </listitem>
        <listitem>
          <simpara>
Rejected anything that had not been accepted yet.
</simpara>
        </listitem>
      </orderedlist>
      <simpara>These rules would be installed for IPv4 and IPv6 connections using <application class="software">iptables</application>
and <application class="software">ip6tables</application> respectively.  To inspect the firewall rules at any given time,
you can run <literal>sudo iptables -L -v -n</literal> which will return the current firewall
status.  In this example, the rules would look like this.</simpara>
      <screen>Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target    prot opt in out source          destination
    0     0 ACCEPT    all  --  lo *   0.0.0.0/0       0.0.0.0/0
   13  1012 whitelist all  --  *  *   0.0.0.0/0       0.0.0.0/0
    0     0 blacklist all  --  *  *   0.0.0.0/0       0.0.0.0/0
    0     0 ACCEPT    all  --  *  *   0.0.0.0/0       0.0.0.0/0 state ESTABLISHED
    0     0 ACCEPT    all  --  *  *   0.0.0.0/0       0.0.0.0/0 state RELATED
    0     0 ACCEPT    icmp --  *  *   0.0.0.0/0       0.0.0.0/0 icmp type 8
    0     0 ACCEPT    icmp --  *  *   0.0.0.0/0       0.0.0.0/0 icmp type 0
    0     0 ACCEPT    icmp --  *  *   0.0.0.0/0       0.0.0.0/0 icmp type 11
    0     0 ACCEPT    tcp  --  *  *   1.2.3.4         0.0.0.0/0 tcp dpt:22
    0     0 ACCEPT    udp  --  *  *   1.2.3.4         0.0.0.0/0 udp dpt:22
    0     0 ACCEPT    tcp  --  *  *   0.0.0.0/0       0.0.0.0/0 tcp dpt:80
    0     0 ACCEPT    udp  --  *  *   0.0.0.0/0       0.0.0.0/0 udp dpt:80
    0     0 ACCEPT    tcp  --  *  *   0.0.0.0/0       0.0.0.0/0 tcp dpt:666
    0     0 ACCEPT    udp  --  *  *   0.0.0.0/0       0.0.0.0/0 udp dpt:666
    0     0 ACCEPT    tcp  --  *  *   0.0.0.0/0       0.0.0.0/0 tcp dpt:25
    0     0 ACCEPT    udp  --  *  *   0.0.0.0/0       0.0.0.0/0 udp dpt:25
    0     0 REJECT    all  --  *  *   0.0.0.0/0       0.0.0.0/0 reject-with icmp-port-unreachable

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target    prot opt in out source          destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target    prot opt in out source          destination
    0     0 ACCEPT    all  --  *  lo  0.0.0.0/0       0.0.0.0/0
    7  1388 ACCEPT    all  --  *  *   0.0.0.0/0       0.0.0.0/0 state ESTABLISHED
    0     0 ACCEPT    all  --  *  *   0.0.0.0/0       0.0.0.0/0 state RELATED
    0     0 REJECT    all  --  *  *   0.0.0.0/0       0.0.0.0/0 owner UID match 33 reject-with icmp-port-unreachable

Chain blacklist (1 references)
 pkts bytes target    prot opt in out source          destination
    0     0 REJECT    all  --  *  *   71.63.72.4      0.0.0.0/0 reject-with icmp-port-unreachable
    0     0 REJECT    all  --  *  *   61.145.118.190  0.0.0.0/0 reject-with icmp-port-unreachable

Chain whitelist (1 references)
 pkts bytes target    prot opt in out source           destination
   13  1012 ACCEPT    all  --  *  *   212.110.163.132 0.0.0.0/0</screen>
      <simpara>This listing shows how the rules in the files under
<filename class="directory">/etc/symbiosis/firewall/</filename> are translated into <application class="software">iptables</application>
rules.  It also shows that by default all connections on the loopback
interface <emphasis role="strong">lo</emphasis> are permitted, and that the whitelist and blacklist
tables have references in the <literal>INPUT</literal>, i.e. incoming, table before the
rules defined in <filename class="directory">/etc/symbiosis/firewall/incoming.d/</filename> are
applied.</simpara>
      <simpara>IPv6 rules follow the same format, and can be checked by running <literal>sudo
ip6tables -L -v -n</literal>.</simpara>
    </section>
    <section id="s-firewall-custom-additions">
      <title>Making custom additions to your firewall</title>
      <simpara>
        <indexterm>
          <primary>Firewall</primary>
          <secondary>adding custom rules</secondary>
        </indexterm>
      </simpara>
      <simpara>The Symbiosis firewall package should allow you to carry out the most
common tasks, simply by creating files named after the services you
wish to permit or deny.</simpara>
      <simpara>However there are times when you might wish to make your own custom
additions, and for this purpose the firewall package allows you to run
an unlimited number of custom scripts/programs once it has loaded the
rules - these scripts may perform arbitrary actions, but will be most
typically used to update the firewall rules, via the <application class="software">iptables</application> or
<application class="software">ip6tables</application> commands.</simpara>
      <simpara>The program <application class="software">run-parts</application> is used to execute scripts in
<filename class="directory">/etc/symbiosis/firewall/local.d/</filename>, after the firewall has
finished loading.  This means that the scripts have to have to fulfil
the naming conditions described in the
<ulink url="http://manpages.debian.net/cgi-bin/man.cgi?query=run-parts&amp;manpath=Debian+6.0+squeeze&amp;format=html">run-parts(8)</ulink>
manual page.  Essentially the script should be marked executable, and
only contain alphanumeric characters in its name.</simpara>
      <warning>
        <simpara>If any scripts in <filename class="directory">local.d/</filename> exit with a non-zero status the
firewall will be deemed to have failed in some way, and the firewall
will be restored to its prior state.</simpara>
      </warning>
    </section>
    <section id="s-firewall-blacklist">
      <title>Blocking abusive remote hosts</title>
      <simpara>
        <indexterm>
          <primary>Firewall</primary>
          <secondary>automatic blacklist</secondary>
        </indexterm>
      </simpara>
      <simpara>The <filename class="devicefile">symbiosis-firewall-blacklist</filename> tool runs four times an hour, and
is designed to scan your server’s logfiles for abusive behaviour from
malicious remote hosts.  Malicious activity which is detected will
result in the remote host being denied further access to your server.</simpara>
      <simpara>Currently we regard malicious activity as:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
Invalid SSH logins.
</simpara>
        </listitem>
        <listitem>
          <simpara>
Invalid FTP logins.
</simpara>
        </listitem>
        <listitem>
          <simpara>
Invalid SMTP/POP3/IMAP/ManageSieve logins.
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>Every 15 minutes various logfiles are scanned for certain patterns to
search for new malicious IPs, and the firewall is updated.</simpara>
      <simpara>These patterns are defined in
<filename class="directory">/etc/symbiosis/firewall/patterns.d/</filename>.  For example, for SSH
the following pattern definition is used:
<indexterm><primary>Firewall</primary><secondary>patterns used for blacklisting IPs</secondary></indexterm></simpara>
      <screen>#
#  The logfile we look for matches within.
#
file = /var/log/auth.log <co id="CO1-1"/>

#
#  Any matches will be denied access to these ports.
#
#  Comma-separated values are expected.
#
ports = 22 <co id="CO1-2"/>


#
#  Patterns we'll match upon.
#
Failed password for invalid user [^ ]+ from __IP__ port [^ ]+ ssh2 <co id="CO1-3"/>
Failed password for [^ ]+ from __IP__ port [^ ]+ ssh2</screen>
      <calloutlist>
        <callout arearefs="CO1-1">
          <para>
Is the file to search
</para>
        </callout>
        <callout arearefs="CO1-2">
          <para>
Are the ports to block
</para>
        </callout>
        <callout arearefs="CO1-3">
          <para>
Are the regular expressions to look for, where __IP__ is a
    pre-defined regular expression that matches both IPv4 and IPv6
    addresses.
</para>
        </callout>
      </calloutlist>
      <simpara>If an IP matches one of those patterns in the period since the last
check was made, it is added to the blacklist.</simpara>
      <simpara>Disabling the firewall completely will disable the blacklisting
behaviour, but you might also wish to disable that separately.</simpara>
      <simpara>To do this, login over SFTP as <emphasis role="strong">admin</emphasis> and create the file
<filename class="devicefile">/etc/symbiosis/firewall/blacklist/disabled</filename>.  This will immediately
disable and clear the blacklist.</simpara>
      <note>
        <simpara>IPv6 addresses are masked to a /64, which is the smallest
assignment of addresses recommended for an end site.</simpara>
      </note>
    </section>
    <section id="s-firewall-whitelist">
      <title>Whitelisting "known-good" IP addresses</title>
      <simpara>
        <indexterm>
          <primary>Firewall</primary>
          <secondary>automatic whitelist</secondary>
        </indexterm>
      </simpara>
      <simpara>The <filename class="devicefile">symbiosis-firewall-whitelist</filename> tool runs once per hour, and is
designed to perform the opposite task to the
<filename class="devicefile">symbiosis-firewall-blacklist</filename> script - in short it is designed to
ensure that any remote host which has successfully connected to your
server in the past isn’t (accidentally) blacklisted in the future.</simpara>
      <simpara>Every hour the script will examine the successful logins which have
been observed recently.  Each IP address which has successfully been
the source of a login attempt will be permitted access to the system
on a global basis, and will thus not be locked out.</simpara>
      <simpara>As with the automatic blacklist, IPv6 addresses are masked to a /64,
which is the smallest recommended assignment for an end site.</simpara>
      <simpara>To disable the automatic whitelist, login over SFTP as <emphasis role="strong">admin</emphasis> and
create the file <filename class="devicefile">/etc/symbiosis/firewall/whitelist.d/disabled</filename>.  This
will immediately clear the whitelist, and prevent further updates.</simpara>
      <simpara>You can add your own entries to the whitelist, which never expire, by
creating entries in the directory <filename class="directory">/etc/symbiosis/firewall/whitelist.d/</filename>.
Create the file <filename class="devicefile">/etc/symbiosis/firewall/whitelist.d/&lt;ip address&gt;</filename> and the specified
IP address will not be blacklisted, or refused access to your server.</simpara>
    </section>
    <section id="s-syn-protection">
      <title>SYN-ACK/ACK flood protection</title>
      <simpara>Symbiosis now comes with basic SYN-ACK/ACK flood protection. These are simple
 but effective denial of service attacks, which can leave the network stack inundated.
<ulink url="https://en.wikipedia.org/wiki/SYN_flood">Wikipedia has an article on the matter for the curious</ulink></simpara>
      <simpara>To enable the protection, create the following file :</simpara>
      <simpara>
        <filename class="devicefile">/etc/symbiosis/firewall/incoming.d/00-syn-ack-flood-protection</filename>
      </simpara>
    </section>
    <section id="s-disabling-firewall">
      <title>Disabling the firewall</title>
      <simpara>
        <indexterm>
          <primary>Firewall</primary>
          <secondary>disabling</secondary>
        </indexterm>
      </simpara>
      <simpara>If you wish you may disable the firewall completely, allowing remote
users to connect to any service you have running upon your machine.</simpara>
      <simpara>We’d not recommend that you disable the firewall, because it does provide
a increase in system security, but if you wish it is possible by
executing the following two commands:</simpara>
      <screen>touch /etc/symbiosis/firewall/disabled
sudo symbiosis-firewall flush</screen>
      <simpara>The presence of the disabled rule will not itself clear the firewall,
merely prevent further updates to it, which is why the <literal>flush</literal> command
is needed.</simpara>
    </section>
    <section id="_configuration_layout">
      <title>Configuration layout</title>
      <simpara>
        <indexterm>
          <primary>Firewall</primary>
          <secondary>configuration layout</secondary>
        </indexterm>
      </simpara>
      <simpara>All configuration of the firewall is conducted via the presence or
absence of files in a number of directories beneath
<filename class="directory">/etc/symbiosis/firewall/</filename>.  Actions and rules are all kept
under <filename class="directory">/usr/share/symbiosis/firewall/</filename>.</simpara>
      <variablelist>
        <varlistentry>
          <term>
<filename class="directory">/etc/symbiosis/firewall/blacklist.d/</filename>
</term>
          <listitem>
            <simpara>
  A persistent record of IP addresses which are blacklisted, such that
  no connections will be permitted from them.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">/etc/symbiosis/firewall/blacklist.d/disabled</filename>
</term>
          <listitem>
            <simpara>
  If this file is present, then the automatic blacklisting is
  disabled.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">/etc/symbiosis/firewall/disabled</filename>
</term>
          <listitem>
            <simpara>
If this file is present then the
firewall will be disabled.  However this will not clear the firewall
rules.  See <xref linkend="s-disabling-firewall"/>.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">/etc/symbiosis/firewall/incoming.d/</filename>
</term>
          <listitem>
            <simpara>
  Settings related to the incoming connections your machine will
  receive.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">/etc/symbiosis/firewall/local.d/</filename>
</term>
          <listitem>
            <simpara>
  The place to add local customisations.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">/etc/symbiosis/firewall/outgoing.d/</filename>
</term>
          <listitem>
            <simpara>
  Settings related to the outgoing connections your machine is
  permitted to initiate.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">/etc/symbiosis/firewall/patterns.d/</filename>
</term>
          <listitem>
            <simpara>
  A collection of pattern files use by <application class="software">symbiosis-firewall-blacklist</application>
  to automatically determine addresses to blacklist
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">/etc/symbiosis/firewall/whitelist.d/</filename>
</term>
          <listitem>
            <simpara>
  A persistent record of IP addresses which are always allowed to
  connect to your server.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="devicefile">/etc/symbiosis/firewall/whitelist.d/disabled</filename>
</term>
          <listitem>
            <simpara>
  If this file is present, then the automatic whitelisting is
  disabled.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">/usr/share/symbiosis/firewall/action.d/</filename>
</term>
          <listitem>
            <simpara>
  This directory contains the various actions that the
  <application class="software">symbiosis-firewall</application> uses to maintain the firewall.  If you wish to
  write your own actions, or change the ones that come with symbiosis,
  they should go in
  <filename class="directory">/usr/local/share/symbiosis/firewall/action.d/</filename>.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">/usr/share/symbiosis/firewall/rule.d/</filename>
</term>
          <listitem>
            <simpara>
  This directory contains the various pre-defined rules described in
  <xref linkend="s-firewall-special-rules"/>.  If you wish to add your own rules,
  or change the ones provided, they should go in
  <filename class="directory">/usr/local/share/symbiosis/firewall/rule.d/</filename>.
</simpara>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>
  </chapter>
  <chapter id="ch-dns-hosting">
    <title>DNS Hosting</title>
    <simpara>To take full advantage of the Symbiosis system, your domain needs to be
configured to have Bytemark’s name servers as authority for it.</simpara>
    <simpara>What follows only applies if our name servers are used; if that is not the case
you will need to manage your DNS data outside of the Symbiosis system.
<xref linkend="s-example-dns-records"/> gives a listing of the records needed for
the correct functioning of the system.</simpara>
    <simpara>All domains which are hosted upon a Symbiosis system will have their DNS records
automatically uploaded to the Bytemark Content DNS servers.</simpara>
    <simpara>By default a set of typical records is created for each hosted domain with MX
records pointing to the local system, and aliases such as <emphasis>www.</emphasis> and
<emphasis>ftp.</emphasis> for convenience.  If you wish you may edit the records to make
custom additions or otherwise make changes to those defaults.</simpara>
    <simpara>For the domain "my-brilliant-site.com" you will find the
auto-generated DNS records in
<filename class="devicefile">/srv/my-brilliant-site.com/config/dns/my-brilliant-site.com.txt</filename></simpara>
    <simpara>The DNS files are uploaded to the Bytemark content DNS service every
hour, and allow you to use the full range of available TinyDNS
options. These options are documented upon the
<ulink url="https://docs.bytemark.co.uk/article/content-dns-example/">Bytemark Website</ulink> and in the
<ulink url="http://cr.yp.to/djbdns/tinydns-data.html">TinyDNS documentation</ulink>.</simpara>
    <section id="s-example-dns-records">
      <title>Example DNS records</title>
      <simpara>
        <indexterm>
          <primary>DNS records</primary>
          <secondary>example</secondary>
        </indexterm>
      </simpara>
      <simpara>This is an example of the records Symbiosis generates for
<literal>my-brilliant-site.com</literal>.  They are created automatically and stored in
<filename class="devicefile">config/dns/my-brilliant-site.com.txt</filename>.
<indexterm><primary>config/</primary><secondary>dns/</secondary><tertiary>my-brilliant-site.com.txt</tertiary></indexterm></simpara>
      <formalpara>
        <title>DNS records example</title>
        <para>
<screen>#
#  Nameserver records. <co id="CO2-1"/>
#
.my-brilliant-site.com::a.ns.bytemark.co.uk:300
.my-brilliant-site.com::b.ns.bytemark.co.uk:300
.my-brilliant-site.com::c.ns.bytemark.co.uk:300

#
#  The domain name itself <co id="CO2-2"/>
#
=my-brilliant-site.com:89.16.174.65:300

#
#  Useful aliases. <co id="CO2-3"/>
#
+ftp.my-brilliant-site.com:89.16.174.65:300
+www.my-brilliant-site.com:89.16.174.65:300
+mail.my-brilliant-site.com:89.16.174.65:300

#
# A record for MX <co id="CO2-4"/>
#
+mx.my-brilliant-site.com:89.16.174.65:300

#
# The domain name itself -- AAAA record and reverse. <co id="CO2-5"/>
#
6my-brilliant-site.com:200141c80001596d0000000000000065:300

#
# Useful aliases -- AAAA records only
#
3ftp.my-brilliant-site.com:200141c80001596d0000000000000065:300
3www.my-brilliant-site.com:200141c80001596d0000000000000065:300
3mail.my-brilliant-site.com:200141c80001596d0000000000000065:300

#
# AAAA record for MX
#
3mx.my-brilliant-site.com:200141c80001596d0000000000000065:300

#
#  MX record -- no IP defined, as this is done separately above. <co id="CO2-6"/>
#
@my-brilliant-site.com::mx.my-brilliant-site.com:15:300</screen>
</para>
      </formalpara>
      <calloutlist>
        <callout arearefs="CO2-1">
          <para>
These lines create <emphasis>NS</emphasis> and <emphasis>SOA</emphasis> records for <literal>my-brilliant-site.com</literal> pointing at
    a.ns.bytemark.co.uk, b.ns.bytemark.co.uk, and c.ns.bytemark.co.uk.
    The time-to-live for these records is 300 seconds.  Note that the
    double colons in these records are deliberate as the IP addresses
    are defined elsewhere by Bytemark.
</para>
        </callout>
        <callout arearefs="CO2-2">
          <para>
This creates an <emphasis>A</emphasis> record pointing <literal>my-brilliant-site.com</literal> to the
    IP address <literal>89.16.174.65</literal>, and a <emphasis>PTR</emphasis> record for the reverse.
    Again, the TTL is 300 seconds.
</para>
        </callout>
        <callout arearefs="CO2-3">
          <para>
These three lines add <emphasis>A</emphasis> records for expected aliases. Once again,
    the TTL for these records is 300 seconds.
</para>
        </callout>
        <callout arearefs="CO2-4">
          <para>
This line adds in an <emphasis>A</emphasis> record for the <emphasis>MX</emphasis> record defined below.
</para>
        </callout>
        <callout arearefs="CO2-5">
          <para>
From here the IPv6 equivalents of <emphasis role="strong">2</emphasis>, <emphasis role="strong">3</emphasis>, and <emphasis role="strong">4</emphasis> are specified,
    using <emphasis>AAAA</emphasis> records is used instead of an <emphasis>A</emphasis> record.  Note that
    IPv6 addresses are specified in full, without any colons.
</para>
        </callout>
        <callout arearefs="CO2-6">
          <para>
This last record creates an <emphasis>MX</emphasis> record directing mail for
    <literal>my-brilliant-site.com</literal> to <literal>mx.my-brilliant-site.com</literal>, with a
    distance of 15.  The double colon is deliberate since we defined
    the <emphasis>A</emphasis> record for <literal>+mx.my-brilliant-site.com</literal> in &lt;4&gt;, and an
    <emphasis>AAAA</emphasis> record for the same name in &lt;5&gt;.
</para>
        </callout>
      </calloutlist>
    </section>
    <section id="s-adding-hostname-wildcard">
      <title>Adding a wild-card hostname record</title>
      <simpara>
        <indexterm>
          <primary>DNS records</primary>
          <secondary>hostname wild-card</secondary>
        </indexterm>
      </simpara>
      <simpara>In addition to these records for each domain, a wild-card <emphasis>A</emphasis> record is
needed for the hostname such that the <literal>.testing.</literal> prefix works.  If
your machine is at Bytemark, this has already been setup for your
machine’s Bytemark alias, for example <emphasis>example.default.bytemark.uk0.bigv.io</emphasis>.</simpara>
      <simpara>If your machine is not hosted at Bytemark, or your hostname does not
end in <literal>bytemark.co.uk</literal> then you will need to set this alias up.
Adding the following line to your DNS file will work, assuming the
domain is hosted at Bytemark.  This assumes that your machine is called
<literal>host.example.com</literal> and that your machine’s IP address is 1.2.3.4.</simpara>
      <screen>+*.host.example.com:1.2.3.4</screen>
    </section>
    <section id="s-adding-ttl-per-domain">
      <title>Adding a custom TTL per domain</title>
      <simpara>Symbiosis allows adding a custom TTL to a domain. If you’re unfamiliar,
you can read more about time to live (TTL) <ulink url="https://en.wikipedia.org/wiki/Time_to_live">here</ulink>.
You can configure this by creating the file :</simpara>
      <simpara>
        <filename class="devicefile">/srv/my-brilliant-site.com/config/ttl</filename>
      </simpara>
      <simpara>The contents of the file should be a number, and it represents the time a
 name server can cache the record in seconds. A lower TTL is good for making frequent changes,
as clients won’t cache for too long. A longer TTL is good for times when DNS is
unavailable for some reason.</simpara>
    </section>
    <section id="s-adding-dmarc-per-domain">
      <title>Adding a DMARC policy per domain</title>
      <simpara>There’s also an easy way to add a DMARC policy on a per-domain
basis. If you’re unfamiliar with DMARC, <ulink url="https://en.wikipedia.org/wiki/DMARC">Wikipedia has an article</ulink>
. It provides indication that emails are protected by SPF and/or DKIM. It can be
 configured by creating a file in the format :</simpara>
      <simpara>
        <filename class="devicefile">/srv/my-brilliant-site.com/config/dmarc</filename>
      </simpara>
      <simpara>You may leave this as an empty file, and Symbiosis will use its defaults. If
you prefer, the file can contain your own DMARC string.</simpara>
    </section>
    <section id="_moving_domains_between_machines_using_the_bytemark_content_dns_service">
      <title>Moving domains between machines using the Bytemark content DNS service</title>
      <simpara>
        <indexterm>
          <primary>Domains</primary>
          <secondary>moving between machines</secondary>
        </indexterm>
      </simpara>
      <simpara>If you wish to move your domains between two machines running
Symbiosis and using the Bytemark content DNS service, you must contact
Bytemark Support to arrange the domain to be moved between content DNS
accounts.</simpara>
      <simpara>This results from the necessity for ensuring that only people with the proper
authorisation can change live DNS data. Once a domain has been hosted
on our network, a content DNS account will have sole authority for it.</simpara>
      <simpara>If you purchase a second server and move some of your domains onto it, or
purchase a domain from another Bytemark customer you must contact us to move
authority for the domain into the correct account.</simpara>
      <simpara>Until this is done, although the Symbiosis system will be creating and uploading
data it will not be to the account with the authority to make the data live.</simpara>
    </section>
    <section id="s-spf-dkim">
      <title>Configuring SPF and DKIM records</title>
      <simpara><indexterm><primary>DNS records</primary><secondary>SPF</secondary></indexterm>
<indexterm><primary>DNS records</primary><secondary>DKIM</secondary></indexterm></simpara>
      <simpara><glossterm linkend="SPF">SPF</glossterm> and <glossterm linkend="DKIM">DKIM</glossterm> are standards that help mail servers decide if email is legitimate, ensuring it is more likely to reach the intended recipient’s inbox instead of being rejected or marked as spam.  Both these technologies require creation of one or more DNS records.</simpara>
      <section id="s-spf-configuration">
        <title>Adding SPF records</title>
        <simpara>
          <indexterm>
            <primary>SPF</primary>
            <secondary>adding records</secondary>
          </indexterm>
        </simpara>
        <simpara>Before adding any records, a policy needs to be decided.  The guide at <ulink url="http://www.openspf.org/SPF_Record_Syntax">OpenSPF</ulink> can help determine what the record should look like.  The default policy Symbiosis uses is <command>v=spf1 +a +mx ?all</command>.</simpara>
        <simpara><indexterm><primary>config/</primary><secondary>spf</secondary></indexterm>
To create SPF records simply create the file <filename class="devicefile">/srv/my-brilliant-site.com/config/spf</filename>.  Nothing more is required if the default policy is adequate.  If you have decided on a different policy, then you can just write it to this file.</simpara>
        <simpara>A task is run hourly to generate the DNS data and upload it to the Bytemark DNS servers, at which point the domain will start benefiting from it.  If you wish to speed up this process, run <command>sudo symbiosis-dns-generate --verbose</command>.</simpara>
      </section>
      <section id="s-dkim-configuration">
        <title>Adding DKIM records</title>
        <simpara>
          <indexterm>
            <primary>DKIM</primary>
            <secondary>setup</secondary>
          </indexterm>
        </simpara>
        <simpara><glossterm linkend="DKIM">DKIM</glossterm> is a way of cryptographically signing email headers to provide a level of confidence surrounding the origin of said email.  Configuring DKIM requires a private RSA key, and a DNS record specifying the public part of the key, along with a policy dictating how the key should be used.  For DKIM to work in Symbiosis two files are required, one contains the private key, and the second contains the selector (or nothing).</simpara>
        <procedure id="proc-dkim-setup">
          <step>
            <simpara>
To generate the private key, run <command>openssl genrsa -out /srv/my-brilliant-site.com/config/dkim.key 2048</command> on your server. This will generate a key that is 2048 bits long. Set the permissions of this key appropriately with <command>chmod 640 /srv/my-brilliant-site.com/config/dkim.key</command> and <command>chown admin:Debian-exim /srv/my-brilliant-site.com/config/dkim.key</command>.
  <indexterm><primary>config/</primary><secondary>dkim.key</secondary></indexterm>
<indexterm><primary>config/</primary><secondary>dkim</secondary></indexterm>
</simpara>
          </step>
          <step>
            <simpara>
Next, create the file <filename class="devicefile">/srv/my-brilliant-site.com/config/dkim</filename>,
  either as an empty file or with the selector in it.  If the file is
  empty, the selector is left as the first component of the machines
  hostnome, or "default" if this cannot be determined.  <indexterm><primary>config/</primary><secondary>dkim</secondary></indexterm>
</simpara>
          </step>
        </procedure>
        <simpara>Once both files are in place the hourly DNS task will update the DNS records for your domain and upload them as usual.  If you wish to speed up this process, run <command>sudo symbiosis-dns-generate --verbose</command>.</simpara>
      </section>
    </section>
  </chapter>
  <chapter id="ch-cron">
    <title>Scheduled tasks</title>
    <simpara>Jobs can be scheduled to run on a per-domain basis.  This is
configured in the same style as the traditional crontab, and is kept
in the <filename class="directory">config/</filename> directory of a domain.</simpara>
    <section id="_testing_the_crontab">
      <title>Testing the crontab</title>
      <simpara>
        <indexterm>
          <primary>Crontab</primary>
          <secondary>Testing</secondary>
        </indexterm>
      </simpara>
      <simpara>The crontab can also be tested.  To do this you have to SSH to the machine,
usually as <emphasis role="strong">admin</emphasis> to run the command.</simpara>
      <simpara>For example, to test the <emphasis role="strong">my-brilliant-site.com</emphasis> crontab navigate to
<filename class="directory">/srv/my-brilliant-site.com/config/</filename> and run <command>symbiosis-crontab
--test crontab</command>.</simpara>
      <simpara>The <emphasis role="strong">my-brilliant-site.com</emphasis> crontab reads</simpara>
      <screen># Send any output to Bob
#
MAILTO=bob@my-brilliant-site.com

#
# run at 18:40 every day
#
40 18 * * *       echo Hello Dave.

#
# run at 9am every Monday - Friday
#
0 9 * * mon-fri wget http://www.my-brilliant-site.com/cron.php

#
# Run once a month
#
@monthly          /usr/local/bin/monthly-job.sh</screen>
      <simpara>Therefore the output generated is</simpara>
      <screen> Environment
 ------------------------------------------------------------------------
 HOME = /srv
 LOGNAME = admin
 PATH = /usr/local/bin:/usr/bin:/bin
 MAILTO = bob@my-brilliant-site.com
 ========================================================================

 Jobs next due -- Local time 2010-06-17T17:57:37+01:00
 ------------------------------------------------------------------------
 Date                       Command
 ------------------------------------------------------------------------
 2010-06-17T18:40:00+01:00  echo Hello Dave.
 2010-06-18T09:00:00+01:00  wget http://www.my-brilliant-site.com/cron.php
 2010-07-01T00:00:00+01:00  /usr/local/bin/monthly-job.sh
 ========================================================================</screen>
      <note>
        <simpara>The only environment variables that can be set within your
crontab are PATH and MAILTO.  All the rest are set automatically, and
cannot be altered.</simpara>
      </note>
    </section>
    <section id="_system_scheduled_tasks">
      <title>System scheduled tasks</title>
      <simpara>There are various automated tasks which are executed upon a Symbiosis
system.  These scheduled tasks are responsible for automating things
such as:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
The addition of new IP addresses to your system.
</simpara>
        </listitem>
        <listitem>
          <simpara>
The generation and upload of DNS data.
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>The following section document precisely which jobs are installed by
default, along with their purpose.</simpara>
      <simpara>These are the system tasks which are installed by default:</simpara>
      <variablelist>
        <varlistentry>
          <term>
/etc/cron.d/symbiosis-common
</term>
          <listitem>
            <simpara>
This carries the rudimentary password
checks on mail and FTP passwords on an hourly and weekly basis.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
/etc/cron.d/symbiosis-cron
</term>
          <listitem>
            <simpara>
This is responsible for launching any
user-scheduled jobs, as described in <xref linkend="ch-cron"/>, and is run every
minute.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
/etc/cron.d/symbiosis-firewall
</term>
          <listitem>
            <simpara>
The jobs here are responsible for
checking for new blacklist and whitelist entries, as discussed in
<xref linkend="s-firewall-blacklist"/>.  The whitelist and blacklists are
regenerated every 15 minutes.  The whole firewall is reloaded hourly.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
/etc/cron.d/symbiosis-monit
</term>
          <listitem>
            <simpara>
This schedules the Symbiosis service
monitor, which is described in <xref linkend="ch-monitoring-reference"/>.  This is
run every two minutes.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
/etc/cron.d/symbiosis-dns
</term>
          <listitem>
            <simpara>
This regenerates DNS data for all the
domains in <filename class="directory">/srv/</filename>, and triggers an upload to the Bytemark
DNS server.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
/etc/cron.daily/symbiosis-httpd-rotate-logs
</term>
          <listitem>
            <simpara>
This manages rotation of the
webserver log files for each domain.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
/etc/cron.hourly/symbiosis-configure-ips
</term>
          <listitem>
            <simpara>
This adds IP addresses
configured by domains in <filename class="devicefile">config/ip</filename> to the host.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
/etc/cron.hourly/symbiosis-httpd-configure
</term>
          <listitem>
            <simpara>
This task creates a per-IP
Apache configuration file for new IP addresses, and is closely related
to the previous task.
</simpara>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>
  </chapter>
  <chapter id="ch-database-reference">
    <title>Database configuration</title>
    <simpara><indexterm><primary><application class="software">MySQL</application></primary><secondary>root password</secondary></indexterm>
<indexterm><primary>Database</primary><secondary>root password</secondary></indexterm>
Initially the <emphasis role="strong">root</emphasis> password for the database is the same as that of
the <emphasis role="strong">admin</emphasis> user used to to connect to your machine via SSH or SFTP.
To change this you can use the <application class="software">phpMyAdmin</application> interface.</simpara>
    <simpara>As a general rule, each application should have its own username and
access rights, to make sure that there is a degree of separation
between all the applications on a server.  This can all be done
through the <application class="software">phpMyAdmin</application> interface.</simpara>
    <simpara>In Symbiosis Stretch, MySQL uses unix socket auth for the <emphasis role="strong">root@localhost</emphasis> user
by default, which is incompatible with <application class="software">phpMyAdmin</application>. As such, a new
<emphasis role="strong">admin@localhost</emphasis> user has been created to be used with <application class="software">phpMyAdmin</application>. This user
has privileges equivalent to root, but uses traditional username/password
authentication instead.</simpara>
    <section id="_adding_a_user_with_remote_privileges">
      <title>Adding a user with remote privileges</title>
      <simpara><indexterm><primary><application class="software">MySQL</application></primary><secondary>adding a remote user</secondary></indexterm>
<indexterm><primary>Database</primary><secondary>adding a remote user</secondary></indexterm></simpara>
      <simpara>There are two ways to do this, either using the <application class="software">MySQL</application> command line
tool, or via <application class="software">phpMyAdmin</application>.  This section will cover doing it with the
latter.</simpara>
      <procedure>
        <step>
          <simpara>
In <application class="software">phpMyAdmin</application>, select the <guibutton>Privileges</guibutton> link from the front page,
   once you’ve logged in to it as <emphasis role="strong">root</emphasis> (or <emphasis role="strong">admin</emphasis> on Symbiosis Stretch,
   as mentioned above).
</simpara>
        </step>
        <step>
          <simpara>
The privileges section will present a <emphasis role="strong">User Overview</emphasis>, at the bottom
   of which there is a link to <guibutton>Add a new user</guibutton>.
</simpara>
        </step>
        <step>
          <simpara>
In the <emphasis role="strong">Add a new user</emphasis> screen, fill out the details in the form as
   needed, making sure that the <guilabel>Host</guilabel> field is set to <emphasis role="strong">Any
   host</emphasis>.
</simpara>
          <simpara>The privileges tick boxes lower down should be selected carefully.
Most applications will need at least those in the <guilabel>Data</guilabel>
section, and some of those in the <guilabel>Structure</guilabel> section.
Check the documentation of the software you’re using to see what it
requires.</simpara>
          <simpara>If you want an account with all privileges, select <guilabel>check
all</guilabel>.</simpara>
        </step>
        <step>
          <simpara>
Once you’re satisfied with everything, click <guibutton>Go</guibutton>.  This will
   confirm that a user has been created.
</simpara>
        </step>
        <step>
          <simpara>
Now return to the home screen by clicking the <application class="software">phpMyAdmin</application> logo
   at the top left of the screen.
</simpara>
        </step>
        <step>
          <simpara>
Finally, on the front page click the <guibutton>Reload privileges</guibutton> link to
   make sure <application class="software">MySQL</application> knows about this new user.
</simpara>
        </step>
      </procedure>
      <simpara>You should now be able to access the <application class="software">MySQL</application> database remotely, using
this new username and password.</simpara>
    </section>
  </chapter>
  <chapter id="ch-backup-reference">
    <title>Backup Reference</title>
    <simpara>The Symbiosis system includes a component designed to handle backups, using
the flexible <ulink url="http://backup2l.sourceforge.net/">backup2l software</ulink>.</simpara>
    <simpara><application class="software">backup2l</application> was selected due to its simplicity and flexibility, which allows
it to be used easily.  By default the backup software executes once per
day and archives the contents of significant directories to a local
directory. Before the actual backup takes place, the total space needed is
calculated. If there is not sufficient storage space to accomodate the new
backup, the backup operation will not proceed and no backups will be made.
An error is generated in this case.</simpara>
    <section id="_configuration">
      <title>Configuration</title>
      <simpara>In Symbiosis the <application class="software">Backup2l</application> configuration is generated from the
snippets in <filename class="directory">/etc/symbiosis/backup.d/conf.d/</filename>.</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
The local directories to backup (<filename class="directory">/etc/</filename>, <filename class="directory">/srv/</filename>, etc).
</simpara>
        </listitem>
        <listitem>
          <simpara>
The destination to which the backups should be stored (<filename class="directory">/var/backups/localhost/</filename>)
</simpara>
        </listitem>
        <listitem>
          <simpara>
The number of backups to keep.
</simpara>
        </listitem>
      </itemizedlist>
    </section>
    <section id="_advanced_configuration">
      <title>Advanced Configuration</title>
      <simpara>Additionally we’ve configured the backup software to easily execute a number of
scripts before and after the backup is performed:</simpara>
      <variablelist>
        <varlistentry>
          <term>
<filename class="directory">/etc/symbiosis/backup.d/pre-backup.d/</filename>
</term>
          <listitem>
            <simpara>
  Any executable script located in this directory is executed, prior
  to a backup execution.
</simpara>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>
<filename class="directory">/etc/symbiosis/backup.d/post-backup.d/</filename>
</term>
          <listitem>
            <simpara>
  Any executable script located in this directory is executed after a
  backup has completed.
</simpara>
          </listitem>
        </varlistentry>
      </variablelist>
    </section>
    <section id="_listing_backup_contents">
      <title>Listing Backup Contents</title>
      <simpara>To list the contents of your backup area you need to run <application class="software">backup2l</application> with the "-l" flag:</simpara>
      <screen>all.1: /etc/.pwd.lock
all.1: /etc/GeoIP.conf.default
all.1: /etc/X11/Xresources/x11-common
all.1: /etc/X11/Xsession
all.1: /etc/X11/Xsession.d/20x11-common_process-args
all.1: /etc/X11/Xsession.d/30x11-common_xresources
all.1: /etc/X11/Xsession.d/40x11-common_xsessionrc
all.1: /etc/X11/Xsession.d/50x11-common_determine-startup
...</screen>
      <simpara>Here you will see the contents of the <filename class="directory">/etc/</filename> directory which have
been archived.</simpara>
      <simpara>If you’d like to restrict this view you can apply a regular expression to
filter the results.  For example we can list the files which match the
pattern <emphasis>passwd</emphasis> with this command:</simpara>
      <screen>~$ sudo backup2l -l passwd
Listing locations...
all.1: /etc/exim4/passwd.client
all.1: /etc/passwd
all.1: /etc/passwd-
all.1: /etc/phpmyadmin/htpasswd.setup
all.1: /etc/pure-ftpd/pureftpd.passwd
...</screen>
    </section>
    <section id="_restoring_from_backup">
      <title>Restoring From Backup</title>
      <simpara>To illustrate how this works, an example is used.  We’re looking for a
backup of the file <filename class="devicefile">/etc/passwd</filename>.</simpara>
      <procedure>
        <step>
          <simpara>
First log in to your machine over SSH as <emphasis role="strong">admin</emphasis>.
</simpara>
        </step>
        <step>
          <simpara>
To find the available versions of the file, run <command>sudo backup2l -l '/etc/passwd$'</command>.
   The dollar sign is there to show that you want an exact match of
   <filename class="devicefile">/etc/passwd</filename>.  The first time you run <command>sudo</command> you will be prompted
   for the <emphasis role="strong">admin</emphasis> password.  The following output will be generated
   by <application class="software">backup2l</application>.
</simpara>
          <screen>backup2l v1.5 by Gundolf Kiefer

Active files in &lt;all.1101&gt;: 1
  found in all.1101:       0   (    1 left)
  found in all.11:         1   (    0 left)

Listing locations...
all.11: /etc/passwd</screen>
          <simpara>This shows the latest available version of the file</simpara>
        </step>
        <step>
          <simpara>
To recover it you should run <command>sudo backup2l -r '/etc/passwd$'</command>.
   The following output will be generated
</simpara>
          <screen>backup2l v1.5 by Gundolf Kiefer

Active files in &lt;all.1101&gt;: 1
  found in all.1101:       0   (    1 left)
  found in all.11:         1   (    0 left)

Restoring files...
  all.11.tar.gz: 1 file(s) using 'DRIVER_TAR_GZ'</screen>
        </step>
      </procedure>
      <simpara>That has restored the file to <filename class="devicefile">etc/passwd</filename> in the current directory.
It is <emphasis role="strong">not recommended</emphasis> to run this program in the <filename class="directory">/</filename>
directory, as any existing files will get overwritten.</simpara>
    </section>
    <section id="_recovery_from_earlier_backups">
      <title>Recovery From Earlier Backups</title>
      <simpara>It is also possible to pick which version of a file you wish to
restore.</simpara>
      <procedure>
        <step>
          <simpara>
First login to your machine over SSH as <emphasis role="strong">admin</emphasis>
</simpara>
        </step>
        <step>
          <simpara>
Then, to show all available versions of a file, run <command>sudo backup2l -a '/etc/passwd$'</command>.
   Again, the first time you run <command>sudo</command> you will be prompted for a
   password.  The following output is generated.
</simpara>
          <screen>backup2l v1.5 by Gundolf Kiefer

Listing available files...
all.101   -     1067 06/18/08 13:59:47 0000.0000 0644 /etc/passwd
all.101   +     1118 06/19/08 11:29:10 0000.0000 0644 /etc/passwd
all.108   -     1118 06/19/08 11:29:10 0000.0000 0644 /etc/passwd
all.108   +     1153 08/27/08 10:25:45 0000.0000 0644 /etc/passwd
all.11    -     1067 06/18/08 13:59:47 0000.0000 0644 /etc/passwd
all.11    +     1153 08/27/08 10:25:45 0000.0000 0644 /etc/passwd
all.1     +     1067 06/18/08 13:59:47 0000.0000 0644 /etc/passwd</screen>
          <simpara>Note that the versions are not shown in date order, and that the dates are in
the US <literal>mm/dd/yy</literal> format. In that list the <literal>+</literal>
indicates that the file is new and thus contained in the archive file.
A <literal>-</literal> indicates that the file has been removed
(or replaced). Choose which backup you wish to recover from.</simpara>
        </step>
        <step>
          <simpara>
To recover the file dated 19th June 2008, you need backup
number 101 — remember the <literal>+</literal> indicates that it is present in that
archive. To recover that file, run <command>sudo backup2l -t 101 -r '/etc/passwd$'</command>
</simpara>
          <screen>backup2l v1.5 by Gundolf Kiefer

Active files in &lt;all.101&gt;: 1
  found in all.101:        1   (    0 left)

Restoring files...
  all.101.tar.gz: 1 file(s) using 'DRIVER_TAR_GZ'</screen>
          <simpara>Notice the -t 101 argument which specifies which backup we want to restore from.</simpara>
        </step>
      </procedure>
      <simpara>We have now successfully restored the file to <filename class="devicefile">etc/passwd</filename> in the
current directory.  We can check by running <command>ls -la etc/</command></simpara>
      <screen>total 16
drwxr-xr-x  2 root  root  4096 2008-09-09 09:56 .
drwxr-xr-x 14 root  root  4096 2008-09-09 09:51 ..
-rw-r--r--  1 root  root  1118 2008-06-19 11:29 passwd</screen>
    </section>
    <section id="_offsite_backup_storage">
      <title>Offsite backup storage</title>
      <simpara>The Symbiosis system assumes that it has access to an associated external
storage area.  It will try and use <application class="software">rsync</application> to upload the backups to this
area, via a script named
<filename class="devicefile">/etc/symbiosis/backup.d/post-backup.d/99-upload-backup</filename>.</simpara>
      <simpara>If the host is on Bytemark’s network, this script can establish the backup
space name automatically.  Otherwise you can specify it manually by setting the
full <application class="software">rsync</application> path in <filename class="devicefile">/etc/symbiosis/dns.d/backup.name</filename>.</simpara>
    </section>
    <section id="_recovering_from_the_offsite_backup_storage">
      <title>Recovering from the offsite backup storage</title>
      <simpara>Before each backup a second script will synchronise the remote backup space
locally, ensuring that a complete set of backups are held in both
places.  This means that if disaster strikes your machine, it is
straightforward to recover your backups.  This is done by running
<filename class="devicefile">/etc/symbiosis/backup.d/pre-backup.d/00-download-backup</filename>.</simpara>
      <simpara>This also helps to maintain the integrity of the differential backups
provided by <application class="software">backup2l</application> by replacing any files accidentally removed
from the local backup directory before the backup starts.</simpara>
    </section>
    <section id="_trimming_the_size_of_the_local_backups">
      <title>Trimming the size of the local backups.</title>
      <simpara>It is possible to reduce the size of the backups stored locally.  The
first thing to do is check the current status of the backups by
running <command>sudo backup2l -s</command>.  This will present a summary of the
current backups.  For example:</simpara>
      <screen>backup2l v1.5 by Gundolf Kiefer

Summary
=======

Backup       Date       Time  |  Size   | Skipped  Files+D |  New  Obs. | Err.
- ----------------------------------------------------------------------------
all.1        2010-08-10 02:52 |   41.7M |       0     3836 | 3836     0 |    0
all.11       2010-11-01 04:45 |   38.1M |       0     3935 | 1517  1418 |    0
all.12       2011-01-21 04:27 |   39.7M |       0     3985 |  561   511 |    0
all.121      2011-01-30 04:38 |   10.5M |       0     4001 |  137   121 |    0
all.122      2011-02-08 03:54 |    1.5M |       0     4029 |  129   101 |    0
all.123      2011-09-07 05:08 |   33.8M |       0     3892 | 1437  1574 |    0
all.124      2011-09-16 05:07 |    1.3M |       0     4791 |  956    57 |    0
all.125      2011-09-25 04:45 |    868K |       0     5676 |  928    43 |    0
all.126      2011-10-04 05:15 |   11.3M |       0     6559 |  990   107 |    0
all.127      2011-10-13 04:29 |    894K |       0     7444 |  928    43 |    0
all.128      2011-10-22 04:59 |    345K |       0     8329 |  935    50 |    0
all.13       2011-10-31 05:03 |   45.7M |       0     9218 | 6833  1600 |    0

Filesystem            Size  Used Avail Use% Mounted on
/dev/vda               10G  1.9G  7.6G  20% /</screen>
      <simpara>From here it is possible to see which levels of backups that can be pruned.  In
the above example the third-level backups <literal>all.121</literal> to <literal>all.128</literal> can be pruned,
as there has been a subsequent second level backup, <literal>all.13</literal>.  The downside of
this is that any changes contained in those backups will be lost, and only
changes from the <literal>all.12</literal> will be available.</simpara>
      <simpara>To prune these backups run <command>sudo backup2l -p 121</command>. This will then show
<application class="software">Backup2l</application> removing <literal>all.121</literal> and all its dependent backups.</simpara>
      <screen>backup2l v1.5 by Gundolf Kiefer

Purging &lt;121&gt;...
  removing &lt;all.121&gt;
  removing &lt;all.122&gt;
  removing &lt;all.123&gt;
  removing &lt;all.124&gt;
  removing &lt;all.125&gt;
  removing &lt;all.126&gt;
  removing &lt;all.127&gt;
  removing &lt;all.128&gt;</screen>
      <simpara>Finally we need to make sure these deletions are synchronised to the remote
backup space, to ensure that our deleted files do not mysteriously return again
prior to the next backup run.</simpara>
      <screen>sudo /etc/symbiosis/backup.d/post-backup.d/99-upload-backup</screen>
      <simpara>Which will provide output similar to that shown below.</simpara>
      <screen>Sending backups to example.backup.bytemark.co.uk::example/example.default.bytemark.uk0.bigv.io...
building file list ... done
deleting localhost/all.lock
deleting localhost/all.128.tar.gz
....
deleting localhost/all.121.error.gz
deleting localhost/all.121.check
localhost/

sent 2.95K bytes  received 22 bytes  1.98K bytes/sec
total size is 400.59M  speedup is 134742.36</screen>
      <simpara>Those level three backups will no longer exist.</simpara>
    </section>
    <section id="_making_changes_to_the_backup2l_configuration">
      <title>Making changes to the backup2l configuration</title>
      <simpara>The configuration is kept in <filename class="devicefile">/etc/symbiosis/backup.d/conf.d</filename>.  If you
need to make changes, you should make them to the files in that
directory and then run <command>make</command> to generate the live configuration file.</simpara>
    </section>
  </chapter>
  <chapter id="ch-monitoring-reference">
    <title>Service Monitoring</title>
    <simpara>The Symbiosis system is comprised of several distinct components, which
we’ve documented throughout the course of this reference:</simpara>
    <itemizedlist>
      <listitem>
        <simpara>
The <application class="software">MySQL</application> database server.
</simpara>
      </listitem>
      <listitem>
        <simpara>
<application class="software">Exim</application> &amp; <application class="software">Dovecot</application> servers for handling email.
</simpara>
      </listitem>
      <listitem>
        <simpara>
<application class="software">Apache</application> for serving websites.
</simpara>
      </listitem>
      <listitem>
        <simpara>
The FTP server, <application class="software">proftpd</application>
</simpara>
      </listitem>
      <listitem>
        <simpara>
The inotify cron daemon, <application class="software">incron</application>.
</simpara>
      </listitem>
      <listitem>
        <simpara>
<application class="software">Prosody</application> an XMPP server
</simpara>
      </listitem>
    </itemizedlist>
    <simpara>Each of these services runs in an independent fashion, and it is
possible under certain circumstances that these services might fail, or
stop themselves.</simpara>
    <simpara>To handle the case of services failing to execute normally we’ve
included an automated service checker as part of the Symbiosis system.
The service checker will check upon the health of your system, by
default once every two minutes, and it will automatically restart any
services which have failed.</simpara>
    <simpara>The ‘symbiosis-monit` command is responsible for testing each of
the available services, and restarting the failed ones.  By default it
is executed every two minutes, such that it may respond quickly to
failures.  It will also stop services that are not required.  For example if
the machine is not configured to scan any domains’ mail, then
<application class="software">SpamAssassin</application> will be stopped.</simpara>
    <simpara>At any time you wish to check upon the health of your system you may
launch it manually, when connected to your server via SSH.</simpara>
    <screen>admin@example:~$ sudo symbiosis-monit
= Symbiosis service test report ========================================

 Tests conducted on symbiosis-test.default.uk0.bigv.io.
 Tests started at 2015-10-15T12:50:35+01:00.

 * apache2: PASSED
 * cron: PASSED
 * dovecot: PASSED
 * exim4: PASSED
 * incrond: PASSED
 * mysqld: PASSED
 * prosody: PASSED
 * pure-ftpd: PASSED
 * spamassassin: PASSED
 * sshd: PASSED

 Tests finished at 2015-10-15T12:50:36+01:00.

= End of service test report ===========================================</screen>
    <simpara>In this case all services are working correctly, so "PASSED" was reported
instead of the failing "FAILED".  The possible output status are:</simpara>
    <variablelist>
      <varlistentry>
        <term>
FAILED
</term>
        <listitem>
          <simpara>
The service failed.
</simpara>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>
PASSED
</term>
        <listitem>
          <simpara>
The service appears to be running correctly.
</simpara>
        </listitem>
      </varlistentry>
    </variablelist>
  </chapter>
  <appendix id="appendix-gnu-fdl">
    <title>GNU Free Documentation License</title>
    <simpara>Version 1.3, 3 November 2008</simpara>
    <simpara>
    Copyright © 2000, 2001, 2002, 2007, 2008
    <ulink url="http://www.fsf.org/">Free Software Foundation, Inc.</ulink>
  </simpara>
    <simpara>
    Everyone is permitted to copy and distribute verbatim copies of this
    license document, but changing it is not allowed.
  </simpara>
    <bridgehead id="section0" renderas="sect2">
    0. PREAMBLE
  </bridgehead>
    <simpara>
    The purpose of this License is to make a manual, textbook, or other
    functional and useful document “free” in the sense of freedom:
    to assure everyone the effective freedom to copy and redistribute it, with
    or without modifying it, either commercially or
    noncommercially. Secondarily, this License preserves for the author and
    publisher a way to get credit for their work, while not being considered
    responsible for modifications made by others.
  </simpara>
    <simpara>
    This License is a kind of “copyleft”, which means that
    derivative works of the document must themselves be free in the same
    sense. It complements the GNU General Public License, which is a copyleft
    license designed for free software.
  </simpara>
    <simpara>
    We have designed this License in order to use it for manuals for free
    software, because free software needs free documentation: a free program
    should come with manuals providing the same freedoms that the software
    does. But this License is not limited to software manuals; it can be used
    for any textual work, regardless of subject matter or whether it is
    published as a printed book. We recommend this License principally for
    works whose purpose is instruction or reference.
  </simpara>
    <bridgehead id="section1" renderas="sect2">
    1. APPLICABILITY AND DEFINITIONS
  </bridgehead>
    <simpara>
    This License applies to any manual or other work, in any medium, that
    contains a notice placed by the copyright holder saying it can be
    distributed under the terms of this License. Such a notice grants a
    world-wide, royalty-free license, unlimited in duration, to use that work
    under the conditions stated herein. The “Document”, below,
    refers to any such manual or work. Any member of the public is a licensee,
    and is addressed as “you”. You accept the license if you copy,
    modify or distribute the work in a way requiring permission under
    copyright law.
  </simpara>
    <simpara>
    A “Modified Version” of the Document means any work containing
    the Document or a portion of it, either copied verbatim, or with
    modifications and/or translated into another language.
  </simpara>
    <simpara>
    A “Secondary Section” is a named appendix or a front-matter
    section of the Document that deals exclusively with the relationship of
    the publishers or authors of the Document to the Document’s overall
    subject (or to related matters) and contains nothing that could fall
    directly within that overall subject. (Thus, if the Document is in part a
    textbook of mathematics, a Secondary Section may not explain any
    mathematics.) The relationship could be a matter of historical connection
    with the subject or with related matters, or of legal, commercial,
    philosophical, ethical or political position regarding them.
  </simpara>
    <simpara>
    The “Invariant Sections” are certain Secondary Sections whose
    titles are designated, as being those of Invariant Sections, in the notice
    that says that the Document is released under this License. If a section
    does not fit the above definition of Secondary then it is not allowed to
    be designated as Invariant. The Document may contain zero Invariant
    Sections. If the Document does not identify any Invariant Sections then
    there are none.
  </simpara>
    <simpara>
    The “Cover Texts” are certain short passages of text that are
    listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says
    that the Document is released under this License. A Front-Cover Text may
    be at most 5 words, and a Back-Cover Text may be at most 25 words.
  </simpara>
    <simpara>
    A “Transparent” copy of the Document means a machine-readable
    copy, represented in a format whose specification is available to the
    general public, that is suitable for revising the document
    straightforwardly with generic text editors or (for images composed of
    pixels) generic paint programs or (for drawings) some widely available
    drawing editor, and that is suitable for input to text formatters or for
    automatic translation to a variety of formats suitable for input to text
    formatters. A copy made in an otherwise Transparent file format whose
    markup, or absence of markup, has been arranged to thwart or discourage
    subsequent modification by readers is not Transparent. An image format is
    not Transparent if used for any substantial amount of text. A copy that is
    not “Transparent” is called “Opaque”.
  </simpara>
    <simpara>
    Examples of suitable formats for Transparent copies include plain ASCII
    without markup, Texinfo input format, LaTeX input format, SGML or XML
    using a publicly available DTD, and standard-conforming simple HTML,
    PostScript or PDF designed for human modification. Examples of transparent
    image formats include PNG, XCF and JPG. Opaque formats include proprietary
    formats that can be read and edited only by proprietary word processors,
    SGML or XML for which the DTD and/or processing tools are not generally
    available, and the machine-generated HTML, PostScript or PDF produced by
    some word processors for output purposes only.
  </simpara>
    <simpara>
    The “Title Page” means, for a printed book, the title page
    itself, plus such following pages as are needed to hold, legibly, the
    material this License requires to appear in the title page. For works in
    formats which do not have any title page as such, “Title Page”
    means the text near the most prominent appearance of the work’s
    title, preceding the beginning of the body of the text.
  </simpara>
    <simpara>
    The “publisher” means any person or entity that distributes
    copies of the Document to the public.
  </simpara>
    <simpara>
    A section “Entitled XYZ” means a named subunit of the Document
    whose title either is precisely XYZ or contains XYZ in parentheses
    following text that translates XYZ in another language. (Here XYZ stands
    for a specific section name mentioned below, such as
    “Acknowledgements”, “Dedications”,
    “Endorsements”, or “History”.) To “Preserve
    the Title” of such a section when you modify the Document means that
    it remains a section “Entitled XYZ” according to this
    definition.
  </simpara>
    <simpara>
    The Document may include Warranty Disclaimers next to the notice which
    states that this License applies to the Document. These Warranty
    Disclaimers are considered to be included by reference in this License,
    but only as regards disclaiming warranties: any other implication that
    these Warranty Disclaimers may have is void and has no effect on the
    meaning of this License.
  </simpara>
    <bridgehead id="section2" renderas="sect2">
    2. VERBATIM COPYING
  </bridgehead>
    <simpara>
    You may copy and distribute the Document in any medium, either
    commercially or noncommercially, provided that this License, the copyright
    notices, and the license notice saying this License applies to the
    Document are reproduced in all copies, and that you add no other
    conditions whatsoever to those of this License. You may not use technical
    measures to obstruct or control the reading or further copying of the
    copies you make or distribute. However, you may accept compensation in
    exchange for copies. If you distribute a large enough number of copies you
    must also follow the conditions in section 3.
  </simpara>
    <simpara>
    You may also lend copies, under the same conditions stated above, and you
    may publicly display copies.
  </simpara>
    <bridgehead id="section3" renderas="sect2">
    3. COPYING IN QUANTITY
  </bridgehead>
    <simpara>
    If you publish printed copies (or copies in media that commonly have
    printed covers) of the Document, numbering more than 100, and the
    Document’s license notice requires Cover Texts, you must enclose
    the copies in covers that carry, clearly and legibly, all these Cover
    Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the
    back cover. Both covers must also clearly and legibly identify you as the
    publisher of these copies. The front cover must present the full title
    with all words of the title equally prominent and visible. You may add
    other material on the covers in addition. Copying with changes limited to
    the covers, as long as they preserve the title of the Document and satisfy
    these conditions, can be treated as verbatim copying in other respects.
  </simpara>
    <simpara>
    If the required texts for either cover are too voluminous to fit legibly,
    you should put the first ones listed (as many as fit reasonably) on the
    actual cover, and continue the rest onto adjacent pages.
  </simpara>
    <simpara>
    If you publish or distribute Opaque copies of the Document numbering more
    than 100, you must either include a machine-readable Transparent copy
    along with each Opaque copy, or state in or with each Opaque copy a
    computer-network location from which the general network-using public has
    access to download using public-standard network protocols a complete
    Transparent copy of the Document, free of added material. If you use the
    latter option, you must take reasonably prudent steps, when you begin
    distribution of Opaque copies in quantity, to ensure that this Transparent
    copy will remain thus accessible at the stated location until at least one
    year after the last time you distribute an Opaque copy (directly or
    through your agents or retailers) of that edition to the public.
  </simpara>
    <simpara>
    It is requested, but not required, that you contact the authors of the
    Document well before redistributing any large number of copies, to give
    them a chance to provide you with an updated version of the Document.
  </simpara>
    <bridgehead id="section4" renderas="sect2">
    4. MODIFICATIONS
  </bridgehead>
    <simpara>
    You may copy and distribute a Modified Version of the Document under the
    conditions of sections 2 and 3 above, provided that you release the
    Modified Version under precisely this License, with the Modified Version
    filling the role of the Document, thus licensing distribution and
    modification of the Modified Version to whoever possesses a copy of it. In
    addition, you must do these things in the Modified Version:
  </simpara>
    <orderedlist numeration="upperalpha">
      <listitem>
        <simpara>
        Use in the Title Page (and on the covers, if any) a title distinct
        from that of the Document, and from those of previous versions (which
        should, if there were any, be listed in the History section of the
        Document). You may use the same title as a previous version if the
        original publisher of that version gives permission.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        List on the Title Page, as authors, one or more persons or entities
        responsible for authorship of the modifications in the Modified
        Version, together with at least five of the principal authors of the
        Document (all of its principal authors, if it has fewer than five),
        unless they release you from this requirement.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        State on the Title page the name of the publisher of the Modified
        Version, as the publisher.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        Preserve all the copyright notices of the Document.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        Add an appropriate copyright notice for your modifications adjacent to
        the other copyright notices.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        Include, immediately after the copyright notices, a license notice
        giving the public permission to use the Modified Version under the
        terms of this License, in the form shown in the Addendum below.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        Preserve in that license notice the full lists of Invariant Sections
        and required Cover Texts given in the Document’s license
        notice.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        Include an unaltered copy of this License.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        Preserve the section Entitled “History”, Preserve its
        Title, and add to it an item stating at least the title, year, new
        authors, and publisher of the Modified Version as given on the Title
        Page. If there is no section Entitled “History” in the
        Document, create one stating the title, year, authors, and publisher
        of the Document as given on its Title Page, then add an item
        describing the Modified Version as stated in the previous sentence.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        Preserve the network location, if any, given in the Document for
        public access to a Transparent copy of the Document, and likewise the
        network locations given in the Document for previous versions it was
        based on.  These may be placed in the “History”
        section. You may omit a network location for a work that was published
        at least four years before the Document itself, or if the original
        publisher of the version it refers to gives permission.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        For any section Entitled “Acknowledgements” or
        “Dedications”, Preserve the Title of the section, and
        preserve in the section all the substance and tone of each of the
        contributor acknowledgements and/or dedications given therein.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        Preserve all the Invariant Sections of the Document, unaltered in
        their text and in their titles. Section numbers or the equivalent are
        not considered part of the section titles.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        Delete any section Entitled “Endorsements”. Such a section
        may not be included in the Modified Version.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        Do not retitle any existing section to be Entitled
        “Endorsements” or to conflict in title with any Invariant
        Section.
      </simpara>
      </listitem>
      <listitem>
        <simpara>
        Preserve any Warranty Disclaimers.
      </simpara>
      </listitem>
    </orderedlist>
    <simpara>
    If the Modified Version includes new front-matter sections or appendices
    that qualify as Secondary Sections and contain no material copied from the
    Document, you may at your option designate some or all of these sections
    as invariant. To do this, add their titles to the list of Invariant
    Sections in the Modified Version’s license notice. These titles
    must be distinct from any other section titles.
  </simpara>
    <simpara>
    You may add a section Entitled “Endorsements”, provided it
    contains nothing but endorsements of your Modified Version by various
    parties — for example, statements of peer review or that the text
    has been approved by an organization as the authoritative definition of a
    standard.
  </simpara>
    <simpara>
    You may add a passage of up to five words as a Front-Cover Text, and a
    passage of up to 25 words as a Back-Cover Text, to the end of the list of
    Cover Texts in the Modified Version. Only one passage of Front-Cover Text
    and one of Back-Cover Text may be added by (or through arrangements made
    by) any one entity. If the Document already includes a cover text for the
    same cover, previously added by you or by arrangement made by the same
    entity you are acting on behalf of, you may not add another; but you may
    replace the old one, on explicit permission from the previous publisher
    that added the old one.
  </simpara>
    <simpara>
    The author(s) and publisher(s) of the Document do not by this License give
    permission to use their names for publicity for or to assert or imply
    endorsement of any Modified Version.
  </simpara>
    <bridgehead id="section5" renderas="sect2">
    5. COMBINING DOCUMENTS
  </bridgehead>
    <simpara>
    You may combine the Document with other documents released under this
    License, under the terms defined in section 4 above for modified versions,
    provided that you include in the combination all of the Invariant Sections
    of all of the original documents, unmodified, and list them all as
    Invariant Sections of your combined work in its license notice, and that
    you preserve all their Warranty Disclaimers.
  </simpara>
    <simpara>
    The combined work need only contain one copy of this License, and multiple
    identical Invariant Sections may be replaced with a single copy. If there
    are multiple Invariant Sections with the same name but different contents,
    make the title of each such section unique by adding at the end of it, in
    parentheses, the name of the original author or publisher of that section
    if known, or else a unique number. Make the same adjustment to the section
    titles in the list of Invariant Sections in the license notice of the
    combined work.
  </simpara>
    <simpara>
    In the combination, you must combine any sections Entitled
    “History” in the various original documents, forming one
    section Entitled “History”; likewise combine any sections
    Entitled “Acknowledgements”, and any sections Entitled
    “Dedications”. You must delete all sections Entitled
    “Endorsements”.
  </simpara>
    <bridgehead id="section6" renderas="sect2">
    6. COLLECTIONS OF DOCUMENTS
  </bridgehead>
    <simpara>
    You may make a collection consisting of the Document and other documents
    released under this License, and replace the individual copies of this
    License in the various documents with a single copy that is included in
    the collection, provided that you follow the rules of this License for
    verbatim copying of each of the documents in all other respects.
  </simpara>
    <simpara>
    You may extract a single document from such a collection, and distribute
    it individually under this License, provided you insert a copy of this
    License into the extracted document, and follow this License in all other
    respects regarding verbatim copying of that document.
  </simpara>
    <bridgehead id="section7" renderas="sect2">
    7. AGGREGATION WITH INDEPENDENT WORKS
  </bridgehead>
    <simpara>
    A compilation of the Document or its derivatives with other separate and
    independent documents or works, in or on a volume of a storage or
    distribution medium, is called an “aggregate” if the copyright
    resulting from the compilation is not used to limit the legal rights of
    the compilation’s users beyond what the individual works
    permit. When the Document is included in an aggregate, this License does
    not apply to the other works in the aggregate which are not themselves
    derivative works of the Document.
  </simpara>
    <simpara>
    If the Cover Text requirement of section 3 is applicable to these copies
    of the Document, then if the Document is less than one half of the entire
    aggregate, the Document’s Cover Texts may be placed on covers that
    bracket the Document within the aggregate, or the electronic equivalent of
    covers if the Document is in electronic form. Otherwise they must appear
    on printed covers that bracket the whole aggregate.
  </simpara>
    <bridgehead id="section8" renderas="sect2">
    8. TRANSLATION
  </bridgehead>
    <simpara>
    Translation is considered a kind of modification, so you may distribute
    translations of the Document under the terms of section 4. Replacing
    Invariant Sections with translations requires special permission from
    their copyright holders, but you may include translations of some or all
    Invariant Sections in addition to the original versions of these Invariant
    Sections. You may include a translation of this License, and all the
    license notices in the Document, and any Warranty Disclaimers, provided
    that you also include the original English version of this License and the
    original versions of those notices and disclaimers. In case of a
    disagreement between the translation and the original version of this
    License or a notice or disclaimer, the original version will prevail.
  </simpara>
    <simpara>
    If a section in the Document is Entitled “Acknowledgements”,
    “Dedications”, or “History”, the requirement
    (section 4) to Preserve its Title (section 1) will typically require
    changing the actual title.
  </simpara>
    <bridgehead id="section9" renderas="sect2">
    9. TERMINATION
  </bridgehead>
    <simpara>
    You may not copy, modify, sublicense, or distribute the Document except as
    expressly provided under this License. Any attempt otherwise to copy,
    modify, sublicense, or distribute it is void, and will automatically
    terminate your rights under this License.
  </simpara>
    <simpara>
    However, if you cease all violation of this License, then your license
    from a particular copyright holder is reinstated (a) provisionally, unless
    and until the copyright holder explicitly and finally terminates your
    license, and (b) permanently, if the copyright holder fails to notify you
    of the violation by some reasonable means prior to 60 days after the
    cessation.
  </simpara>
    <simpara>
    Moreover, your license from a particular copyright holder is reinstated
    permanently if the copyright holder notifies you of the violation by some
    reasonable means, this is the first time you have received notice of
    violation of this License (for any work) from that copyright holder, and
    you cure the violation prior to 30 days after your receipt of the notice.
  </simpara>
    <simpara>
    Termination of your rights under this section does not terminate the
    licenses of parties who have received copies or rights from you under this
    License. If your rights have been terminated and not permanently
    reinstated, receipt of a copy of some or all of the same material does not
    give you any rights to use it.
  </simpara>
    <bridgehead id="section10" renderas="sect2">
    10. FUTURE REVISIONS OF THIS LICENSE
  </bridgehead>
    <simpara>
    The Free Software Foundation may publish new, revised versions of the GNU
    Free Documentation License from time to time. Such new versions will be
    similar in spirit to the present version, but may differ in detail to
    address new problems or concerns. See
    <ulink url="http://www.gnu.org/copyleft/">Copyleft</ulink>.
  </simpara>
    <simpara>
    Each version of the License is given a distinguishing version number. If
    the Document specifies that a particular numbered version of this License
    “or any later version” applies to it, you have the option of
    following the terms and conditions either of that specified version or of
    any later version that has been published (not as a draft) by the Free
    Software Foundation. If the Document does not specify a version number of
    this License, you may choose any version ever published (not as a draft)
    by the Free Software Foundation. If the Document specifies that a proxy
    can decide which future versions of this License can be used, that
    proxy’s public statement of acceptance of a version permanently
    authorizes you to choose that version for the Document.
  </simpara>
    <bridgehead id="section11" renderas="sect2">
    11. RELICENSING
  </bridgehead>
    <simpara>
    “Massive Multiauthor Collaboration Site” (or “MMC
    Site”) means any World Wide Web server that publishes copyrightable
    works and also provides prominent facilities for anybody to edit those
    works. A public wiki that anybody can edit is an example of such a
    server. A “Massive Multiauthor Collaboration” (or
    “MMC”) contained in the site means any set of copyrightable
    works thus published on the MMC site.
  </simpara>
    <simpara>
    “CC-BY-SA” means the Creative Commons Attribution-Share Alike
    3.0 license published by Creative Commons Corporation, a not-for-profit
    corporation with a principal place of business in San Francisco,
    California, as well as future copyleft versions of that license published
    by that same organization.
  </simpara>
    <simpara>
    “Incorporate” means to publish or republish a Document, in
    whole or in part, as part of another Document.
  </simpara>
    <simpara>
    An MMC is “eligible for relicensing” if it is licensed under
    this License, and if all works that were first published under this
    License somewhere other than this MMC, and subsequently incorporated in
    whole or in part into the MMC, (1) had no cover texts or invariant
    sections, and (2) were thus incorporated prior to November 1, 2008.
  </simpara>
    <simpara>
    The operator of an MMC Site may republish an MMC contained in the site
    under CC-BY-SA on the same site at any time before August 1, 2009,
    provided the MMC is eligible for relicensing.
  </simpara>
    <bridgehead id="addendum" renderas="sect2">
    ADDENDUM: How to use this License for your documents
  </bridgehead>
    <simpara>
    To use this License in a document you have written, include a copy of the
    License in the document and put the following copyright and license
    notices just after the title page:
  </simpara>
    <screen>Copyright © YEAR YOUR NAME

Permission is granted to copy, distribute and/or modify this document under the
terms of the GNU Free Documentation License, Version 1.3 or any later version
published by the Free Software Foundation; with no Invariant Sections, no
Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in
the section entitled “GNU Free Documentation License”.</screen>
    <simpara>
    If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
    replace the “with… Texts.” line with this:
  </simpara>
    <screen>with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts
being LIST, and with the Back-Cover Texts being LIST.</screen>
    <simpara>
    If you have Invariant Sections without Cover Texts, or some other
    combination of the three, merge those two alternatives to suit the
    situation.
  </simpara>
    <simpara>
    If your document contains nontrivial examples of program code, we
    recommend releasing these examples in parallel under your choice of free
    software license, such as the GNU General Public License, to permit their
    use in free software.
  </simpara>
  </appendix>
  <glossary id="ch-glossary">
    <title>Glossary</title>
    <glossentry id="BSD">
      <glossterm>BSD, Berkeley System Distribution</glossterm>
      <glossdef>
        <simpara>A family of Unix versions developed by Bill Joy and others at the
University of California at Berkeley, originally for the DEC VAX and
PDP-11 computers, and subsequently ported to almost all modern
general-purpose computers. BSD Unix incorporates paged virtual memory,
TCP/IP networking enhancements and many other features <xref linkend="FOLDOC"/>.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="DKIM">
      <glossterm>DKIM, Domain Keys Identified Mail</glossterm>
      <glossdef>
        <simpara>This adds a DKIM signature to each outbound email message on a system
which can then be verified by recipients. Recipient SMTP servers will
look up the DKIM selector of the mail, and verify that the key the
mail is signed with matches the public key in DNS.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="DNS">
      <glossterm>DNS, Domain Name System</glossterm>
      <glossdef>
        <simpara>This system is used to convert IP Addresses into hostnames.  It is
also used to determine where mail should be routed for a domain.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="FTP">
      <glossterm>FTP, File Transfer Protocol</glossterm>
      <glossdef>
        <simpara>FTP used to be used to transfer large files over the internet.  It is
an archaic protocol.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="FTPS">
      <glossterm>FTPS, File Transfer Protocol Secure</glossterm>
      <glossdef>
        <simpara>FTPS is an extension to FTP that allows encryption using TLS or SSL. It
is not to be confused with SFTP, which is a subsystem of SSH.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="HTML">
      <glossterm>HTML, Hypertext Markup Language</glossterm>
      <glossdef>
        <simpara>A system to mark up documents.  It is the most common format used for
documents on the world-wide web, and is the format that web browsers
display.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="HTTP">
      <glossterm>HTTP, Hypertext Transfer Protocol</glossterm>
      <glossdef>
        <simpara>This protocol was originally used to transfer HTML documents between
machines connected to the internet.  It has become the standard
protocol for transferring all types of documents over the world-wide
web.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="IMAP">
      <glossterm>IMAP, Internet Message Access Protocol</glossterm>
      <glossdef>
        <simpara>The Internet Message Access Protocol (IMAP) is one of the two most prevalent
Internet standard protocols for e-mail retrieval, the other being the Post
Office Protocol (POP). Virtually all modern e-mail clients and mail servers
support both protocols as a means of transferring e-mail messages from a server.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="IP">
      <glossterm>IP, Internet Protocol</glossterm>
      <glossdef>
        <simpara>The network layer for the TCP/IP protocol suite widely used on
Ethernet networks, defined in STD 5, RFC 791. IP is a
connectionless, best-effort packet switching protocol. It provides
packet routing, fragmentation and re-assembly through the data link
layer.</simpara>
        <simpara>+
IPv4 is the version in widespread use and IPv6 was just beginning to
come into use in 2000 but was still not widespread by 2008 <xref linkend="FOLDOC"/>.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="IP_Address">
      <glossterm>IP Address</glossterm>
      <glossdef>
        <simpara>IP addresses come in two flavours, reflecting the two versions of
<glossterm linkend="IP">IP</glossterm> used.</simpara>
        <simpara>+
An IPv4 address is a 32 bit number generally represented as a dotted quad e.g.
10.20.30.40.  There is a limit of just under 4.3 billion IPv4 addresses, which
is slowly being reached, which necessitated the invention of IPv6.</simpara>
        <simpara>+
An IPv6 address is a 128 bit number, generally represented as a hexadecimal
number, split into nibbles of up to four digits, separated by colons, e.g.
2001:41c8:12::34.  There are up to 2<superscript>128</superscript> or 3 × 10<superscript>38</superscript>
addresses available in IPv6.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="ISP">
      <glossterm>ISP, Internet Service Provider</glossterm>
      <glossdef>
        <simpara>A company which provides other companies or individuals with access
to, or presence on, the Internet. Most ISPs are also Internet Access
Providers; extra services include help with design, creation and
administration of World-Wide Web sites, training and administration
of intranets and domain name registration <xref linkend="FOLDOC"/>.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="ManageSieve">
      <glossterm>ManageSieve</glossterm>
      <glossdef>
        <simpara>ManageSieve is a protocol that is allows <glossterm linkend="Sieve">Sieve</glossterm> filters to be
managed remotely, testing any filters before allowing them to be used.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="MTA">
      <glossterm>MTA, Mail Transfer Agent</glossterm>
      <glossdef>
        <simpara>A mail transfer agent is a computer
process or software agent that transfers electronic mail messages from one
computer to another, in single hop application-level transactions. A MTA
implements both the client (sending) and server (receiving) portions of the
Simple Mail Transfer Protocol.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="MUC">
      <glossterm>MUC, Multi User Chat</glossterm>
      <glossdef>
        <simpara>A Multi User Chat is a feature of XMPP allowing many users to converse in
the same window. This is often used to ease communication between groups in
different offices, and for the sake of ease can be thought of as the point
at which mailing lists and instant messages meet.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="NTP">
      <glossterm>NTP, Network Time Protocol</glossterm>
      <glossdef>
        <simpara>A protocol built on top of TCP/IP that assures accurate local
timekeeping with reference to radio, atomic or other clocks located
on the Internet. This protocol is capable of synchronising
distributed clocks within milliseconds over long time periods.<xref linkend="FOLDOC"/>.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="PHP">
      <glossterm>PHP</glossterm>
      <glossdef>
        <simpara>PHP is a widely-used general-purpose scripting language that is
especially suited for Web development and can be embedded into HTML.
<xref linkend="PHPNET"/></simpara>
      </glossdef>
    </glossentry>
    <glossentry id="POP3">
      <glossterm>POP3, Post Office Protocol 3</glossterm>
      <glossdef>
        <simpara>Version 3 of the Post Office Protocol. POP3 is defined in RFC 1081,
written in November 1988 by Marshall Rose, which is based on RFC 918
(since revised as RFC 937). POP3 allows a client computer to
retrieve electronic mail from a POP3 server via a (temporary) TCP/IP
or other[?] connection. It does not provide for sending mail, which
is assumed to be done via SMTP or some other method <xref linkend="FOLDOC"/>.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="SFTP">
      <glossterm>Secure File Transfer Protocol, SFTP</glossterm>
      <glossdef>
        <simpara>SFTP is a file transfer protocol which involves using an SSH server
to manage the file uploads.  It is secure in the sense that file
contents are encrypted during transfer, and that plain-text passwords
are never sent over the internet.  SFTP is the logical successor to
FTP, which is less secure, and more complex to firewall.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="Sieve">
      <glossterm>Sieve</glossterm>
      <glossdef>
        <simpara>Sieve is a language that can be used to filter email messages.  It is a powerful
language that provides a safe environment for filtering to occur during mail
delivery, allowing messages to be delivered directly into mailboxes configured
by the user.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="SMTP">
      <glossterm>SMTP, Simple Mail Transfer Protocol</glossterm>
      <glossdef>
        <simpara>A protocol defined in STD 10, RFC 821, used to transfer electronic
mail between computers, usually over Ethernet. It is a server to
server protocol, so other protocols are used to access the
messages <xref linkend="FOLDOC"/>.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="SPF">
      <glossterm>SPF, Sender Policy Framework</glossterm>
      <glossdef>
        <simpara>An anti-spam measure designed to let domain administrators choose
how mail sent on their domain’s behalf will be treated by recipients,
which can help send spoofed mail to spam and protect your domain’s
reputation.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="SSH">
      <glossterm>SSH, Secure Shell</glossterm>
      <glossdef>
        <simpara>A Unix shell program for logging into, and executing commands on, a
remote computer. ssh is intended to replace rlogin and rsh, and
provide secure encrypted communications between two untrusted hosts
over an insecure network. X11 connections and arbitrary TCP/IP ports
can also be forwarded over the secure channel <xref linkend="FOLDOC"/>.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="SSL">
      <glossterm>SSL, Secure Sockets Layer</glossterm>
      <glossdef>
        <simpara>A protocol designed by Netscape Communications Corporation to
provide secure communications over the Internet using asymmetric key
encryption. SSL is layered beneath application protocols such as
HTTP, SMTP, Telnet, FTP, Gopher and NNTP and is layered above the
connection protocol TCP/IP. It is used by the HTTPS access
method <xref linkend="FOLDOC"/>.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="TCP">
      <glossterm>TCP, Transmission Control Protocol</glossterm>
      <glossdef>
        <simpara>The most common transport layer protocol used on Ethernet and the
Internet. It was developed by DARPA.</simpara>
        <simpara>TCP is the connection-oriented protocol built on top of Internet
Protocol (IP) and is nearly always seen in the combination TCP/IP
(TCP over IP). It adds reliable communication and flow-control and
provides full-duplex, process-to-process connections.</simpara>
        <simpara>TCP is defined in STD 7 and RFC 793 <xref linkend="FOLDOC"/>.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="TLS">
      <glossterm>TLS, Transport Layer Security</glossterm>
      <glossdef>
        <simpara>A protocol designed to allow client/server applications to
communicate over the Internet without eavesdropping, tampering, or
message forgery.</simpara>
        <simpara>TLS is defined in RFC 2246 <xref linkend="FOLDOC"/>.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="UDP">
      <glossterm>UDP, User Datagram Protocol</glossterm>
      <glossdef>
        <simpara>Internet standard network layer, transport layer and session layer
protocols which provide simple but unreliable datagram services. UDP
is defined in STD 6, RFC 768. It adds a checksum and additional
process-to-process addressing information [to what?]. UDP is a
connectionless protocol which, like TCP, is layered on top of IP.</simpara>
        <simpara>UDP neither guarantees delivery nor does it require a connection. As a
result it is lightweight and efficient, but all error processing and
retransmission must be taken care of by the application
program <xref linkend="FOLDOC"/>.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="URL">
      <glossterm>URL, Uniform Resource Locator</glossterm>
      <glossdef>
        <simpara>A Uniform Resource Locator (URL) is a Uniform Resource Identifier (URI) that
specifies where an identified resource is available and the mechanism for
retrieving it. In popular usage and in many technical documents and verbal
discussions it is often incorrectly used as a synonym for URI. The best-known
example of a URL is the "address" of a web page e.g.
<ulink url="http://www.example.com">http://www.example.com</ulink> <xref linkend="WIKIPEDIA_URL"/>.</simpara>
      </glossdef>
    </glossentry>
    <glossentry id="XMPP">
      <glossterm>XMPP, Extensible Messaging and Presence Protocol</glossterm>
      <glossdef>
        <simpara>A protocol enabling instant messaging, contact list maintenance, and
presence information. Addresses usually take the same form as an email
address, eg, <ulink url="mailto:user@domain.tld">user@domain.tld</ulink>. Various common extensions exist, including
file transfer, voice and video (<filename class="devicefile">Jingle</filename>), service discovery, and
multi user chat. Federation is another key feature of XMPP, which allows
any user of XMPP to contact any other user, provided they are able to
connect that user’s XMPP server. XMPP is not limited to chat, but can
also be used to deliver push notifications, file sharing, and identity services.</simpara>
      </glossdef>
    </glossentry>
  </glossary>
  <bibliography id="ch-bibliography">
    <title>Bibliography</title>
    <bibliodiv>
      <bibliomixed>
<bibliomisc>
<anchor id="FOLDOC" xreflabel="[FOLDOC]"/>[FOLDOC] Denis Howe (ed). ‘The Free On-line Dictionary of Computing’, <ulink url="http://foldoc.org/">http://foldoc.org/</ulink>
</bibliomisc>
</bibliomixed>
      <bibliomixed>
<bibliomisc>
<anchor id="PHPNET" xreflabel="[PHPNET]"/>[PHPNET] The PHP Group. ‘PHP: Hypertext Preprocessor’, <ulink url="http://php.net/">http://php.net/</ulink>
</bibliomisc>
</bibliomixed>
      <bibliomixed>
<bibliomisc>
<anchor id="WIKIPEDIA_URL" xreflabel="[WIKIPEDIA_URL]"/>[WIKIPEDIA_URL] Wikipedia contributors. ‘Uniform Resource
  Locator’, <emphasis>Wikipedia, The Free Encyclopedia</emphasis>.  <ulink url="http://en.wikipedia.org/w/index.php?title=Uniform_Resource_Locator&amp;oldid=367676813">http://en.wikipedia.org/w/index.php?title=Uniform_Resource_Locator&amp;oldid=367676813</ulink> (downloaded 2010-06-10).
</bibliomisc>
</bibliomixed>
    </bibliodiv>
  </bibliography>
  <index id="ch-index">
    <title>Index</title>
  </index>
</book>
