<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.stoney-cloud.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=David</id>
	<title>stoney-cloud.org - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.stoney-cloud.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=David"/>
	<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/wiki/Special:Contributions/David"/>
	<updated>2026-05-13T13:46:49Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=stoney_backup:_Server_set-up&amp;diff=3670</id>
		<title>stoney backup: Server set-up</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=stoney_backup:_Server_set-up&amp;diff=3670"/>
		<updated>2014-06-13T13:51:13Z</updated>

		<summary type="html">&lt;p&gt;David: /* Cronjobs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Abstract =&lt;br /&gt;
This document describes server setup for the stoney cloud (Online) Backup service, built upon the [http://www.gentoo.org/ Gentoo] Linux distribution.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
After working through this documentation, you will be able to set up and configure your own (Online) Backup service server.&lt;br /&gt;
&lt;br /&gt;
= Software Installation =&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
A working stoney cloud, installed according to [[stoney cloud: Single-Node Installation]] or [[stoney cloud: Multi-Node Installation]].&lt;br /&gt;
&lt;br /&gt;
== Keywords &amp;amp; USE-Flags ==&lt;br /&gt;
For a minimal OpenLDAP directory installation:&lt;br /&gt;
 echo &amp;quot;net-nds/openldap minimal sasl&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
 echo &amp;quot;net-nds/openldap ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
NSS and PAM modules for lookups using LDAP:&lt;br /&gt;
 echo &amp;quot;sys-auth/nss-pam-ldapd sasl&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
 echo &amp;quot;sys-auth/nss-pam-ldapd ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;sys-fs/quota ldap&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;=app-admin/jailkit-2.16 ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
For the prov-backup-rsnapshot daemon:&lt;br /&gt;
 echo &amp;quot;dev-perl/Net-SMTPS ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;perl-core/Switch ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
To build puttygen only without X11:&lt;br /&gt;
 echo &amp;quot;net-misc/putty ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;net-misc/putty -gtk&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&lt;br /&gt;
== Emerge ==&lt;br /&gt;
 emerge -va nss-pam-ldapd \&lt;br /&gt;
            quota \&lt;br /&gt;
            net-misc/putty \&lt;br /&gt;
            app-admin/jailkit \&lt;br /&gt;
            sys-apps/haveged \&lt;br /&gt;
            net-misc/putty \&lt;br /&gt;
            sys-apps/sst-backup-utils \&lt;br /&gt;
            sys-apps/sst-prov-backup-rsnapshot&lt;br /&gt;
&lt;br /&gt;
To list the dependencies of ebuilds, you can use &amp;lt;code&amp;gt;equery&amp;lt;/code&amp;gt;:&lt;br /&gt;
 equery depgraph sst-backup-utils&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * Searching for sst-backup-utils ...&lt;br /&gt;
&lt;br /&gt;
 * dependency graph for sys-apps/sst-backup-utils-0.1.0&lt;br /&gt;
 `--  sys-apps/sst-backup-utils-0.1.0  amd64 &lt;br /&gt;
   `--  dev-perl/PerlUtil-0.1.0  (&amp;gt;=dev-perl/PerlUtil-0.1.0) amd64 &lt;br /&gt;
   `--  virtual/perl-Sys-Syslog-0.320.0  (virtual/perl-Sys-Syslog) amd64 &lt;br /&gt;
   `--  dev-perl/perl-ldap-0.530.0  (dev-perl/perl-ldap) amd64 &lt;br /&gt;
   `--  dev-perl/XML-Simple-2.200.0  (dev-perl/XML-Simple) amd64 &lt;br /&gt;
   `--  dev-perl/Config-IniFiles-2.780.0  (dev-perl/Config-IniFiles) amd64 &lt;br /&gt;
   `--  dev-perl/XML-Validator-Schema-1.100.0  (dev-perl/XML-Validator-Schema) amd64 &lt;br /&gt;
   `--  dev-perl/Date-Calc-6.300.0  (dev-perl/Date-Calc) amd64 &lt;br /&gt;
   `--  dev-perl/DateManip-6.310.0  (dev-perl/DateManip) amd64 &lt;br /&gt;
   `--  dev-perl/Schedule-Cron-Events-1.930.0  (dev-perl/Schedule-Cron-Events) amd64 &lt;br /&gt;
   `--  dev-perl/DateTime-Format-Strptime-1.520.0  (dev-perl/DateTime-Format-Strptime) amd64 &lt;br /&gt;
   `--  dev-perl/XML-SAX-0.990.0  (dev-perl/XML-SAX) amd64 &lt;br /&gt;
   `--  virtual/perl-MIME-Base64-3.130.0-r2  (virtual/perl-MIME-Base64) amd64 &lt;br /&gt;
   `--  dev-perl/Authen-SASL-2.160.0  (dev-perl/Authen-SASL) amd64 &lt;br /&gt;
   `--  dev-perl/Net-SMTPS-0.30.0  (dev-perl/Net-SMTPS) ~amd64 &lt;br /&gt;
   `--  dev-perl/text-template-1.450.0  (dev-perl/text-template) amd64 &lt;br /&gt;
   `--  virtual/perl-Getopt-Long-2.380.0-r2  (virtual/perl-Getopt-Long) amd64 &lt;br /&gt;
   `--  dev-perl/Parallel-ForkManager-1.20.0  (dev-perl/Parallel-ForkManager) amd64 &lt;br /&gt;
   `--  dev-perl/Time-Stopwatch-1.0.0  (dev-perl/Time-Stopwatch) amd64 &lt;br /&gt;
   `--  app-backup/rsnapshot-1.3.1-r1  (app-backup/rsnapshot) amd64 &lt;br /&gt;
[ sys-apps/sst-backup-utils-0.1.0 stats: packages (20), max depth (1) ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more information, visit the [http://www.gentoo.org/doc/en/gentoolkit.xml Gentoolkit] page.&lt;br /&gt;
&lt;br /&gt;
= Base Server Software Configuration =&lt;br /&gt;
== OpenSSH ==&lt;br /&gt;
=== OpenSSH Configuration ===&lt;br /&gt;
Configure the OpenSSH daemon:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vi /etc/ssh/sshd_config&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set following options:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
PubkeyAuthentication yes&lt;br /&gt;
PasswordAuthentication yes&lt;br /&gt;
UsePAM yes&lt;br /&gt;
Subsystem     sftp   internal-sftp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure, that &amp;lt;code&amp;gt;Subsystem     sftp   internal-sftp&amp;lt;/code&amp;gt; is the last line in the configuration file.&lt;br /&gt;
&lt;br /&gt;
We want to reduce the numbers of chroot environments in one folder. As the &amp;lt;code&amp;gt;ChrootDirectory&amp;lt;/code&amp;gt; configuration option only allows &amp;lt;code&amp;gt;%h&amp;lt;/code&amp;gt; (home directory of the user) and &amp;lt;code&amp;gt;%u&amp;lt;/code&amp;gt; (username of the user), we need to create the necessary matching rules in the form of:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Match User *000&lt;br /&gt;
  ChrootDirectory /var/backup/000/%u&lt;br /&gt;
  AuthorizedKeysFile /var/backup/000/%u/%h/.ssh/authorized_keys&lt;br /&gt;
Match&lt;br /&gt;
Match User *001&lt;br /&gt;
  ChrootDirectory /var/backup/001/%u&lt;br /&gt;
  AuthorizedKeysFile /var/backup/001/%u/%h/.ssh/authorized_keys&lt;br /&gt;
Match&lt;br /&gt;
...&lt;br /&gt;
Match User *999&lt;br /&gt;
  ChrootDirectory /var/backup/999/%u&lt;br /&gt;
  AuthorizedKeysFile /var/backup/999/%u/%h/.ssh/authorized_keys&lt;br /&gt;
Match&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The creation of the matching rules is done by executing the following bash commands:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
FILE=/etc/ssh/sshd_config;&lt;br /&gt;
&lt;br /&gt;
for x in {0..999} ; do \&lt;br /&gt;
  printf &amp;quot;Match User *%03d\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;  ChrootDirectory /var/backup/%03d/%%u\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;  AuthorizedKeysFile /var/backup/%03d/%%u/%%h/.ssh/authorized_keys\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;Match\n&amp;quot; &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to restart the OpenSSH daemon:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/etc/init.d/sshd restart&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSSH Host Keys ===&lt;br /&gt;
If you migrate from a existing backup server, you might want to copy the ssh host keys to the new server. If you do so clients want see a difference between the two hosts as the fingerprint remains the same. Copy the following files from the existing host to the new:&lt;br /&gt;
* /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_ecdsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_key&lt;br /&gt;
* /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_dsa_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_ecdsa_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_rsa_key.pub&lt;br /&gt;
&lt;br /&gt;
Set the correct permissions on the new host:&lt;br /&gt;
 chmod 600 /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_key /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
 chmod 644 /etc/ssh/*.pub&lt;br /&gt;
&lt;br /&gt;
And restart the ssh daemon. &#039;&#039;Caution&#039;&#039;: do not close your existing ssh session as long as you are not sure the ssh daemon has restarted properly and you can login again.&lt;br /&gt;
 /etc/init.d/sshd restart&lt;br /&gt;
&lt;br /&gt;
== OpenLDAP ==&lt;br /&gt;
=== /etc/hosts ===&lt;br /&gt;
Update the &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt; with the LDAP server:&lt;br /&gt;
 /etc/hosts&lt;br /&gt;
&lt;br /&gt;
 # VIP of the LDAP Server&lt;br /&gt;
 31.216.40.4      ldapm.stoney-cloud.org&lt;br /&gt;
&lt;br /&gt;
=== Root CA Certificate Installation ===&lt;br /&gt;
Install the root CA certificate into the OpenSSL default certificate storage directory:&lt;br /&gt;
 fqdn=&amp;quot;cloud.stoney-cloud.org&amp;quot;    # The fully qualified domain name of the server containing the root certificate.&lt;br /&gt;
 &lt;br /&gt;
 cd /etc/ssl/certs/&lt;br /&gt;
 wget --no-check-certificate https://${fqdn}/ca/FOSS-Cloud_CA.cert.pem&lt;br /&gt;
 chown root:root /etc/ssl/certs/FOSS-Cloud_CA.cert.pem&lt;br /&gt;
 chmod 444 /etc/ssl/certs/FOSS-Cloud_CA.cert.pem&lt;br /&gt;
&lt;br /&gt;
Rebuild the CA hashes&lt;br /&gt;
 c_rehash /etc/ssl/certs/&lt;br /&gt;
&lt;br /&gt;
=== /etc/openldap/ldap.conf ===&lt;br /&gt;
Update the &amp;lt;code&amp;gt;/etc/openldap/ldap.conf&amp;lt;/code&amp;gt;LDAP configuration file/environment variables:&lt;br /&gt;
 /etc/openldap/ldap.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Used to specify a size limit to use when performing searches. The number should be an&lt;br /&gt;
# non-negative integer. SIZELIMIT of zero (0) specifies unlimited search size.&lt;br /&gt;
SIZELIMIT       20000&lt;br /&gt;
&lt;br /&gt;
# Used to specify a time limit to use when performing searches. The number should be an&lt;br /&gt;
# non-negative integer. TIMELIMIT of zero (0) specifies unlimited search time to be used.&lt;br /&gt;
TIMELIMIT       45&lt;br /&gt;
&lt;br /&gt;
# Specify how aliases dereferencing is done. DEREF should be set to one of never, always, search,&lt;br /&gt;
# or find to specify that aliases are never dereferenced, always dereferenced, dereferenced when&lt;br /&gt;
# searching, or dereferenced only when locating the base object for the search. The default is to&lt;br /&gt;
# never dereference aliases.&lt;br /&gt;
DEREF           never&lt;br /&gt;
&lt;br /&gt;
# Specifies the URI(s) of an LDAP server(s) to which the LDAP library should connect. The URI&lt;br /&gt;
# scheme may be either ldapor ldaps which refer to LDAP over TCP and LDAP over SSL (TLS)&lt;br /&gt;
# respectively. Each server&#039;s name can be specified as a domain- style name or an IP address&lt;br /&gt;
# literal. Optionally, the server&#039;s name can followed by a &#039;:&#039; and the port number the LDAP&lt;br /&gt;
# server is listening on. If no port number is provided, the default port for the scheme is&lt;br /&gt;
# used (389 for ldap://, 636 for ldaps://). A space separated list of URIs may be provided.&lt;br /&gt;
URI             ldaps://ldapm.stoney-cloud.org&lt;br /&gt;
&lt;br /&gt;
# Used to specify the default base DN to use when performing ldap operations. The base must be&lt;br /&gt;
# specified as a Distinguished Name in LDAP format.&lt;br /&gt;
BASE            dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# This is a local copy of the certificate of the certificate authority&lt;br /&gt;
# used to sign the server certificate for the LDAP server I am using&lt;br /&gt;
TLS_CACERT      /etc/ssl/certs/FOSS-Cloud_CA.cert.pem&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check you configuration by doing a search:&lt;br /&gt;
 ldapsearch -v -H &amp;quot;ldaps://ldapm.stoney-cloud.org&amp;quot; \&lt;br /&gt;
               -b &amp;quot;dc=stoney-cloud,dc=org&amp;quot; \&lt;br /&gt;
               -D &amp;quot;cn=Manager,dc=stoney-cloud,dc=org&amp;quot; \&lt;br /&gt;
               -s one &amp;quot;(objectClass=*)&amp;quot; \&lt;br /&gt;
               -LLL -W&lt;br /&gt;
&lt;br /&gt;
The result should look something like:&lt;br /&gt;
 ldap_initialize( ldaps://ldapm.stoney-cloud.org:636/??base )&lt;br /&gt;
 filter: (objectClass=*)&lt;br /&gt;
 requesting: All userApplication attributes&lt;br /&gt;
 dn: ou=administration,dc=stoney-cloud,dc=org&lt;br /&gt;
 objectClass: top&lt;br /&gt;
 objectClass: organizationalUnit&lt;br /&gt;
 ou: administration&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
== Random Number Generator (haveged) ==&lt;br /&gt;
Tools like putty are dependent on random numbers to be able to create certificates.&lt;br /&gt;
&lt;br /&gt;
=== haveged - Generate random numbers and feed linux random device ===&lt;br /&gt;
The haveged daemon doesn&#039;t need any special configuration, therefore you can start it from the command line interface:&lt;br /&gt;
 /etc/init.d/haveged start&lt;br /&gt;
&lt;br /&gt;
Check, if the start was successful:&lt;br /&gt;
 ps auxf | grep haveged&lt;br /&gt;
&lt;br /&gt;
 root     18001  1.0  0.0   7420  3616 ?        Ss   08:48   0:00 /usr/sbin/haveged -r 0 -w 1024 -v 1&lt;br /&gt;
&lt;br /&gt;
Add the haveged daemon to the default run level:&lt;br /&gt;
 rc-update add haveged default&lt;br /&gt;
&lt;br /&gt;
== nss-pam-ldapd ==&lt;br /&gt;
=== nslcd.conf — configuration file for LDAP nameservice daemon ===&lt;br /&gt;
 /etc/nslcd.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is the configuration file for the LDAP nameservice&lt;br /&gt;
# switch library&#039;s nslcd daemon. It configures the mapping&lt;br /&gt;
# between NSS names (see /etc/nsswitch.conf) and LDAP&lt;br /&gt;
# information in the directory.&lt;br /&gt;
# See the manual page nslcd.conf(5) for more information.&lt;br /&gt;
&lt;br /&gt;
# The user and group nslcd should run as.&lt;br /&gt;
uid nslcd&lt;br /&gt;
gid nslcd&lt;br /&gt;
&lt;br /&gt;
# The uri pointing to the LDAP server to use for name lookups.&lt;br /&gt;
# Multiple entries may be specified. The address that is used&lt;br /&gt;
# here should be resolvable without using LDAP (obviously).&lt;br /&gt;
#uri ldap://127.0.0.1/&lt;br /&gt;
#uri ldaps://127.0.0.1/&lt;br /&gt;
#uri ldapi://%2fvar%2frun%2fldapi_sock/&lt;br /&gt;
# Note: %2f encodes the &#039;/&#039; used as directory separator&lt;br /&gt;
uri ldaps://ldapm.tombstone.ch&lt;br /&gt;
&lt;br /&gt;
# The LDAP version to use (defaults to 3&lt;br /&gt;
# if supported by client library)&lt;br /&gt;
#ldap_version 3&lt;br /&gt;
&lt;br /&gt;
# The distinguished name of the search base.&lt;br /&gt;
base dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# The distinguished name to bind to the server with.&lt;br /&gt;
# Optional: default is to bind anonymously.&lt;br /&gt;
binddn cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# The credentials to bind with.&lt;br /&gt;
# Optional: default is no credentials.&lt;br /&gt;
# Note that if you set a bindpw you should check the permissions of this file.&lt;br /&gt;
bindpw myverysecretpassword&lt;br /&gt;
&lt;br /&gt;
# The distinguished name to perform password modifications by root by.&lt;br /&gt;
#rootpwmoddn cn=admin,dc=example,dc=com&lt;br /&gt;
&lt;br /&gt;
# The default search scope.&lt;br /&gt;
#scope sub&lt;br /&gt;
#scope one&lt;br /&gt;
#scope base&lt;br /&gt;
&lt;br /&gt;
# Customize certain database lookups.&lt;br /&gt;
#base   group  ou=Groups,dc=example,dc=com&lt;br /&gt;
base   group  ou=groups,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
base   passwd ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
base   shadow ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
#scope  group  onelevel&lt;br /&gt;
#scope  hosts  sub&lt;br /&gt;
&lt;br /&gt;
#filter group  (&amp;amp;(objectClass=posixGroup)(sstIsActive=TRUE))&lt;br /&gt;
filter passwd (&amp;amp;(objectClass=posixAccount)(sstIsActive=TRUE))&lt;br /&gt;
filter shadow (&amp;amp;(objectClass=shadowAccount)(sstIsActive=TRUE))&lt;br /&gt;
&lt;br /&gt;
# Bind/connect timelimit.&lt;br /&gt;
#bind_timelimit 30&lt;br /&gt;
&lt;br /&gt;
# Search timelimit.&lt;br /&gt;
#timelimit 30&lt;br /&gt;
&lt;br /&gt;
# Idle timelimit. nslcd will close connections if the&lt;br /&gt;
# server has not been contacted for the number of seconds.&lt;br /&gt;
#idle_timelimit 3600&lt;br /&gt;
&lt;br /&gt;
# Use StartTLS without verifying the server certificate.&lt;br /&gt;
#ssl start_tls&lt;br /&gt;
tls_reqcert never&lt;br /&gt;
&lt;br /&gt;
# CA certificates for server certificate verification&lt;br /&gt;
#tls_cacertdir /etc/ssl/certs&lt;br /&gt;
#tls_cacertfile /etc/ssl/ca.cert&lt;br /&gt;
&lt;br /&gt;
# Seed the PRNG if /dev/urandom is not provided&lt;br /&gt;
#tls_randfile /var/run/egd-pool&lt;br /&gt;
&lt;br /&gt;
# SSL cipher suite&lt;br /&gt;
# See man ciphers for syntax&lt;br /&gt;
#tls_ciphers TLSv1&lt;br /&gt;
&lt;br /&gt;
# Client certificate and key&lt;br /&gt;
# Use these, if your server requires client authentication.&lt;br /&gt;
#tls_cert&lt;br /&gt;
#tls_key&lt;br /&gt;
&lt;br /&gt;
# Mappings for Services for UNIX 3.5&lt;br /&gt;
#filter passwd (objectClass=User)&lt;br /&gt;
#map    passwd uid              msSFU30Name&lt;br /&gt;
#map    passwd userPassword     msSFU30Password&lt;br /&gt;
#map    passwd homeDirectory    msSFU30HomeDirectory&lt;br /&gt;
#map    passwd homeDirectory    msSFUHomeDirectory&lt;br /&gt;
#filter shadow (objectClass=User)&lt;br /&gt;
#map    shadow uid              msSFU30Name&lt;br /&gt;
#map    shadow userPassword     msSFU30Password&lt;br /&gt;
#filter group  (objectClass=Group)&lt;br /&gt;
#map    group  member           msSFU30PosixMember&lt;br /&gt;
&lt;br /&gt;
# Mappings for Services for UNIX 2.0&lt;br /&gt;
#filter passwd (objectClass=User)&lt;br /&gt;
#map    passwd uid              msSFUName&lt;br /&gt;
#map    passwd userPassword     msSFUPassword&lt;br /&gt;
#map    passwd homeDirectory    msSFUHomeDirectory&lt;br /&gt;
#map    passwd gecos            msSFUName&lt;br /&gt;
#filter shadow (objectClass=User)&lt;br /&gt;
#map    shadow uid              msSFUName&lt;br /&gt;
#map    shadow userPassword     msSFUPassword&lt;br /&gt;
#map    shadow shadowLastChange pwdLastSet&lt;br /&gt;
#filter group  (objectClass=Group)&lt;br /&gt;
#map    group  member           posixMember&lt;br /&gt;
&lt;br /&gt;
# Mappings for Active Directory&lt;br /&gt;
#pagesize 1000&lt;br /&gt;
#referrals off&lt;br /&gt;
#idle_timelimit 800&lt;br /&gt;
#filter passwd (&amp;amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))&lt;br /&gt;
#map    passwd uid              sAMAccountName&lt;br /&gt;
#map    passwd homeDirectory    unixHomeDirectory&lt;br /&gt;
#map    passwd gecos            displayName&lt;br /&gt;
#filter shadow (&amp;amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))&lt;br /&gt;
#map    shadow uid              sAMAccountName&lt;br /&gt;
#map    shadow shadowLastChange pwdLastSet&lt;br /&gt;
#filter group  (objectClass=group)&lt;br /&gt;
&lt;br /&gt;
# Alternative mappings for Active Directory&lt;br /&gt;
# (replace the SIDs in the objectSid mappings with the value for your domain)&lt;br /&gt;
#pagesize 1000&lt;br /&gt;
#referrals off&lt;br /&gt;
#idle_timelimit 800&lt;br /&gt;
#filter passwd (&amp;amp;(objectClass=user)(objectClass=person)(!(objectClass=computer)))&lt;br /&gt;
#map    passwd uid           cn&lt;br /&gt;
#map    passwd uidNumber     objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
#map    passwd gidNumber     objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
#map    passwd homeDirectory &amp;quot;/home/$cn&amp;quot;&lt;br /&gt;
#map    passwd gecos         displayName&lt;br /&gt;
#map    passwd loginShell    &amp;quot;/bin/bash&amp;quot;&lt;br /&gt;
#filter group (|(objectClass=group)(objectClass=person))&lt;br /&gt;
#map    group gidNumber      objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
&lt;br /&gt;
# Mappings for AIX SecureWay&lt;br /&gt;
#filter passwd (objectClass=aixAccount)&lt;br /&gt;
#map    passwd uid              userName&lt;br /&gt;
#map    passwd userPassword     passwordChar&lt;br /&gt;
#map    passwd uidNumber        uid&lt;br /&gt;
#map    passwd gidNumber        gid&lt;br /&gt;
#filter group  (objectClass=aixAccessGroup)&lt;br /&gt;
#map    group  cn               groupName&lt;br /&gt;
#map    group  gidNumber        gid&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== nsswitch.conf - Name Service Switch configuration file ===&lt;br /&gt;
 /etc/nsswitch.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd:      files ldap&lt;br /&gt;
shadow:      files ldap&lt;br /&gt;
group:       files ldap&lt;br /&gt;
&lt;br /&gt;
# passwd:    db files nis&lt;br /&gt;
# shadow:    db files nis&lt;br /&gt;
# group:     db files nis&lt;br /&gt;
&lt;br /&gt;
hosts:       files dns&lt;br /&gt;
networks:    files dns&lt;br /&gt;
&lt;br /&gt;
services:    db files&lt;br /&gt;
protocols:   db files&lt;br /&gt;
rpc:         db files&lt;br /&gt;
ethers:      db files&lt;br /&gt;
netmasks:    files&lt;br /&gt;
netgroup:    files&lt;br /&gt;
bootparams:  files&lt;br /&gt;
&lt;br /&gt;
automount:   files&lt;br /&gt;
aliases:     files&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== system-auth ===&lt;br /&gt;
 vi /etc/pam.d/system-auth&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auth            required        pam_env.so&lt;br /&gt;
auth            sufficient      pam_unix.so try_first_pass likeauth nullok&lt;br /&gt;
auth            sufficient      pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
auth            required        pam_deny.so&lt;br /&gt;
&lt;br /&gt;
account         required        pam_unix.so&lt;br /&gt;
account         sufficient      pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
&lt;br /&gt;
password        required        pam_cracklib.so difok=2 minlen=8 dcredit=2 ocredit=2 retry=3&lt;br /&gt;
password        required        pam_unix.so try_first_pass use_authtok nullok sha512 shadow&lt;br /&gt;
password        sufficient      pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
password        required        pam_deny.so&lt;br /&gt;
&lt;br /&gt;
session         required        pam_limits.so&lt;br /&gt;
session         required        pam_env.so&lt;br /&gt;
session         required        pam_unix.so&lt;br /&gt;
session         sufficient      pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test the Setup ===&lt;br /&gt;
 nslcd -d&lt;br /&gt;
&lt;br /&gt;
=== Update the Default Run Levels ===&lt;br /&gt;
 rc-update add nslcd default&lt;br /&gt;
 rc-update add nscd default&lt;br /&gt;
&lt;br /&gt;
=== Start the necessary Daemons ===&lt;br /&gt;
 /etc/init.d/nslcd start&lt;br /&gt;
 /etc/init.d/nscd start&lt;br /&gt;
&lt;br /&gt;
== Quota ==&lt;br /&gt;
=== 32-bit Project Identifier Support ===&lt;br /&gt;
We need to enable 32-bit project identifier support (PROJID32BIT feature) for our naming scheme (uid numbers larger than 65&#039;536), which is already the default on the stepping stone virtual machines:&lt;br /&gt;
 mkfs.xfs &#039;&#039;&#039;-i projid32bit=1&#039;&#039;&#039; /dev/vg-local-01/var&lt;br /&gt;
&lt;br /&gt;
=== Update /etc/fstab and Mount ===&lt;br /&gt;
Make sure, that you have user quota (uqota) and project quota (pquota) set as options on the chosen mount point in /etc/fstab. For example:&lt;br /&gt;
 LABEL=LV-VAR            /var            xfs             noatime,discard,inode64,uquota,pquota  0 2&lt;br /&gt;
&lt;br /&gt;
 reboot&lt;br /&gt;
&lt;br /&gt;
Check, if everything went ok:&lt;br /&gt;
 df -h | grep var&lt;br /&gt;
&lt;br /&gt;
 /dev/mapper/vg--local--01-var  1023G  220G  804G  22% /var&lt;br /&gt;
&lt;br /&gt;
=== Verify ===&lt;br /&gt;
Some important options for xfs_quota:&lt;br /&gt;
* -x: Enable expert mode.&lt;br /&gt;
* -c: Pass arguments on the command line. Multiple arguments may be given.&lt;br /&gt;
&lt;br /&gt;
Remount the file system /var and check, if /var has the desired values:&lt;br /&gt;
 xfs_quota -x -c state /var&lt;br /&gt;
&lt;br /&gt;
As you can see (items marked bold), we have achieved our goal:&lt;br /&gt;
 User quota state on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
   Accounting: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Enforcement: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Inode: #131 (1 blocks, 1 extents)&lt;br /&gt;
 Group quota state on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
   Accounting: OFF&lt;br /&gt;
   Enforcement: OFF&lt;br /&gt;
   Inode: #132 (1 blocks, 1 extents)&lt;br /&gt;
 Project quota state on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
   Accounting: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Enforcement: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Inode: #132 (1 blocks, 1 extents)&lt;br /&gt;
 Blocks grace time: [7 days 00:00:30]&lt;br /&gt;
 Inodes grace time: [7 days 00:00:30]&lt;br /&gt;
 Realtime Blocks grace time: [7 days 00:00:30]&lt;br /&gt;
&lt;br /&gt;
=== User Quotas ===&lt;br /&gt;
==== Adding a User Quota ====&lt;br /&gt;
Set a quota of 1 Gigabyte for the user 4000187 (the values are in kilobytes, so 1048576 kilobyte are 1024 megabytes which corresponds to 1 gigabyte):&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1048576k 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Or in bytes:&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1073741824 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Read the quota information for the user 4000187:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
 /dev/mapper/vg--local--01-var                     0          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
If the user has data in the project, that belongs to him, the result will change:&lt;br /&gt;
 /dev/mapper/vg--local--01-var                512000          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
==== Modifiying a User Quota ====&lt;br /&gt;
To modify a users quota, you just set a new quota (limit):&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1048576k 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Read the quota information for the user 4000187:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
 /dev/mapper/vg--local--01-var                     0          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
If the user has data in the project, that belongs to him, the result will change:&lt;br /&gt;
 /dev/mapper/vg--local--01-var                512000          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
==== Removing a User Quota ====&lt;br /&gt;
Removing a quota for a user:&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=0 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
The following command should give you an empty result:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
=== Project (Directory) Quotas ===&lt;br /&gt;
==== Adding a Project (Directory) Quota ====&lt;br /&gt;
The XFS file system additionally allows you to set quotas on individual directory hierarchies in the file system that are known as managed trees. Each managed tree is uniquely identified by a project ID and an optional project name. We&#039;ll use the following values in the examples:&lt;br /&gt;
* project_ID: The uid of the online backup account (4000187).&lt;br /&gt;
* project_name: The uid of the online backup account (4000187). This could be a human readable name.&lt;br /&gt;
* mountpoint: The mountpoint of the xfs-filesystem (/var). See the &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt; entry from above.&lt;br /&gt;
* directory: The directory of the project (187/4000187), starting from the mountpoint of the xfs-filesystem (/var).&lt;br /&gt;
&lt;br /&gt;
Define a unique project ID for the directory hierarchy in the &amp;lt;code&amp;gt;/etc/projects&amp;lt;/code&amp;gt; file (project_ID:mountpoint/directory):&lt;br /&gt;
 echo &amp;quot;4000187:/var/backup/187/4000187/home/4000187&amp;quot; &amp;gt;&amp;gt; /etc/projects&lt;br /&gt;
&lt;br /&gt;
Create an entry in the &amp;lt;code&amp;gt;/etc/projid&amp;lt;/code&amp;gt; file that maps a project name to the project ID (project_name:project_ID):&lt;br /&gt;
 echo &amp;quot;4000187:4000187&amp;quot; &amp;gt;&amp;gt; /etc/projid&lt;br /&gt;
&lt;br /&gt;
Set Project:&lt;br /&gt;
 xfs_quota -x -c &#039;project -s -p /var/backup/187/4000187/home/4000187 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Set Quota (limit) on Project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=1048576k 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Check your Quota (limit)&lt;br /&gt;
 xfs_quota -x -c &#039;quota -p 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Check the Quota:&lt;br /&gt;
* &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt;: increase verbosity in reporting (also dumps zero values).&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt;: suppress the initial header.&lt;br /&gt;
* &amp;lt;code&amp;gt;-p&amp;lt;/code&amp;gt;: display project quota information.&lt;br /&gt;
* &amp;lt;code&amp;gt;-h&amp;lt;/code&amp;gt;: human readable format.&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -p 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
 /dev/mapper/vg--local--01-var                     0          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
If you copied data into the project, the output will look something like:&lt;br /&gt;
 /dev/mapper/vg--local--01-var                512000          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
To give you an overall view of the whole system:&lt;br /&gt;
 xfs_quota -x -c report /var&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
User quota on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
User ID          Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
root          1024000          0          0     00 [--------]&lt;br /&gt;
4000187             0          0    1048576     00 [--------]&lt;br /&gt;
&lt;br /&gt;
Project quota on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
Project ID       Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
4000187        512000          0    1048576     00 [--------]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modifying a Project (Directory) Quota ====&lt;br /&gt;
To modify a project (directory) quota, you just set an new quota (limit) on the chosen project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=1048576k 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Check your quota (limit)&lt;br /&gt;
 xfs_quota -x -c &#039;quota -p 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
==== Removing a Project (Directory) Quota ====&lt;br /&gt;
Removing a quota from a project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=0 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Chreck the results:&lt;br /&gt;
 xfs_quota -x -c report /var&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
User quota on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
User ID          Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
root           512000          0          0     00 [--------]&lt;br /&gt;
4000187             0          0       1024     00 [--------]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the line with the Project ID 4000187 has disappeared:&lt;br /&gt;
 4000187        512000          0    1048576     00 [--------]&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to remove the project from &amp;lt;code&amp;gt;/etc/projects&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/etc/projid&amp;lt;/code&amp;gt;:&lt;br /&gt;
 sed -i -e &#039;/4000187/d&#039; /etc/projects&lt;br /&gt;
 sed -i -e &#039;/4000187/d&#039; /etc/projid&lt;br /&gt;
&lt;br /&gt;
=== Some important notes concerning XFS ===&lt;br /&gt;
# The &#039;&#039;&#039;quotacheck&#039;&#039;&#039; command has no effect on XFS filesystems. The first time quota accounting is turned on (at mount time), XFS does an automatic quotacheck internally; afterwards, the quota system will always be completely consistent until quotas are manually turned off. &lt;br /&gt;
# There is &#039;&#039;&#039;no need for quota file(s)&#039;&#039;&#039; in the root of the XFS filesystem.&lt;br /&gt;
&lt;br /&gt;
== prov-backup-rsnapshot ==&lt;br /&gt;
Install the prov-backup-rsnasphot daemon script using the package manager:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
emerge -va sys-apps/sst-prov-backup-rsnapshot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
If it is the first provisioning module running on this server (very likely) you first have to configure the provisioning daemon (you can skip this step if you have already another provisioning module running on this server)&lt;br /&gt;
&lt;br /&gt;
==== Provisioning global configuration ====&lt;br /&gt;
The global configuration for the provisioning daemon applies to all provisioning modules running on the server. This configuration therefore contains information about the provisioning daemon itself and no information at all about the specific modules. &lt;br /&gt;
 /etc/Provisioning/Global.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Copyright (C) 2012 stepping stone GmbH&lt;br /&gt;
#                    Switzerland&lt;br /&gt;
#                    http://www.stepping-stone.ch&lt;br /&gt;
#                    support@stepping-stone.ch&lt;br /&gt;
#&lt;br /&gt;
# Authors:&lt;br /&gt;
#  Pat Kläy &amp;lt;pat.klaey@stepping-stone.ch&amp;gt;&lt;br /&gt;
#  &lt;br /&gt;
# Licensed under the EUPL, Version 1.1.&lt;br /&gt;
#&lt;br /&gt;
# You may not use this work except in compliance with the&lt;br /&gt;
# Licence.&lt;br /&gt;
# You may obtain a copy of the Licence at:&lt;br /&gt;
#&lt;br /&gt;
# http://www.osor.eu/eupl&lt;br /&gt;
#&lt;br /&gt;
# Unless required by applicable law or agreed to in&lt;br /&gt;
# writing, software distributed under the Licence is&lt;br /&gt;
# distributed on an &amp;quot;AS IS&amp;quot; basis,&lt;br /&gt;
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either&lt;br /&gt;
# express or implied.&lt;br /&gt;
# See the Licence for the specific language governing&lt;br /&gt;
# permissions and limitations under the Licence.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
[Global]&lt;br /&gt;
# If true the script logs every information to the log-file.&lt;br /&gt;
LOG_DEBUG = 0&lt;br /&gt;
&lt;br /&gt;
# If true the script logs additional information to the log-file.&lt;br /&gt;
LOG_INFO = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs warnings to the log-file.&lt;br /&gt;
LOG_WARNING = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs errors to the log-file.&lt;br /&gt;
LOG_ERR = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The number of seconds to wait before retry contacting the backend server during startup.&lt;br /&gt;
SLEEP = 10&lt;br /&gt;
&lt;br /&gt;
# Number of backend server connection retries during startup.&lt;br /&gt;
ATTEMPTS = 3&lt;br /&gt;
&lt;br /&gt;
[Operation Mode]&lt;br /&gt;
# The number of seconds to wait before retry contacting the backend server in case of a service interruptions.&lt;br /&gt;
SLEEP = 30&lt;br /&gt;
&lt;br /&gt;
# Number of backend server connection retries in case of a service interruptions.&lt;br /&gt;
ATTEMPTS = 3&lt;br /&gt;
&lt;br /&gt;
[Mail]&lt;br /&gt;
# Error messages are sent to the mail configured below.&lt;br /&gt;
SENDTO = &amp;lt;YOUR-MAIL-ADDRESS&amp;gt;&lt;br /&gt;
HOST = mail.stepping-stone.ch&lt;br /&gt;
PORT = 587&lt;br /&gt;
USERNAME = &amp;lt;YOUR-NOTIFICATION-EMAIL-ADDRESS&amp;gt;&lt;br /&gt;
PASSWORD = &amp;lt;PASSWORD&amp;gt;&lt;br /&gt;
FROMNAME = Provisioning daemon&lt;br /&gt;
CA_DIR = /etc/ssl/certs&lt;br /&gt;
SSL = starttls&lt;br /&gt;
AUTH_METHOD = LOGIN&lt;br /&gt;
&lt;br /&gt;
# Additionally, you can be informed about creation, modification and deletion of services.&lt;br /&gt;
WANTINFOMAIL = 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Provisioning daemon prov-backup-rsnapshot module ====&lt;br /&gt;
The module specific configuration is located in /etc/Provisioning/&amp;lt;Service&amp;gt;/&amp;lt;Type&amp;gt;.conf. In the case of the prov-backup-rsnapshot module this is &amp;lt;code&amp;gt;/etc/Provisioning/Backup/Rsnapshot.conf&amp;lt;/code&amp;gt;. (Note: Comments starting with /* are not in the configuration file, they are only in the wiki to add some additional information)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Copyright (C) 2013 stepping stone GmbH&lt;br /&gt;
#                    Switzerland&lt;br /&gt;
#                    http://www.stepping-stone.ch&lt;br /&gt;
#                    support@stepping-stone.ch&lt;br /&gt;
#&lt;br /&gt;
# Authors:&lt;br /&gt;
#  Pat Kläy &amp;lt;pat.klaey@stepping-stone.ch&amp;gt;&lt;br /&gt;
#  &lt;br /&gt;
# Licensed under the EUPL, Version 1.1.&lt;br /&gt;
#&lt;br /&gt;
# You may not use this work except in compliance with the&lt;br /&gt;
# Licence.&lt;br /&gt;
# You may obtain a copy of the Licence at:&lt;br /&gt;
#&lt;br /&gt;
# http://www.osor.eu/eupl&lt;br /&gt;
#&lt;br /&gt;
# Unless required by applicable law or agreed to in&lt;br /&gt;
# writing, software distributed under the Licence is&lt;br /&gt;
# distributed on an &amp;quot;AS IS&amp;quot; basis,&lt;br /&gt;
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either&lt;br /&gt;
# express or implied.&lt;br /&gt;
# See the Licence for the specific language governing&lt;br /&gt;
# permissions and limitations under the Licence.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
/* If you want, you can override the log information from the global configuration file this might be useful for debugging */&lt;br /&gt;
[Global]&lt;br /&gt;
# If true the script logs every information to the log-file.&lt;br /&gt;
LOG_DEBUG = 1&lt;br /&gt;
&lt;br /&gt;
# If true the script logs additional information to the log-file.&lt;br /&gt;
LOG_INFO = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs warnings to the log-file.&lt;br /&gt;
LOG_WARNING = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs errors to the log-file.&lt;br /&gt;
LOG_ERR = 1&lt;br /&gt;
&lt;br /&gt;
/* Specify the hosts fully qualified domain name. This name will be used to perform some checks and also appear in the information and error mails */&lt;br /&gt;
ENVIRONMENT = &amp;lt;FQDN&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
[Database]&lt;br /&gt;
BACKEND = LDAP&lt;br /&gt;
SERVER = ldaps://ldapm.tombstone.org&lt;br /&gt;
PORT = 636&lt;br /&gt;
ADMIN_USER = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
ADMIN_PASSWORD = &amp;lt;PASSWORD&amp;gt;&lt;br /&gt;
SERVICE_SUBTREE = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
COOKIE_FILE = /etc/Provisioning/Backup/rsnapshot.cookie&lt;br /&gt;
DEFAULT_COOKIE = rid=001,csn=&lt;br /&gt;
SEARCH_FILTER = (&amp;amp;(entryCSN&amp;gt;=%entryCSN%)(sstProvisioningState=0))&lt;br /&gt;
&lt;br /&gt;
/* Specifies the service itself. As it is the prov-backup-rsnapshot module, the SERVICE is &amp;quot;Backup&amp;quot; and the TYPE is &amp;quot;Rsnapshot&amp;quot;.&lt;br /&gt;
 * The MODUS is as usual selfcare and the TRANSPORTAPI is LocalCLI. This is because the daemon is running on the same host as the&lt;br /&gt;
 * backup accounts are provisioned and the commands can be executed on this host using the cli.&lt;br /&gt;
 * For more information about MODUS and TRANSPORTAPI see https://int.stepping-stone.ch/wiki/provisioning.pl#Service_Konfiguration&lt;br /&gt;
 */&lt;br /&gt;
[Service]&lt;br /&gt;
MODUS = selfcare&lt;br /&gt;
TRANSPORTAPI = LocalCLI&lt;br /&gt;
SERVICE = Backup&lt;br /&gt;
TYPE = Rsnapshot&lt;br /&gt;
&lt;br /&gt;
SYSLOG = prov-backup-rsnapshot&lt;br /&gt;
&lt;br /&gt;
/* For the TRANSPORTAPI LocalCLI there is no gateway required because there is no connection to establish. So set HOST, USER and&lt;br /&gt;
 * DSA_FILE to whatever you want. Don&#039;t leave it blank, otherwise the provisioning daemon would log some error messages saying&lt;br /&gt;
 * these attributes are empty &lt;br /&gt;
 */&lt;br /&gt;
[Gateway]&lt;br /&gt;
HOST = localhost&lt;br /&gt;
USER = provisioning&lt;br /&gt;
DSA_FILE = none&lt;br /&gt;
&lt;br /&gt;
/* Information about the backup itself (how to setup everything). Note that the %uid% int the RSNAPSHOT_CONFIG_FILE parameter will&lt;br /&gt;
 * be replaced by the accounts UID. The script CREATE_CHROOT_CMD was installed with the prov-backup-rsnapshot module, so do not&lt;br /&gt;
 * change this parameter. The quota parameters (SET_QUOTA_CMD, MOUNTPOINT, QUOTA_FILE, PROJECTS_FILE and PROJID_FILE) represent &lt;br /&gt;
 * the quota setup as described on http://wiki.stoney-cloud.org/index.php/stoney_backup:_Server_set-up#Quota. If you followed this&lt;br /&gt;
 * manual, you can copy-paste them into your configuration file, otherwise adapt them according to your quota setup.&lt;br /&gt;
 */&lt;br /&gt;
[Backup]&lt;br /&gt;
RSNAPSHOT_CONFIG_FILE = /etc/rsnapshot/rsnapshot.conf.%uid%&lt;br /&gt;
SET_QUOTA_CMD = /usr/sbin/xfs_quota&lt;br /&gt;
CREATE_CHROOT_CMD = /usr/libexec/createBackupDirectory.sh&lt;br /&gt;
MOUNTPOINT = /var&lt;br /&gt;
QUOTA_FILE = /etc/backupSize&lt;br /&gt;
PROJECTS_FILE = /etc/projects&lt;br /&gt;
PROJID_FILE = /etc/projid&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== backup utils ==&lt;br /&gt;
Install the backup utils (multiple scripts which help you to manage and monitor your backup server and backup accounts) using the package manager. For more information about the scripts please see the [[stoney_backup:_Server_set-up#stoney_backup_Service_Software | stoney backup Service Software]] section. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
emerge -va sys-apps/sst-backup-utils&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
Please refer to the configuration sections for the different scripts in [[stoney_backup:_Server_set-up#stoney_backup_Service_Software | stoney backup Service Software]].&lt;br /&gt;
&lt;br /&gt;
= stoney backup Service Software =&lt;br /&gt;
The stoney backup Service comes along with multiple scripts which help you to manage and monitor your backup server and accounts: &lt;br /&gt;
&lt;br /&gt;
We use rsnapshot - remote filesystem snapshot utility for the actual snapshots and a handful of wrapper scripts, that do things like:&lt;br /&gt;
* Read the users and their settings from the LDAP directory.&lt;br /&gt;
* Execute rsnapshot according to the users settings.&lt;br /&gt;
* Write the backup quotas backup (incoming), iterations (.snapshots) and free space to the users local backupSize file and update the LDAP directory.&lt;br /&gt;
* Inform the reseller, customer or user (depending on the settings in the LDAP directory) via mail, if the quota limit has been reached.&lt;br /&gt;
* Depending on the users settings in the LDAP directory, warning mail will be sent to the reseller, customer or user, if a backup was not executed on time.&lt;br /&gt;
&lt;br /&gt;
== writeAccountSize.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/writeAccountSize.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package and does the following:&lt;br /&gt;
* Calculates the used disk space (backup and iterations) for a given account and writes the corresponding values to:&lt;br /&gt;
*# The LDAP backend (used by the selfcare webinterface to display quota information):&lt;br /&gt;
*#* Backup space used (sstBackupSize): The disk space the account uses for the backup itself (disk space used under the &amp;lt;code&amp;gt;incoming&amp;lt;/code&amp;gt; folder of the users chroot-home directory)&lt;br /&gt;
*#* Snapshot space used (sstIncrementSize): The disk space the account uses for the iterations (disk space under the &amp;lt;code&amp;gt;.snapshot&amp;lt;/code&amp;gt; folder of the users chroot-home directory)&lt;br /&gt;
*# The file &amp;lt;code&amp;gt;etc/backupSize&amp;lt;/code&amp;gt; of the accounts chroot (used by the Sepiola Online Backup client):&lt;br /&gt;
* Checks if the user and/or reseller must be notified that there is no more disk space left for the given account&lt;br /&gt;
** Checks if the notification flag was passed, if not no notification will be triggered&lt;br /&gt;
** Calculates the used disk space (backup and iterations) in percentage&lt;br /&gt;
** Reads the notification threshold value from the LDAP backed&lt;br /&gt;
** If the disk space used (in percentage) is bigger than the value retrieved from the LDAP backend start the [[stoney_cloud:_Notification_Architecture | notification]] process with&lt;br /&gt;
*** Product: Given account UID&lt;br /&gt;
*** Service: Backup&lt;br /&gt;
*** Problem: Quota&lt;br /&gt;
* Pod documentation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    writeAccountSize.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This Script gets quota information from filesystem, size of incoming and&lt;br /&gt;
    snapshots directories, write the data to a file and the LDAP backend and&lt;br /&gt;
    sends an e-mail message for each account that is over quota to users&lt;br /&gt;
    e-mail address (from ldap directory) if notification flag is passed.&lt;br /&gt;
&lt;br /&gt;
    The configuration file for this script is stored in the backup-utils&lt;br /&gt;
    configuration directory (/etc/backup-utils/) and is called&lt;br /&gt;
    writeAccountSize.conf.&lt;br /&gt;
&lt;br /&gt;
    The script needs access to the quota program to get quota information.&lt;br /&gt;
    The script needs ldap access to get users e-mail address and quota&lt;br /&gt;
    information. The script uses syslog for logging purposes.&lt;br /&gt;
&lt;br /&gt;
    Command Line Interface (CLI) parameters:&lt;br /&gt;
&lt;br /&gt;
    -C configfile&lt;br /&gt;
        The configuration file.&lt;br /&gt;
&lt;br /&gt;
    -U uid&lt;br /&gt;
        The user id.&lt;br /&gt;
&lt;br /&gt;
    -n notification&lt;br /&gt;
        Start notification process if quota threshold is reached&lt;br /&gt;
&lt;br /&gt;
    -d debug&lt;br /&gt;
        Turns the debug mode on.&lt;br /&gt;
&lt;br /&gt;
    -h help&lt;br /&gt;
        This online help.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    writeAccountSize.pl -U uid [-C configuration file ] []-d debug] [-h&lt;br /&gt;
    help] [-n]&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2009-04-16 michael.rhyner@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2009-04-16 michael.rhyner@stepping-stone.ch created&lt;br /&gt;
    2009-04-30 michael.rhyner@stepping-stone.ch changed position based quota&lt;br /&gt;
    output parsing with correctly parsed elements&lt;br /&gt;
    2009-06-15 michael.rhyner@stepping-stone.ch added over quota check and&lt;br /&gt;
    sending e-mail&lt;br /&gt;
    2009-06-16 michael.rhyner@stepping-stone.ch renamed script and make it&lt;br /&gt;
    more general usable (e.g. for online backup, online storage, ...)&lt;br /&gt;
    2009-06-17 michael.rhyner@stepping-stone.ch changed mail message to read&lt;br /&gt;
    from a text file instead from configuration parameter&lt;br /&gt;
    2009-06-18 michael.rhyner@stepping-stone.ch corrected wrong regex to&lt;br /&gt;
    weed out the asterisk (*) in getQuotaSize&lt;br /&gt;
    2009-06-19 michael.rhyner@stepping-stone.ch corrected wrong evaluation&lt;br /&gt;
    success from subroutines and avoid message output when not in debug mode&lt;br /&gt;
    2009-06-22 michael.rhyner@stepping-stone.ch getQuotaSize: return&lt;br /&gt;
    immediately if no quota was set&lt;br /&gt;
    2009-06-24 michael.rhyner@stepping-stone.ch alert when used certain&lt;br /&gt;
    percentge of allowed space instead of more than allowed space&lt;br /&gt;
    2009-06-26 michael.rhyner@stepping-stone.ch values are presented in&lt;br /&gt;
    Gigabytes within notification message&lt;br /&gt;
    2009-07-23 michael.rhyner@stepping-stone.ch corrected wrong syslog&lt;br /&gt;
    severities for errors&lt;br /&gt;
    2009-07-24 michael.rhyner@stepping-stone.ch made e-mail address&lt;br /&gt;
    available within message body&lt;br /&gt;
    2013-08-19 pat.klaey@stepping-stone.ch write quota values also to the&lt;br /&gt;
    LDAP&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporate code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Config::IniFiles;&lt;br /&gt;
        Getopt::Std;&lt;br /&gt;
        Sys::Syslog;&lt;br /&gt;
        File::Basename;&lt;br /&gt;
        Text::Template;&lt;br /&gt;
        POSIX;&lt;br /&gt;
        Notification;&lt;br /&gt;
        PerlUtil::Logging;&lt;br /&gt;
        PerlUtil::LDAPUtil;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 /etc/backup-utils/writeAccountSize.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Global]&lt;br /&gt;
INCOMING_DIRECTORY = /incoming&lt;br /&gt;
ACCOUNT_SIZE_FILE = /etc/backupSize&lt;br /&gt;
SNAPSHOTS = 1&lt;br /&gt;
&lt;br /&gt;
[Syslog]&lt;br /&gt;
SYSLOG = rsnapshot&lt;br /&gt;
&lt;br /&gt;
[Directory]&lt;br /&gt;
LDAP_SERVER = ldaps://ldapm.tombstone.ch&lt;br /&gt;
LDAP_PORT = 636&lt;br /&gt;
LDAP_BIND_DN = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
LDAP_BIND_PW = &amp;lt;password&amp;gt;&lt;br /&gt;
LDAP_BASE_DN = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
LDAP_PERSON_BASE = ou=people,dc=stoney-cloud,dc=org&lt;br /&gt;
LDAP_RESELLER_BASE = ou=reseller,ou=configuration,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
LDAP_EMAIL_ATTRIBUTE = mail&lt;br /&gt;
&lt;br /&gt;
[Notification]&lt;br /&gt;
EMAIL_SENDER = stepping stone GmbH Supprt &amp;lt;support@stepping-stone.ch&amp;gt;&lt;br /&gt;
EMAIL_ALERT_THRESHOLD = 85&lt;br /&gt;
&lt;br /&gt;
Salutation_Default_de-CH = Liebe Kundin / Lieber Kunde&lt;br /&gt;
Salutation_m_de-CH = Sehr geehrter Herr&lt;br /&gt;
Salutation_f_de-CH = Sehr geehrte Frau&lt;br /&gt;
Salutation_Default_en-GB = Dear customer&lt;br /&gt;
Salutation_m_en-GB = Dear Mr.&lt;br /&gt;
Salutation_f_en-GB = Dear Mrs.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
 /usr/libexec/backup-utils/writeAccountSize.pl -U 4000080 -d&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Debug modus was turned on&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersHomeDirectory: $localUsersHomeDirectory: /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersHomeDirectory: The $localUsersHomeDirectory /var/backup/080/4000080/home/4000080 exists&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersHomeDirectory:   /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersIncomingDirectory: /incoming&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localIncomingPath:           /var/backup/080/4000080/home/4000080/incoming&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: The $localIncomingPath /var/backup/080/4000080/home/4000080/incoming exists&lt;br /&gt;
Total Quota: 1048576 kilobytes&lt;br /&gt;
Total used Space: 0 kilobytes&lt;br /&gt;
Incoming Size: 0 kilobytes&lt;br /&gt;
Debug sub getSnapshotsSize: $localUsedQuota:   0&lt;br /&gt;
Debug sub getSnapshotsSize: $localSnapshotsSize:   0&lt;br /&gt;
Debug writeAccountSize: Working on /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
Debug: wrote 1024 0 0 to /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstBackupSize =&amp;gt; 0&lt;br /&gt;
&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstIncrementSize =&amp;gt; 0&lt;br /&gt;
&lt;br /&gt;
Alert Threshold: 85 %&lt;br /&gt;
Calculated value: 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now write some data (200 megaytes in this example) into the users incoming directory and then execute the script again:&lt;br /&gt;
 dd if=/dev/zero of=/var/backup/080/4000080/home/4000080/incoming/test.zeros bs=1024k count=200&lt;br /&gt;
 chown 4000080:4000080 /var/backup/080/4000080/home/4000080/incoming/test.zeros&lt;br /&gt;
 /usr/libexec/backup-utils/writeAccountSize.pl -U 4000080 -d&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Debug modus was turned on&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersHomeDirectory: $localUsersHomeDirectory: /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersHomeDirectory: The $localUsersHomeDirectory /var/backup/080/4000080/home/4000080 exists&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersHomeDirectory:   /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersIncomingDirectory: /incoming&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localIncomingPath:           /var/backup/080/4000080/home/4000080/incoming&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: The $localIncomingPath /var/backup/080/4000080/home/4000080/incoming exists&lt;br /&gt;
Total Quota: 1048576 kilobytes&lt;br /&gt;
Total used Space: 204800 kilobytes&lt;br /&gt;
Incoming Size: 204800 kilobytes&lt;br /&gt;
Debug sub getSnapshotsSize: $localUsedQuota:   204800&lt;br /&gt;
Debug sub getSnapshotsSize: $localSnapshotsSize:   0&lt;br /&gt;
Debug writeAccountSize: Working on /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
Debug: wrote 1024 200 0 to /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstBackupSize =&amp;gt; 209715200&lt;br /&gt;
&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstIncrementSize =&amp;gt; 0&lt;br /&gt;
&lt;br /&gt;
Alert Threshold: 85 %&lt;br /&gt;
Calculated value: 19.53125&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Everything seems to be working fine!&lt;br /&gt;
&lt;br /&gt;
== snapshot.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/snapshot.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package and does the following:&lt;br /&gt;
* Read interval parameter value passed&lt;br /&gt;
** The interval parameter value can be daily, weekly, monthly (or yearly)&lt;br /&gt;
* Find all backup active accounts for which the rsnapshot command must be executed (depending on the given interval)&lt;br /&gt;
** Filter to find these accounts: &amp;lt;code&amp;gt;(&amp;amp;(sstBackupInterval&amp;lt;INTERVAL&amp;gt;=*)(sstIsActive=TRUE))&amp;lt;/code&amp;gt; for example for the daily rsnapshot the filter is &amp;lt;code&amp;gt;(&amp;amp;(sstBackupIntervalDaily=*)(sstIsActive=TRUE))&amp;lt;/code&amp;gt;&lt;br /&gt;
*** In other words this means: Get me all acounts that have for &amp;lt;code&amp;gt;sstBackupInterval&amp;lt;INTERVAL&amp;gt;&amp;lt;/code&amp;gt; a value defined AND &amp;lt;code&amp;gt;sstIsActive&amp;lt;/code&amp;gt; is set to &amp;quot;TRUE&amp;quot;&lt;br /&gt;
* According to the interval given and the account UID calculate the rsnapshot command for all these accounts&lt;br /&gt;
** For example&lt;br /&gt;
*** Account UID: 4000000 &lt;br /&gt;
*** Interval: daily&lt;br /&gt;
*** Resulting rsnapshot command: /usr/bin/nice -n 19 /usr/bin/rsnapshot  -c /etc/rsnapshot/rsnapshot.conf.4000000 daily (if you use the [[#snapshot.pl_Configuration | configuration]] below)&lt;br /&gt;
* Execute all these commands&lt;br /&gt;
** Use controlled parallel execution, you can specify how many commands can be executed in parallel (see [[#snapshot.pl_Configuration | configuration]] below)&lt;br /&gt;
* Pod documentation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    snapshot.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script gets all active online backup accounts from the LDAP backend&lt;br /&gt;
    for which the rsnapshot process for the given interval must be executed.&lt;br /&gt;
    According to these accounts and the given interval, the commands to be&lt;br /&gt;
    executed are generated and finally executed. The commands can be&lt;br /&gt;
    executed in parallel, however there is a limit defined in the&lt;br /&gt;
    configuration file which limits the amount of parallel running&lt;br /&gt;
    processes.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    ./snapshot.pl --interval interval [--debug] [--help]&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
    --interval/-i interval&lt;br /&gt;
        Specifies the rsnapshot interval (can be hourly, daily, weekly,&lt;br /&gt;
        monthly or yearly)&lt;br /&gt;
&lt;br /&gt;
    --debug/-d&lt;br /&gt;
        Turns on debug mode&lt;br /&gt;
&lt;br /&gt;
    --help/-h&lt;br /&gt;
        Shows this help&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2012-03-19 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2012-03-19 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporated code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Getopt::Long;&lt;br /&gt;
        Sys::Syslog;&lt;br /&gt;
        PerlUtil::Logging;&lt;br /&gt;
        PerlUtil::LDAPUtil;&lt;br /&gt;
        File::Basename;&lt;br /&gt;
        Parallel::ForkManager;&lt;br /&gt;
        Time::Stopwatch;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
There are two things to do in this step: &lt;br /&gt;
* Configure the rsnapshot root directory&lt;br /&gt;
* Configure the snapshot.pl script itself&lt;br /&gt;
&lt;br /&gt;
==== rsnaphot configuration directory ====&lt;br /&gt;
The users individual rsnapshot configurations are stored under &amp;lt;code&amp;gt;/etc/rsnapshot&amp;lt;/code&amp;gt;. Please make sure, that the directory exists:&lt;br /&gt;
 ls -al /etc | grep rsnapshot&lt;br /&gt;
&lt;br /&gt;
 drwx------  2 root   root      64 30. Aug 20:20 rsnapshot&lt;br /&gt;
&lt;br /&gt;
If not, create it:&lt;br /&gt;
 mkdir /etc/rsnapshot&lt;br /&gt;
 chmod 700 /etc/rsnapshot&lt;br /&gt;
&lt;br /&gt;
==== snapshot.pl Configuration ====&lt;br /&gt;
The snapshot.pl script is responsible for the execution of rsnapshot according to the users settings.&lt;br /&gt;
 /etc/backup-utils/snapshot.conf &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[General]&lt;br /&gt;
MaxParallelProcesses = 5&lt;br /&gt;
Rsnapshot_command = /usr/bin/nice -n 19 /usr/bin/rsnapshot  -c /etc/rsnapshot/rsnapshot.conf.%uid% %interval%&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
Host = ldaps://ldapm.tombstone.ch&lt;br /&gt;
Port = 636&lt;br /&gt;
User = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
Password = &amp;lt;Password&amp;gt;&lt;br /&gt;
CA_Path = /etc/ssl/certs&lt;br /&gt;
Accounts_Base = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Legend: At runtime the following placeholders are replaced as follows&lt;br /&gt;
* &#039;&#039;&#039;%uid%&#039;&#039;&#039;: The backup account and login uid as a numeric number. For example: 4000205.&lt;br /&gt;
* &#039;&#039;&#039;%interval%&#039;&#039;&#039;: The backup level to be executed. Possible values are hourly, daily, weekly, monthly and yearly.&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
Before adding the necessary cronjob entries, we need to make sure, that we&#039;ve configured the snapshot.pl script correctly:&lt;br /&gt;
 /usr/libexec/backup-utils/snapshot.pl --interval daily -d&lt;br /&gt;
&lt;br /&gt;
If everything worked as planned, you should receive feedback looking roughly like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INFO:  Starting rsnapshot for interval daily with maximum 5 parallel processes&lt;br /&gt;
&lt;br /&gt;
INFO:  Executing snapshot for 4000080&lt;br /&gt;
&lt;br /&gt;
INFO:  Executing snapshot for 4000079&lt;br /&gt;
&lt;br /&gt;
INFO:  Snapshot process for 4000079 finished in 0.18 seconds with status 0&lt;br /&gt;
&lt;br /&gt;
INFO:  Snapshot process for 4000080 finished in 0.19 seconds with status 0&lt;br /&gt;
&lt;br /&gt;
INFO:  rsnapshot for all backups done. Took 0.24 seconds&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Just to make sure, that everything did work out fine, execute &amp;lt;code&amp;gt;writeAccountSize.pl&amp;lt;/code&amp;gt; again:&lt;br /&gt;
 /usr/libexec/backup-utils/writeAccountSize.pl -U 4000080 -d&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Debug modus was turned on&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersHomeDirectory: $localUsersHomeDirectory: /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersHomeDirectory: The $localUsersHomeDirectory /var/backup/080/4000080/home/4000080 exists&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersHomeDirectory:   /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersIncomingDirectory: /incoming&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localIncomingPath:           /var/backup/080/4000080/home/4000080/incoming&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: The $localIncomingPath /var/backup/080/4000080/home/4000080/incoming exists&lt;br /&gt;
Total Quota: 1048576 kilobytes&lt;br /&gt;
Total used Space: 409600 kilobytes&lt;br /&gt;
Incoming Size: 204800 kilobytes&lt;br /&gt;
Debug sub getSnapshotsSize: $localUsedQuota:   409600&lt;br /&gt;
Debug sub getSnapshotsSize: $localSnapshotsSize:   204800&lt;br /&gt;
Debug writeAccountSize: Working on /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
Debug: wrote 1024 200 200 to /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstBackupSize =&amp;gt; 209715200&lt;br /&gt;
&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstIncrementSize =&amp;gt; 209715200&lt;br /&gt;
&lt;br /&gt;
Alert Threshold: 85 %&lt;br /&gt;
Calculated value: 39.0625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the total used space has risen to 39.0625.&lt;br /&gt;
&lt;br /&gt;
=== Cronjobs ===&lt;br /&gt;
After making sure, that everything worked as planned, you can update your crontab entry:&lt;br /&gt;
 crontab -e&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
# Rsnapshot for all users&lt;br /&gt;
30 22 * * * /usr/libexec/backup-utils/snapshot.pl --interval daily&lt;br /&gt;
15 22 * * sun /usr/libexec/backup-utils/snapshot.pl --interval weekly&lt;br /&gt;
00 22 1 * * /usr/libexec/backup-utils/snapshot.pl --interval monthly&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* TBD: Maybe this is not optimal if there is a lot of data to rotate. In this case, it might be that for example weekly and daily snapshot both run at the same time what might lead to strange results. &lt;br /&gt;
* Workarounds: &lt;br /&gt;
** Simple/short version: Instead one could create another wrapper script which is called everyday and does some simple logic:&lt;br /&gt;
** Is today the first day of a month? &lt;br /&gt;
*** Yes: Is today sunday? &lt;br /&gt;
**** Yes: Execute monthly then weekly then daily rsnapshots using the snapshot.pl script (but wait for each interval to finish before starting the next)&lt;br /&gt;
**** No: Execute monthly then daily rsnapshots using the snapshot.pl script (but wait for monthly interval to finish before starting the daily)&lt;br /&gt;
*** No: Is today sunday?&lt;br /&gt;
**** Yes: Execute weekly then daily rsnapshots using the snapshot.pl script (but wait for weekly interval to finish before starting the daily)&lt;br /&gt;
**** No: Execute daily rsnapshots using the snapshot.pl script&lt;br /&gt;
** Complex/long version: Adapt the snapshot.pl script and call it every day without interval parameter. The script does the logic described above.&lt;br /&gt;
This avoids the above mentioned collision&lt;br /&gt;
&lt;br /&gt;
(Complex) / short version: rule via cronjobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Rsnapshot for all users&lt;br /&gt;
30 22 * * 1-6 [ $( date +\%d ) -gt 1 ] &amp;amp;&amp;amp; /usr/libexec/backup-utils/snapshot.pl --interval daily&lt;br /&gt;
15 22 * * 7 [ $( date +\%d ) -gt 1 ] &amp;amp;&amp;amp; /usr/libexec/backup-utils/snapshot.pl --interval weekly &amp;amp;&amp;amp; /usr/libexec/backup-utils/snapshot.pl --interval daily&lt;br /&gt;
00 22 1 * * /usr/libexec/backup-utils/snapshot.pl --interval monthly &amp;amp;&amp;amp; /usr/libexec/backup-utils/snapshot.pl --interval weekly &amp;amp;&amp;amp; /usr/libexec/backup-utils/snapshot.pl --interval daily&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== scheduleWarning.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/scheduleWarning.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package and does the following:&lt;br /&gt;
* The basic task of this script is simple: For the given account&lt;br /&gt;
** Check if the planned backups were started&lt;br /&gt;
*** If not, start the [[stoney_cloud:_Notification_Architecture | notification]] process with&lt;br /&gt;
**** Product: Given account UID&lt;br /&gt;
**** Service: Backup&lt;br /&gt;
**** Problem: Schedule &lt;br /&gt;
** Check if the planned backups finished successfully&lt;br /&gt;
*** If not, start the [[stoney_cloud:_Notification_Architecture | notification]] process with&lt;br /&gt;
**** Product: Given account UID&lt;br /&gt;
**** Service: Backup&lt;br /&gt;
**** Problem: Unsuccessful&lt;br /&gt;
&lt;br /&gt;
As the backup clients distributed by stepping stone GmbH upload metadata XML before (scheduling information and start time) and after (end time and backup status) the actual backup, the scheduleWarning.pl script is able to verify whether or not a planned backup has been executed and whether or not the backup was successful. &lt;br /&gt;
&lt;br /&gt;
* Pod documentation&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    scheduleWarning.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script tests whether a planed backup was successful or not. There&lt;br /&gt;
    are two different typs of failure.&lt;br /&gt;
&lt;br /&gt;
    1. The Backup did not start&lt;br /&gt;
        The first type of error is that a backup is scheduled for YYYY-MM-DD&lt;br /&gt;
        at HH:MM, but the backup don&#039;t start at this specified time. A&lt;br /&gt;
        possible reason could be that the computer was shut down.&lt;br /&gt;
&lt;br /&gt;
    2.The backup was not successful&lt;br /&gt;
        The second type of error is that a backup started as scheduled but&lt;br /&gt;
        did not finish successfully. There are different reasons for this&lt;br /&gt;
        error.&lt;br /&gt;
&lt;br /&gt;
    If a backup wasn&#039;t successful the script checks which type of error&lt;br /&gt;
    occured. It reads the XML files which are stored on the server and&lt;br /&gt;
    compares the given information. If the error is detected, the script&lt;br /&gt;
    stats the norification process with the information of the error.&lt;br /&gt;
&lt;br /&gt;
    If a user has more than one computer backed-up, the script tests one&lt;br /&gt;
    computer after the other. The mail(s) sent by the programm also&lt;br /&gt;
    contain(s) the information which computer is affected.&lt;br /&gt;
&lt;br /&gt;
OPTION&lt;br /&gt;
    -U uid&lt;br /&gt;
        The -U option is required to run the script, it indicates for which&lt;br /&gt;
        uid the script is executed.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    scheduleWarning.pl [-U user]&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2010-04-14 created Pat Kläy &amp;lt;pat.klaey@stepping-stone.ch&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2010-04-14 v0.01, created pkl&lt;br /&gt;
    2010-08-24 v0.02, modified pkl&lt;br /&gt;
        New using Net::SMTP::TLS to send mails&lt;br /&gt;
&lt;br /&gt;
    2013-09-13 v0.03, modified pat.klaey@stepping-stone.ch&lt;br /&gt;
        Changes to use the script with the new backup infrastructure (read&lt;br /&gt;
        more information from LDAP, use Notification lib to send mails)&lt;br /&gt;
&lt;br /&gt;
USES&lt;br /&gt;
    strict;&lt;br /&gt;
    warnings;&lt;br /&gt;
    XML::Simple;&lt;br /&gt;
    Config::IniFiles;&lt;br /&gt;
    XML::Validator::Schema;&lt;br /&gt;
    Date::Calc qw(:all);&lt;br /&gt;
    Date::Manip;&lt;br /&gt;
    Schedule::Cron::Events;&lt;br /&gt;
    DateTime::Format::Strptime;&lt;br /&gt;
    Sys::Syslog;&lt;br /&gt;
    XML::SAX::ParserFactory;&lt;br /&gt;
    Getopt::Std;&lt;br /&gt;
    MIME::Base64;&lt;br /&gt;
    Authen::SASL;&lt;br /&gt;
    Net::LDAPS;&lt;br /&gt;
    Net::SMTP::TLS;&lt;br /&gt;
    Cwd &#039;abs_path&#039;;&lt;br /&gt;
    PerlUtil::Logging;&lt;br /&gt;
    PerlUtil::LDAPUtil;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 /etc/backup-utils/scheduleWarning.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Backup]&lt;br /&gt;
CHROOT_DIRECTORY = /var/backup/%lastthree%/%user%&lt;br /&gt;
&lt;br /&gt;
[XML]&lt;br /&gt;
SCHEDULE_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/scheduler.xml&lt;br /&gt;
SCHEDULE_XSD = /etc/backup-utils/schema/scheduler_schema.xsd&lt;br /&gt;
BACKUP_ENDED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupEnded.xml&lt;br /&gt;
BACKUP_ENDED_XSD = /etc/backup-utils/schema/backupended_schema.xsd&lt;br /&gt;
BACKUP_STARTED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupStarted.xml&lt;br /&gt;
BACKUP_STARTED_XSD = /etc/backup-utils/schema/backupstarted_schema.xsd&lt;br /&gt;
&lt;br /&gt;
[TEMPLATE]&lt;br /&gt;
Salutation_Default_de-CH = Liebe Kundin / Lieber Kunde&lt;br /&gt;
Salutation_m_de-CH = Sehr geehrter Herr&lt;br /&gt;
Salutation_f_de-CH = Sehr geehrte Frau&lt;br /&gt;
Salutation_Default_en-GB = Dear customer&lt;br /&gt;
Salutation_m_en-GB = Dear Mr.&lt;br /&gt;
Salutation_f_en-GB = Dear Mrs.&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
&lt;br /&gt;
SERVER = ldaps://ldapm.tombstone.ch&lt;br /&gt;
PORT = 636&lt;br /&gt;
DEBUG = 1&lt;br /&gt;
&lt;br /&gt;
ADMIN_DN = cn=Manager,dc=stoney-cloud,dc=org &lt;br /&gt;
ADMIN_PASSWORD = &amp;lt;Password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
BACKUP_BASE = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
PEOPLE_BASE = ou=people,dc=stoney-cloud,dc=org&lt;br /&gt;
RESELLER_BASE = ou=reseller,ou=configuration,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
SCOPE = sub&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== checkBackups.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/writeDate.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package. It is a wrapper around the above mentioned &amp;lt;code&amp;gt;writeAccountSize.pl&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scheduleWarning.pl&amp;lt;/code&amp;gt; scripts (if you configure it accordingly).&lt;br /&gt;
* As mentioned the script is a wrapper for calling the quota and scheduler information scripts:&lt;br /&gt;
** It gets all active backup accounts from the LDAP directory&lt;br /&gt;
** According to the CLI parameters passed it calles for all these accounts:&lt;br /&gt;
*** The quota checking script (this script can be defined in the configuration file, see [[stoney_backup:_Server_set-up#Configuration_6 | configuration]] section below)&lt;br /&gt;
*** The scheduler checking script (this script can be defined in the configuration file, see [[stoney_backup:_Server_set-up#Configuration_6 | configuration]] section below)&lt;br /&gt;
* Pod documentation: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    checkBackups.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script processes all active backup accounts and checks (according&lt;br /&gt;
    to the command line options) the quota and/or the scheduled backups for&lt;br /&gt;
    the given accounts.&lt;br /&gt;
&lt;br /&gt;
    The script uses syslog for logging purposes.&lt;br /&gt;
&lt;br /&gt;
    Command Line Interface (CLI) parameters:&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
    --schedule/-s&lt;br /&gt;
        Checks schedule information by calling the defined script&lt;br /&gt;
&lt;br /&gt;
    --quota/-s&lt;br /&gt;
        Checks the quota values by calling the defined script&lt;br /&gt;
&lt;br /&gt;
    --notify/-n&lt;br /&gt;
        Passes the notify flag to the called scripts&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    ./checkBackups.pl [--quota] [--schedule] [--notify]&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --quota&lt;br /&gt;
        Checks and writes the quota for all active backup accounts. The user&lt;br /&gt;
        and/or reseller will NOT be informed if any quota threshold is&lt;br /&gt;
        reached&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --quota --notify&lt;br /&gt;
        Checks and writes the quota for all active backup accounts. The user&lt;br /&gt;
        and/or reseller will be informed if any quota threshold is reached.&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --schedule&lt;br /&gt;
        Checkes all active backup account if the scheduled backup was&lt;br /&gt;
        executed and successful. The --schedule option will allways trigger&lt;br /&gt;
        a notification mail to the user and/or reseller.&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --schedule --quota&lt;br /&gt;
        Checks both, quota and schedule, for all active backup accounts.&lt;br /&gt;
        Only schedule will trigger notification mails.&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --schedule --quota --notify&lt;br /&gt;
        Checks both, quota and schedule, for all active backup accounts.&lt;br /&gt;
        Both, quota and schedule, will trigger notification mails.&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2013-09-17 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2013-09-17 pat.klaey@stepping-stone.ch created&lt;br /&gt;
    2013-11-19 pat.klaey@stepping-stone.ch Added options to be able to check&lt;br /&gt;
    quota, schedule or both in one run&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporated code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Getopt::Long;&lt;br /&gt;
        Sys::Syslog;&lt;br /&gt;
        Cwd &#039;abs_path&#039;;&lt;br /&gt;
        File::Basename;&lt;br /&gt;
        PerlUtil::LDAPUtil;&lt;br /&gt;
        PerlUtil::Logging;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
In the configuration you have to define two simple things: &lt;br /&gt;
# Which script to call for quota checks and scheduler checks&lt;br /&gt;
# How to access the LDAP backend&lt;br /&gt;
 /etc/backup-utils/checkBackups.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Scripts]&lt;br /&gt;
CheckQuotaScript = /usr/libexec/backup-utils/writeAccountSize.pl&lt;br /&gt;
CheckScheduleScript = /usr/libexec/backup-utils/scheduleWarning.pl&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
Server = ldaps://ldapm.tombstone.ch&lt;br /&gt;
Port = 636&lt;br /&gt;
Username = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
Password = &amp;lt;PASSWORD&amp;gt;&lt;br /&gt;
AccountBase = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Cronjobs ====&lt;br /&gt;
As you can pass the notification flag to the scripts, you can call the quota script say all 10 minutes. This makes sense if followed the configuration section, as the writeAccountSize.pl script writes the quota values to the LDAP backend which will then be visible in the selfcare webinterface. Like that you have a more or less up to date quota representation in the selfcare webinterface. On the other side, you don&#039;t want to send notification mails to the user every 10 minutes. It might be enough to send them once a day, so the cronjobs may look like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Check backups&lt;br /&gt;
15 12 * * * /usr/libexec/backup-utils/checkBackups.pl --schedule --quota --notify&lt;br /&gt;
&lt;br /&gt;
# Write quota values every 10 minutes&lt;br /&gt;
*/10 * * * * /usr/libexec/backup-utils/checkBackups.pl --quota&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ResellerBackupBilling.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/writeDate.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package. The pod documentation says all what needs to be said about this script.&lt;br /&gt;
* Pod documentation&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    ResellerBackupBilling.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script processes the reseller with the passed UID and creates a&lt;br /&gt;
    very simplistic backup-billing overview which then is sent to the&lt;br /&gt;
    address specified in the configuration file. The billing overview&lt;br /&gt;
    contains all backup accounts which belong to the given reseller as well&lt;br /&gt;
    as their quota. According to the billing plan specified in the&lt;br /&gt;
    configuration file, the script also calculates the price for each backup&lt;br /&gt;
    account.&lt;br /&gt;
&lt;br /&gt;
    The script uses syslog for logging purposes.&lt;br /&gt;
&lt;br /&gt;
    Command Line Interface (CLI) parameters:&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
    --reseller/-r UID&lt;br /&gt;
        Process the reseller with this UID&lt;br /&gt;
&lt;br /&gt;
    --debug/-d&lt;br /&gt;
        Turn on debug mode&lt;br /&gt;
&lt;br /&gt;
    --help/-h&lt;br /&gt;
        Display this help&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    ./ResellerBackupBilling.pl --reseller UID [--debug] [--help]&lt;br /&gt;
&lt;br /&gt;
    ./ResellerBackupBilling.pl --reseller 2000000&lt;br /&gt;
        This processes the reseller with the UID 200000 and sends the&lt;br /&gt;
        billing overview to the address specified in the configuration file&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2014-01-24 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2014-01-24 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporated code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Getopt::Long;&lt;br /&gt;
        PerlUtil::LDAPUtil;&lt;br /&gt;
        PerlUtil::Logging;&lt;br /&gt;
        PerlUtil::Mail;&lt;br /&gt;
        Number::Format;&lt;br /&gt;
        File::Basename;&lt;br /&gt;
        Cwd &#039;abs_path&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
&lt;br /&gt;
== writeDate.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/writeDate.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package. This is a very simple script, it simply writes the current date and time to a file on the backup server before the rsnapshots rotates the backup. This date is used by the Sepiola Online Backup Client to display the iterations and their dates.&lt;br /&gt;
* Pod documentation: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    writeDate.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script writes the current date and time into the file for each&lt;br /&gt;
    backup before the rsnapshots rotates the backup. This information is&lt;br /&gt;
    used by the Sepiola Online Backup Client.&lt;br /&gt;
&lt;br /&gt;
    The configuration file for this script is stored under&lt;br /&gt;
    /etc/backup-utils/writeDate.conf&lt;br /&gt;
&lt;br /&gt;
    The script uses syslog for logging purposes.&lt;br /&gt;
&lt;br /&gt;
    Command Line Interface (CLI) parameters:&lt;br /&gt;
&lt;br /&gt;
    -C configfile&lt;br /&gt;
        The configuration file.&lt;br /&gt;
&lt;br /&gt;
    -U uid&lt;br /&gt;
        The user id.&lt;br /&gt;
&lt;br /&gt;
    -d debug&lt;br /&gt;
        Turns the debug mode on.&lt;br /&gt;
&lt;br /&gt;
    -h help&lt;br /&gt;
        This online help.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    writeDate.pl [-C configuration_file] [-U uid] [-d debug] [-h help]&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2007-09-16 michael.eichenberger@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2013-09-01 michael.eichenberger@stepping-stone.ch updated to reflect&lt;br /&gt;
    changes in the new backup environment&lt;br /&gt;
&lt;br /&gt;
        2007-09-16 michael.eichenberger@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporate code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Config::IniFiles;&lt;br /&gt;
        Getopt::Std;&lt;br /&gt;
        Sys::Syslog;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 /etc/backup-utils/writeDate.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Global]&lt;br /&gt;
BACKUP_DIRECTORY = /incoming&lt;br /&gt;
BACKUP_BACKUP_TIME_FILE = /.sepiola_backup/backupTime&lt;br /&gt;
&lt;br /&gt;
[Syslog]&lt;br /&gt;
SYSLOG = rsnapshot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== rsnapshot wrapper bash scripts ==&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* [http://www.openldap.org/ OpenLDAP], an open source implementation of the Lightweight Directory Access Protocol.&lt;br /&gt;
* [http://arthurdejong.org/nss-pam-ldapd/ nss-pam-ldapd], a Name Service Switch (NSS) module that allows your LDAP server to provide user account, group, host name, alias, netgroup, and basically any other information that you would normally get from /etc flat files or NIS.&lt;br /&gt;
* [http://www.gentoo.org/doc/de/ldap-howto.xml Gentoo Leitfaden zur OpenLDAP Authentifikation].&lt;br /&gt;
* [http://wiki.gentoo.org/wiki/Centralized_authentication_using_OpenLDAP Centralized authentication using OpenLDAP].&lt;br /&gt;
* [https://code.google.com/p/openssh-lpk/source/browse/trunk/schemas/openssh-lpk_openldap.schema openssh-lpk_openldap.schema] OpenSSH LDAP Public Keys.&lt;br /&gt;
* [http://sourceforge.net/projects/linuxquota/ linuxquota] Linux DiskQuota.&lt;br /&gt;
* [http://www.rsnapshot.org/ rsnapshot], a remote filesystem snapshot utility, based on rsync.&lt;br /&gt;
* [http://olivier.sessink.nl/jailkit/ Jailkit], set of utilities to limit user accounts to specific files using chroot() and or specific commands. Also includes a tool to build a chroot environment.&lt;br /&gt;
* [http://www.busybox.net/ Busybox] BusyBox combines tiny versions of many common UNIX utilities into a single small executable. Useful to reduce the number of files (and thus the complexity) when building a chroot. &lt;br /&gt;
&lt;br /&gt;
[[Category:stoney backup]]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=stoney_backup:_Server_set-up&amp;diff=3669</id>
		<title>stoney backup: Server set-up</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=stoney_backup:_Server_set-up&amp;diff=3669"/>
		<updated>2014-06-13T13:50:28Z</updated>

		<summary type="html">&lt;p&gt;David: /* Cronjobs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Abstract =&lt;br /&gt;
This document describes server setup for the stoney cloud (Online) Backup service, built upon the [http://www.gentoo.org/ Gentoo] Linux distribution.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
After working through this documentation, you will be able to set up and configure your own (Online) Backup service server.&lt;br /&gt;
&lt;br /&gt;
= Software Installation =&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
A working stoney cloud, installed according to [[stoney cloud: Single-Node Installation]] or [[stoney cloud: Multi-Node Installation]].&lt;br /&gt;
&lt;br /&gt;
== Keywords &amp;amp; USE-Flags ==&lt;br /&gt;
For a minimal OpenLDAP directory installation:&lt;br /&gt;
 echo &amp;quot;net-nds/openldap minimal sasl&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
 echo &amp;quot;net-nds/openldap ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
NSS and PAM modules for lookups using LDAP:&lt;br /&gt;
 echo &amp;quot;sys-auth/nss-pam-ldapd sasl&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
 echo &amp;quot;sys-auth/nss-pam-ldapd ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;sys-fs/quota ldap&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;=app-admin/jailkit-2.16 ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
For the prov-backup-rsnapshot daemon:&lt;br /&gt;
 echo &amp;quot;dev-perl/Net-SMTPS ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;perl-core/Switch ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
To build puttygen only without X11:&lt;br /&gt;
 echo &amp;quot;net-misc/putty ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;net-misc/putty -gtk&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&lt;br /&gt;
== Emerge ==&lt;br /&gt;
 emerge -va nss-pam-ldapd \&lt;br /&gt;
            quota \&lt;br /&gt;
            net-misc/putty \&lt;br /&gt;
            app-admin/jailkit \&lt;br /&gt;
            sys-apps/haveged \&lt;br /&gt;
            net-misc/putty \&lt;br /&gt;
            sys-apps/sst-backup-utils \&lt;br /&gt;
            sys-apps/sst-prov-backup-rsnapshot&lt;br /&gt;
&lt;br /&gt;
To list the dependencies of ebuilds, you can use &amp;lt;code&amp;gt;equery&amp;lt;/code&amp;gt;:&lt;br /&gt;
 equery depgraph sst-backup-utils&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * Searching for sst-backup-utils ...&lt;br /&gt;
&lt;br /&gt;
 * dependency graph for sys-apps/sst-backup-utils-0.1.0&lt;br /&gt;
 `--  sys-apps/sst-backup-utils-0.1.0  amd64 &lt;br /&gt;
   `--  dev-perl/PerlUtil-0.1.0  (&amp;gt;=dev-perl/PerlUtil-0.1.0) amd64 &lt;br /&gt;
   `--  virtual/perl-Sys-Syslog-0.320.0  (virtual/perl-Sys-Syslog) amd64 &lt;br /&gt;
   `--  dev-perl/perl-ldap-0.530.0  (dev-perl/perl-ldap) amd64 &lt;br /&gt;
   `--  dev-perl/XML-Simple-2.200.0  (dev-perl/XML-Simple) amd64 &lt;br /&gt;
   `--  dev-perl/Config-IniFiles-2.780.0  (dev-perl/Config-IniFiles) amd64 &lt;br /&gt;
   `--  dev-perl/XML-Validator-Schema-1.100.0  (dev-perl/XML-Validator-Schema) amd64 &lt;br /&gt;
   `--  dev-perl/Date-Calc-6.300.0  (dev-perl/Date-Calc) amd64 &lt;br /&gt;
   `--  dev-perl/DateManip-6.310.0  (dev-perl/DateManip) amd64 &lt;br /&gt;
   `--  dev-perl/Schedule-Cron-Events-1.930.0  (dev-perl/Schedule-Cron-Events) amd64 &lt;br /&gt;
   `--  dev-perl/DateTime-Format-Strptime-1.520.0  (dev-perl/DateTime-Format-Strptime) amd64 &lt;br /&gt;
   `--  dev-perl/XML-SAX-0.990.0  (dev-perl/XML-SAX) amd64 &lt;br /&gt;
   `--  virtual/perl-MIME-Base64-3.130.0-r2  (virtual/perl-MIME-Base64) amd64 &lt;br /&gt;
   `--  dev-perl/Authen-SASL-2.160.0  (dev-perl/Authen-SASL) amd64 &lt;br /&gt;
   `--  dev-perl/Net-SMTPS-0.30.0  (dev-perl/Net-SMTPS) ~amd64 &lt;br /&gt;
   `--  dev-perl/text-template-1.450.0  (dev-perl/text-template) amd64 &lt;br /&gt;
   `--  virtual/perl-Getopt-Long-2.380.0-r2  (virtual/perl-Getopt-Long) amd64 &lt;br /&gt;
   `--  dev-perl/Parallel-ForkManager-1.20.0  (dev-perl/Parallel-ForkManager) amd64 &lt;br /&gt;
   `--  dev-perl/Time-Stopwatch-1.0.0  (dev-perl/Time-Stopwatch) amd64 &lt;br /&gt;
   `--  app-backup/rsnapshot-1.3.1-r1  (app-backup/rsnapshot) amd64 &lt;br /&gt;
[ sys-apps/sst-backup-utils-0.1.0 stats: packages (20), max depth (1) ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more information, visit the [http://www.gentoo.org/doc/en/gentoolkit.xml Gentoolkit] page.&lt;br /&gt;
&lt;br /&gt;
= Base Server Software Configuration =&lt;br /&gt;
== OpenSSH ==&lt;br /&gt;
=== OpenSSH Configuration ===&lt;br /&gt;
Configure the OpenSSH daemon:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vi /etc/ssh/sshd_config&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set following options:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
PubkeyAuthentication yes&lt;br /&gt;
PasswordAuthentication yes&lt;br /&gt;
UsePAM yes&lt;br /&gt;
Subsystem     sftp   internal-sftp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure, that &amp;lt;code&amp;gt;Subsystem     sftp   internal-sftp&amp;lt;/code&amp;gt; is the last line in the configuration file.&lt;br /&gt;
&lt;br /&gt;
We want to reduce the numbers of chroot environments in one folder. As the &amp;lt;code&amp;gt;ChrootDirectory&amp;lt;/code&amp;gt; configuration option only allows &amp;lt;code&amp;gt;%h&amp;lt;/code&amp;gt; (home directory of the user) and &amp;lt;code&amp;gt;%u&amp;lt;/code&amp;gt; (username of the user), we need to create the necessary matching rules in the form of:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Match User *000&lt;br /&gt;
  ChrootDirectory /var/backup/000/%u&lt;br /&gt;
  AuthorizedKeysFile /var/backup/000/%u/%h/.ssh/authorized_keys&lt;br /&gt;
Match&lt;br /&gt;
Match User *001&lt;br /&gt;
  ChrootDirectory /var/backup/001/%u&lt;br /&gt;
  AuthorizedKeysFile /var/backup/001/%u/%h/.ssh/authorized_keys&lt;br /&gt;
Match&lt;br /&gt;
...&lt;br /&gt;
Match User *999&lt;br /&gt;
  ChrootDirectory /var/backup/999/%u&lt;br /&gt;
  AuthorizedKeysFile /var/backup/999/%u/%h/.ssh/authorized_keys&lt;br /&gt;
Match&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The creation of the matching rules is done by executing the following bash commands:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
FILE=/etc/ssh/sshd_config;&lt;br /&gt;
&lt;br /&gt;
for x in {0..999} ; do \&lt;br /&gt;
  printf &amp;quot;Match User *%03d\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;  ChrootDirectory /var/backup/%03d/%%u\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;  AuthorizedKeysFile /var/backup/%03d/%%u/%%h/.ssh/authorized_keys\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;Match\n&amp;quot; &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to restart the OpenSSH daemon:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/etc/init.d/sshd restart&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSSH Host Keys ===&lt;br /&gt;
If you migrate from a existing backup server, you might want to copy the ssh host keys to the new server. If you do so clients want see a difference between the two hosts as the fingerprint remains the same. Copy the following files from the existing host to the new:&lt;br /&gt;
* /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_ecdsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_key&lt;br /&gt;
* /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_dsa_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_ecdsa_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_rsa_key.pub&lt;br /&gt;
&lt;br /&gt;
Set the correct permissions on the new host:&lt;br /&gt;
 chmod 600 /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_key /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
 chmod 644 /etc/ssh/*.pub&lt;br /&gt;
&lt;br /&gt;
And restart the ssh daemon. &#039;&#039;Caution&#039;&#039;: do not close your existing ssh session as long as you are not sure the ssh daemon has restarted properly and you can login again.&lt;br /&gt;
 /etc/init.d/sshd restart&lt;br /&gt;
&lt;br /&gt;
== OpenLDAP ==&lt;br /&gt;
=== /etc/hosts ===&lt;br /&gt;
Update the &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt; with the LDAP server:&lt;br /&gt;
 /etc/hosts&lt;br /&gt;
&lt;br /&gt;
 # VIP of the LDAP Server&lt;br /&gt;
 31.216.40.4      ldapm.stoney-cloud.org&lt;br /&gt;
&lt;br /&gt;
=== Root CA Certificate Installation ===&lt;br /&gt;
Install the root CA certificate into the OpenSSL default certificate storage directory:&lt;br /&gt;
 fqdn=&amp;quot;cloud.stoney-cloud.org&amp;quot;    # The fully qualified domain name of the server containing the root certificate.&lt;br /&gt;
 &lt;br /&gt;
 cd /etc/ssl/certs/&lt;br /&gt;
 wget --no-check-certificate https://${fqdn}/ca/FOSS-Cloud_CA.cert.pem&lt;br /&gt;
 chown root:root /etc/ssl/certs/FOSS-Cloud_CA.cert.pem&lt;br /&gt;
 chmod 444 /etc/ssl/certs/FOSS-Cloud_CA.cert.pem&lt;br /&gt;
&lt;br /&gt;
Rebuild the CA hashes&lt;br /&gt;
 c_rehash /etc/ssl/certs/&lt;br /&gt;
&lt;br /&gt;
=== /etc/openldap/ldap.conf ===&lt;br /&gt;
Update the &amp;lt;code&amp;gt;/etc/openldap/ldap.conf&amp;lt;/code&amp;gt;LDAP configuration file/environment variables:&lt;br /&gt;
 /etc/openldap/ldap.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Used to specify a size limit to use when performing searches. The number should be an&lt;br /&gt;
# non-negative integer. SIZELIMIT of zero (0) specifies unlimited search size.&lt;br /&gt;
SIZELIMIT       20000&lt;br /&gt;
&lt;br /&gt;
# Used to specify a time limit to use when performing searches. The number should be an&lt;br /&gt;
# non-negative integer. TIMELIMIT of zero (0) specifies unlimited search time to be used.&lt;br /&gt;
TIMELIMIT       45&lt;br /&gt;
&lt;br /&gt;
# Specify how aliases dereferencing is done. DEREF should be set to one of never, always, search,&lt;br /&gt;
# or find to specify that aliases are never dereferenced, always dereferenced, dereferenced when&lt;br /&gt;
# searching, or dereferenced only when locating the base object for the search. The default is to&lt;br /&gt;
# never dereference aliases.&lt;br /&gt;
DEREF           never&lt;br /&gt;
&lt;br /&gt;
# Specifies the URI(s) of an LDAP server(s) to which the LDAP library should connect. The URI&lt;br /&gt;
# scheme may be either ldapor ldaps which refer to LDAP over TCP and LDAP over SSL (TLS)&lt;br /&gt;
# respectively. Each server&#039;s name can be specified as a domain- style name or an IP address&lt;br /&gt;
# literal. Optionally, the server&#039;s name can followed by a &#039;:&#039; and the port number the LDAP&lt;br /&gt;
# server is listening on. If no port number is provided, the default port for the scheme is&lt;br /&gt;
# used (389 for ldap://, 636 for ldaps://). A space separated list of URIs may be provided.&lt;br /&gt;
URI             ldaps://ldapm.stoney-cloud.org&lt;br /&gt;
&lt;br /&gt;
# Used to specify the default base DN to use when performing ldap operations. The base must be&lt;br /&gt;
# specified as a Distinguished Name in LDAP format.&lt;br /&gt;
BASE            dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# This is a local copy of the certificate of the certificate authority&lt;br /&gt;
# used to sign the server certificate for the LDAP server I am using&lt;br /&gt;
TLS_CACERT      /etc/ssl/certs/FOSS-Cloud_CA.cert.pem&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check you configuration by doing a search:&lt;br /&gt;
 ldapsearch -v -H &amp;quot;ldaps://ldapm.stoney-cloud.org&amp;quot; \&lt;br /&gt;
               -b &amp;quot;dc=stoney-cloud,dc=org&amp;quot; \&lt;br /&gt;
               -D &amp;quot;cn=Manager,dc=stoney-cloud,dc=org&amp;quot; \&lt;br /&gt;
               -s one &amp;quot;(objectClass=*)&amp;quot; \&lt;br /&gt;
               -LLL -W&lt;br /&gt;
&lt;br /&gt;
The result should look something like:&lt;br /&gt;
 ldap_initialize( ldaps://ldapm.stoney-cloud.org:636/??base )&lt;br /&gt;
 filter: (objectClass=*)&lt;br /&gt;
 requesting: All userApplication attributes&lt;br /&gt;
 dn: ou=administration,dc=stoney-cloud,dc=org&lt;br /&gt;
 objectClass: top&lt;br /&gt;
 objectClass: organizationalUnit&lt;br /&gt;
 ou: administration&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
== Random Number Generator (haveged) ==&lt;br /&gt;
Tools like putty are dependent on random numbers to be able to create certificates.&lt;br /&gt;
&lt;br /&gt;
=== haveged - Generate random numbers and feed linux random device ===&lt;br /&gt;
The haveged daemon doesn&#039;t need any special configuration, therefore you can start it from the command line interface:&lt;br /&gt;
 /etc/init.d/haveged start&lt;br /&gt;
&lt;br /&gt;
Check, if the start was successful:&lt;br /&gt;
 ps auxf | grep haveged&lt;br /&gt;
&lt;br /&gt;
 root     18001  1.0  0.0   7420  3616 ?        Ss   08:48   0:00 /usr/sbin/haveged -r 0 -w 1024 -v 1&lt;br /&gt;
&lt;br /&gt;
Add the haveged daemon to the default run level:&lt;br /&gt;
 rc-update add haveged default&lt;br /&gt;
&lt;br /&gt;
== nss-pam-ldapd ==&lt;br /&gt;
=== nslcd.conf — configuration file for LDAP nameservice daemon ===&lt;br /&gt;
 /etc/nslcd.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is the configuration file for the LDAP nameservice&lt;br /&gt;
# switch library&#039;s nslcd daemon. It configures the mapping&lt;br /&gt;
# between NSS names (see /etc/nsswitch.conf) and LDAP&lt;br /&gt;
# information in the directory.&lt;br /&gt;
# See the manual page nslcd.conf(5) for more information.&lt;br /&gt;
&lt;br /&gt;
# The user and group nslcd should run as.&lt;br /&gt;
uid nslcd&lt;br /&gt;
gid nslcd&lt;br /&gt;
&lt;br /&gt;
# The uri pointing to the LDAP server to use for name lookups.&lt;br /&gt;
# Multiple entries may be specified. The address that is used&lt;br /&gt;
# here should be resolvable without using LDAP (obviously).&lt;br /&gt;
#uri ldap://127.0.0.1/&lt;br /&gt;
#uri ldaps://127.0.0.1/&lt;br /&gt;
#uri ldapi://%2fvar%2frun%2fldapi_sock/&lt;br /&gt;
# Note: %2f encodes the &#039;/&#039; used as directory separator&lt;br /&gt;
uri ldaps://ldapm.tombstone.ch&lt;br /&gt;
&lt;br /&gt;
# The LDAP version to use (defaults to 3&lt;br /&gt;
# if supported by client library)&lt;br /&gt;
#ldap_version 3&lt;br /&gt;
&lt;br /&gt;
# The distinguished name of the search base.&lt;br /&gt;
base dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# The distinguished name to bind to the server with.&lt;br /&gt;
# Optional: default is to bind anonymously.&lt;br /&gt;
binddn cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# The credentials to bind with.&lt;br /&gt;
# Optional: default is no credentials.&lt;br /&gt;
# Note that if you set a bindpw you should check the permissions of this file.&lt;br /&gt;
bindpw myverysecretpassword&lt;br /&gt;
&lt;br /&gt;
# The distinguished name to perform password modifications by root by.&lt;br /&gt;
#rootpwmoddn cn=admin,dc=example,dc=com&lt;br /&gt;
&lt;br /&gt;
# The default search scope.&lt;br /&gt;
#scope sub&lt;br /&gt;
#scope one&lt;br /&gt;
#scope base&lt;br /&gt;
&lt;br /&gt;
# Customize certain database lookups.&lt;br /&gt;
#base   group  ou=Groups,dc=example,dc=com&lt;br /&gt;
base   group  ou=groups,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
base   passwd ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
base   shadow ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
#scope  group  onelevel&lt;br /&gt;
#scope  hosts  sub&lt;br /&gt;
&lt;br /&gt;
#filter group  (&amp;amp;(objectClass=posixGroup)(sstIsActive=TRUE))&lt;br /&gt;
filter passwd (&amp;amp;(objectClass=posixAccount)(sstIsActive=TRUE))&lt;br /&gt;
filter shadow (&amp;amp;(objectClass=shadowAccount)(sstIsActive=TRUE))&lt;br /&gt;
&lt;br /&gt;
# Bind/connect timelimit.&lt;br /&gt;
#bind_timelimit 30&lt;br /&gt;
&lt;br /&gt;
# Search timelimit.&lt;br /&gt;
#timelimit 30&lt;br /&gt;
&lt;br /&gt;
# Idle timelimit. nslcd will close connections if the&lt;br /&gt;
# server has not been contacted for the number of seconds.&lt;br /&gt;
#idle_timelimit 3600&lt;br /&gt;
&lt;br /&gt;
# Use StartTLS without verifying the server certificate.&lt;br /&gt;
#ssl start_tls&lt;br /&gt;
tls_reqcert never&lt;br /&gt;
&lt;br /&gt;
# CA certificates for server certificate verification&lt;br /&gt;
#tls_cacertdir /etc/ssl/certs&lt;br /&gt;
#tls_cacertfile /etc/ssl/ca.cert&lt;br /&gt;
&lt;br /&gt;
# Seed the PRNG if /dev/urandom is not provided&lt;br /&gt;
#tls_randfile /var/run/egd-pool&lt;br /&gt;
&lt;br /&gt;
# SSL cipher suite&lt;br /&gt;
# See man ciphers for syntax&lt;br /&gt;
#tls_ciphers TLSv1&lt;br /&gt;
&lt;br /&gt;
# Client certificate and key&lt;br /&gt;
# Use these, if your server requires client authentication.&lt;br /&gt;
#tls_cert&lt;br /&gt;
#tls_key&lt;br /&gt;
&lt;br /&gt;
# Mappings for Services for UNIX 3.5&lt;br /&gt;
#filter passwd (objectClass=User)&lt;br /&gt;
#map    passwd uid              msSFU30Name&lt;br /&gt;
#map    passwd userPassword     msSFU30Password&lt;br /&gt;
#map    passwd homeDirectory    msSFU30HomeDirectory&lt;br /&gt;
#map    passwd homeDirectory    msSFUHomeDirectory&lt;br /&gt;
#filter shadow (objectClass=User)&lt;br /&gt;
#map    shadow uid              msSFU30Name&lt;br /&gt;
#map    shadow userPassword     msSFU30Password&lt;br /&gt;
#filter group  (objectClass=Group)&lt;br /&gt;
#map    group  member           msSFU30PosixMember&lt;br /&gt;
&lt;br /&gt;
# Mappings for Services for UNIX 2.0&lt;br /&gt;
#filter passwd (objectClass=User)&lt;br /&gt;
#map    passwd uid              msSFUName&lt;br /&gt;
#map    passwd userPassword     msSFUPassword&lt;br /&gt;
#map    passwd homeDirectory    msSFUHomeDirectory&lt;br /&gt;
#map    passwd gecos            msSFUName&lt;br /&gt;
#filter shadow (objectClass=User)&lt;br /&gt;
#map    shadow uid              msSFUName&lt;br /&gt;
#map    shadow userPassword     msSFUPassword&lt;br /&gt;
#map    shadow shadowLastChange pwdLastSet&lt;br /&gt;
#filter group  (objectClass=Group)&lt;br /&gt;
#map    group  member           posixMember&lt;br /&gt;
&lt;br /&gt;
# Mappings for Active Directory&lt;br /&gt;
#pagesize 1000&lt;br /&gt;
#referrals off&lt;br /&gt;
#idle_timelimit 800&lt;br /&gt;
#filter passwd (&amp;amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))&lt;br /&gt;
#map    passwd uid              sAMAccountName&lt;br /&gt;
#map    passwd homeDirectory    unixHomeDirectory&lt;br /&gt;
#map    passwd gecos            displayName&lt;br /&gt;
#filter shadow (&amp;amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))&lt;br /&gt;
#map    shadow uid              sAMAccountName&lt;br /&gt;
#map    shadow shadowLastChange pwdLastSet&lt;br /&gt;
#filter group  (objectClass=group)&lt;br /&gt;
&lt;br /&gt;
# Alternative mappings for Active Directory&lt;br /&gt;
# (replace the SIDs in the objectSid mappings with the value for your domain)&lt;br /&gt;
#pagesize 1000&lt;br /&gt;
#referrals off&lt;br /&gt;
#idle_timelimit 800&lt;br /&gt;
#filter passwd (&amp;amp;(objectClass=user)(objectClass=person)(!(objectClass=computer)))&lt;br /&gt;
#map    passwd uid           cn&lt;br /&gt;
#map    passwd uidNumber     objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
#map    passwd gidNumber     objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
#map    passwd homeDirectory &amp;quot;/home/$cn&amp;quot;&lt;br /&gt;
#map    passwd gecos         displayName&lt;br /&gt;
#map    passwd loginShell    &amp;quot;/bin/bash&amp;quot;&lt;br /&gt;
#filter group (|(objectClass=group)(objectClass=person))&lt;br /&gt;
#map    group gidNumber      objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
&lt;br /&gt;
# Mappings for AIX SecureWay&lt;br /&gt;
#filter passwd (objectClass=aixAccount)&lt;br /&gt;
#map    passwd uid              userName&lt;br /&gt;
#map    passwd userPassword     passwordChar&lt;br /&gt;
#map    passwd uidNumber        uid&lt;br /&gt;
#map    passwd gidNumber        gid&lt;br /&gt;
#filter group  (objectClass=aixAccessGroup)&lt;br /&gt;
#map    group  cn               groupName&lt;br /&gt;
#map    group  gidNumber        gid&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== nsswitch.conf - Name Service Switch configuration file ===&lt;br /&gt;
 /etc/nsswitch.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd:      files ldap&lt;br /&gt;
shadow:      files ldap&lt;br /&gt;
group:       files ldap&lt;br /&gt;
&lt;br /&gt;
# passwd:    db files nis&lt;br /&gt;
# shadow:    db files nis&lt;br /&gt;
# group:     db files nis&lt;br /&gt;
&lt;br /&gt;
hosts:       files dns&lt;br /&gt;
networks:    files dns&lt;br /&gt;
&lt;br /&gt;
services:    db files&lt;br /&gt;
protocols:   db files&lt;br /&gt;
rpc:         db files&lt;br /&gt;
ethers:      db files&lt;br /&gt;
netmasks:    files&lt;br /&gt;
netgroup:    files&lt;br /&gt;
bootparams:  files&lt;br /&gt;
&lt;br /&gt;
automount:   files&lt;br /&gt;
aliases:     files&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== system-auth ===&lt;br /&gt;
 vi /etc/pam.d/system-auth&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auth            required        pam_env.so&lt;br /&gt;
auth            sufficient      pam_unix.so try_first_pass likeauth nullok&lt;br /&gt;
auth            sufficient      pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
auth            required        pam_deny.so&lt;br /&gt;
&lt;br /&gt;
account         required        pam_unix.so&lt;br /&gt;
account         sufficient      pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
&lt;br /&gt;
password        required        pam_cracklib.so difok=2 minlen=8 dcredit=2 ocredit=2 retry=3&lt;br /&gt;
password        required        pam_unix.so try_first_pass use_authtok nullok sha512 shadow&lt;br /&gt;
password        sufficient      pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
password        required        pam_deny.so&lt;br /&gt;
&lt;br /&gt;
session         required        pam_limits.so&lt;br /&gt;
session         required        pam_env.so&lt;br /&gt;
session         required        pam_unix.so&lt;br /&gt;
session         sufficient      pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test the Setup ===&lt;br /&gt;
 nslcd -d&lt;br /&gt;
&lt;br /&gt;
=== Update the Default Run Levels ===&lt;br /&gt;
 rc-update add nslcd default&lt;br /&gt;
 rc-update add nscd default&lt;br /&gt;
&lt;br /&gt;
=== Start the necessary Daemons ===&lt;br /&gt;
 /etc/init.d/nslcd start&lt;br /&gt;
 /etc/init.d/nscd start&lt;br /&gt;
&lt;br /&gt;
== Quota ==&lt;br /&gt;
=== 32-bit Project Identifier Support ===&lt;br /&gt;
We need to enable 32-bit project identifier support (PROJID32BIT feature) for our naming scheme (uid numbers larger than 65&#039;536), which is already the default on the stepping stone virtual machines:&lt;br /&gt;
 mkfs.xfs &#039;&#039;&#039;-i projid32bit=1&#039;&#039;&#039; /dev/vg-local-01/var&lt;br /&gt;
&lt;br /&gt;
=== Update /etc/fstab and Mount ===&lt;br /&gt;
Make sure, that you have user quota (uqota) and project quota (pquota) set as options on the chosen mount point in /etc/fstab. For example:&lt;br /&gt;
 LABEL=LV-VAR            /var            xfs             noatime,discard,inode64,uquota,pquota  0 2&lt;br /&gt;
&lt;br /&gt;
 reboot&lt;br /&gt;
&lt;br /&gt;
Check, if everything went ok:&lt;br /&gt;
 df -h | grep var&lt;br /&gt;
&lt;br /&gt;
 /dev/mapper/vg--local--01-var  1023G  220G  804G  22% /var&lt;br /&gt;
&lt;br /&gt;
=== Verify ===&lt;br /&gt;
Some important options for xfs_quota:&lt;br /&gt;
* -x: Enable expert mode.&lt;br /&gt;
* -c: Pass arguments on the command line. Multiple arguments may be given.&lt;br /&gt;
&lt;br /&gt;
Remount the file system /var and check, if /var has the desired values:&lt;br /&gt;
 xfs_quota -x -c state /var&lt;br /&gt;
&lt;br /&gt;
As you can see (items marked bold), we have achieved our goal:&lt;br /&gt;
 User quota state on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
   Accounting: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Enforcement: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Inode: #131 (1 blocks, 1 extents)&lt;br /&gt;
 Group quota state on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
   Accounting: OFF&lt;br /&gt;
   Enforcement: OFF&lt;br /&gt;
   Inode: #132 (1 blocks, 1 extents)&lt;br /&gt;
 Project quota state on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
   Accounting: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Enforcement: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Inode: #132 (1 blocks, 1 extents)&lt;br /&gt;
 Blocks grace time: [7 days 00:00:30]&lt;br /&gt;
 Inodes grace time: [7 days 00:00:30]&lt;br /&gt;
 Realtime Blocks grace time: [7 days 00:00:30]&lt;br /&gt;
&lt;br /&gt;
=== User Quotas ===&lt;br /&gt;
==== Adding a User Quota ====&lt;br /&gt;
Set a quota of 1 Gigabyte for the user 4000187 (the values are in kilobytes, so 1048576 kilobyte are 1024 megabytes which corresponds to 1 gigabyte):&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1048576k 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Or in bytes:&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1073741824 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Read the quota information for the user 4000187:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
 /dev/mapper/vg--local--01-var                     0          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
If the user has data in the project, that belongs to him, the result will change:&lt;br /&gt;
 /dev/mapper/vg--local--01-var                512000          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
==== Modifiying a User Quota ====&lt;br /&gt;
To modify a users quota, you just set a new quota (limit):&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1048576k 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Read the quota information for the user 4000187:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
 /dev/mapper/vg--local--01-var                     0          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
If the user has data in the project, that belongs to him, the result will change:&lt;br /&gt;
 /dev/mapper/vg--local--01-var                512000          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
==== Removing a User Quota ====&lt;br /&gt;
Removing a quota for a user:&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=0 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
The following command should give you an empty result:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
=== Project (Directory) Quotas ===&lt;br /&gt;
==== Adding a Project (Directory) Quota ====&lt;br /&gt;
The XFS file system additionally allows you to set quotas on individual directory hierarchies in the file system that are known as managed trees. Each managed tree is uniquely identified by a project ID and an optional project name. We&#039;ll use the following values in the examples:&lt;br /&gt;
* project_ID: The uid of the online backup account (4000187).&lt;br /&gt;
* project_name: The uid of the online backup account (4000187). This could be a human readable name.&lt;br /&gt;
* mountpoint: The mountpoint of the xfs-filesystem (/var). See the &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt; entry from above.&lt;br /&gt;
* directory: The directory of the project (187/4000187), starting from the mountpoint of the xfs-filesystem (/var).&lt;br /&gt;
&lt;br /&gt;
Define a unique project ID for the directory hierarchy in the &amp;lt;code&amp;gt;/etc/projects&amp;lt;/code&amp;gt; file (project_ID:mountpoint/directory):&lt;br /&gt;
 echo &amp;quot;4000187:/var/backup/187/4000187/home/4000187&amp;quot; &amp;gt;&amp;gt; /etc/projects&lt;br /&gt;
&lt;br /&gt;
Create an entry in the &amp;lt;code&amp;gt;/etc/projid&amp;lt;/code&amp;gt; file that maps a project name to the project ID (project_name:project_ID):&lt;br /&gt;
 echo &amp;quot;4000187:4000187&amp;quot; &amp;gt;&amp;gt; /etc/projid&lt;br /&gt;
&lt;br /&gt;
Set Project:&lt;br /&gt;
 xfs_quota -x -c &#039;project -s -p /var/backup/187/4000187/home/4000187 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Set Quota (limit) on Project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=1048576k 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Check your Quota (limit)&lt;br /&gt;
 xfs_quota -x -c &#039;quota -p 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Check the Quota:&lt;br /&gt;
* &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt;: increase verbosity in reporting (also dumps zero values).&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt;: suppress the initial header.&lt;br /&gt;
* &amp;lt;code&amp;gt;-p&amp;lt;/code&amp;gt;: display project quota information.&lt;br /&gt;
* &amp;lt;code&amp;gt;-h&amp;lt;/code&amp;gt;: human readable format.&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -p 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
 /dev/mapper/vg--local--01-var                     0          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
If you copied data into the project, the output will look something like:&lt;br /&gt;
 /dev/mapper/vg--local--01-var                512000          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
To give you an overall view of the whole system:&lt;br /&gt;
 xfs_quota -x -c report /var&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
User quota on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
User ID          Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
root          1024000          0          0     00 [--------]&lt;br /&gt;
4000187             0          0    1048576     00 [--------]&lt;br /&gt;
&lt;br /&gt;
Project quota on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
Project ID       Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
4000187        512000          0    1048576     00 [--------]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modifying a Project (Directory) Quota ====&lt;br /&gt;
To modify a project (directory) quota, you just set an new quota (limit) on the chosen project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=1048576k 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Check your quota (limit)&lt;br /&gt;
 xfs_quota -x -c &#039;quota -p 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
==== Removing a Project (Directory) Quota ====&lt;br /&gt;
Removing a quota from a project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=0 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Chreck the results:&lt;br /&gt;
 xfs_quota -x -c report /var&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
User quota on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
User ID          Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
root           512000          0          0     00 [--------]&lt;br /&gt;
4000187             0          0       1024     00 [--------]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the line with the Project ID 4000187 has disappeared:&lt;br /&gt;
 4000187        512000          0    1048576     00 [--------]&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to remove the project from &amp;lt;code&amp;gt;/etc/projects&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/etc/projid&amp;lt;/code&amp;gt;:&lt;br /&gt;
 sed -i -e &#039;/4000187/d&#039; /etc/projects&lt;br /&gt;
 sed -i -e &#039;/4000187/d&#039; /etc/projid&lt;br /&gt;
&lt;br /&gt;
=== Some important notes concerning XFS ===&lt;br /&gt;
# The &#039;&#039;&#039;quotacheck&#039;&#039;&#039; command has no effect on XFS filesystems. The first time quota accounting is turned on (at mount time), XFS does an automatic quotacheck internally; afterwards, the quota system will always be completely consistent until quotas are manually turned off. &lt;br /&gt;
# There is &#039;&#039;&#039;no need for quota file(s)&#039;&#039;&#039; in the root of the XFS filesystem.&lt;br /&gt;
&lt;br /&gt;
== prov-backup-rsnapshot ==&lt;br /&gt;
Install the prov-backup-rsnasphot daemon script using the package manager:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
emerge -va sys-apps/sst-prov-backup-rsnapshot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
If it is the first provisioning module running on this server (very likely) you first have to configure the provisioning daemon (you can skip this step if you have already another provisioning module running on this server)&lt;br /&gt;
&lt;br /&gt;
==== Provisioning global configuration ====&lt;br /&gt;
The global configuration for the provisioning daemon applies to all provisioning modules running on the server. This configuration therefore contains information about the provisioning daemon itself and no information at all about the specific modules. &lt;br /&gt;
 /etc/Provisioning/Global.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Copyright (C) 2012 stepping stone GmbH&lt;br /&gt;
#                    Switzerland&lt;br /&gt;
#                    http://www.stepping-stone.ch&lt;br /&gt;
#                    support@stepping-stone.ch&lt;br /&gt;
#&lt;br /&gt;
# Authors:&lt;br /&gt;
#  Pat Kläy &amp;lt;pat.klaey@stepping-stone.ch&amp;gt;&lt;br /&gt;
#  &lt;br /&gt;
# Licensed under the EUPL, Version 1.1.&lt;br /&gt;
#&lt;br /&gt;
# You may not use this work except in compliance with the&lt;br /&gt;
# Licence.&lt;br /&gt;
# You may obtain a copy of the Licence at:&lt;br /&gt;
#&lt;br /&gt;
# http://www.osor.eu/eupl&lt;br /&gt;
#&lt;br /&gt;
# Unless required by applicable law or agreed to in&lt;br /&gt;
# writing, software distributed under the Licence is&lt;br /&gt;
# distributed on an &amp;quot;AS IS&amp;quot; basis,&lt;br /&gt;
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either&lt;br /&gt;
# express or implied.&lt;br /&gt;
# See the Licence for the specific language governing&lt;br /&gt;
# permissions and limitations under the Licence.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
[Global]&lt;br /&gt;
# If true the script logs every information to the log-file.&lt;br /&gt;
LOG_DEBUG = 0&lt;br /&gt;
&lt;br /&gt;
# If true the script logs additional information to the log-file.&lt;br /&gt;
LOG_INFO = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs warnings to the log-file.&lt;br /&gt;
LOG_WARNING = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs errors to the log-file.&lt;br /&gt;
LOG_ERR = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The number of seconds to wait before retry contacting the backend server during startup.&lt;br /&gt;
SLEEP = 10&lt;br /&gt;
&lt;br /&gt;
# Number of backend server connection retries during startup.&lt;br /&gt;
ATTEMPTS = 3&lt;br /&gt;
&lt;br /&gt;
[Operation Mode]&lt;br /&gt;
# The number of seconds to wait before retry contacting the backend server in case of a service interruptions.&lt;br /&gt;
SLEEP = 30&lt;br /&gt;
&lt;br /&gt;
# Number of backend server connection retries in case of a service interruptions.&lt;br /&gt;
ATTEMPTS = 3&lt;br /&gt;
&lt;br /&gt;
[Mail]&lt;br /&gt;
# Error messages are sent to the mail configured below.&lt;br /&gt;
SENDTO = &amp;lt;YOUR-MAIL-ADDRESS&amp;gt;&lt;br /&gt;
HOST = mail.stepping-stone.ch&lt;br /&gt;
PORT = 587&lt;br /&gt;
USERNAME = &amp;lt;YOUR-NOTIFICATION-EMAIL-ADDRESS&amp;gt;&lt;br /&gt;
PASSWORD = &amp;lt;PASSWORD&amp;gt;&lt;br /&gt;
FROMNAME = Provisioning daemon&lt;br /&gt;
CA_DIR = /etc/ssl/certs&lt;br /&gt;
SSL = starttls&lt;br /&gt;
AUTH_METHOD = LOGIN&lt;br /&gt;
&lt;br /&gt;
# Additionally, you can be informed about creation, modification and deletion of services.&lt;br /&gt;
WANTINFOMAIL = 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Provisioning daemon prov-backup-rsnapshot module ====&lt;br /&gt;
The module specific configuration is located in /etc/Provisioning/&amp;lt;Service&amp;gt;/&amp;lt;Type&amp;gt;.conf. In the case of the prov-backup-rsnapshot module this is &amp;lt;code&amp;gt;/etc/Provisioning/Backup/Rsnapshot.conf&amp;lt;/code&amp;gt;. (Note: Comments starting with /* are not in the configuration file, they are only in the wiki to add some additional information)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Copyright (C) 2013 stepping stone GmbH&lt;br /&gt;
#                    Switzerland&lt;br /&gt;
#                    http://www.stepping-stone.ch&lt;br /&gt;
#                    support@stepping-stone.ch&lt;br /&gt;
#&lt;br /&gt;
# Authors:&lt;br /&gt;
#  Pat Kläy &amp;lt;pat.klaey@stepping-stone.ch&amp;gt;&lt;br /&gt;
#  &lt;br /&gt;
# Licensed under the EUPL, Version 1.1.&lt;br /&gt;
#&lt;br /&gt;
# You may not use this work except in compliance with the&lt;br /&gt;
# Licence.&lt;br /&gt;
# You may obtain a copy of the Licence at:&lt;br /&gt;
#&lt;br /&gt;
# http://www.osor.eu/eupl&lt;br /&gt;
#&lt;br /&gt;
# Unless required by applicable law or agreed to in&lt;br /&gt;
# writing, software distributed under the Licence is&lt;br /&gt;
# distributed on an &amp;quot;AS IS&amp;quot; basis,&lt;br /&gt;
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either&lt;br /&gt;
# express or implied.&lt;br /&gt;
# See the Licence for the specific language governing&lt;br /&gt;
# permissions and limitations under the Licence.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
/* If you want, you can override the log information from the global configuration file this might be useful for debugging */&lt;br /&gt;
[Global]&lt;br /&gt;
# If true the script logs every information to the log-file.&lt;br /&gt;
LOG_DEBUG = 1&lt;br /&gt;
&lt;br /&gt;
# If true the script logs additional information to the log-file.&lt;br /&gt;
LOG_INFO = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs warnings to the log-file.&lt;br /&gt;
LOG_WARNING = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs errors to the log-file.&lt;br /&gt;
LOG_ERR = 1&lt;br /&gt;
&lt;br /&gt;
/* Specify the hosts fully qualified domain name. This name will be used to perform some checks and also appear in the information and error mails */&lt;br /&gt;
ENVIRONMENT = &amp;lt;FQDN&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
[Database]&lt;br /&gt;
BACKEND = LDAP&lt;br /&gt;
SERVER = ldaps://ldapm.tombstone.org&lt;br /&gt;
PORT = 636&lt;br /&gt;
ADMIN_USER = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
ADMIN_PASSWORD = &amp;lt;PASSWORD&amp;gt;&lt;br /&gt;
SERVICE_SUBTREE = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
COOKIE_FILE = /etc/Provisioning/Backup/rsnapshot.cookie&lt;br /&gt;
DEFAULT_COOKIE = rid=001,csn=&lt;br /&gt;
SEARCH_FILTER = (&amp;amp;(entryCSN&amp;gt;=%entryCSN%)(sstProvisioningState=0))&lt;br /&gt;
&lt;br /&gt;
/* Specifies the service itself. As it is the prov-backup-rsnapshot module, the SERVICE is &amp;quot;Backup&amp;quot; and the TYPE is &amp;quot;Rsnapshot&amp;quot;.&lt;br /&gt;
 * The MODUS is as usual selfcare and the TRANSPORTAPI is LocalCLI. This is because the daemon is running on the same host as the&lt;br /&gt;
 * backup accounts are provisioned and the commands can be executed on this host using the cli.&lt;br /&gt;
 * For more information about MODUS and TRANSPORTAPI see https://int.stepping-stone.ch/wiki/provisioning.pl#Service_Konfiguration&lt;br /&gt;
 */&lt;br /&gt;
[Service]&lt;br /&gt;
MODUS = selfcare&lt;br /&gt;
TRANSPORTAPI = LocalCLI&lt;br /&gt;
SERVICE = Backup&lt;br /&gt;
TYPE = Rsnapshot&lt;br /&gt;
&lt;br /&gt;
SYSLOG = prov-backup-rsnapshot&lt;br /&gt;
&lt;br /&gt;
/* For the TRANSPORTAPI LocalCLI there is no gateway required because there is no connection to establish. So set HOST, USER and&lt;br /&gt;
 * DSA_FILE to whatever you want. Don&#039;t leave it blank, otherwise the provisioning daemon would log some error messages saying&lt;br /&gt;
 * these attributes are empty &lt;br /&gt;
 */&lt;br /&gt;
[Gateway]&lt;br /&gt;
HOST = localhost&lt;br /&gt;
USER = provisioning&lt;br /&gt;
DSA_FILE = none&lt;br /&gt;
&lt;br /&gt;
/* Information about the backup itself (how to setup everything). Note that the %uid% int the RSNAPSHOT_CONFIG_FILE parameter will&lt;br /&gt;
 * be replaced by the accounts UID. The script CREATE_CHROOT_CMD was installed with the prov-backup-rsnapshot module, so do not&lt;br /&gt;
 * change this parameter. The quota parameters (SET_QUOTA_CMD, MOUNTPOINT, QUOTA_FILE, PROJECTS_FILE and PROJID_FILE) represent &lt;br /&gt;
 * the quota setup as described on http://wiki.stoney-cloud.org/index.php/stoney_backup:_Server_set-up#Quota. If you followed this&lt;br /&gt;
 * manual, you can copy-paste them into your configuration file, otherwise adapt them according to your quota setup.&lt;br /&gt;
 */&lt;br /&gt;
[Backup]&lt;br /&gt;
RSNAPSHOT_CONFIG_FILE = /etc/rsnapshot/rsnapshot.conf.%uid%&lt;br /&gt;
SET_QUOTA_CMD = /usr/sbin/xfs_quota&lt;br /&gt;
CREATE_CHROOT_CMD = /usr/libexec/createBackupDirectory.sh&lt;br /&gt;
MOUNTPOINT = /var&lt;br /&gt;
QUOTA_FILE = /etc/backupSize&lt;br /&gt;
PROJECTS_FILE = /etc/projects&lt;br /&gt;
PROJID_FILE = /etc/projid&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== backup utils ==&lt;br /&gt;
Install the backup utils (multiple scripts which help you to manage and monitor your backup server and backup accounts) using the package manager. For more information about the scripts please see the [[stoney_backup:_Server_set-up#stoney_backup_Service_Software | stoney backup Service Software]] section. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
emerge -va sys-apps/sst-backup-utils&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
Please refer to the configuration sections for the different scripts in [[stoney_backup:_Server_set-up#stoney_backup_Service_Software | stoney backup Service Software]].&lt;br /&gt;
&lt;br /&gt;
= stoney backup Service Software =&lt;br /&gt;
The stoney backup Service comes along with multiple scripts which help you to manage and monitor your backup server and accounts: &lt;br /&gt;
&lt;br /&gt;
We use rsnapshot - remote filesystem snapshot utility for the actual snapshots and a handful of wrapper scripts, that do things like:&lt;br /&gt;
* Read the users and their settings from the LDAP directory.&lt;br /&gt;
* Execute rsnapshot according to the users settings.&lt;br /&gt;
* Write the backup quotas backup (incoming), iterations (.snapshots) and free space to the users local backupSize file and update the LDAP directory.&lt;br /&gt;
* Inform the reseller, customer or user (depending on the settings in the LDAP directory) via mail, if the quota limit has been reached.&lt;br /&gt;
* Depending on the users settings in the LDAP directory, warning mail will be sent to the reseller, customer or user, if a backup was not executed on time.&lt;br /&gt;
&lt;br /&gt;
== writeAccountSize.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/writeAccountSize.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package and does the following:&lt;br /&gt;
* Calculates the used disk space (backup and iterations) for a given account and writes the corresponding values to:&lt;br /&gt;
*# The LDAP backend (used by the selfcare webinterface to display quota information):&lt;br /&gt;
*#* Backup space used (sstBackupSize): The disk space the account uses for the backup itself (disk space used under the &amp;lt;code&amp;gt;incoming&amp;lt;/code&amp;gt; folder of the users chroot-home directory)&lt;br /&gt;
*#* Snapshot space used (sstIncrementSize): The disk space the account uses for the iterations (disk space under the &amp;lt;code&amp;gt;.snapshot&amp;lt;/code&amp;gt; folder of the users chroot-home directory)&lt;br /&gt;
*# The file &amp;lt;code&amp;gt;etc/backupSize&amp;lt;/code&amp;gt; of the accounts chroot (used by the Sepiola Online Backup client):&lt;br /&gt;
* Checks if the user and/or reseller must be notified that there is no more disk space left for the given account&lt;br /&gt;
** Checks if the notification flag was passed, if not no notification will be triggered&lt;br /&gt;
** Calculates the used disk space (backup and iterations) in percentage&lt;br /&gt;
** Reads the notification threshold value from the LDAP backed&lt;br /&gt;
** If the disk space used (in percentage) is bigger than the value retrieved from the LDAP backend start the [[stoney_cloud:_Notification_Architecture | notification]] process with&lt;br /&gt;
*** Product: Given account UID&lt;br /&gt;
*** Service: Backup&lt;br /&gt;
*** Problem: Quota&lt;br /&gt;
* Pod documentation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    writeAccountSize.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This Script gets quota information from filesystem, size of incoming and&lt;br /&gt;
    snapshots directories, write the data to a file and the LDAP backend and&lt;br /&gt;
    sends an e-mail message for each account that is over quota to users&lt;br /&gt;
    e-mail address (from ldap directory) if notification flag is passed.&lt;br /&gt;
&lt;br /&gt;
    The configuration file for this script is stored in the backup-utils&lt;br /&gt;
    configuration directory (/etc/backup-utils/) and is called&lt;br /&gt;
    writeAccountSize.conf.&lt;br /&gt;
&lt;br /&gt;
    The script needs access to the quota program to get quota information.&lt;br /&gt;
    The script needs ldap access to get users e-mail address and quota&lt;br /&gt;
    information. The script uses syslog for logging purposes.&lt;br /&gt;
&lt;br /&gt;
    Command Line Interface (CLI) parameters:&lt;br /&gt;
&lt;br /&gt;
    -C configfile&lt;br /&gt;
        The configuration file.&lt;br /&gt;
&lt;br /&gt;
    -U uid&lt;br /&gt;
        The user id.&lt;br /&gt;
&lt;br /&gt;
    -n notification&lt;br /&gt;
        Start notification process if quota threshold is reached&lt;br /&gt;
&lt;br /&gt;
    -d debug&lt;br /&gt;
        Turns the debug mode on.&lt;br /&gt;
&lt;br /&gt;
    -h help&lt;br /&gt;
        This online help.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    writeAccountSize.pl -U uid [-C configuration file ] []-d debug] [-h&lt;br /&gt;
    help] [-n]&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2009-04-16 michael.rhyner@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2009-04-16 michael.rhyner@stepping-stone.ch created&lt;br /&gt;
    2009-04-30 michael.rhyner@stepping-stone.ch changed position based quota&lt;br /&gt;
    output parsing with correctly parsed elements&lt;br /&gt;
    2009-06-15 michael.rhyner@stepping-stone.ch added over quota check and&lt;br /&gt;
    sending e-mail&lt;br /&gt;
    2009-06-16 michael.rhyner@stepping-stone.ch renamed script and make it&lt;br /&gt;
    more general usable (e.g. for online backup, online storage, ...)&lt;br /&gt;
    2009-06-17 michael.rhyner@stepping-stone.ch changed mail message to read&lt;br /&gt;
    from a text file instead from configuration parameter&lt;br /&gt;
    2009-06-18 michael.rhyner@stepping-stone.ch corrected wrong regex to&lt;br /&gt;
    weed out the asterisk (*) in getQuotaSize&lt;br /&gt;
    2009-06-19 michael.rhyner@stepping-stone.ch corrected wrong evaluation&lt;br /&gt;
    success from subroutines and avoid message output when not in debug mode&lt;br /&gt;
    2009-06-22 michael.rhyner@stepping-stone.ch getQuotaSize: return&lt;br /&gt;
    immediately if no quota was set&lt;br /&gt;
    2009-06-24 michael.rhyner@stepping-stone.ch alert when used certain&lt;br /&gt;
    percentge of allowed space instead of more than allowed space&lt;br /&gt;
    2009-06-26 michael.rhyner@stepping-stone.ch values are presented in&lt;br /&gt;
    Gigabytes within notification message&lt;br /&gt;
    2009-07-23 michael.rhyner@stepping-stone.ch corrected wrong syslog&lt;br /&gt;
    severities for errors&lt;br /&gt;
    2009-07-24 michael.rhyner@stepping-stone.ch made e-mail address&lt;br /&gt;
    available within message body&lt;br /&gt;
    2013-08-19 pat.klaey@stepping-stone.ch write quota values also to the&lt;br /&gt;
    LDAP&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporate code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Config::IniFiles;&lt;br /&gt;
        Getopt::Std;&lt;br /&gt;
        Sys::Syslog;&lt;br /&gt;
        File::Basename;&lt;br /&gt;
        Text::Template;&lt;br /&gt;
        POSIX;&lt;br /&gt;
        Notification;&lt;br /&gt;
        PerlUtil::Logging;&lt;br /&gt;
        PerlUtil::LDAPUtil;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 /etc/backup-utils/writeAccountSize.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Global]&lt;br /&gt;
INCOMING_DIRECTORY = /incoming&lt;br /&gt;
ACCOUNT_SIZE_FILE = /etc/backupSize&lt;br /&gt;
SNAPSHOTS = 1&lt;br /&gt;
&lt;br /&gt;
[Syslog]&lt;br /&gt;
SYSLOG = rsnapshot&lt;br /&gt;
&lt;br /&gt;
[Directory]&lt;br /&gt;
LDAP_SERVER = ldaps://ldapm.tombstone.ch&lt;br /&gt;
LDAP_PORT = 636&lt;br /&gt;
LDAP_BIND_DN = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
LDAP_BIND_PW = &amp;lt;password&amp;gt;&lt;br /&gt;
LDAP_BASE_DN = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
LDAP_PERSON_BASE = ou=people,dc=stoney-cloud,dc=org&lt;br /&gt;
LDAP_RESELLER_BASE = ou=reseller,ou=configuration,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
LDAP_EMAIL_ATTRIBUTE = mail&lt;br /&gt;
&lt;br /&gt;
[Notification]&lt;br /&gt;
EMAIL_SENDER = stepping stone GmbH Supprt &amp;lt;support@stepping-stone.ch&amp;gt;&lt;br /&gt;
EMAIL_ALERT_THRESHOLD = 85&lt;br /&gt;
&lt;br /&gt;
Salutation_Default_de-CH = Liebe Kundin / Lieber Kunde&lt;br /&gt;
Salutation_m_de-CH = Sehr geehrter Herr&lt;br /&gt;
Salutation_f_de-CH = Sehr geehrte Frau&lt;br /&gt;
Salutation_Default_en-GB = Dear customer&lt;br /&gt;
Salutation_m_en-GB = Dear Mr.&lt;br /&gt;
Salutation_f_en-GB = Dear Mrs.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
 /usr/libexec/backup-utils/writeAccountSize.pl -U 4000080 -d&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Debug modus was turned on&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersHomeDirectory: $localUsersHomeDirectory: /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersHomeDirectory: The $localUsersHomeDirectory /var/backup/080/4000080/home/4000080 exists&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersHomeDirectory:   /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersIncomingDirectory: /incoming&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localIncomingPath:           /var/backup/080/4000080/home/4000080/incoming&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: The $localIncomingPath /var/backup/080/4000080/home/4000080/incoming exists&lt;br /&gt;
Total Quota: 1048576 kilobytes&lt;br /&gt;
Total used Space: 0 kilobytes&lt;br /&gt;
Incoming Size: 0 kilobytes&lt;br /&gt;
Debug sub getSnapshotsSize: $localUsedQuota:   0&lt;br /&gt;
Debug sub getSnapshotsSize: $localSnapshotsSize:   0&lt;br /&gt;
Debug writeAccountSize: Working on /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
Debug: wrote 1024 0 0 to /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstBackupSize =&amp;gt; 0&lt;br /&gt;
&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstIncrementSize =&amp;gt; 0&lt;br /&gt;
&lt;br /&gt;
Alert Threshold: 85 %&lt;br /&gt;
Calculated value: 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now write some data (200 megaytes in this example) into the users incoming directory and then execute the script again:&lt;br /&gt;
 dd if=/dev/zero of=/var/backup/080/4000080/home/4000080/incoming/test.zeros bs=1024k count=200&lt;br /&gt;
 chown 4000080:4000080 /var/backup/080/4000080/home/4000080/incoming/test.zeros&lt;br /&gt;
 /usr/libexec/backup-utils/writeAccountSize.pl -U 4000080 -d&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Debug modus was turned on&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersHomeDirectory: $localUsersHomeDirectory: /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersHomeDirectory: The $localUsersHomeDirectory /var/backup/080/4000080/home/4000080 exists&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersHomeDirectory:   /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersIncomingDirectory: /incoming&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localIncomingPath:           /var/backup/080/4000080/home/4000080/incoming&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: The $localIncomingPath /var/backup/080/4000080/home/4000080/incoming exists&lt;br /&gt;
Total Quota: 1048576 kilobytes&lt;br /&gt;
Total used Space: 204800 kilobytes&lt;br /&gt;
Incoming Size: 204800 kilobytes&lt;br /&gt;
Debug sub getSnapshotsSize: $localUsedQuota:   204800&lt;br /&gt;
Debug sub getSnapshotsSize: $localSnapshotsSize:   0&lt;br /&gt;
Debug writeAccountSize: Working on /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
Debug: wrote 1024 200 0 to /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstBackupSize =&amp;gt; 209715200&lt;br /&gt;
&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstIncrementSize =&amp;gt; 0&lt;br /&gt;
&lt;br /&gt;
Alert Threshold: 85 %&lt;br /&gt;
Calculated value: 19.53125&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Everything seems to be working fine!&lt;br /&gt;
&lt;br /&gt;
== snapshot.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/snapshot.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package and does the following:&lt;br /&gt;
* Read interval parameter value passed&lt;br /&gt;
** The interval parameter value can be daily, weekly, monthly (or yearly)&lt;br /&gt;
* Find all backup active accounts for which the rsnapshot command must be executed (depending on the given interval)&lt;br /&gt;
** Filter to find these accounts: &amp;lt;code&amp;gt;(&amp;amp;(sstBackupInterval&amp;lt;INTERVAL&amp;gt;=*)(sstIsActive=TRUE))&amp;lt;/code&amp;gt; for example for the daily rsnapshot the filter is &amp;lt;code&amp;gt;(&amp;amp;(sstBackupIntervalDaily=*)(sstIsActive=TRUE))&amp;lt;/code&amp;gt;&lt;br /&gt;
*** In other words this means: Get me all acounts that have for &amp;lt;code&amp;gt;sstBackupInterval&amp;lt;INTERVAL&amp;gt;&amp;lt;/code&amp;gt; a value defined AND &amp;lt;code&amp;gt;sstIsActive&amp;lt;/code&amp;gt; is set to &amp;quot;TRUE&amp;quot;&lt;br /&gt;
* According to the interval given and the account UID calculate the rsnapshot command for all these accounts&lt;br /&gt;
** For example&lt;br /&gt;
*** Account UID: 4000000 &lt;br /&gt;
*** Interval: daily&lt;br /&gt;
*** Resulting rsnapshot command: /usr/bin/nice -n 19 /usr/bin/rsnapshot  -c /etc/rsnapshot/rsnapshot.conf.4000000 daily (if you use the [[#snapshot.pl_Configuration | configuration]] below)&lt;br /&gt;
* Execute all these commands&lt;br /&gt;
** Use controlled parallel execution, you can specify how many commands can be executed in parallel (see [[#snapshot.pl_Configuration | configuration]] below)&lt;br /&gt;
* Pod documentation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    snapshot.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script gets all active online backup accounts from the LDAP backend&lt;br /&gt;
    for which the rsnapshot process for the given interval must be executed.&lt;br /&gt;
    According to these accounts and the given interval, the commands to be&lt;br /&gt;
    executed are generated and finally executed. The commands can be&lt;br /&gt;
    executed in parallel, however there is a limit defined in the&lt;br /&gt;
    configuration file which limits the amount of parallel running&lt;br /&gt;
    processes.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    ./snapshot.pl --interval interval [--debug] [--help]&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
    --interval/-i interval&lt;br /&gt;
        Specifies the rsnapshot interval (can be hourly, daily, weekly,&lt;br /&gt;
        monthly or yearly)&lt;br /&gt;
&lt;br /&gt;
    --debug/-d&lt;br /&gt;
        Turns on debug mode&lt;br /&gt;
&lt;br /&gt;
    --help/-h&lt;br /&gt;
        Shows this help&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2012-03-19 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2012-03-19 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporated code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Getopt::Long;&lt;br /&gt;
        Sys::Syslog;&lt;br /&gt;
        PerlUtil::Logging;&lt;br /&gt;
        PerlUtil::LDAPUtil;&lt;br /&gt;
        File::Basename;&lt;br /&gt;
        Parallel::ForkManager;&lt;br /&gt;
        Time::Stopwatch;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
There are two things to do in this step: &lt;br /&gt;
* Configure the rsnapshot root directory&lt;br /&gt;
* Configure the snapshot.pl script itself&lt;br /&gt;
&lt;br /&gt;
==== rsnaphot configuration directory ====&lt;br /&gt;
The users individual rsnapshot configurations are stored under &amp;lt;code&amp;gt;/etc/rsnapshot&amp;lt;/code&amp;gt;. Please make sure, that the directory exists:&lt;br /&gt;
 ls -al /etc | grep rsnapshot&lt;br /&gt;
&lt;br /&gt;
 drwx------  2 root   root      64 30. Aug 20:20 rsnapshot&lt;br /&gt;
&lt;br /&gt;
If not, create it:&lt;br /&gt;
 mkdir /etc/rsnapshot&lt;br /&gt;
 chmod 700 /etc/rsnapshot&lt;br /&gt;
&lt;br /&gt;
==== snapshot.pl Configuration ====&lt;br /&gt;
The snapshot.pl script is responsible for the execution of rsnapshot according to the users settings.&lt;br /&gt;
 /etc/backup-utils/snapshot.conf &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[General]&lt;br /&gt;
MaxParallelProcesses = 5&lt;br /&gt;
Rsnapshot_command = /usr/bin/nice -n 19 /usr/bin/rsnapshot  -c /etc/rsnapshot/rsnapshot.conf.%uid% %interval%&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
Host = ldaps://ldapm.tombstone.ch&lt;br /&gt;
Port = 636&lt;br /&gt;
User = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
Password = &amp;lt;Password&amp;gt;&lt;br /&gt;
CA_Path = /etc/ssl/certs&lt;br /&gt;
Accounts_Base = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Legend: At runtime the following placeholders are replaced as follows&lt;br /&gt;
* &#039;&#039;&#039;%uid%&#039;&#039;&#039;: The backup account and login uid as a numeric number. For example: 4000205.&lt;br /&gt;
* &#039;&#039;&#039;%interval%&#039;&#039;&#039;: The backup level to be executed. Possible values are hourly, daily, weekly, monthly and yearly.&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
Before adding the necessary cronjob entries, we need to make sure, that we&#039;ve configured the snapshot.pl script correctly:&lt;br /&gt;
 /usr/libexec/backup-utils/snapshot.pl --interval daily -d&lt;br /&gt;
&lt;br /&gt;
If everything worked as planned, you should receive feedback looking roughly like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INFO:  Starting rsnapshot for interval daily with maximum 5 parallel processes&lt;br /&gt;
&lt;br /&gt;
INFO:  Executing snapshot for 4000080&lt;br /&gt;
&lt;br /&gt;
INFO:  Executing snapshot for 4000079&lt;br /&gt;
&lt;br /&gt;
INFO:  Snapshot process for 4000079 finished in 0.18 seconds with status 0&lt;br /&gt;
&lt;br /&gt;
INFO:  Snapshot process for 4000080 finished in 0.19 seconds with status 0&lt;br /&gt;
&lt;br /&gt;
INFO:  rsnapshot for all backups done. Took 0.24 seconds&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Just to make sure, that everything did work out fine, execute &amp;lt;code&amp;gt;writeAccountSize.pl&amp;lt;/code&amp;gt; again:&lt;br /&gt;
 /usr/libexec/backup-utils/writeAccountSize.pl -U 4000080 -d&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Debug modus was turned on&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersHomeDirectory: $localUsersHomeDirectory: /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersHomeDirectory: The $localUsersHomeDirectory /var/backup/080/4000080/home/4000080 exists&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersHomeDirectory:   /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersIncomingDirectory: /incoming&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localIncomingPath:           /var/backup/080/4000080/home/4000080/incoming&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: The $localIncomingPath /var/backup/080/4000080/home/4000080/incoming exists&lt;br /&gt;
Total Quota: 1048576 kilobytes&lt;br /&gt;
Total used Space: 409600 kilobytes&lt;br /&gt;
Incoming Size: 204800 kilobytes&lt;br /&gt;
Debug sub getSnapshotsSize: $localUsedQuota:   409600&lt;br /&gt;
Debug sub getSnapshotsSize: $localSnapshotsSize:   204800&lt;br /&gt;
Debug writeAccountSize: Working on /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
Debug: wrote 1024 200 200 to /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstBackupSize =&amp;gt; 209715200&lt;br /&gt;
&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstIncrementSize =&amp;gt; 209715200&lt;br /&gt;
&lt;br /&gt;
Alert Threshold: 85 %&lt;br /&gt;
Calculated value: 39.0625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the total used space has risen to 39.0625.&lt;br /&gt;
&lt;br /&gt;
=== Cronjobs ===&lt;br /&gt;
After making sure, that everything worked as planned, you can update your crontab entry:&lt;br /&gt;
 crontab -e&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
# Rsnapshot for all users&lt;br /&gt;
30 22 * * * /usr/libexec/backup-utils/snapshot.pl --interval daily&lt;br /&gt;
15 22 * * sun /usr/libexec/backup-utils/snapshot.pl --interval weekly&lt;br /&gt;
00 22 1 * * /usr/libexec/backup-utils/snapshot.pl --interval monthly&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* TBD: Maybe this is not optimal if there is a lot of data to rotate. In this case, it might be that for example weekly and daily snapshot both run at the same time what might lead to strange results. &lt;br /&gt;
* Workarounds: &lt;br /&gt;
** Simple/short version: Instead one could create another wrapper script which is called everyday and does some simple logic:&lt;br /&gt;
** Is today the first day of a month? &lt;br /&gt;
*** Yes: Is today sunday? &lt;br /&gt;
**** Yes: Execute monthly then weekly then daily rsnapshots using the snapshot.pl script (but wait for each interval to finish before starting the next)&lt;br /&gt;
**** No: Execute monthly then daily rsnapshots using the snapshot.pl script (but wait for monthly interval to finish before starting the daily)&lt;br /&gt;
*** No: Is today sunday?&lt;br /&gt;
**** Yes: Execute weekly then daily rsnapshots using the snapshot.pl script (but wait for weekly interval to finish before starting the daily)&lt;br /&gt;
**** No: Execute daily rsnapshots using the snapshot.pl script&lt;br /&gt;
** Complex/long version: Adapt the snapshot.pl script and call it every day without interval parameter. The script does the logic described above.&lt;br /&gt;
This avoids the above mentioned collision&lt;br /&gt;
&lt;br /&gt;
(Complex) / short version: rule via cronjobs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Rsnapshot for all users&lt;br /&gt;
30 22 * * 1-6 [ $( date +\%d ) -gt 1 ] &amp;amp;&amp;amp; /usr/libexec/backup-utils/snapshot.pl --interval daily&lt;br /&gt;
15 22 * * 7 [ $( date +\%d ) -gt 1 ] &amp;amp;&amp;amp; /usr/libexec/backup-utils/snapshot.pl --interval weekly; /usr/libexec/backup-utils/snapshot.pl --interval daily&lt;br /&gt;
00 22 1 * * /usr/libexec/backup-utils/snapshot.pl --interval monthly; /usr/libexec/backup-utils/snapshot.pl --interval weekly; /usr/libexec/backup-utils/snapshot.pl --interval daily&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== scheduleWarning.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/scheduleWarning.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package and does the following:&lt;br /&gt;
* The basic task of this script is simple: For the given account&lt;br /&gt;
** Check if the planned backups were started&lt;br /&gt;
*** If not, start the [[stoney_cloud:_Notification_Architecture | notification]] process with&lt;br /&gt;
**** Product: Given account UID&lt;br /&gt;
**** Service: Backup&lt;br /&gt;
**** Problem: Schedule &lt;br /&gt;
** Check if the planned backups finished successfully&lt;br /&gt;
*** If not, start the [[stoney_cloud:_Notification_Architecture | notification]] process with&lt;br /&gt;
**** Product: Given account UID&lt;br /&gt;
**** Service: Backup&lt;br /&gt;
**** Problem: Unsuccessful&lt;br /&gt;
&lt;br /&gt;
As the backup clients distributed by stepping stone GmbH upload metadata XML before (scheduling information and start time) and after (end time and backup status) the actual backup, the scheduleWarning.pl script is able to verify whether or not a planned backup has been executed and whether or not the backup was successful. &lt;br /&gt;
&lt;br /&gt;
* Pod documentation&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    scheduleWarning.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script tests whether a planed backup was successful or not. There&lt;br /&gt;
    are two different typs of failure.&lt;br /&gt;
&lt;br /&gt;
    1. The Backup did not start&lt;br /&gt;
        The first type of error is that a backup is scheduled for YYYY-MM-DD&lt;br /&gt;
        at HH:MM, but the backup don&#039;t start at this specified time. A&lt;br /&gt;
        possible reason could be that the computer was shut down.&lt;br /&gt;
&lt;br /&gt;
    2.The backup was not successful&lt;br /&gt;
        The second type of error is that a backup started as scheduled but&lt;br /&gt;
        did not finish successfully. There are different reasons for this&lt;br /&gt;
        error.&lt;br /&gt;
&lt;br /&gt;
    If a backup wasn&#039;t successful the script checks which type of error&lt;br /&gt;
    occured. It reads the XML files which are stored on the server and&lt;br /&gt;
    compares the given information. If the error is detected, the script&lt;br /&gt;
    stats the norification process with the information of the error.&lt;br /&gt;
&lt;br /&gt;
    If a user has more than one computer backed-up, the script tests one&lt;br /&gt;
    computer after the other. The mail(s) sent by the programm also&lt;br /&gt;
    contain(s) the information which computer is affected.&lt;br /&gt;
&lt;br /&gt;
OPTION&lt;br /&gt;
    -U uid&lt;br /&gt;
        The -U option is required to run the script, it indicates for which&lt;br /&gt;
        uid the script is executed.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    scheduleWarning.pl [-U user]&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2010-04-14 created Pat Kläy &amp;lt;pat.klaey@stepping-stone.ch&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2010-04-14 v0.01, created pkl&lt;br /&gt;
    2010-08-24 v0.02, modified pkl&lt;br /&gt;
        New using Net::SMTP::TLS to send mails&lt;br /&gt;
&lt;br /&gt;
    2013-09-13 v0.03, modified pat.klaey@stepping-stone.ch&lt;br /&gt;
        Changes to use the script with the new backup infrastructure (read&lt;br /&gt;
        more information from LDAP, use Notification lib to send mails)&lt;br /&gt;
&lt;br /&gt;
USES&lt;br /&gt;
    strict;&lt;br /&gt;
    warnings;&lt;br /&gt;
    XML::Simple;&lt;br /&gt;
    Config::IniFiles;&lt;br /&gt;
    XML::Validator::Schema;&lt;br /&gt;
    Date::Calc qw(:all);&lt;br /&gt;
    Date::Manip;&lt;br /&gt;
    Schedule::Cron::Events;&lt;br /&gt;
    DateTime::Format::Strptime;&lt;br /&gt;
    Sys::Syslog;&lt;br /&gt;
    XML::SAX::ParserFactory;&lt;br /&gt;
    Getopt::Std;&lt;br /&gt;
    MIME::Base64;&lt;br /&gt;
    Authen::SASL;&lt;br /&gt;
    Net::LDAPS;&lt;br /&gt;
    Net::SMTP::TLS;&lt;br /&gt;
    Cwd &#039;abs_path&#039;;&lt;br /&gt;
    PerlUtil::Logging;&lt;br /&gt;
    PerlUtil::LDAPUtil;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 /etc/backup-utils/scheduleWarning.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Backup]&lt;br /&gt;
CHROOT_DIRECTORY = /var/backup/%lastthree%/%user%&lt;br /&gt;
&lt;br /&gt;
[XML]&lt;br /&gt;
SCHEDULE_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/scheduler.xml&lt;br /&gt;
SCHEDULE_XSD = /etc/backup-utils/schema/scheduler_schema.xsd&lt;br /&gt;
BACKUP_ENDED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupEnded.xml&lt;br /&gt;
BACKUP_ENDED_XSD = /etc/backup-utils/schema/backupended_schema.xsd&lt;br /&gt;
BACKUP_STARTED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupStarted.xml&lt;br /&gt;
BACKUP_STARTED_XSD = /etc/backup-utils/schema/backupstarted_schema.xsd&lt;br /&gt;
&lt;br /&gt;
[TEMPLATE]&lt;br /&gt;
Salutation_Default_de-CH = Liebe Kundin / Lieber Kunde&lt;br /&gt;
Salutation_m_de-CH = Sehr geehrter Herr&lt;br /&gt;
Salutation_f_de-CH = Sehr geehrte Frau&lt;br /&gt;
Salutation_Default_en-GB = Dear customer&lt;br /&gt;
Salutation_m_en-GB = Dear Mr.&lt;br /&gt;
Salutation_f_en-GB = Dear Mrs.&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
&lt;br /&gt;
SERVER = ldaps://ldapm.tombstone.ch&lt;br /&gt;
PORT = 636&lt;br /&gt;
DEBUG = 1&lt;br /&gt;
&lt;br /&gt;
ADMIN_DN = cn=Manager,dc=stoney-cloud,dc=org &lt;br /&gt;
ADMIN_PASSWORD = &amp;lt;Password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
BACKUP_BASE = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
PEOPLE_BASE = ou=people,dc=stoney-cloud,dc=org&lt;br /&gt;
RESELLER_BASE = ou=reseller,ou=configuration,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
SCOPE = sub&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== checkBackups.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/writeDate.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package. It is a wrapper around the above mentioned &amp;lt;code&amp;gt;writeAccountSize.pl&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scheduleWarning.pl&amp;lt;/code&amp;gt; scripts (if you configure it accordingly).&lt;br /&gt;
* As mentioned the script is a wrapper for calling the quota and scheduler information scripts:&lt;br /&gt;
** It gets all active backup accounts from the LDAP directory&lt;br /&gt;
** According to the CLI parameters passed it calles for all these accounts:&lt;br /&gt;
*** The quota checking script (this script can be defined in the configuration file, see [[stoney_backup:_Server_set-up#Configuration_6 | configuration]] section below)&lt;br /&gt;
*** The scheduler checking script (this script can be defined in the configuration file, see [[stoney_backup:_Server_set-up#Configuration_6 | configuration]] section below)&lt;br /&gt;
* Pod documentation: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    checkBackups.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script processes all active backup accounts and checks (according&lt;br /&gt;
    to the command line options) the quota and/or the scheduled backups for&lt;br /&gt;
    the given accounts.&lt;br /&gt;
&lt;br /&gt;
    The script uses syslog for logging purposes.&lt;br /&gt;
&lt;br /&gt;
    Command Line Interface (CLI) parameters:&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
    --schedule/-s&lt;br /&gt;
        Checks schedule information by calling the defined script&lt;br /&gt;
&lt;br /&gt;
    --quota/-s&lt;br /&gt;
        Checks the quota values by calling the defined script&lt;br /&gt;
&lt;br /&gt;
    --notify/-n&lt;br /&gt;
        Passes the notify flag to the called scripts&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    ./checkBackups.pl [--quota] [--schedule] [--notify]&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --quota&lt;br /&gt;
        Checks and writes the quota for all active backup accounts. The user&lt;br /&gt;
        and/or reseller will NOT be informed if any quota threshold is&lt;br /&gt;
        reached&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --quota --notify&lt;br /&gt;
        Checks and writes the quota for all active backup accounts. The user&lt;br /&gt;
        and/or reseller will be informed if any quota threshold is reached.&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --schedule&lt;br /&gt;
        Checkes all active backup account if the scheduled backup was&lt;br /&gt;
        executed and successful. The --schedule option will allways trigger&lt;br /&gt;
        a notification mail to the user and/or reseller.&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --schedule --quota&lt;br /&gt;
        Checks both, quota and schedule, for all active backup accounts.&lt;br /&gt;
        Only schedule will trigger notification mails.&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --schedule --quota --notify&lt;br /&gt;
        Checks both, quota and schedule, for all active backup accounts.&lt;br /&gt;
        Both, quota and schedule, will trigger notification mails.&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2013-09-17 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2013-09-17 pat.klaey@stepping-stone.ch created&lt;br /&gt;
    2013-11-19 pat.klaey@stepping-stone.ch Added options to be able to check&lt;br /&gt;
    quota, schedule or both in one run&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporated code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Getopt::Long;&lt;br /&gt;
        Sys::Syslog;&lt;br /&gt;
        Cwd &#039;abs_path&#039;;&lt;br /&gt;
        File::Basename;&lt;br /&gt;
        PerlUtil::LDAPUtil;&lt;br /&gt;
        PerlUtil::Logging;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
In the configuration you have to define two simple things: &lt;br /&gt;
# Which script to call for quota checks and scheduler checks&lt;br /&gt;
# How to access the LDAP backend&lt;br /&gt;
 /etc/backup-utils/checkBackups.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Scripts]&lt;br /&gt;
CheckQuotaScript = /usr/libexec/backup-utils/writeAccountSize.pl&lt;br /&gt;
CheckScheduleScript = /usr/libexec/backup-utils/scheduleWarning.pl&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
Server = ldaps://ldapm.tombstone.ch&lt;br /&gt;
Port = 636&lt;br /&gt;
Username = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
Password = &amp;lt;PASSWORD&amp;gt;&lt;br /&gt;
AccountBase = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Cronjobs ====&lt;br /&gt;
As you can pass the notification flag to the scripts, you can call the quota script say all 10 minutes. This makes sense if followed the configuration section, as the writeAccountSize.pl script writes the quota values to the LDAP backend which will then be visible in the selfcare webinterface. Like that you have a more or less up to date quota representation in the selfcare webinterface. On the other side, you don&#039;t want to send notification mails to the user every 10 minutes. It might be enough to send them once a day, so the cronjobs may look like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Check backups&lt;br /&gt;
15 12 * * * /usr/libexec/backup-utils/checkBackups.pl --schedule --quota --notify&lt;br /&gt;
&lt;br /&gt;
# Write quota values every 10 minutes&lt;br /&gt;
*/10 * * * * /usr/libexec/backup-utils/checkBackups.pl --quota&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ResellerBackupBilling.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/writeDate.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package. The pod documentation says all what needs to be said about this script.&lt;br /&gt;
* Pod documentation&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    ResellerBackupBilling.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script processes the reseller with the passed UID and creates a&lt;br /&gt;
    very simplistic backup-billing overview which then is sent to the&lt;br /&gt;
    address specified in the configuration file. The billing overview&lt;br /&gt;
    contains all backup accounts which belong to the given reseller as well&lt;br /&gt;
    as their quota. According to the billing plan specified in the&lt;br /&gt;
    configuration file, the script also calculates the price for each backup&lt;br /&gt;
    account.&lt;br /&gt;
&lt;br /&gt;
    The script uses syslog for logging purposes.&lt;br /&gt;
&lt;br /&gt;
    Command Line Interface (CLI) parameters:&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
    --reseller/-r UID&lt;br /&gt;
        Process the reseller with this UID&lt;br /&gt;
&lt;br /&gt;
    --debug/-d&lt;br /&gt;
        Turn on debug mode&lt;br /&gt;
&lt;br /&gt;
    --help/-h&lt;br /&gt;
        Display this help&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    ./ResellerBackupBilling.pl --reseller UID [--debug] [--help]&lt;br /&gt;
&lt;br /&gt;
    ./ResellerBackupBilling.pl --reseller 2000000&lt;br /&gt;
        This processes the reseller with the UID 200000 and sends the&lt;br /&gt;
        billing overview to the address specified in the configuration file&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2014-01-24 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2014-01-24 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporated code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Getopt::Long;&lt;br /&gt;
        PerlUtil::LDAPUtil;&lt;br /&gt;
        PerlUtil::Logging;&lt;br /&gt;
        PerlUtil::Mail;&lt;br /&gt;
        Number::Format;&lt;br /&gt;
        File::Basename;&lt;br /&gt;
        Cwd &#039;abs_path&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
&lt;br /&gt;
== writeDate.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/writeDate.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package. This is a very simple script, it simply writes the current date and time to a file on the backup server before the rsnapshots rotates the backup. This date is used by the Sepiola Online Backup Client to display the iterations and their dates.&lt;br /&gt;
* Pod documentation: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    writeDate.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script writes the current date and time into the file for each&lt;br /&gt;
    backup before the rsnapshots rotates the backup. This information is&lt;br /&gt;
    used by the Sepiola Online Backup Client.&lt;br /&gt;
&lt;br /&gt;
    The configuration file for this script is stored under&lt;br /&gt;
    /etc/backup-utils/writeDate.conf&lt;br /&gt;
&lt;br /&gt;
    The script uses syslog for logging purposes.&lt;br /&gt;
&lt;br /&gt;
    Command Line Interface (CLI) parameters:&lt;br /&gt;
&lt;br /&gt;
    -C configfile&lt;br /&gt;
        The configuration file.&lt;br /&gt;
&lt;br /&gt;
    -U uid&lt;br /&gt;
        The user id.&lt;br /&gt;
&lt;br /&gt;
    -d debug&lt;br /&gt;
        Turns the debug mode on.&lt;br /&gt;
&lt;br /&gt;
    -h help&lt;br /&gt;
        This online help.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    writeDate.pl [-C configuration_file] [-U uid] [-d debug] [-h help]&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2007-09-16 michael.eichenberger@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2013-09-01 michael.eichenberger@stepping-stone.ch updated to reflect&lt;br /&gt;
    changes in the new backup environment&lt;br /&gt;
&lt;br /&gt;
        2007-09-16 michael.eichenberger@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporate code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Config::IniFiles;&lt;br /&gt;
        Getopt::Std;&lt;br /&gt;
        Sys::Syslog;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 /etc/backup-utils/writeDate.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Global]&lt;br /&gt;
BACKUP_DIRECTORY = /incoming&lt;br /&gt;
BACKUP_BACKUP_TIME_FILE = /.sepiola_backup/backupTime&lt;br /&gt;
&lt;br /&gt;
[Syslog]&lt;br /&gt;
SYSLOG = rsnapshot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== rsnapshot wrapper bash scripts ==&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* [http://www.openldap.org/ OpenLDAP], an open source implementation of the Lightweight Directory Access Protocol.&lt;br /&gt;
* [http://arthurdejong.org/nss-pam-ldapd/ nss-pam-ldapd], a Name Service Switch (NSS) module that allows your LDAP server to provide user account, group, host name, alias, netgroup, and basically any other information that you would normally get from /etc flat files or NIS.&lt;br /&gt;
* [http://www.gentoo.org/doc/de/ldap-howto.xml Gentoo Leitfaden zur OpenLDAP Authentifikation].&lt;br /&gt;
* [http://wiki.gentoo.org/wiki/Centralized_authentication_using_OpenLDAP Centralized authentication using OpenLDAP].&lt;br /&gt;
* [https://code.google.com/p/openssh-lpk/source/browse/trunk/schemas/openssh-lpk_openldap.schema openssh-lpk_openldap.schema] OpenSSH LDAP Public Keys.&lt;br /&gt;
* [http://sourceforge.net/projects/linuxquota/ linuxquota] Linux DiskQuota.&lt;br /&gt;
* [http://www.rsnapshot.org/ rsnapshot], a remote filesystem snapshot utility, based on rsync.&lt;br /&gt;
* [http://olivier.sessink.nl/jailkit/ Jailkit], set of utilities to limit user accounts to specific files using chroot() and or specific commands. Also includes a tool to build a chroot environment.&lt;br /&gt;
* [http://www.busybox.net/ Busybox] BusyBox combines tiny versions of many common UNIX utilities into a single small executable. Useful to reduce the number of files (and thus the complexity) when building a chroot. &lt;br /&gt;
&lt;br /&gt;
[[Category:stoney backup]]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=stoney_backup:_Server_set-up&amp;diff=3668</id>
		<title>stoney backup: Server set-up</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=stoney_backup:_Server_set-up&amp;diff=3668"/>
		<updated>2014-06-13T13:41:38Z</updated>

		<summary type="html">&lt;p&gt;David: /* Cronjobs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Abstract =&lt;br /&gt;
This document describes server setup for the stoney cloud (Online) Backup service, built upon the [http://www.gentoo.org/ Gentoo] Linux distribution.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
After working through this documentation, you will be able to set up and configure your own (Online) Backup service server.&lt;br /&gt;
&lt;br /&gt;
= Software Installation =&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
A working stoney cloud, installed according to [[stoney cloud: Single-Node Installation]] or [[stoney cloud: Multi-Node Installation]].&lt;br /&gt;
&lt;br /&gt;
== Keywords &amp;amp; USE-Flags ==&lt;br /&gt;
For a minimal OpenLDAP directory installation:&lt;br /&gt;
 echo &amp;quot;net-nds/openldap minimal sasl&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
 echo &amp;quot;net-nds/openldap ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
NSS and PAM modules for lookups using LDAP:&lt;br /&gt;
 echo &amp;quot;sys-auth/nss-pam-ldapd sasl&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
 echo &amp;quot;sys-auth/nss-pam-ldapd ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;sys-fs/quota ldap&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;=app-admin/jailkit-2.16 ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
For the prov-backup-rsnapshot daemon:&lt;br /&gt;
 echo &amp;quot;dev-perl/Net-SMTPS ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;perl-core/Switch ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
To build puttygen only without X11:&lt;br /&gt;
 echo &amp;quot;net-misc/putty ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;net-misc/putty -gtk&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&lt;br /&gt;
== Emerge ==&lt;br /&gt;
 emerge -va nss-pam-ldapd \&lt;br /&gt;
            quota \&lt;br /&gt;
            net-misc/putty \&lt;br /&gt;
            app-admin/jailkit \&lt;br /&gt;
            sys-apps/haveged \&lt;br /&gt;
            net-misc/putty \&lt;br /&gt;
            sys-apps/sst-backup-utils \&lt;br /&gt;
            sys-apps/sst-prov-backup-rsnapshot&lt;br /&gt;
&lt;br /&gt;
To list the dependencies of ebuilds, you can use &amp;lt;code&amp;gt;equery&amp;lt;/code&amp;gt;:&lt;br /&gt;
 equery depgraph sst-backup-utils&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * Searching for sst-backup-utils ...&lt;br /&gt;
&lt;br /&gt;
 * dependency graph for sys-apps/sst-backup-utils-0.1.0&lt;br /&gt;
 `--  sys-apps/sst-backup-utils-0.1.0  amd64 &lt;br /&gt;
   `--  dev-perl/PerlUtil-0.1.0  (&amp;gt;=dev-perl/PerlUtil-0.1.0) amd64 &lt;br /&gt;
   `--  virtual/perl-Sys-Syslog-0.320.0  (virtual/perl-Sys-Syslog) amd64 &lt;br /&gt;
   `--  dev-perl/perl-ldap-0.530.0  (dev-perl/perl-ldap) amd64 &lt;br /&gt;
   `--  dev-perl/XML-Simple-2.200.0  (dev-perl/XML-Simple) amd64 &lt;br /&gt;
   `--  dev-perl/Config-IniFiles-2.780.0  (dev-perl/Config-IniFiles) amd64 &lt;br /&gt;
   `--  dev-perl/XML-Validator-Schema-1.100.0  (dev-perl/XML-Validator-Schema) amd64 &lt;br /&gt;
   `--  dev-perl/Date-Calc-6.300.0  (dev-perl/Date-Calc) amd64 &lt;br /&gt;
   `--  dev-perl/DateManip-6.310.0  (dev-perl/DateManip) amd64 &lt;br /&gt;
   `--  dev-perl/Schedule-Cron-Events-1.930.0  (dev-perl/Schedule-Cron-Events) amd64 &lt;br /&gt;
   `--  dev-perl/DateTime-Format-Strptime-1.520.0  (dev-perl/DateTime-Format-Strptime) amd64 &lt;br /&gt;
   `--  dev-perl/XML-SAX-0.990.0  (dev-perl/XML-SAX) amd64 &lt;br /&gt;
   `--  virtual/perl-MIME-Base64-3.130.0-r2  (virtual/perl-MIME-Base64) amd64 &lt;br /&gt;
   `--  dev-perl/Authen-SASL-2.160.0  (dev-perl/Authen-SASL) amd64 &lt;br /&gt;
   `--  dev-perl/Net-SMTPS-0.30.0  (dev-perl/Net-SMTPS) ~amd64 &lt;br /&gt;
   `--  dev-perl/text-template-1.450.0  (dev-perl/text-template) amd64 &lt;br /&gt;
   `--  virtual/perl-Getopt-Long-2.380.0-r2  (virtual/perl-Getopt-Long) amd64 &lt;br /&gt;
   `--  dev-perl/Parallel-ForkManager-1.20.0  (dev-perl/Parallel-ForkManager) amd64 &lt;br /&gt;
   `--  dev-perl/Time-Stopwatch-1.0.0  (dev-perl/Time-Stopwatch) amd64 &lt;br /&gt;
   `--  app-backup/rsnapshot-1.3.1-r1  (app-backup/rsnapshot) amd64 &lt;br /&gt;
[ sys-apps/sst-backup-utils-0.1.0 stats: packages (20), max depth (1) ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more information, visit the [http://www.gentoo.org/doc/en/gentoolkit.xml Gentoolkit] page.&lt;br /&gt;
&lt;br /&gt;
= Base Server Software Configuration =&lt;br /&gt;
== OpenSSH ==&lt;br /&gt;
=== OpenSSH Configuration ===&lt;br /&gt;
Configure the OpenSSH daemon:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vi /etc/ssh/sshd_config&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set following options:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
PubkeyAuthentication yes&lt;br /&gt;
PasswordAuthentication yes&lt;br /&gt;
UsePAM yes&lt;br /&gt;
Subsystem     sftp   internal-sftp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure, that &amp;lt;code&amp;gt;Subsystem     sftp   internal-sftp&amp;lt;/code&amp;gt; is the last line in the configuration file.&lt;br /&gt;
&lt;br /&gt;
We want to reduce the numbers of chroot environments in one folder. As the &amp;lt;code&amp;gt;ChrootDirectory&amp;lt;/code&amp;gt; configuration option only allows &amp;lt;code&amp;gt;%h&amp;lt;/code&amp;gt; (home directory of the user) and &amp;lt;code&amp;gt;%u&amp;lt;/code&amp;gt; (username of the user), we need to create the necessary matching rules in the form of:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Match User *000&lt;br /&gt;
  ChrootDirectory /var/backup/000/%u&lt;br /&gt;
  AuthorizedKeysFile /var/backup/000/%u/%h/.ssh/authorized_keys&lt;br /&gt;
Match&lt;br /&gt;
Match User *001&lt;br /&gt;
  ChrootDirectory /var/backup/001/%u&lt;br /&gt;
  AuthorizedKeysFile /var/backup/001/%u/%h/.ssh/authorized_keys&lt;br /&gt;
Match&lt;br /&gt;
...&lt;br /&gt;
Match User *999&lt;br /&gt;
  ChrootDirectory /var/backup/999/%u&lt;br /&gt;
  AuthorizedKeysFile /var/backup/999/%u/%h/.ssh/authorized_keys&lt;br /&gt;
Match&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The creation of the matching rules is done by executing the following bash commands:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
FILE=/etc/ssh/sshd_config;&lt;br /&gt;
&lt;br /&gt;
for x in {0..999} ; do \&lt;br /&gt;
  printf &amp;quot;Match User *%03d\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;  ChrootDirectory /var/backup/%03d/%%u\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;  AuthorizedKeysFile /var/backup/%03d/%%u/%%h/.ssh/authorized_keys\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;Match\n&amp;quot; &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to restart the OpenSSH daemon:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/etc/init.d/sshd restart&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSSH Host Keys ===&lt;br /&gt;
If you migrate from a existing backup server, you might want to copy the ssh host keys to the new server. If you do so clients want see a difference between the two hosts as the fingerprint remains the same. Copy the following files from the existing host to the new:&lt;br /&gt;
* /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_ecdsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_key&lt;br /&gt;
* /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_dsa_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_ecdsa_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_rsa_key.pub&lt;br /&gt;
&lt;br /&gt;
Set the correct permissions on the new host:&lt;br /&gt;
 chmod 600 /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_key /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
 chmod 644 /etc/ssh/*.pub&lt;br /&gt;
&lt;br /&gt;
And restart the ssh daemon. &#039;&#039;Caution&#039;&#039;: do not close your existing ssh session as long as you are not sure the ssh daemon has restarted properly and you can login again.&lt;br /&gt;
 /etc/init.d/sshd restart&lt;br /&gt;
&lt;br /&gt;
== OpenLDAP ==&lt;br /&gt;
=== /etc/hosts ===&lt;br /&gt;
Update the &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt; with the LDAP server:&lt;br /&gt;
 /etc/hosts&lt;br /&gt;
&lt;br /&gt;
 # VIP of the LDAP Server&lt;br /&gt;
 31.216.40.4      ldapm.stoney-cloud.org&lt;br /&gt;
&lt;br /&gt;
=== Root CA Certificate Installation ===&lt;br /&gt;
Install the root CA certificate into the OpenSSL default certificate storage directory:&lt;br /&gt;
 fqdn=&amp;quot;cloud.stoney-cloud.org&amp;quot;    # The fully qualified domain name of the server containing the root certificate.&lt;br /&gt;
 &lt;br /&gt;
 cd /etc/ssl/certs/&lt;br /&gt;
 wget --no-check-certificate https://${fqdn}/ca/FOSS-Cloud_CA.cert.pem&lt;br /&gt;
 chown root:root /etc/ssl/certs/FOSS-Cloud_CA.cert.pem&lt;br /&gt;
 chmod 444 /etc/ssl/certs/FOSS-Cloud_CA.cert.pem&lt;br /&gt;
&lt;br /&gt;
Rebuild the CA hashes&lt;br /&gt;
 c_rehash /etc/ssl/certs/&lt;br /&gt;
&lt;br /&gt;
=== /etc/openldap/ldap.conf ===&lt;br /&gt;
Update the &amp;lt;code&amp;gt;/etc/openldap/ldap.conf&amp;lt;/code&amp;gt;LDAP configuration file/environment variables:&lt;br /&gt;
 /etc/openldap/ldap.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Used to specify a size limit to use when performing searches. The number should be an&lt;br /&gt;
# non-negative integer. SIZELIMIT of zero (0) specifies unlimited search size.&lt;br /&gt;
SIZELIMIT       20000&lt;br /&gt;
&lt;br /&gt;
# Used to specify a time limit to use when performing searches. The number should be an&lt;br /&gt;
# non-negative integer. TIMELIMIT of zero (0) specifies unlimited search time to be used.&lt;br /&gt;
TIMELIMIT       45&lt;br /&gt;
&lt;br /&gt;
# Specify how aliases dereferencing is done. DEREF should be set to one of never, always, search,&lt;br /&gt;
# or find to specify that aliases are never dereferenced, always dereferenced, dereferenced when&lt;br /&gt;
# searching, or dereferenced only when locating the base object for the search. The default is to&lt;br /&gt;
# never dereference aliases.&lt;br /&gt;
DEREF           never&lt;br /&gt;
&lt;br /&gt;
# Specifies the URI(s) of an LDAP server(s) to which the LDAP library should connect. The URI&lt;br /&gt;
# scheme may be either ldapor ldaps which refer to LDAP over TCP and LDAP over SSL (TLS)&lt;br /&gt;
# respectively. Each server&#039;s name can be specified as a domain- style name or an IP address&lt;br /&gt;
# literal. Optionally, the server&#039;s name can followed by a &#039;:&#039; and the port number the LDAP&lt;br /&gt;
# server is listening on. If no port number is provided, the default port for the scheme is&lt;br /&gt;
# used (389 for ldap://, 636 for ldaps://). A space separated list of URIs may be provided.&lt;br /&gt;
URI             ldaps://ldapm.stoney-cloud.org&lt;br /&gt;
&lt;br /&gt;
# Used to specify the default base DN to use when performing ldap operations. The base must be&lt;br /&gt;
# specified as a Distinguished Name in LDAP format.&lt;br /&gt;
BASE            dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# This is a local copy of the certificate of the certificate authority&lt;br /&gt;
# used to sign the server certificate for the LDAP server I am using&lt;br /&gt;
TLS_CACERT      /etc/ssl/certs/FOSS-Cloud_CA.cert.pem&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check you configuration by doing a search:&lt;br /&gt;
 ldapsearch -v -H &amp;quot;ldaps://ldapm.stoney-cloud.org&amp;quot; \&lt;br /&gt;
               -b &amp;quot;dc=stoney-cloud,dc=org&amp;quot; \&lt;br /&gt;
               -D &amp;quot;cn=Manager,dc=stoney-cloud,dc=org&amp;quot; \&lt;br /&gt;
               -s one &amp;quot;(objectClass=*)&amp;quot; \&lt;br /&gt;
               -LLL -W&lt;br /&gt;
&lt;br /&gt;
The result should look something like:&lt;br /&gt;
 ldap_initialize( ldaps://ldapm.stoney-cloud.org:636/??base )&lt;br /&gt;
 filter: (objectClass=*)&lt;br /&gt;
 requesting: All userApplication attributes&lt;br /&gt;
 dn: ou=administration,dc=stoney-cloud,dc=org&lt;br /&gt;
 objectClass: top&lt;br /&gt;
 objectClass: organizationalUnit&lt;br /&gt;
 ou: administration&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
== Random Number Generator (haveged) ==&lt;br /&gt;
Tools like putty are dependent on random numbers to be able to create certificates.&lt;br /&gt;
&lt;br /&gt;
=== haveged - Generate random numbers and feed linux random device ===&lt;br /&gt;
The haveged daemon doesn&#039;t need any special configuration, therefore you can start it from the command line interface:&lt;br /&gt;
 /etc/init.d/haveged start&lt;br /&gt;
&lt;br /&gt;
Check, if the start was successful:&lt;br /&gt;
 ps auxf | grep haveged&lt;br /&gt;
&lt;br /&gt;
 root     18001  1.0  0.0   7420  3616 ?        Ss   08:48   0:00 /usr/sbin/haveged -r 0 -w 1024 -v 1&lt;br /&gt;
&lt;br /&gt;
Add the haveged daemon to the default run level:&lt;br /&gt;
 rc-update add haveged default&lt;br /&gt;
&lt;br /&gt;
== nss-pam-ldapd ==&lt;br /&gt;
=== nslcd.conf — configuration file for LDAP nameservice daemon ===&lt;br /&gt;
 /etc/nslcd.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is the configuration file for the LDAP nameservice&lt;br /&gt;
# switch library&#039;s nslcd daemon. It configures the mapping&lt;br /&gt;
# between NSS names (see /etc/nsswitch.conf) and LDAP&lt;br /&gt;
# information in the directory.&lt;br /&gt;
# See the manual page nslcd.conf(5) for more information.&lt;br /&gt;
&lt;br /&gt;
# The user and group nslcd should run as.&lt;br /&gt;
uid nslcd&lt;br /&gt;
gid nslcd&lt;br /&gt;
&lt;br /&gt;
# The uri pointing to the LDAP server to use for name lookups.&lt;br /&gt;
# Multiple entries may be specified. The address that is used&lt;br /&gt;
# here should be resolvable without using LDAP (obviously).&lt;br /&gt;
#uri ldap://127.0.0.1/&lt;br /&gt;
#uri ldaps://127.0.0.1/&lt;br /&gt;
#uri ldapi://%2fvar%2frun%2fldapi_sock/&lt;br /&gt;
# Note: %2f encodes the &#039;/&#039; used as directory separator&lt;br /&gt;
uri ldaps://ldapm.tombstone.ch&lt;br /&gt;
&lt;br /&gt;
# The LDAP version to use (defaults to 3&lt;br /&gt;
# if supported by client library)&lt;br /&gt;
#ldap_version 3&lt;br /&gt;
&lt;br /&gt;
# The distinguished name of the search base.&lt;br /&gt;
base dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# The distinguished name to bind to the server with.&lt;br /&gt;
# Optional: default is to bind anonymously.&lt;br /&gt;
binddn cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# The credentials to bind with.&lt;br /&gt;
# Optional: default is no credentials.&lt;br /&gt;
# Note that if you set a bindpw you should check the permissions of this file.&lt;br /&gt;
bindpw myverysecretpassword&lt;br /&gt;
&lt;br /&gt;
# The distinguished name to perform password modifications by root by.&lt;br /&gt;
#rootpwmoddn cn=admin,dc=example,dc=com&lt;br /&gt;
&lt;br /&gt;
# The default search scope.&lt;br /&gt;
#scope sub&lt;br /&gt;
#scope one&lt;br /&gt;
#scope base&lt;br /&gt;
&lt;br /&gt;
# Customize certain database lookups.&lt;br /&gt;
#base   group  ou=Groups,dc=example,dc=com&lt;br /&gt;
base   group  ou=groups,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
base   passwd ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
base   shadow ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
#scope  group  onelevel&lt;br /&gt;
#scope  hosts  sub&lt;br /&gt;
&lt;br /&gt;
#filter group  (&amp;amp;(objectClass=posixGroup)(sstIsActive=TRUE))&lt;br /&gt;
filter passwd (&amp;amp;(objectClass=posixAccount)(sstIsActive=TRUE))&lt;br /&gt;
filter shadow (&amp;amp;(objectClass=shadowAccount)(sstIsActive=TRUE))&lt;br /&gt;
&lt;br /&gt;
# Bind/connect timelimit.&lt;br /&gt;
#bind_timelimit 30&lt;br /&gt;
&lt;br /&gt;
# Search timelimit.&lt;br /&gt;
#timelimit 30&lt;br /&gt;
&lt;br /&gt;
# Idle timelimit. nslcd will close connections if the&lt;br /&gt;
# server has not been contacted for the number of seconds.&lt;br /&gt;
#idle_timelimit 3600&lt;br /&gt;
&lt;br /&gt;
# Use StartTLS without verifying the server certificate.&lt;br /&gt;
#ssl start_tls&lt;br /&gt;
tls_reqcert never&lt;br /&gt;
&lt;br /&gt;
# CA certificates for server certificate verification&lt;br /&gt;
#tls_cacertdir /etc/ssl/certs&lt;br /&gt;
#tls_cacertfile /etc/ssl/ca.cert&lt;br /&gt;
&lt;br /&gt;
# Seed the PRNG if /dev/urandom is not provided&lt;br /&gt;
#tls_randfile /var/run/egd-pool&lt;br /&gt;
&lt;br /&gt;
# SSL cipher suite&lt;br /&gt;
# See man ciphers for syntax&lt;br /&gt;
#tls_ciphers TLSv1&lt;br /&gt;
&lt;br /&gt;
# Client certificate and key&lt;br /&gt;
# Use these, if your server requires client authentication.&lt;br /&gt;
#tls_cert&lt;br /&gt;
#tls_key&lt;br /&gt;
&lt;br /&gt;
# Mappings for Services for UNIX 3.5&lt;br /&gt;
#filter passwd (objectClass=User)&lt;br /&gt;
#map    passwd uid              msSFU30Name&lt;br /&gt;
#map    passwd userPassword     msSFU30Password&lt;br /&gt;
#map    passwd homeDirectory    msSFU30HomeDirectory&lt;br /&gt;
#map    passwd homeDirectory    msSFUHomeDirectory&lt;br /&gt;
#filter shadow (objectClass=User)&lt;br /&gt;
#map    shadow uid              msSFU30Name&lt;br /&gt;
#map    shadow userPassword     msSFU30Password&lt;br /&gt;
#filter group  (objectClass=Group)&lt;br /&gt;
#map    group  member           msSFU30PosixMember&lt;br /&gt;
&lt;br /&gt;
# Mappings for Services for UNIX 2.0&lt;br /&gt;
#filter passwd (objectClass=User)&lt;br /&gt;
#map    passwd uid              msSFUName&lt;br /&gt;
#map    passwd userPassword     msSFUPassword&lt;br /&gt;
#map    passwd homeDirectory    msSFUHomeDirectory&lt;br /&gt;
#map    passwd gecos            msSFUName&lt;br /&gt;
#filter shadow (objectClass=User)&lt;br /&gt;
#map    shadow uid              msSFUName&lt;br /&gt;
#map    shadow userPassword     msSFUPassword&lt;br /&gt;
#map    shadow shadowLastChange pwdLastSet&lt;br /&gt;
#filter group  (objectClass=Group)&lt;br /&gt;
#map    group  member           posixMember&lt;br /&gt;
&lt;br /&gt;
# Mappings for Active Directory&lt;br /&gt;
#pagesize 1000&lt;br /&gt;
#referrals off&lt;br /&gt;
#idle_timelimit 800&lt;br /&gt;
#filter passwd (&amp;amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))&lt;br /&gt;
#map    passwd uid              sAMAccountName&lt;br /&gt;
#map    passwd homeDirectory    unixHomeDirectory&lt;br /&gt;
#map    passwd gecos            displayName&lt;br /&gt;
#filter shadow (&amp;amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))&lt;br /&gt;
#map    shadow uid              sAMAccountName&lt;br /&gt;
#map    shadow shadowLastChange pwdLastSet&lt;br /&gt;
#filter group  (objectClass=group)&lt;br /&gt;
&lt;br /&gt;
# Alternative mappings for Active Directory&lt;br /&gt;
# (replace the SIDs in the objectSid mappings with the value for your domain)&lt;br /&gt;
#pagesize 1000&lt;br /&gt;
#referrals off&lt;br /&gt;
#idle_timelimit 800&lt;br /&gt;
#filter passwd (&amp;amp;(objectClass=user)(objectClass=person)(!(objectClass=computer)))&lt;br /&gt;
#map    passwd uid           cn&lt;br /&gt;
#map    passwd uidNumber     objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
#map    passwd gidNumber     objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
#map    passwd homeDirectory &amp;quot;/home/$cn&amp;quot;&lt;br /&gt;
#map    passwd gecos         displayName&lt;br /&gt;
#map    passwd loginShell    &amp;quot;/bin/bash&amp;quot;&lt;br /&gt;
#filter group (|(objectClass=group)(objectClass=person))&lt;br /&gt;
#map    group gidNumber      objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
&lt;br /&gt;
# Mappings for AIX SecureWay&lt;br /&gt;
#filter passwd (objectClass=aixAccount)&lt;br /&gt;
#map    passwd uid              userName&lt;br /&gt;
#map    passwd userPassword     passwordChar&lt;br /&gt;
#map    passwd uidNumber        uid&lt;br /&gt;
#map    passwd gidNumber        gid&lt;br /&gt;
#filter group  (objectClass=aixAccessGroup)&lt;br /&gt;
#map    group  cn               groupName&lt;br /&gt;
#map    group  gidNumber        gid&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== nsswitch.conf - Name Service Switch configuration file ===&lt;br /&gt;
 /etc/nsswitch.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd:      files ldap&lt;br /&gt;
shadow:      files ldap&lt;br /&gt;
group:       files ldap&lt;br /&gt;
&lt;br /&gt;
# passwd:    db files nis&lt;br /&gt;
# shadow:    db files nis&lt;br /&gt;
# group:     db files nis&lt;br /&gt;
&lt;br /&gt;
hosts:       files dns&lt;br /&gt;
networks:    files dns&lt;br /&gt;
&lt;br /&gt;
services:    db files&lt;br /&gt;
protocols:   db files&lt;br /&gt;
rpc:         db files&lt;br /&gt;
ethers:      db files&lt;br /&gt;
netmasks:    files&lt;br /&gt;
netgroup:    files&lt;br /&gt;
bootparams:  files&lt;br /&gt;
&lt;br /&gt;
automount:   files&lt;br /&gt;
aliases:     files&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== system-auth ===&lt;br /&gt;
 vi /etc/pam.d/system-auth&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auth            required        pam_env.so&lt;br /&gt;
auth            sufficient      pam_unix.so try_first_pass likeauth nullok&lt;br /&gt;
auth            sufficient      pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
auth            required        pam_deny.so&lt;br /&gt;
&lt;br /&gt;
account         required        pam_unix.so&lt;br /&gt;
account         sufficient      pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
&lt;br /&gt;
password        required        pam_cracklib.so difok=2 minlen=8 dcredit=2 ocredit=2 retry=3&lt;br /&gt;
password        required        pam_unix.so try_first_pass use_authtok nullok sha512 shadow&lt;br /&gt;
password        sufficient      pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
password        required        pam_deny.so&lt;br /&gt;
&lt;br /&gt;
session         required        pam_limits.so&lt;br /&gt;
session         required        pam_env.so&lt;br /&gt;
session         required        pam_unix.so&lt;br /&gt;
session         sufficient      pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test the Setup ===&lt;br /&gt;
 nslcd -d&lt;br /&gt;
&lt;br /&gt;
=== Update the Default Run Levels ===&lt;br /&gt;
 rc-update add nslcd default&lt;br /&gt;
 rc-update add nscd default&lt;br /&gt;
&lt;br /&gt;
=== Start the necessary Daemons ===&lt;br /&gt;
 /etc/init.d/nslcd start&lt;br /&gt;
 /etc/init.d/nscd start&lt;br /&gt;
&lt;br /&gt;
== Quota ==&lt;br /&gt;
=== 32-bit Project Identifier Support ===&lt;br /&gt;
We need to enable 32-bit project identifier support (PROJID32BIT feature) for our naming scheme (uid numbers larger than 65&#039;536), which is already the default on the stepping stone virtual machines:&lt;br /&gt;
 mkfs.xfs &#039;&#039;&#039;-i projid32bit=1&#039;&#039;&#039; /dev/vg-local-01/var&lt;br /&gt;
&lt;br /&gt;
=== Update /etc/fstab and Mount ===&lt;br /&gt;
Make sure, that you have user quota (uqota) and project quota (pquota) set as options on the chosen mount point in /etc/fstab. For example:&lt;br /&gt;
 LABEL=LV-VAR            /var            xfs             noatime,discard,inode64,uquota,pquota  0 2&lt;br /&gt;
&lt;br /&gt;
 reboot&lt;br /&gt;
&lt;br /&gt;
Check, if everything went ok:&lt;br /&gt;
 df -h | grep var&lt;br /&gt;
&lt;br /&gt;
 /dev/mapper/vg--local--01-var  1023G  220G  804G  22% /var&lt;br /&gt;
&lt;br /&gt;
=== Verify ===&lt;br /&gt;
Some important options for xfs_quota:&lt;br /&gt;
* -x: Enable expert mode.&lt;br /&gt;
* -c: Pass arguments on the command line. Multiple arguments may be given.&lt;br /&gt;
&lt;br /&gt;
Remount the file system /var and check, if /var has the desired values:&lt;br /&gt;
 xfs_quota -x -c state /var&lt;br /&gt;
&lt;br /&gt;
As you can see (items marked bold), we have achieved our goal:&lt;br /&gt;
 User quota state on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
   Accounting: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Enforcement: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Inode: #131 (1 blocks, 1 extents)&lt;br /&gt;
 Group quota state on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
   Accounting: OFF&lt;br /&gt;
   Enforcement: OFF&lt;br /&gt;
   Inode: #132 (1 blocks, 1 extents)&lt;br /&gt;
 Project quota state on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
   Accounting: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Enforcement: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Inode: #132 (1 blocks, 1 extents)&lt;br /&gt;
 Blocks grace time: [7 days 00:00:30]&lt;br /&gt;
 Inodes grace time: [7 days 00:00:30]&lt;br /&gt;
 Realtime Blocks grace time: [7 days 00:00:30]&lt;br /&gt;
&lt;br /&gt;
=== User Quotas ===&lt;br /&gt;
==== Adding a User Quota ====&lt;br /&gt;
Set a quota of 1 Gigabyte for the user 4000187 (the values are in kilobytes, so 1048576 kilobyte are 1024 megabytes which corresponds to 1 gigabyte):&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1048576k 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Or in bytes:&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1073741824 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Read the quota information for the user 4000187:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
 /dev/mapper/vg--local--01-var                     0          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
If the user has data in the project, that belongs to him, the result will change:&lt;br /&gt;
 /dev/mapper/vg--local--01-var                512000          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
==== Modifiying a User Quota ====&lt;br /&gt;
To modify a users quota, you just set a new quota (limit):&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1048576k 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Read the quota information for the user 4000187:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
 /dev/mapper/vg--local--01-var                     0          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
If the user has data in the project, that belongs to him, the result will change:&lt;br /&gt;
 /dev/mapper/vg--local--01-var                512000          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
==== Removing a User Quota ====&lt;br /&gt;
Removing a quota for a user:&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=0 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
The following command should give you an empty result:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
=== Project (Directory) Quotas ===&lt;br /&gt;
==== Adding a Project (Directory) Quota ====&lt;br /&gt;
The XFS file system additionally allows you to set quotas on individual directory hierarchies in the file system that are known as managed trees. Each managed tree is uniquely identified by a project ID and an optional project name. We&#039;ll use the following values in the examples:&lt;br /&gt;
* project_ID: The uid of the online backup account (4000187).&lt;br /&gt;
* project_name: The uid of the online backup account (4000187). This could be a human readable name.&lt;br /&gt;
* mountpoint: The mountpoint of the xfs-filesystem (/var). See the &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt; entry from above.&lt;br /&gt;
* directory: The directory of the project (187/4000187), starting from the mountpoint of the xfs-filesystem (/var).&lt;br /&gt;
&lt;br /&gt;
Define a unique project ID for the directory hierarchy in the &amp;lt;code&amp;gt;/etc/projects&amp;lt;/code&amp;gt; file (project_ID:mountpoint/directory):&lt;br /&gt;
 echo &amp;quot;4000187:/var/backup/187/4000187/home/4000187&amp;quot; &amp;gt;&amp;gt; /etc/projects&lt;br /&gt;
&lt;br /&gt;
Create an entry in the &amp;lt;code&amp;gt;/etc/projid&amp;lt;/code&amp;gt; file that maps a project name to the project ID (project_name:project_ID):&lt;br /&gt;
 echo &amp;quot;4000187:4000187&amp;quot; &amp;gt;&amp;gt; /etc/projid&lt;br /&gt;
&lt;br /&gt;
Set Project:&lt;br /&gt;
 xfs_quota -x -c &#039;project -s -p /var/backup/187/4000187/home/4000187 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Set Quota (limit) on Project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=1048576k 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Check your Quota (limit)&lt;br /&gt;
 xfs_quota -x -c &#039;quota -p 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Check the Quota:&lt;br /&gt;
* &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt;: increase verbosity in reporting (also dumps zero values).&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt;: suppress the initial header.&lt;br /&gt;
* &amp;lt;code&amp;gt;-p&amp;lt;/code&amp;gt;: display project quota information.&lt;br /&gt;
* &amp;lt;code&amp;gt;-h&amp;lt;/code&amp;gt;: human readable format.&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -p 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
 /dev/mapper/vg--local--01-var                     0          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
If you copied data into the project, the output will look something like:&lt;br /&gt;
 /dev/mapper/vg--local--01-var                512000          0    1048576   00 [--------] /var&lt;br /&gt;
&lt;br /&gt;
To give you an overall view of the whole system:&lt;br /&gt;
 xfs_quota -x -c report /var&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
User quota on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
User ID          Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
root          1024000          0          0     00 [--------]&lt;br /&gt;
4000187             0          0    1048576     00 [--------]&lt;br /&gt;
&lt;br /&gt;
Project quota on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
Project ID       Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
4000187        512000          0    1048576     00 [--------]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modifying a Project (Directory) Quota ====&lt;br /&gt;
To modify a project (directory) quota, you just set an new quota (limit) on the chosen project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=1048576k 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Check your quota (limit)&lt;br /&gt;
 xfs_quota -x -c &#039;quota -p 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
==== Removing a Project (Directory) Quota ====&lt;br /&gt;
Removing a quota from a project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=0 4000187&#039; /var&lt;br /&gt;
&lt;br /&gt;
Chreck the results:&lt;br /&gt;
 xfs_quota -x -c report /var&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
User quota on /var (/dev/mapper/vg--local--01-var)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
User ID          Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
root           512000          0          0     00 [--------]&lt;br /&gt;
4000187             0          0       1024     00 [--------]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the line with the Project ID 4000187 has disappeared:&lt;br /&gt;
 4000187        512000          0    1048576     00 [--------]&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to remove the project from &amp;lt;code&amp;gt;/etc/projects&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/etc/projid&amp;lt;/code&amp;gt;:&lt;br /&gt;
 sed -i -e &#039;/4000187/d&#039; /etc/projects&lt;br /&gt;
 sed -i -e &#039;/4000187/d&#039; /etc/projid&lt;br /&gt;
&lt;br /&gt;
=== Some important notes concerning XFS ===&lt;br /&gt;
# The &#039;&#039;&#039;quotacheck&#039;&#039;&#039; command has no effect on XFS filesystems. The first time quota accounting is turned on (at mount time), XFS does an automatic quotacheck internally; afterwards, the quota system will always be completely consistent until quotas are manually turned off. &lt;br /&gt;
# There is &#039;&#039;&#039;no need for quota file(s)&#039;&#039;&#039; in the root of the XFS filesystem.&lt;br /&gt;
&lt;br /&gt;
== prov-backup-rsnapshot ==&lt;br /&gt;
Install the prov-backup-rsnasphot daemon script using the package manager:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
emerge -va sys-apps/sst-prov-backup-rsnapshot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
If it is the first provisioning module running on this server (very likely) you first have to configure the provisioning daemon (you can skip this step if you have already another provisioning module running on this server)&lt;br /&gt;
&lt;br /&gt;
==== Provisioning global configuration ====&lt;br /&gt;
The global configuration for the provisioning daemon applies to all provisioning modules running on the server. This configuration therefore contains information about the provisioning daemon itself and no information at all about the specific modules. &lt;br /&gt;
 /etc/Provisioning/Global.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Copyright (C) 2012 stepping stone GmbH&lt;br /&gt;
#                    Switzerland&lt;br /&gt;
#                    http://www.stepping-stone.ch&lt;br /&gt;
#                    support@stepping-stone.ch&lt;br /&gt;
#&lt;br /&gt;
# Authors:&lt;br /&gt;
#  Pat Kläy &amp;lt;pat.klaey@stepping-stone.ch&amp;gt;&lt;br /&gt;
#  &lt;br /&gt;
# Licensed under the EUPL, Version 1.1.&lt;br /&gt;
#&lt;br /&gt;
# You may not use this work except in compliance with the&lt;br /&gt;
# Licence.&lt;br /&gt;
# You may obtain a copy of the Licence at:&lt;br /&gt;
#&lt;br /&gt;
# http://www.osor.eu/eupl&lt;br /&gt;
#&lt;br /&gt;
# Unless required by applicable law or agreed to in&lt;br /&gt;
# writing, software distributed under the Licence is&lt;br /&gt;
# distributed on an &amp;quot;AS IS&amp;quot; basis,&lt;br /&gt;
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either&lt;br /&gt;
# express or implied.&lt;br /&gt;
# See the Licence for the specific language governing&lt;br /&gt;
# permissions and limitations under the Licence.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
[Global]&lt;br /&gt;
# If true the script logs every information to the log-file.&lt;br /&gt;
LOG_DEBUG = 0&lt;br /&gt;
&lt;br /&gt;
# If true the script logs additional information to the log-file.&lt;br /&gt;
LOG_INFO = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs warnings to the log-file.&lt;br /&gt;
LOG_WARNING = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs errors to the log-file.&lt;br /&gt;
LOG_ERR = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The number of seconds to wait before retry contacting the backend server during startup.&lt;br /&gt;
SLEEP = 10&lt;br /&gt;
&lt;br /&gt;
# Number of backend server connection retries during startup.&lt;br /&gt;
ATTEMPTS = 3&lt;br /&gt;
&lt;br /&gt;
[Operation Mode]&lt;br /&gt;
# The number of seconds to wait before retry contacting the backend server in case of a service interruptions.&lt;br /&gt;
SLEEP = 30&lt;br /&gt;
&lt;br /&gt;
# Number of backend server connection retries in case of a service interruptions.&lt;br /&gt;
ATTEMPTS = 3&lt;br /&gt;
&lt;br /&gt;
[Mail]&lt;br /&gt;
# Error messages are sent to the mail configured below.&lt;br /&gt;
SENDTO = &amp;lt;YOUR-MAIL-ADDRESS&amp;gt;&lt;br /&gt;
HOST = mail.stepping-stone.ch&lt;br /&gt;
PORT = 587&lt;br /&gt;
USERNAME = &amp;lt;YOUR-NOTIFICATION-EMAIL-ADDRESS&amp;gt;&lt;br /&gt;
PASSWORD = &amp;lt;PASSWORD&amp;gt;&lt;br /&gt;
FROMNAME = Provisioning daemon&lt;br /&gt;
CA_DIR = /etc/ssl/certs&lt;br /&gt;
SSL = starttls&lt;br /&gt;
AUTH_METHOD = LOGIN&lt;br /&gt;
&lt;br /&gt;
# Additionally, you can be informed about creation, modification and deletion of services.&lt;br /&gt;
WANTINFOMAIL = 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Provisioning daemon prov-backup-rsnapshot module ====&lt;br /&gt;
The module specific configuration is located in /etc/Provisioning/&amp;lt;Service&amp;gt;/&amp;lt;Type&amp;gt;.conf. In the case of the prov-backup-rsnapshot module this is &amp;lt;code&amp;gt;/etc/Provisioning/Backup/Rsnapshot.conf&amp;lt;/code&amp;gt;. (Note: Comments starting with /* are not in the configuration file, they are only in the wiki to add some additional information)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Copyright (C) 2013 stepping stone GmbH&lt;br /&gt;
#                    Switzerland&lt;br /&gt;
#                    http://www.stepping-stone.ch&lt;br /&gt;
#                    support@stepping-stone.ch&lt;br /&gt;
#&lt;br /&gt;
# Authors:&lt;br /&gt;
#  Pat Kläy &amp;lt;pat.klaey@stepping-stone.ch&amp;gt;&lt;br /&gt;
#  &lt;br /&gt;
# Licensed under the EUPL, Version 1.1.&lt;br /&gt;
#&lt;br /&gt;
# You may not use this work except in compliance with the&lt;br /&gt;
# Licence.&lt;br /&gt;
# You may obtain a copy of the Licence at:&lt;br /&gt;
#&lt;br /&gt;
# http://www.osor.eu/eupl&lt;br /&gt;
#&lt;br /&gt;
# Unless required by applicable law or agreed to in&lt;br /&gt;
# writing, software distributed under the Licence is&lt;br /&gt;
# distributed on an &amp;quot;AS IS&amp;quot; basis,&lt;br /&gt;
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either&lt;br /&gt;
# express or implied.&lt;br /&gt;
# See the Licence for the specific language governing&lt;br /&gt;
# permissions and limitations under the Licence.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
/* If you want, you can override the log information from the global configuration file this might be useful for debugging */&lt;br /&gt;
[Global]&lt;br /&gt;
# If true the script logs every information to the log-file.&lt;br /&gt;
LOG_DEBUG = 1&lt;br /&gt;
&lt;br /&gt;
# If true the script logs additional information to the log-file.&lt;br /&gt;
LOG_INFO = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs warnings to the log-file.&lt;br /&gt;
LOG_WARNING = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs errors to the log-file.&lt;br /&gt;
LOG_ERR = 1&lt;br /&gt;
&lt;br /&gt;
/* Specify the hosts fully qualified domain name. This name will be used to perform some checks and also appear in the information and error mails */&lt;br /&gt;
ENVIRONMENT = &amp;lt;FQDN&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
[Database]&lt;br /&gt;
BACKEND = LDAP&lt;br /&gt;
SERVER = ldaps://ldapm.tombstone.org&lt;br /&gt;
PORT = 636&lt;br /&gt;
ADMIN_USER = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
ADMIN_PASSWORD = &amp;lt;PASSWORD&amp;gt;&lt;br /&gt;
SERVICE_SUBTREE = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
COOKIE_FILE = /etc/Provisioning/Backup/rsnapshot.cookie&lt;br /&gt;
DEFAULT_COOKIE = rid=001,csn=&lt;br /&gt;
SEARCH_FILTER = (&amp;amp;(entryCSN&amp;gt;=%entryCSN%)(sstProvisioningState=0))&lt;br /&gt;
&lt;br /&gt;
/* Specifies the service itself. As it is the prov-backup-rsnapshot module, the SERVICE is &amp;quot;Backup&amp;quot; and the TYPE is &amp;quot;Rsnapshot&amp;quot;.&lt;br /&gt;
 * The MODUS is as usual selfcare and the TRANSPORTAPI is LocalCLI. This is because the daemon is running on the same host as the&lt;br /&gt;
 * backup accounts are provisioned and the commands can be executed on this host using the cli.&lt;br /&gt;
 * For more information about MODUS and TRANSPORTAPI see https://int.stepping-stone.ch/wiki/provisioning.pl#Service_Konfiguration&lt;br /&gt;
 */&lt;br /&gt;
[Service]&lt;br /&gt;
MODUS = selfcare&lt;br /&gt;
TRANSPORTAPI = LocalCLI&lt;br /&gt;
SERVICE = Backup&lt;br /&gt;
TYPE = Rsnapshot&lt;br /&gt;
&lt;br /&gt;
SYSLOG = prov-backup-rsnapshot&lt;br /&gt;
&lt;br /&gt;
/* For the TRANSPORTAPI LocalCLI there is no gateway required because there is no connection to establish. So set HOST, USER and&lt;br /&gt;
 * DSA_FILE to whatever you want. Don&#039;t leave it blank, otherwise the provisioning daemon would log some error messages saying&lt;br /&gt;
 * these attributes are empty &lt;br /&gt;
 */&lt;br /&gt;
[Gateway]&lt;br /&gt;
HOST = localhost&lt;br /&gt;
USER = provisioning&lt;br /&gt;
DSA_FILE = none&lt;br /&gt;
&lt;br /&gt;
/* Information about the backup itself (how to setup everything). Note that the %uid% int the RSNAPSHOT_CONFIG_FILE parameter will&lt;br /&gt;
 * be replaced by the accounts UID. The script CREATE_CHROOT_CMD was installed with the prov-backup-rsnapshot module, so do not&lt;br /&gt;
 * change this parameter. The quota parameters (SET_QUOTA_CMD, MOUNTPOINT, QUOTA_FILE, PROJECTS_FILE and PROJID_FILE) represent &lt;br /&gt;
 * the quota setup as described on http://wiki.stoney-cloud.org/index.php/stoney_backup:_Server_set-up#Quota. If you followed this&lt;br /&gt;
 * manual, you can copy-paste them into your configuration file, otherwise adapt them according to your quota setup.&lt;br /&gt;
 */&lt;br /&gt;
[Backup]&lt;br /&gt;
RSNAPSHOT_CONFIG_FILE = /etc/rsnapshot/rsnapshot.conf.%uid%&lt;br /&gt;
SET_QUOTA_CMD = /usr/sbin/xfs_quota&lt;br /&gt;
CREATE_CHROOT_CMD = /usr/libexec/createBackupDirectory.sh&lt;br /&gt;
MOUNTPOINT = /var&lt;br /&gt;
QUOTA_FILE = /etc/backupSize&lt;br /&gt;
PROJECTS_FILE = /etc/projects&lt;br /&gt;
PROJID_FILE = /etc/projid&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== backup utils ==&lt;br /&gt;
Install the backup utils (multiple scripts which help you to manage and monitor your backup server and backup accounts) using the package manager. For more information about the scripts please see the [[stoney_backup:_Server_set-up#stoney_backup_Service_Software | stoney backup Service Software]] section. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
emerge -va sys-apps/sst-backup-utils&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
Please refer to the configuration sections for the different scripts in [[stoney_backup:_Server_set-up#stoney_backup_Service_Software | stoney backup Service Software]].&lt;br /&gt;
&lt;br /&gt;
= stoney backup Service Software =&lt;br /&gt;
The stoney backup Service comes along with multiple scripts which help you to manage and monitor your backup server and accounts: &lt;br /&gt;
&lt;br /&gt;
We use rsnapshot - remote filesystem snapshot utility for the actual snapshots and a handful of wrapper scripts, that do things like:&lt;br /&gt;
* Read the users and their settings from the LDAP directory.&lt;br /&gt;
* Execute rsnapshot according to the users settings.&lt;br /&gt;
* Write the backup quotas backup (incoming), iterations (.snapshots) and free space to the users local backupSize file and update the LDAP directory.&lt;br /&gt;
* Inform the reseller, customer or user (depending on the settings in the LDAP directory) via mail, if the quota limit has been reached.&lt;br /&gt;
* Depending on the users settings in the LDAP directory, warning mail will be sent to the reseller, customer or user, if a backup was not executed on time.&lt;br /&gt;
&lt;br /&gt;
== writeAccountSize.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/writeAccountSize.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package and does the following:&lt;br /&gt;
* Calculates the used disk space (backup and iterations) for a given account and writes the corresponding values to:&lt;br /&gt;
*# The LDAP backend (used by the selfcare webinterface to display quota information):&lt;br /&gt;
*#* Backup space used (sstBackupSize): The disk space the account uses for the backup itself (disk space used under the &amp;lt;code&amp;gt;incoming&amp;lt;/code&amp;gt; folder of the users chroot-home directory)&lt;br /&gt;
*#* Snapshot space used (sstIncrementSize): The disk space the account uses for the iterations (disk space under the &amp;lt;code&amp;gt;.snapshot&amp;lt;/code&amp;gt; folder of the users chroot-home directory)&lt;br /&gt;
*# The file &amp;lt;code&amp;gt;etc/backupSize&amp;lt;/code&amp;gt; of the accounts chroot (used by the Sepiola Online Backup client):&lt;br /&gt;
* Checks if the user and/or reseller must be notified that there is no more disk space left for the given account&lt;br /&gt;
** Checks if the notification flag was passed, if not no notification will be triggered&lt;br /&gt;
** Calculates the used disk space (backup and iterations) in percentage&lt;br /&gt;
** Reads the notification threshold value from the LDAP backed&lt;br /&gt;
** If the disk space used (in percentage) is bigger than the value retrieved from the LDAP backend start the [[stoney_cloud:_Notification_Architecture | notification]] process with&lt;br /&gt;
*** Product: Given account UID&lt;br /&gt;
*** Service: Backup&lt;br /&gt;
*** Problem: Quota&lt;br /&gt;
* Pod documentation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    writeAccountSize.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This Script gets quota information from filesystem, size of incoming and&lt;br /&gt;
    snapshots directories, write the data to a file and the LDAP backend and&lt;br /&gt;
    sends an e-mail message for each account that is over quota to users&lt;br /&gt;
    e-mail address (from ldap directory) if notification flag is passed.&lt;br /&gt;
&lt;br /&gt;
    The configuration file for this script is stored in the backup-utils&lt;br /&gt;
    configuration directory (/etc/backup-utils/) and is called&lt;br /&gt;
    writeAccountSize.conf.&lt;br /&gt;
&lt;br /&gt;
    The script needs access to the quota program to get quota information.&lt;br /&gt;
    The script needs ldap access to get users e-mail address and quota&lt;br /&gt;
    information. The script uses syslog for logging purposes.&lt;br /&gt;
&lt;br /&gt;
    Command Line Interface (CLI) parameters:&lt;br /&gt;
&lt;br /&gt;
    -C configfile&lt;br /&gt;
        The configuration file.&lt;br /&gt;
&lt;br /&gt;
    -U uid&lt;br /&gt;
        The user id.&lt;br /&gt;
&lt;br /&gt;
    -n notification&lt;br /&gt;
        Start notification process if quota threshold is reached&lt;br /&gt;
&lt;br /&gt;
    -d debug&lt;br /&gt;
        Turns the debug mode on.&lt;br /&gt;
&lt;br /&gt;
    -h help&lt;br /&gt;
        This online help.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    writeAccountSize.pl -U uid [-C configuration file ] []-d debug] [-h&lt;br /&gt;
    help] [-n]&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2009-04-16 michael.rhyner@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2009-04-16 michael.rhyner@stepping-stone.ch created&lt;br /&gt;
    2009-04-30 michael.rhyner@stepping-stone.ch changed position based quota&lt;br /&gt;
    output parsing with correctly parsed elements&lt;br /&gt;
    2009-06-15 michael.rhyner@stepping-stone.ch added over quota check and&lt;br /&gt;
    sending e-mail&lt;br /&gt;
    2009-06-16 michael.rhyner@stepping-stone.ch renamed script and make it&lt;br /&gt;
    more general usable (e.g. for online backup, online storage, ...)&lt;br /&gt;
    2009-06-17 michael.rhyner@stepping-stone.ch changed mail message to read&lt;br /&gt;
    from a text file instead from configuration parameter&lt;br /&gt;
    2009-06-18 michael.rhyner@stepping-stone.ch corrected wrong regex to&lt;br /&gt;
    weed out the asterisk (*) in getQuotaSize&lt;br /&gt;
    2009-06-19 michael.rhyner@stepping-stone.ch corrected wrong evaluation&lt;br /&gt;
    success from subroutines and avoid message output when not in debug mode&lt;br /&gt;
    2009-06-22 michael.rhyner@stepping-stone.ch getQuotaSize: return&lt;br /&gt;
    immediately if no quota was set&lt;br /&gt;
    2009-06-24 michael.rhyner@stepping-stone.ch alert when used certain&lt;br /&gt;
    percentge of allowed space instead of more than allowed space&lt;br /&gt;
    2009-06-26 michael.rhyner@stepping-stone.ch values are presented in&lt;br /&gt;
    Gigabytes within notification message&lt;br /&gt;
    2009-07-23 michael.rhyner@stepping-stone.ch corrected wrong syslog&lt;br /&gt;
    severities for errors&lt;br /&gt;
    2009-07-24 michael.rhyner@stepping-stone.ch made e-mail address&lt;br /&gt;
    available within message body&lt;br /&gt;
    2013-08-19 pat.klaey@stepping-stone.ch write quota values also to the&lt;br /&gt;
    LDAP&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporate code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Config::IniFiles;&lt;br /&gt;
        Getopt::Std;&lt;br /&gt;
        Sys::Syslog;&lt;br /&gt;
        File::Basename;&lt;br /&gt;
        Text::Template;&lt;br /&gt;
        POSIX;&lt;br /&gt;
        Notification;&lt;br /&gt;
        PerlUtil::Logging;&lt;br /&gt;
        PerlUtil::LDAPUtil;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 /etc/backup-utils/writeAccountSize.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Global]&lt;br /&gt;
INCOMING_DIRECTORY = /incoming&lt;br /&gt;
ACCOUNT_SIZE_FILE = /etc/backupSize&lt;br /&gt;
SNAPSHOTS = 1&lt;br /&gt;
&lt;br /&gt;
[Syslog]&lt;br /&gt;
SYSLOG = rsnapshot&lt;br /&gt;
&lt;br /&gt;
[Directory]&lt;br /&gt;
LDAP_SERVER = ldaps://ldapm.tombstone.ch&lt;br /&gt;
LDAP_PORT = 636&lt;br /&gt;
LDAP_BIND_DN = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
LDAP_BIND_PW = &amp;lt;password&amp;gt;&lt;br /&gt;
LDAP_BASE_DN = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
LDAP_PERSON_BASE = ou=people,dc=stoney-cloud,dc=org&lt;br /&gt;
LDAP_RESELLER_BASE = ou=reseller,ou=configuration,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
LDAP_EMAIL_ATTRIBUTE = mail&lt;br /&gt;
&lt;br /&gt;
[Notification]&lt;br /&gt;
EMAIL_SENDER = stepping stone GmbH Supprt &amp;lt;support@stepping-stone.ch&amp;gt;&lt;br /&gt;
EMAIL_ALERT_THRESHOLD = 85&lt;br /&gt;
&lt;br /&gt;
Salutation_Default_de-CH = Liebe Kundin / Lieber Kunde&lt;br /&gt;
Salutation_m_de-CH = Sehr geehrter Herr&lt;br /&gt;
Salutation_f_de-CH = Sehr geehrte Frau&lt;br /&gt;
Salutation_Default_en-GB = Dear customer&lt;br /&gt;
Salutation_m_en-GB = Dear Mr.&lt;br /&gt;
Salutation_f_en-GB = Dear Mrs.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
 /usr/libexec/backup-utils/writeAccountSize.pl -U 4000080 -d&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Debug modus was turned on&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersHomeDirectory: $localUsersHomeDirectory: /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersHomeDirectory: The $localUsersHomeDirectory /var/backup/080/4000080/home/4000080 exists&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersHomeDirectory:   /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersIncomingDirectory: /incoming&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localIncomingPath:           /var/backup/080/4000080/home/4000080/incoming&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: The $localIncomingPath /var/backup/080/4000080/home/4000080/incoming exists&lt;br /&gt;
Total Quota: 1048576 kilobytes&lt;br /&gt;
Total used Space: 0 kilobytes&lt;br /&gt;
Incoming Size: 0 kilobytes&lt;br /&gt;
Debug sub getSnapshotsSize: $localUsedQuota:   0&lt;br /&gt;
Debug sub getSnapshotsSize: $localSnapshotsSize:   0&lt;br /&gt;
Debug writeAccountSize: Working on /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
Debug: wrote 1024 0 0 to /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstBackupSize =&amp;gt; 0&lt;br /&gt;
&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstIncrementSize =&amp;gt; 0&lt;br /&gt;
&lt;br /&gt;
Alert Threshold: 85 %&lt;br /&gt;
Calculated value: 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now write some data (200 megaytes in this example) into the users incoming directory and then execute the script again:&lt;br /&gt;
 dd if=/dev/zero of=/var/backup/080/4000080/home/4000080/incoming/test.zeros bs=1024k count=200&lt;br /&gt;
 chown 4000080:4000080 /var/backup/080/4000080/home/4000080/incoming/test.zeros&lt;br /&gt;
 /usr/libexec/backup-utils/writeAccountSize.pl -U 4000080 -d&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Debug modus was turned on&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersHomeDirectory: $localUsersHomeDirectory: /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersHomeDirectory: The $localUsersHomeDirectory /var/backup/080/4000080/home/4000080 exists&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersHomeDirectory:   /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersIncomingDirectory: /incoming&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localIncomingPath:           /var/backup/080/4000080/home/4000080/incoming&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: The $localIncomingPath /var/backup/080/4000080/home/4000080/incoming exists&lt;br /&gt;
Total Quota: 1048576 kilobytes&lt;br /&gt;
Total used Space: 204800 kilobytes&lt;br /&gt;
Incoming Size: 204800 kilobytes&lt;br /&gt;
Debug sub getSnapshotsSize: $localUsedQuota:   204800&lt;br /&gt;
Debug sub getSnapshotsSize: $localSnapshotsSize:   0&lt;br /&gt;
Debug writeAccountSize: Working on /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
Debug: wrote 1024 200 0 to /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstBackupSize =&amp;gt; 209715200&lt;br /&gt;
&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstIncrementSize =&amp;gt; 0&lt;br /&gt;
&lt;br /&gt;
Alert Threshold: 85 %&lt;br /&gt;
Calculated value: 19.53125&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Everything seems to be working fine!&lt;br /&gt;
&lt;br /&gt;
== snapshot.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/snapshot.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package and does the following:&lt;br /&gt;
* Read interval parameter value passed&lt;br /&gt;
** The interval parameter value can be daily, weekly, monthly (or yearly)&lt;br /&gt;
* Find all backup active accounts for which the rsnapshot command must be executed (depending on the given interval)&lt;br /&gt;
** Filter to find these accounts: &amp;lt;code&amp;gt;(&amp;amp;(sstBackupInterval&amp;lt;INTERVAL&amp;gt;=*)(sstIsActive=TRUE))&amp;lt;/code&amp;gt; for example for the daily rsnapshot the filter is &amp;lt;code&amp;gt;(&amp;amp;(sstBackupIntervalDaily=*)(sstIsActive=TRUE))&amp;lt;/code&amp;gt;&lt;br /&gt;
*** In other words this means: Get me all acounts that have for &amp;lt;code&amp;gt;sstBackupInterval&amp;lt;INTERVAL&amp;gt;&amp;lt;/code&amp;gt; a value defined AND &amp;lt;code&amp;gt;sstIsActive&amp;lt;/code&amp;gt; is set to &amp;quot;TRUE&amp;quot;&lt;br /&gt;
* According to the interval given and the account UID calculate the rsnapshot command for all these accounts&lt;br /&gt;
** For example&lt;br /&gt;
*** Account UID: 4000000 &lt;br /&gt;
*** Interval: daily&lt;br /&gt;
*** Resulting rsnapshot command: /usr/bin/nice -n 19 /usr/bin/rsnapshot  -c /etc/rsnapshot/rsnapshot.conf.4000000 daily (if you use the [[#snapshot.pl_Configuration | configuration]] below)&lt;br /&gt;
* Execute all these commands&lt;br /&gt;
** Use controlled parallel execution, you can specify how many commands can be executed in parallel (see [[#snapshot.pl_Configuration | configuration]] below)&lt;br /&gt;
* Pod documentation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    snapshot.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script gets all active online backup accounts from the LDAP backend&lt;br /&gt;
    for which the rsnapshot process for the given interval must be executed.&lt;br /&gt;
    According to these accounts and the given interval, the commands to be&lt;br /&gt;
    executed are generated and finally executed. The commands can be&lt;br /&gt;
    executed in parallel, however there is a limit defined in the&lt;br /&gt;
    configuration file which limits the amount of parallel running&lt;br /&gt;
    processes.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    ./snapshot.pl --interval interval [--debug] [--help]&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
    --interval/-i interval&lt;br /&gt;
        Specifies the rsnapshot interval (can be hourly, daily, weekly,&lt;br /&gt;
        monthly or yearly)&lt;br /&gt;
&lt;br /&gt;
    --debug/-d&lt;br /&gt;
        Turns on debug mode&lt;br /&gt;
&lt;br /&gt;
    --help/-h&lt;br /&gt;
        Shows this help&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2012-03-19 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2012-03-19 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporated code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Getopt::Long;&lt;br /&gt;
        Sys::Syslog;&lt;br /&gt;
        PerlUtil::Logging;&lt;br /&gt;
        PerlUtil::LDAPUtil;&lt;br /&gt;
        File::Basename;&lt;br /&gt;
        Parallel::ForkManager;&lt;br /&gt;
        Time::Stopwatch;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
There are two things to do in this step: &lt;br /&gt;
* Configure the rsnapshot root directory&lt;br /&gt;
* Configure the snapshot.pl script itself&lt;br /&gt;
&lt;br /&gt;
==== rsnaphot configuration directory ====&lt;br /&gt;
The users individual rsnapshot configurations are stored under &amp;lt;code&amp;gt;/etc/rsnapshot&amp;lt;/code&amp;gt;. Please make sure, that the directory exists:&lt;br /&gt;
 ls -al /etc | grep rsnapshot&lt;br /&gt;
&lt;br /&gt;
 drwx------  2 root   root      64 30. Aug 20:20 rsnapshot&lt;br /&gt;
&lt;br /&gt;
If not, create it:&lt;br /&gt;
 mkdir /etc/rsnapshot&lt;br /&gt;
 chmod 700 /etc/rsnapshot&lt;br /&gt;
&lt;br /&gt;
==== snapshot.pl Configuration ====&lt;br /&gt;
The snapshot.pl script is responsible for the execution of rsnapshot according to the users settings.&lt;br /&gt;
 /etc/backup-utils/snapshot.conf &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[General]&lt;br /&gt;
MaxParallelProcesses = 5&lt;br /&gt;
Rsnapshot_command = /usr/bin/nice -n 19 /usr/bin/rsnapshot  -c /etc/rsnapshot/rsnapshot.conf.%uid% %interval%&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
Host = ldaps://ldapm.tombstone.ch&lt;br /&gt;
Port = 636&lt;br /&gt;
User = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
Password = &amp;lt;Password&amp;gt;&lt;br /&gt;
CA_Path = /etc/ssl/certs&lt;br /&gt;
Accounts_Base = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Legend: At runtime the following placeholders are replaced as follows&lt;br /&gt;
* &#039;&#039;&#039;%uid%&#039;&#039;&#039;: The backup account and login uid as a numeric number. For example: 4000205.&lt;br /&gt;
* &#039;&#039;&#039;%interval%&#039;&#039;&#039;: The backup level to be executed. Possible values are hourly, daily, weekly, monthly and yearly.&lt;br /&gt;
&lt;br /&gt;
=== Tests ===&lt;br /&gt;
Before adding the necessary cronjob entries, we need to make sure, that we&#039;ve configured the snapshot.pl script correctly:&lt;br /&gt;
 /usr/libexec/backup-utils/snapshot.pl --interval daily -d&lt;br /&gt;
&lt;br /&gt;
If everything worked as planned, you should receive feedback looking roughly like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
INFO:  Starting rsnapshot for interval daily with maximum 5 parallel processes&lt;br /&gt;
&lt;br /&gt;
INFO:  Executing snapshot for 4000080&lt;br /&gt;
&lt;br /&gt;
INFO:  Executing snapshot for 4000079&lt;br /&gt;
&lt;br /&gt;
INFO:  Snapshot process for 4000079 finished in 0.18 seconds with status 0&lt;br /&gt;
&lt;br /&gt;
INFO:  Snapshot process for 4000080 finished in 0.19 seconds with status 0&lt;br /&gt;
&lt;br /&gt;
INFO:  rsnapshot for all backups done. Took 0.24 seconds&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Just to make sure, that everything did work out fine, execute &amp;lt;code&amp;gt;writeAccountSize.pl&amp;lt;/code&amp;gt; again:&lt;br /&gt;
 /usr/libexec/backup-utils/writeAccountSize.pl -U 4000080 -d&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Debug modus was turned on&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersHomeDirectory: $localUsersHomeDirectory: /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersHomeDirectory: The $localUsersHomeDirectory /var/backup/080/4000080/home/4000080 exists&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersHomeDirectory:   /var/backup/080/4000080/home/4000080&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localUsersIncomingDirectory: /incoming&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: $localIncomingPath:           /var/backup/080/4000080/home/4000080/incoming&lt;br /&gt;
&lt;br /&gt;
Debug sub checkUsersIncomingDirectory: The $localIncomingPath /var/backup/080/4000080/home/4000080/incoming exists&lt;br /&gt;
Total Quota: 1048576 kilobytes&lt;br /&gt;
Total used Space: 409600 kilobytes&lt;br /&gt;
Incoming Size: 204800 kilobytes&lt;br /&gt;
Debug sub getSnapshotsSize: $localUsedQuota:   409600&lt;br /&gt;
Debug sub getSnapshotsSize: $localSnapshotsSize:   204800&lt;br /&gt;
Debug writeAccountSize: Working on /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
Debug: wrote 1024 200 200 to /var/backup/080/4000080/etc/backupSize&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstBackupSize =&amp;gt; 209715200&lt;br /&gt;
&lt;br /&gt;
DEBUG:  Successfully executed the following modifications for entry uid=4000080,ou=accounts,ou=backup,ou=services,o=stepping-stone,c=ch: sstIncrementSize =&amp;gt; 209715200&lt;br /&gt;
&lt;br /&gt;
Alert Threshold: 85 %&lt;br /&gt;
Calculated value: 39.0625&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the total used space has risen to 39.0625.&lt;br /&gt;
&lt;br /&gt;
=== Cronjobs ===&lt;br /&gt;
After making sure, that everything worked as planned, you can update your crontab entry:&lt;br /&gt;
 crontab -e&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
# Rsnapshot for all users&lt;br /&gt;
30 22 * * * /usr/libexec/backup-utils/snapshot.pl --interval daily&lt;br /&gt;
15 22 * * sun /usr/libexec/backup-utils/snapshot.pl --interval weekly&lt;br /&gt;
00 22 1 * * /usr/libexec/backup-utils/snapshot.pl --interval monthly&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* TBD: Maybe this is not optimal if there is a lot of data to rotate. In this case, it might be that for example weekly and daily snapshot both run at the same time what might lead to strange results. &lt;br /&gt;
* Workarounds: &lt;br /&gt;
** Simple/short version: Instead one could create another wrapper script which is called everyday and does some simple logic:&lt;br /&gt;
** Is today the first day of a month? &lt;br /&gt;
*** Yes: Is today sunday? &lt;br /&gt;
**** Yes: Execute monthly then weekly then daily rsnapshots using the snapshot.pl script (but wait for each interval to finish before starting the next)&lt;br /&gt;
**** No: Execute monthly then daily rsnapshots using the snapshot.pl script (but wait for monthly interval to finish before starting the daily)&lt;br /&gt;
*** No: Is today sunday?&lt;br /&gt;
**** Yes: Execute weekly then daily rsnapshots using the snapshot.pl script (but wait for weekly interval to finish before starting the daily)&lt;br /&gt;
**** No: Execute daily rsnapshots using the snapshot.pl script&lt;br /&gt;
** Complex/long version: Adapt the snapshot.pl script and call it every day without interval parameter. The script does the logic described above.&lt;br /&gt;
** Complex/short version for weekly/daily: Always run the daily after the weekly and set the cronjoby to mon-sat and sun&lt;br /&gt;
This avoids the above mentioned collision&lt;br /&gt;
&lt;br /&gt;
== scheduleWarning.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/scheduleWarning.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package and does the following:&lt;br /&gt;
* The basic task of this script is simple: For the given account&lt;br /&gt;
** Check if the planned backups were started&lt;br /&gt;
*** If not, start the [[stoney_cloud:_Notification_Architecture | notification]] process with&lt;br /&gt;
**** Product: Given account UID&lt;br /&gt;
**** Service: Backup&lt;br /&gt;
**** Problem: Schedule &lt;br /&gt;
** Check if the planned backups finished successfully&lt;br /&gt;
*** If not, start the [[stoney_cloud:_Notification_Architecture | notification]] process with&lt;br /&gt;
**** Product: Given account UID&lt;br /&gt;
**** Service: Backup&lt;br /&gt;
**** Problem: Unsuccessful&lt;br /&gt;
&lt;br /&gt;
As the backup clients distributed by stepping stone GmbH upload metadata XML before (scheduling information and start time) and after (end time and backup status) the actual backup, the scheduleWarning.pl script is able to verify whether or not a planned backup has been executed and whether or not the backup was successful. &lt;br /&gt;
&lt;br /&gt;
* Pod documentation&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    scheduleWarning.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script tests whether a planed backup was successful or not. There&lt;br /&gt;
    are two different typs of failure.&lt;br /&gt;
&lt;br /&gt;
    1. The Backup did not start&lt;br /&gt;
        The first type of error is that a backup is scheduled for YYYY-MM-DD&lt;br /&gt;
        at HH:MM, but the backup don&#039;t start at this specified time. A&lt;br /&gt;
        possible reason could be that the computer was shut down.&lt;br /&gt;
&lt;br /&gt;
    2.The backup was not successful&lt;br /&gt;
        The second type of error is that a backup started as scheduled but&lt;br /&gt;
        did not finish successfully. There are different reasons for this&lt;br /&gt;
        error.&lt;br /&gt;
&lt;br /&gt;
    If a backup wasn&#039;t successful the script checks which type of error&lt;br /&gt;
    occured. It reads the XML files which are stored on the server and&lt;br /&gt;
    compares the given information. If the error is detected, the script&lt;br /&gt;
    stats the norification process with the information of the error.&lt;br /&gt;
&lt;br /&gt;
    If a user has more than one computer backed-up, the script tests one&lt;br /&gt;
    computer after the other. The mail(s) sent by the programm also&lt;br /&gt;
    contain(s) the information which computer is affected.&lt;br /&gt;
&lt;br /&gt;
OPTION&lt;br /&gt;
    -U uid&lt;br /&gt;
        The -U option is required to run the script, it indicates for which&lt;br /&gt;
        uid the script is executed.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    scheduleWarning.pl [-U user]&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2010-04-14 created Pat Kläy &amp;lt;pat.klaey@stepping-stone.ch&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2010-04-14 v0.01, created pkl&lt;br /&gt;
    2010-08-24 v0.02, modified pkl&lt;br /&gt;
        New using Net::SMTP::TLS to send mails&lt;br /&gt;
&lt;br /&gt;
    2013-09-13 v0.03, modified pat.klaey@stepping-stone.ch&lt;br /&gt;
        Changes to use the script with the new backup infrastructure (read&lt;br /&gt;
        more information from LDAP, use Notification lib to send mails)&lt;br /&gt;
&lt;br /&gt;
USES&lt;br /&gt;
    strict;&lt;br /&gt;
    warnings;&lt;br /&gt;
    XML::Simple;&lt;br /&gt;
    Config::IniFiles;&lt;br /&gt;
    XML::Validator::Schema;&lt;br /&gt;
    Date::Calc qw(:all);&lt;br /&gt;
    Date::Manip;&lt;br /&gt;
    Schedule::Cron::Events;&lt;br /&gt;
    DateTime::Format::Strptime;&lt;br /&gt;
    Sys::Syslog;&lt;br /&gt;
    XML::SAX::ParserFactory;&lt;br /&gt;
    Getopt::Std;&lt;br /&gt;
    MIME::Base64;&lt;br /&gt;
    Authen::SASL;&lt;br /&gt;
    Net::LDAPS;&lt;br /&gt;
    Net::SMTP::TLS;&lt;br /&gt;
    Cwd &#039;abs_path&#039;;&lt;br /&gt;
    PerlUtil::Logging;&lt;br /&gt;
    PerlUtil::LDAPUtil;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 /etc/backup-utils/scheduleWarning.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Backup]&lt;br /&gt;
CHROOT_DIRECTORY = /var/backup/%lastthree%/%user%&lt;br /&gt;
&lt;br /&gt;
[XML]&lt;br /&gt;
SCHEDULE_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/scheduler.xml&lt;br /&gt;
SCHEDULE_XSD = /etc/backup-utils/schema/scheduler_schema.xsd&lt;br /&gt;
BACKUP_ENDED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupEnded.xml&lt;br /&gt;
BACKUP_ENDED_XSD = /etc/backup-utils/schema/backupended_schema.xsd&lt;br /&gt;
BACKUP_STARTED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupStarted.xml&lt;br /&gt;
BACKUP_STARTED_XSD = /etc/backup-utils/schema/backupstarted_schema.xsd&lt;br /&gt;
&lt;br /&gt;
[TEMPLATE]&lt;br /&gt;
Salutation_Default_de-CH = Liebe Kundin / Lieber Kunde&lt;br /&gt;
Salutation_m_de-CH = Sehr geehrter Herr&lt;br /&gt;
Salutation_f_de-CH = Sehr geehrte Frau&lt;br /&gt;
Salutation_Default_en-GB = Dear customer&lt;br /&gt;
Salutation_m_en-GB = Dear Mr.&lt;br /&gt;
Salutation_f_en-GB = Dear Mrs.&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
&lt;br /&gt;
SERVER = ldaps://ldapm.tombstone.ch&lt;br /&gt;
PORT = 636&lt;br /&gt;
DEBUG = 1&lt;br /&gt;
&lt;br /&gt;
ADMIN_DN = cn=Manager,dc=stoney-cloud,dc=org &lt;br /&gt;
ADMIN_PASSWORD = &amp;lt;Password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
BACKUP_BASE = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
PEOPLE_BASE = ou=people,dc=stoney-cloud,dc=org&lt;br /&gt;
RESELLER_BASE = ou=reseller,ou=configuration,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
SCOPE = sub&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== checkBackups.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/writeDate.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package. It is a wrapper around the above mentioned &amp;lt;code&amp;gt;writeAccountSize.pl&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scheduleWarning.pl&amp;lt;/code&amp;gt; scripts (if you configure it accordingly).&lt;br /&gt;
* As mentioned the script is a wrapper for calling the quota and scheduler information scripts:&lt;br /&gt;
** It gets all active backup accounts from the LDAP directory&lt;br /&gt;
** According to the CLI parameters passed it calles for all these accounts:&lt;br /&gt;
*** The quota checking script (this script can be defined in the configuration file, see [[stoney_backup:_Server_set-up#Configuration_6 | configuration]] section below)&lt;br /&gt;
*** The scheduler checking script (this script can be defined in the configuration file, see [[stoney_backup:_Server_set-up#Configuration_6 | configuration]] section below)&lt;br /&gt;
* Pod documentation: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    checkBackups.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script processes all active backup accounts and checks (according&lt;br /&gt;
    to the command line options) the quota and/or the scheduled backups for&lt;br /&gt;
    the given accounts.&lt;br /&gt;
&lt;br /&gt;
    The script uses syslog for logging purposes.&lt;br /&gt;
&lt;br /&gt;
    Command Line Interface (CLI) parameters:&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
    --schedule/-s&lt;br /&gt;
        Checks schedule information by calling the defined script&lt;br /&gt;
&lt;br /&gt;
    --quota/-s&lt;br /&gt;
        Checks the quota values by calling the defined script&lt;br /&gt;
&lt;br /&gt;
    --notify/-n&lt;br /&gt;
        Passes the notify flag to the called scripts&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    ./checkBackups.pl [--quota] [--schedule] [--notify]&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --quota&lt;br /&gt;
        Checks and writes the quota for all active backup accounts. The user&lt;br /&gt;
        and/or reseller will NOT be informed if any quota threshold is&lt;br /&gt;
        reached&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --quota --notify&lt;br /&gt;
        Checks and writes the quota for all active backup accounts. The user&lt;br /&gt;
        and/or reseller will be informed if any quota threshold is reached.&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --schedule&lt;br /&gt;
        Checkes all active backup account if the scheduled backup was&lt;br /&gt;
        executed and successful. The --schedule option will allways trigger&lt;br /&gt;
        a notification mail to the user and/or reseller.&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --schedule --quota&lt;br /&gt;
        Checks both, quota and schedule, for all active backup accounts.&lt;br /&gt;
        Only schedule will trigger notification mails.&lt;br /&gt;
&lt;br /&gt;
    ./checkBackups.pl --schedule --quota --notify&lt;br /&gt;
        Checks both, quota and schedule, for all active backup accounts.&lt;br /&gt;
        Both, quota and schedule, will trigger notification mails.&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2013-09-17 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2013-09-17 pat.klaey@stepping-stone.ch created&lt;br /&gt;
    2013-11-19 pat.klaey@stepping-stone.ch Added options to be able to check&lt;br /&gt;
    quota, schedule or both in one run&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporated code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Getopt::Long;&lt;br /&gt;
        Sys::Syslog;&lt;br /&gt;
        Cwd &#039;abs_path&#039;;&lt;br /&gt;
        File::Basename;&lt;br /&gt;
        PerlUtil::LDAPUtil;&lt;br /&gt;
        PerlUtil::Logging;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
In the configuration you have to define two simple things: &lt;br /&gt;
# Which script to call for quota checks and scheduler checks&lt;br /&gt;
# How to access the LDAP backend&lt;br /&gt;
 /etc/backup-utils/checkBackups.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Scripts]&lt;br /&gt;
CheckQuotaScript = /usr/libexec/backup-utils/writeAccountSize.pl&lt;br /&gt;
CheckScheduleScript = /usr/libexec/backup-utils/scheduleWarning.pl&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
Server = ldaps://ldapm.tombstone.ch&lt;br /&gt;
Port = 636&lt;br /&gt;
Username = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
Password = &amp;lt;PASSWORD&amp;gt;&lt;br /&gt;
AccountBase = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Cronjobs ====&lt;br /&gt;
As you can pass the notification flag to the scripts, you can call the quota script say all 10 minutes. This makes sense if followed the configuration section, as the writeAccountSize.pl script writes the quota values to the LDAP backend which will then be visible in the selfcare webinterface. Like that you have a more or less up to date quota representation in the selfcare webinterface. On the other side, you don&#039;t want to send notification mails to the user every 10 minutes. It might be enough to send them once a day, so the cronjobs may look like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Check backups&lt;br /&gt;
15 12 * * * /usr/libexec/backup-utils/checkBackups.pl --schedule --quota --notify&lt;br /&gt;
&lt;br /&gt;
# Write quota values every 10 minutes&lt;br /&gt;
*/10 * * * * /usr/libexec/backup-utils/checkBackups.pl --quota&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ResellerBackupBilling.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/writeDate.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package. The pod documentation says all what needs to be said about this script.&lt;br /&gt;
* Pod documentation&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    ResellerBackupBilling.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script processes the reseller with the passed UID and creates a&lt;br /&gt;
    very simplistic backup-billing overview which then is sent to the&lt;br /&gt;
    address specified in the configuration file. The billing overview&lt;br /&gt;
    contains all backup accounts which belong to the given reseller as well&lt;br /&gt;
    as their quota. According to the billing plan specified in the&lt;br /&gt;
    configuration file, the script also calculates the price for each backup&lt;br /&gt;
    account.&lt;br /&gt;
&lt;br /&gt;
    The script uses syslog for logging purposes.&lt;br /&gt;
&lt;br /&gt;
    Command Line Interface (CLI) parameters:&lt;br /&gt;
&lt;br /&gt;
OPTIONS&lt;br /&gt;
    --reseller/-r UID&lt;br /&gt;
        Process the reseller with this UID&lt;br /&gt;
&lt;br /&gt;
    --debug/-d&lt;br /&gt;
        Turn on debug mode&lt;br /&gt;
&lt;br /&gt;
    --help/-h&lt;br /&gt;
        Display this help&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    ./ResellerBackupBilling.pl --reseller UID [--debug] [--help]&lt;br /&gt;
&lt;br /&gt;
    ./ResellerBackupBilling.pl --reseller 2000000&lt;br /&gt;
        This processes the reseller with the UID 200000 and sends the&lt;br /&gt;
        billing overview to the address specified in the configuration file&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2014-01-24 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2014-01-24 pat.klaey@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporated code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Getopt::Long;&lt;br /&gt;
        PerlUtil::LDAPUtil;&lt;br /&gt;
        PerlUtil::Logging;&lt;br /&gt;
        PerlUtil::Mail;&lt;br /&gt;
        Number::Format;&lt;br /&gt;
        File::Basename;&lt;br /&gt;
        Cwd &#039;abs_path&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
&lt;br /&gt;
== writeDate.pl ==&lt;br /&gt;
This script is installed to &amp;lt;code&amp;gt;/usr/libexec/backup-utils/writeDate.pl&amp;lt;/code&amp;gt; by the &amp;lt;code&amp;gt;sys-apps/sst-backup-utils&amp;lt;/code&amp;gt; package. This is a very simple script, it simply writes the current date and time to a file on the backup server before the rsnapshots rotates the backup. This date is used by the Sepiola Online Backup Client to display the iterations and their dates.&lt;br /&gt;
* Pod documentation: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NAME&lt;br /&gt;
    writeDate.pl&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
    This script writes the current date and time into the file for each&lt;br /&gt;
    backup before the rsnapshots rotates the backup. This information is&lt;br /&gt;
    used by the Sepiola Online Backup Client.&lt;br /&gt;
&lt;br /&gt;
    The configuration file for this script is stored under&lt;br /&gt;
    /etc/backup-utils/writeDate.conf&lt;br /&gt;
&lt;br /&gt;
    The script uses syslog for logging purposes.&lt;br /&gt;
&lt;br /&gt;
    Command Line Interface (CLI) parameters:&lt;br /&gt;
&lt;br /&gt;
    -C configfile&lt;br /&gt;
        The configuration file.&lt;br /&gt;
&lt;br /&gt;
    -U uid&lt;br /&gt;
        The user id.&lt;br /&gt;
&lt;br /&gt;
    -d debug&lt;br /&gt;
        Turns the debug mode on.&lt;br /&gt;
&lt;br /&gt;
    -h help&lt;br /&gt;
        This online help.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
    writeDate.pl [-C configuration_file] [-U uid] [-d debug] [-h help]&lt;br /&gt;
&lt;br /&gt;
CREATED&lt;br /&gt;
    2007-09-16 michael.eichenberger@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
VERSION&lt;br /&gt;
    2013-09-01 michael.eichenberger@stepping-stone.ch updated to reflect&lt;br /&gt;
    changes in the new backup environment&lt;br /&gt;
&lt;br /&gt;
        2007-09-16 michael.eichenberger@stepping-stone.ch created&lt;br /&gt;
&lt;br /&gt;
INCORPORATED CODE&lt;br /&gt;
    Incorporate code with use:&lt;br /&gt;
&lt;br /&gt;
        warnings;&lt;br /&gt;
        strict;&lt;br /&gt;
        Config::IniFiles;&lt;br /&gt;
        Getopt::Std;&lt;br /&gt;
        Sys::Syslog;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 /etc/backup-utils/writeDate.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Global]&lt;br /&gt;
BACKUP_DIRECTORY = /incoming&lt;br /&gt;
BACKUP_BACKUP_TIME_FILE = /.sepiola_backup/backupTime&lt;br /&gt;
&lt;br /&gt;
[Syslog]&lt;br /&gt;
SYSLOG = rsnapshot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== rsnapshot wrapper bash scripts ==&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* [http://www.openldap.org/ OpenLDAP], an open source implementation of the Lightweight Directory Access Protocol.&lt;br /&gt;
* [http://arthurdejong.org/nss-pam-ldapd/ nss-pam-ldapd], a Name Service Switch (NSS) module that allows your LDAP server to provide user account, group, host name, alias, netgroup, and basically any other information that you would normally get from /etc flat files or NIS.&lt;br /&gt;
* [http://www.gentoo.org/doc/de/ldap-howto.xml Gentoo Leitfaden zur OpenLDAP Authentifikation].&lt;br /&gt;
* [http://wiki.gentoo.org/wiki/Centralized_authentication_using_OpenLDAP Centralized authentication using OpenLDAP].&lt;br /&gt;
* [https://code.google.com/p/openssh-lpk/source/browse/trunk/schemas/openssh-lpk_openldap.schema openssh-lpk_openldap.schema] OpenSSH LDAP Public Keys.&lt;br /&gt;
* [http://sourceforge.net/projects/linuxquota/ linuxquota] Linux DiskQuota.&lt;br /&gt;
* [http://www.rsnapshot.org/ rsnapshot], a remote filesystem snapshot utility, based on rsync.&lt;br /&gt;
* [http://olivier.sessink.nl/jailkit/ Jailkit], set of utilities to limit user accounts to specific files using chroot() and or specific commands. Also includes a tool to build a chroot environment.&lt;br /&gt;
* [http://www.busybox.net/ Busybox] BusyBox combines tiny versions of many common UNIX utilities into a single small executable. Useful to reduce the number of files (and thus the complexity) when building a chroot. &lt;br /&gt;
&lt;br /&gt;
[[Category:stoney backup]]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3143</id>
		<title>Manually adding a new bridge</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3143"/>
		<updated>2014-02-21T09:03:08Z</updated>

		<summary type="html">&lt;p&gt;David: /* Create a new bridging device */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
The following page describes the steps to manually add a new Ethernet bridge (&amp;lt;code&amp;gt;vmbrX&amp;lt;/code&amp;gt;) to an existing stoney cloud installation. In this example we presume you want to add the new Ethernet bridge &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Before adding a new bridge ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
IP interfaces        | 192.168.140.1X |   10.1.110.1X  |   10.1.120.1X  |   10.1.130.1X  |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
Bridging interfaces  |     vmbr0      |    (vmbr1)     |    (vmbr2)     |    (vmbr3)     |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
VLAN interfaces      |    vlan140     |    vlan110     |    vlan120     |    vlan130     |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +-------------------------------------------------------------------+&lt;br /&gt;
Bonding interfaces   |                        bond0 (bonding.mode=802.3ad)               |&lt;br /&gt;
                     +-------------------------------------------------------------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
Physical interfaces  |      eth0      |      eth1      |      eth2      |      ethN      |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== After adding an additional bridge (vmbr4) ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
IP interfaces        | 192.168.140.1X |   10.1.110.1X  |   10.1.120.1X  |   10.1.130.1X  | 192.168.141.1X |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
Bridging interfaces  |     vmbr0      |    (vmbr1)     |    (vmbr2)     |    (vmbr3)     |     vmbr4      |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
VLAN interfaces      |    vlan140     |    vlan110     |    vlan120     |    vlan130     |    vlan141     |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +------------------------------------------------------------------------------------+&lt;br /&gt;
Bonding interfaces   |                        bond0 (bonding.mode=802.3ad)                                |&lt;br /&gt;
                     +------------------------------------------------------------------------------------+&lt;br /&gt;
                     +----------------+----------------+----------------+---------------------------------+&lt;br /&gt;
Physical interfaces  |      eth0      |      eth1      |      eth2      |      ethN                       |&lt;br /&gt;
                     +----------------+----------------+----------------+---------------------------------+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
To be able to add and configure a new bridge, you need to have the following informations present:&lt;br /&gt;
* The name of the bridge, such as &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;vmbr1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;vmbr3&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;vmbr3&amp;lt;/code&amp;gt; are reserved for existing networks)&lt;br /&gt;
* VLAN ID, such as &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP prefix, such as &amp;lt;code&amp;gt;192.168.141.0/24&amp;lt;/code&amp;gt;&lt;br /&gt;
* Default gateway address  (if any), such as &amp;lt;code&amp;gt;192.168.141.1&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP address for the DHCP server on the VM node, such as &amp;lt;code&amp;gt;192.168.141.13&amp;lt;/code&amp;gt;&lt;br /&gt;
* Broadcast address, such as &amp;lt;code&amp;gt;192.168.141.255&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure, that you have configured the new VLAN on all involved switches and routers beforehand.&lt;br /&gt;
&lt;br /&gt;
= Configuration =&lt;br /&gt;
== Add the new VLAN on top of the bonding interface ==&lt;br /&gt;
Login to the first VM node and manually add the new VLAN to the existing bonding interface (&amp;lt;code&amp;gt;bond0&amp;lt;/code&amp;gt;). In the following example VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; is added:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip link add link bond0 name vlan141 type vlan id 141&lt;br /&gt;
ip link set vlan141 up&lt;br /&gt;
ip link show vlan141&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
71: vlan141@bond0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP mode DEFAULT &lt;br /&gt;
    link/ether 38:60:77:9c:98:40 brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to bring the newly configured VLAN up after a system reboot, the network configuration needs to be extended. Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and add the following entries:&lt;br /&gt;
 $EDITOR /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# VLAN (802.1q support)&lt;br /&gt;
&lt;br /&gt;
### Add the new vlan to the bond device&lt;br /&gt;
vlans_bond0=&amp;quot;130 120 110 140 141&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# pub VLAN&lt;br /&gt;
vlan140_name=&amp;quot;vlan140&amp;quot;&lt;br /&gt;
config_vlan140=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new vlan at the end of the VLAN section&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a new bridging device ==&lt;br /&gt;
As the new VLAN interface is now up, an additional bridge can be added.&lt;br /&gt;
&lt;br /&gt;
Again the network configuration needs to be edited. Append the configuration of the new bridge, below the existing &amp;lt;code&amp;gt;vmbr0&amp;lt;/code&amp;gt; bridge configuration. In the following example the bridge &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt; is added on top of VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; with a prefix of &amp;lt;code&amp;gt;192.168.141.13/24&amp;lt;/code&amp;gt;:&lt;br /&gt;
 $EDITOR /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# Bridging (802.1d) interfaces&lt;br /&gt;
&lt;br /&gt;
bridge_vmbr0=&amp;quot;vlan140&amp;quot;&lt;br /&gt;
bridge_add_vlan140=&amp;quot;vmbr0&amp;quot;&lt;br /&gt;
config_vmbr0=&amp;quot;192.168.140.13/24 brd 192.168.140.255&amp;quot;    # 192.168.140.13 is the ip address of the vm-node.&lt;br /&gt;
routes_vmbr0=&amp;quot;default via 192.168.140.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new bridge at the end of the bridge section&lt;br /&gt;
bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
config_vmbr4=&amp;quot;192.168.141.13/24 brd 192.168.141.255&amp;quot;    # 192.168.141.13 is the ip address of the vm-node (only required on primary- and secondary master node for the dhcp server, on all others use: null)&lt;br /&gt;
rc_net_vmbr4_provide=&amp;quot;!net&amp;quot;                             # Otherwise stopping or restarting the bridge, will bring all net-services down.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To bring the bridge up, an init script is required. Simply symlink the &amp;lt;code&amp;gt;net.lo&amp;lt;/code&amp;gt; script to the new bridge name&#039;s script, here &amp;lt;code&amp;gt;net.vmbr4&amp;lt;/code&amp;gt; is assumed:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.vmbr4&lt;br /&gt;
rc-update add net.vmbr4 default&lt;br /&gt;
/etc/init.d/net.vmbr4 start&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * Caching service dependencies ...                                       [ ok ]&lt;br /&gt;
 * Bringing up interface vmbr4&lt;br /&gt;
 *   Creating bridge vmbr4 ...&lt;br /&gt;
 *   Adding ports to vmbr4&lt;br /&gt;
 *     vlan141 ...                                                        [ ok ]&lt;br /&gt;
 *   192.168.141.13/24 ...                                                [ ok ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check if everything looks fine:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip addr show vmbr4 &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
82: vmbr4: &amp;lt;BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP &lt;br /&gt;
    link/ether 38:60:77:9c:98:40 brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
    inet 192.168.141.13/24 brd 192.168.141.255 scope global vmbr4&lt;br /&gt;
       valid_lft forever preferred_lft forever&lt;br /&gt;
bridge name     bridge id               STP enabled     interfaces&lt;br /&gt;
vmbr0           8000.3860779c9840       no              kvm-0217_0&lt;br /&gt;
                                                        vlan140&lt;br /&gt;
vmbr4           8000.3860779c9840       no              kvm-0227_0&lt;br /&gt;
                                                        vlan141&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or if you would like to copy&amp;amp;paste:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vlanId=141&lt;br /&gt;
bridgeName=vmbr4&lt;br /&gt;
nodeIp=192.168.141.13&lt;br /&gt;
prefixLength=24&lt;br /&gt;
broadcast=192.168.141.255&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
bridge_${bridgeName}=&amp;quot;vlan${vlanId}&amp;quot;&lt;br /&gt;
bridge_add_vlan${vlanId}=&amp;quot;${bridgeName}&amp;quot;&lt;br /&gt;
config_${bridgeName}=&amp;quot;${nodeIp}/${prefixLength} brd ${broadcast}&amp;quot;&lt;br /&gt;
rc_net_${bridgeName}_provide=&amp;quot;!net&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.${bridgeName}&lt;br /&gt;
rc-update add net.${bridgeName} default&lt;br /&gt;
/etc/init.d/net.${bridgeName} start&lt;br /&gt;
ip addr show ${bridgeName} &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Delete a bridging device ==&lt;br /&gt;
Tear the bridge down but check if it would also stop all network services:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Set your bridge name&lt;br /&gt;
bridgeName=&amp;lt;NAME OF YOUR BRIDGE&amp;gt;   # e.g.: vmbr4&lt;br /&gt;
&lt;br /&gt;
# Check if it excludes the net services&lt;br /&gt;
grep rc_net_${bridgeName}_provide /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If grep produces output you might consider running the initscript with the &#039;&#039;-D&#039;&#039; options (otherwise network services, like sshd, might get stopped).&lt;br /&gt;
&lt;br /&gt;
Otherwise just stop the bridge and remove the initscript:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/etc/init.d/net.${bridgeName} stop&lt;br /&gt;
&lt;br /&gt;
rc-update del net.${bridgeName} default&lt;br /&gt;
&lt;br /&gt;
rm /etc/init.d/net.${bridgeName}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remove the bridge from the network configuration:&lt;br /&gt;
 $EDITOR /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
### Remove the options for the bridge you want to delete&lt;br /&gt;
#bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
#bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
#config_vmbr4=&amp;quot;192.168.141.13/24 brd 192.168.141.255&amp;quot;    # 192.168.141.13 is the ip address of the vm-node.&lt;br /&gt;
#rc_net_vmbr4_provide=&amp;quot;!net&amp;quot;                             # Otherwise stopping or restarting the bridge, will bring all net-services down.&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Remove a VLAN on a bonding interface ==&lt;br /&gt;
Delete the VLAN from the interface bond0:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Set your vlan id&lt;br /&gt;
vlanId=&amp;lt;VLAN ID&amp;gt;   # e.g. 141&lt;br /&gt;
&lt;br /&gt;
# Shut the vlan down&lt;br /&gt;
ip link set vlan${vlanId} down&lt;br /&gt;
&lt;br /&gt;
# Remove it from the interface bond0&lt;br /&gt;
ip link delete vlan${vlanId} type vlan&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and remove your VLAN:&lt;br /&gt;
 $EDITOR /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
### Remove your vlan options&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
# vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
# config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap10 Gentoo Handbook - VLAN (802.1q support)]&lt;br /&gt;
* [https://wiki.archlinux.org/index.php/VLAN ArchWiki - VLAN]&lt;br /&gt;
* [http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge Linux Foundation - Bridge]&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap7 Gentoo Handbook - Bridging (802.1d support)]&lt;br /&gt;
* [http://wiki.gentoo.org/wiki/Network_bridge Gentoo Wiki - Network Bridge]&lt;br /&gt;
&lt;br /&gt;
[[Category:Workarounds]]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3142</id>
		<title>Manually adding a new bridge</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3142"/>
		<updated>2014-02-21T08:23:40Z</updated>

		<summary type="html">&lt;p&gt;David: /* Add the new VLAN on top of the bonding interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
The following page describes the steps to manually add a new Ethernet bridge (&amp;lt;code&amp;gt;vmbrX&amp;lt;/code&amp;gt;) to an existing stoney cloud installation. In this example we presume you want to add the new Ethernet bridge &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Before adding a new bridge ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
IP interfaces        | 192.168.140.1X |   10.1.110.1X  |   10.1.120.1X  |   10.1.130.1X  |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
Bridging interfaces  |     vmbr0      |    (vmbr1)     |    (vmbr2)     |    (vmbr3)     |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
VLAN interfaces      |    vlan140     |    vlan110     |    vlan120     |    vlan130     |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +-------------------------------------------------------------------+&lt;br /&gt;
Bonding interfaces   |                        bond0 (bonding.mode=802.3ad)               |&lt;br /&gt;
                     +-------------------------------------------------------------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
Physical interfaces  |      eth0      |      eth1      |      eth2      |      ethN      |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== After adding an additional bridge (vmbr4) ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
IP interfaces        | 192.168.140.1X |   10.1.110.1X  |   10.1.120.1X  |   10.1.130.1X  | 192.168.141.1X |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
Bridging interfaces  |     vmbr0      |    (vmbr1)     |    (vmbr2)     |    (vmbr3)     |     vmbr4      |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
VLAN interfaces      |    vlan140     |    vlan110     |    vlan120     |    vlan130     |    vlan141     |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +------------------------------------------------------------------------------------+&lt;br /&gt;
Bonding interfaces   |                        bond0 (bonding.mode=802.3ad)                                |&lt;br /&gt;
                     +------------------------------------------------------------------------------------+&lt;br /&gt;
                     +----------------+----------------+----------------+---------------------------------+&lt;br /&gt;
Physical interfaces  |      eth0      |      eth1      |      eth2      |      ethN                       |&lt;br /&gt;
                     +----------------+----------------+----------------+---------------------------------+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
To be able to add and configure a new bridge, you need to have the following informations present:&lt;br /&gt;
* The name of the bridge, such as &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;vmbr1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;vmbr3&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;vmbr3&amp;lt;/code&amp;gt; are reserved for existing networks)&lt;br /&gt;
* VLAN ID, such as &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP prefix, such as &amp;lt;code&amp;gt;192.168.141.0/24&amp;lt;/code&amp;gt;&lt;br /&gt;
* Default gateway address  (if any), such as &amp;lt;code&amp;gt;192.168.141.1&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP address for the DHCP server on the VM node, such as &amp;lt;code&amp;gt;192.168.141.13&amp;lt;/code&amp;gt;&lt;br /&gt;
* Broadcast address, such as &amp;lt;code&amp;gt;192.168.141.255&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure, that you have configured the new VLAN on all involved switches and routers beforehand.&lt;br /&gt;
&lt;br /&gt;
= Configuration =&lt;br /&gt;
== Add the new VLAN on top of the bonding interface ==&lt;br /&gt;
Login to the first VM node and manually add the new VLAN to the existing bonding interface (&amp;lt;code&amp;gt;bond0&amp;lt;/code&amp;gt;). In the following example VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; is added:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip link add link bond0 name vlan141 type vlan id 141&lt;br /&gt;
ip link set vlan141 up&lt;br /&gt;
ip link show vlan141&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
71: vlan141@bond0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP mode DEFAULT &lt;br /&gt;
    link/ether 38:60:77:9c:98:40 brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to bring the newly configured VLAN up after a system reboot, the network configuration needs to be extended. Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and add the following entries:&lt;br /&gt;
 $EDITOR /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# VLAN (802.1q support)&lt;br /&gt;
&lt;br /&gt;
### Add the new vlan to the bond device&lt;br /&gt;
vlans_bond0=&amp;quot;130 120 110 140 141&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# pub VLAN&lt;br /&gt;
vlan140_name=&amp;quot;vlan140&amp;quot;&lt;br /&gt;
config_vlan140=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new vlan at the end of the VLAN section&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a new bridging device ==&lt;br /&gt;
As the new VLAN interface is now up, an additional bridge can be added.&lt;br /&gt;
&lt;br /&gt;
Again the network configuration needs to be edited. Append the configuration of the new bridge, below the existing &amp;lt;code&amp;gt;vmbr0&amp;lt;/code&amp;gt; bridge configuration. In the following example the bridge &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt; is added on top of VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; with a prefix of &amp;lt;code&amp;gt;192.168.141.13/24&amp;lt;/code&amp;gt;:&lt;br /&gt;
 $EDITOR /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# Bridging (802.1d) interfaces&lt;br /&gt;
&lt;br /&gt;
bridge_vmbr0=&amp;quot;vlan140&amp;quot;&lt;br /&gt;
bridge_add_vlan140=&amp;quot;vmbr0&amp;quot;&lt;br /&gt;
config_vmbr0=&amp;quot;192.168.140.13/24 brd 192.168.140.255&amp;quot;    # 192.168.140.13 is the ip address of the vm-node.&lt;br /&gt;
routes_vmbr0=&amp;quot;default via 192.168.140.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new bridge at the end of the bridge section&lt;br /&gt;
bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
config_vmbr4=&amp;quot;192.168.141.13/24 brd 192.168.141.255&amp;quot;    # 192.168.141.13 is the ip address of the vm-node (only required on primary- and secondary master node, on all others use: null)&lt;br /&gt;
rc_net_vmbr4_provide=&amp;quot;!net&amp;quot;                             # Otherwise stopping or restarting the bridge, will bring all net-services down.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To bring the bridge up, an init script is required. Simply symlink the &amp;lt;code&amp;gt;net.lo&amp;lt;/code&amp;gt; script to the new bridge name&#039;s script, here &amp;lt;code&amp;gt;net.vmbr4&amp;lt;/code&amp;gt; is assumed:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.vmbr4&lt;br /&gt;
rc-update add net.vmbr4 default&lt;br /&gt;
/etc/init.d/net.vmbr4 start&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * Caching service dependencies ...                                       [ ok ]&lt;br /&gt;
 * Bringing up interface vmbr4&lt;br /&gt;
 *   Creating bridge vmbr4 ...&lt;br /&gt;
 *   Adding ports to vmbr4&lt;br /&gt;
 *     vlan141 ...                                                        [ ok ]&lt;br /&gt;
 *   192.168.141.13/24 ...                                                [ ok ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check if everything looks fine:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip addr show vmbr4 &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
82: vmbr4: &amp;lt;BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP &lt;br /&gt;
    link/ether 38:60:77:9c:98:40 brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
    inet 192.168.141.13/24 brd 192.168.141.255 scope global vmbr4&lt;br /&gt;
       valid_lft forever preferred_lft forever&lt;br /&gt;
bridge name     bridge id               STP enabled     interfaces&lt;br /&gt;
vmbr0           8000.3860779c9840       no              kvm-0217_0&lt;br /&gt;
                                                        vlan140&lt;br /&gt;
vmbr4           8000.3860779c9840       no              kvm-0227_0&lt;br /&gt;
                                                        vlan141&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or if you would like to copy&amp;amp;paste:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vlanId=141&lt;br /&gt;
bridgeName=vmbr4&lt;br /&gt;
nodeIp=192.168.141.13&lt;br /&gt;
prefixLength=24&lt;br /&gt;
broadcast=192.168.141.255&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
bridge_${bridgeName}=&amp;quot;vlan${vlanId}&amp;quot;&lt;br /&gt;
bridge_add_vlan${vlanId}=&amp;quot;${bridgeName}&amp;quot;&lt;br /&gt;
config_${bridgeName}=&amp;quot;${nodeIp}/${prefixLength} brd ${broadcast}&amp;quot;&lt;br /&gt;
rc_net_${bridgeName}_provide=&amp;quot;!net&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.${bridgeName}&lt;br /&gt;
rc-update add net.${bridgeName} default&lt;br /&gt;
/etc/init.d/net.${bridgeName} start&lt;br /&gt;
ip addr show ${bridgeName} &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Delete a bridging device ==&lt;br /&gt;
Tear the bridge down but check if it would also stop all network services:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Set your bridge name&lt;br /&gt;
bridgeName=&amp;lt;NAME OF YOUR BRIDGE&amp;gt;   # e.g.: vmbr4&lt;br /&gt;
&lt;br /&gt;
# Check if it excludes the net services&lt;br /&gt;
grep rc_net_${bridgeName}_provide /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If grep produces output you might consider running the initscript with the &#039;&#039;-D&#039;&#039; options (otherwise network services, like sshd, might get stopped).&lt;br /&gt;
&lt;br /&gt;
Otherwise just stop the bridge and remove the initscript:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/etc/init.d/net.${bridgeName} stop&lt;br /&gt;
&lt;br /&gt;
rc-update del net.${bridgeName} default&lt;br /&gt;
&lt;br /&gt;
rm /etc/init.d/net.${bridgeName}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remove the bridge from the network configuration:&lt;br /&gt;
 $EDITOR /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
### Remove the options for the bridge you want to delete&lt;br /&gt;
#bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
#bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
#config_vmbr4=&amp;quot;192.168.141.13/24 brd 192.168.141.255&amp;quot;    # 192.168.141.13 is the ip address of the vm-node.&lt;br /&gt;
#rc_net_vmbr4_provide=&amp;quot;!net&amp;quot;                             # Otherwise stopping or restarting the bridge, will bring all net-services down.&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Remove a VLAN on a bonding interface ==&lt;br /&gt;
Delete the VLAN from the interface bond0:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Set your vlan id&lt;br /&gt;
vlanId=&amp;lt;VLAN ID&amp;gt;   # e.g. 141&lt;br /&gt;
&lt;br /&gt;
# Shut the vlan down&lt;br /&gt;
ip link set vlan${vlanId} down&lt;br /&gt;
&lt;br /&gt;
# Remove it from the interface bond0&lt;br /&gt;
ip link delete vlan${vlanId} type vlan&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and remove your VLAN:&lt;br /&gt;
 $EDITOR /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
### Remove your vlan options&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
# vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
# config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap10 Gentoo Handbook - VLAN (802.1q support)]&lt;br /&gt;
* [https://wiki.archlinux.org/index.php/VLAN ArchWiki - VLAN]&lt;br /&gt;
* [http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge Linux Foundation - Bridge]&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap7 Gentoo Handbook - Bridging (802.1d support)]&lt;br /&gt;
* [http://wiki.gentoo.org/wiki/Network_bridge Gentoo Wiki - Network Bridge]&lt;br /&gt;
&lt;br /&gt;
[[Category:Workarounds]]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3141</id>
		<title>Manually adding a new bridge</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3141"/>
		<updated>2014-02-21T08:23:14Z</updated>

		<summary type="html">&lt;p&gt;David: /* Add the new VLAN on top of the bonding interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
The following page describes the steps to manually add a new Ethernet bridge (&amp;lt;code&amp;gt;vmbrX&amp;lt;/code&amp;gt;) to an existing stoney cloud installation. In this example we presume you want to add the new Ethernet bridge &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Before adding a new bridge ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
IP interfaces        | 192.168.140.1X |   10.1.110.1X  |   10.1.120.1X  |   10.1.130.1X  |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
Bridging interfaces  |     vmbr0      |    (vmbr1)     |    (vmbr2)     |    (vmbr3)     |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
VLAN interfaces      |    vlan140     |    vlan110     |    vlan120     |    vlan130     |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +-------------------------------------------------------------------+&lt;br /&gt;
Bonding interfaces   |                        bond0 (bonding.mode=802.3ad)               |&lt;br /&gt;
                     +-------------------------------------------------------------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
Physical interfaces  |      eth0      |      eth1      |      eth2      |      ethN      |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== After adding an additional bridge (vmbr4) ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
IP interfaces        | 192.168.140.1X |   10.1.110.1X  |   10.1.120.1X  |   10.1.130.1X  | 192.168.141.1X |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
Bridging interfaces  |     vmbr0      |    (vmbr1)     |    (vmbr2)     |    (vmbr3)     |     vmbr4      |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
VLAN interfaces      |    vlan140     |    vlan110     |    vlan120     |    vlan130     |    vlan141     |&lt;br /&gt;
                     +----------------+----------------+----------------+----------------+----------------+&lt;br /&gt;
                     +------------------------------------------------------------------------------------+&lt;br /&gt;
Bonding interfaces   |                        bond0 (bonding.mode=802.3ad)                                |&lt;br /&gt;
                     +------------------------------------------------------------------------------------+&lt;br /&gt;
                     +----------------+----------------+----------------+---------------------------------+&lt;br /&gt;
Physical interfaces  |      eth0      |      eth1      |      eth2      |      ethN                       |&lt;br /&gt;
                     +----------------+----------------+----------------+---------------------------------+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
To be able to add and configure a new bridge, you need to have the following informations present:&lt;br /&gt;
* The name of the bridge, such as &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;vmbr1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;vmbr3&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;vmbr3&amp;lt;/code&amp;gt; are reserved for existing networks)&lt;br /&gt;
* VLAN ID, such as &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP prefix, such as &amp;lt;code&amp;gt;192.168.141.0/24&amp;lt;/code&amp;gt;&lt;br /&gt;
* Default gateway address  (if any), such as &amp;lt;code&amp;gt;192.168.141.1&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP address for the DHCP server on the VM node, such as &amp;lt;code&amp;gt;192.168.141.13&amp;lt;/code&amp;gt;&lt;br /&gt;
* Broadcast address, such as &amp;lt;code&amp;gt;192.168.141.255&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure, that you have configured the new VLAN on all involved switches and routers beforehand.&lt;br /&gt;
&lt;br /&gt;
= Configuration =&lt;br /&gt;
== Add the new VLAN on top of the bonding interface ==&lt;br /&gt;
Login to the first VM node and manually add the new VLAN to the existing bonding interface (&amp;lt;code&amp;gt;bond0&amp;lt;/code&amp;gt;). In the following example VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; is added:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip link add link bond0 name vlan141 type vlan id 141&lt;br /&gt;
ip link set vlan141 up&lt;br /&gt;
ip link show vlan141&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
71: vlan141@bond0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP mode DEFAULT &lt;br /&gt;
    link/ether 38:60:77:9c:98:40 brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to bring the newly configured VLAN up after a system reboot, the network configuration needs to be extended. Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and add the following entry:&lt;br /&gt;
 $EDITOR /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# VLAN (802.1q support)&lt;br /&gt;
&lt;br /&gt;
# add the new vlan to the bond device&lt;br /&gt;
vlans_bond0=&amp;quot;130 120 110 140 141&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# pub VLAN&lt;br /&gt;
vlan140_name=&amp;quot;vlan140&amp;quot;&lt;br /&gt;
config_vlan140=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new vlan at the end of the VLAN section&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a new bridging device ==&lt;br /&gt;
As the new VLAN interface is now up, an additional bridge can be added.&lt;br /&gt;
&lt;br /&gt;
Again the network configuration needs to be edited. Append the configuration of the new bridge, below the existing &amp;lt;code&amp;gt;vmbr0&amp;lt;/code&amp;gt; bridge configuration. In the following example the bridge &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt; is added on top of VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; with a prefix of &amp;lt;code&amp;gt;192.168.141.13/24&amp;lt;/code&amp;gt;:&lt;br /&gt;
 $EDITOR /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# Bridging (802.1d) interfaces&lt;br /&gt;
&lt;br /&gt;
bridge_vmbr0=&amp;quot;vlan140&amp;quot;&lt;br /&gt;
bridge_add_vlan140=&amp;quot;vmbr0&amp;quot;&lt;br /&gt;
config_vmbr0=&amp;quot;192.168.140.13/24 brd 192.168.140.255&amp;quot;    # 192.168.140.13 is the ip address of the vm-node.&lt;br /&gt;
routes_vmbr0=&amp;quot;default via 192.168.140.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new bridge at the end of the bridge section&lt;br /&gt;
bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
config_vmbr4=&amp;quot;192.168.141.13/24 brd 192.168.141.255&amp;quot;    # 192.168.141.13 is the ip address of the vm-node (only required on primary- and secondary master node, on all others use: null)&lt;br /&gt;
rc_net_vmbr4_provide=&amp;quot;!net&amp;quot;                             # Otherwise stopping or restarting the bridge, will bring all net-services down.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To bring the bridge up, an init script is required. Simply symlink the &amp;lt;code&amp;gt;net.lo&amp;lt;/code&amp;gt; script to the new bridge name&#039;s script, here &amp;lt;code&amp;gt;net.vmbr4&amp;lt;/code&amp;gt; is assumed:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.vmbr4&lt;br /&gt;
rc-update add net.vmbr4 default&lt;br /&gt;
/etc/init.d/net.vmbr4 start&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * Caching service dependencies ...                                       [ ok ]&lt;br /&gt;
 * Bringing up interface vmbr4&lt;br /&gt;
 *   Creating bridge vmbr4 ...&lt;br /&gt;
 *   Adding ports to vmbr4&lt;br /&gt;
 *     vlan141 ...                                                        [ ok ]&lt;br /&gt;
 *   192.168.141.13/24 ...                                                [ ok ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check if everything looks fine:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip addr show vmbr4 &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
82: vmbr4: &amp;lt;BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP &lt;br /&gt;
    link/ether 38:60:77:9c:98:40 brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
    inet 192.168.141.13/24 brd 192.168.141.255 scope global vmbr4&lt;br /&gt;
       valid_lft forever preferred_lft forever&lt;br /&gt;
bridge name     bridge id               STP enabled     interfaces&lt;br /&gt;
vmbr0           8000.3860779c9840       no              kvm-0217_0&lt;br /&gt;
                                                        vlan140&lt;br /&gt;
vmbr4           8000.3860779c9840       no              kvm-0227_0&lt;br /&gt;
                                                        vlan141&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or if you would like to copy&amp;amp;paste:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vlanId=141&lt;br /&gt;
bridgeName=vmbr4&lt;br /&gt;
nodeIp=192.168.141.13&lt;br /&gt;
prefixLength=24&lt;br /&gt;
broadcast=192.168.141.255&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
bridge_${bridgeName}=&amp;quot;vlan${vlanId}&amp;quot;&lt;br /&gt;
bridge_add_vlan${vlanId}=&amp;quot;${bridgeName}&amp;quot;&lt;br /&gt;
config_${bridgeName}=&amp;quot;${nodeIp}/${prefixLength} brd ${broadcast}&amp;quot;&lt;br /&gt;
rc_net_${bridgeName}_provide=&amp;quot;!net&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.${bridgeName}&lt;br /&gt;
rc-update add net.${bridgeName} default&lt;br /&gt;
/etc/init.d/net.${bridgeName} start&lt;br /&gt;
ip addr show ${bridgeName} &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Delete a bridging device ==&lt;br /&gt;
Tear the bridge down but check if it would also stop all network services:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Set your bridge name&lt;br /&gt;
bridgeName=&amp;lt;NAME OF YOUR BRIDGE&amp;gt;   # e.g.: vmbr4&lt;br /&gt;
&lt;br /&gt;
# Check if it excludes the net services&lt;br /&gt;
grep rc_net_${bridgeName}_provide /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If grep produces output you might consider running the initscript with the &#039;&#039;-D&#039;&#039; options (otherwise network services, like sshd, might get stopped).&lt;br /&gt;
&lt;br /&gt;
Otherwise just stop the bridge and remove the initscript:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/etc/init.d/net.${bridgeName} stop&lt;br /&gt;
&lt;br /&gt;
rc-update del net.${bridgeName} default&lt;br /&gt;
&lt;br /&gt;
rm /etc/init.d/net.${bridgeName}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remove the bridge from the network configuration:&lt;br /&gt;
 $EDITOR /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
### Remove the options for the bridge you want to delete&lt;br /&gt;
#bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
#bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
#config_vmbr4=&amp;quot;192.168.141.13/24 brd 192.168.141.255&amp;quot;    # 192.168.141.13 is the ip address of the vm-node.&lt;br /&gt;
#rc_net_vmbr4_provide=&amp;quot;!net&amp;quot;                             # Otherwise stopping or restarting the bridge, will bring all net-services down.&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Remove a VLAN on a bonding interface ==&lt;br /&gt;
Delete the VLAN from the interface bond0:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Set your vlan id&lt;br /&gt;
vlanId=&amp;lt;VLAN ID&amp;gt;   # e.g. 141&lt;br /&gt;
&lt;br /&gt;
# Shut the vlan down&lt;br /&gt;
ip link set vlan${vlanId} down&lt;br /&gt;
&lt;br /&gt;
# Remove it from the interface bond0&lt;br /&gt;
ip link delete vlan${vlanId} type vlan&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and remove your VLAN:&lt;br /&gt;
 $EDITOR /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
### Remove your vlan options&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
# vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
# config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap10 Gentoo Handbook - VLAN (802.1q support)]&lt;br /&gt;
* [https://wiki.archlinux.org/index.php/VLAN ArchWiki - VLAN]&lt;br /&gt;
* [http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge Linux Foundation - Bridge]&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap7 Gentoo Handbook - Bridging (802.1d support)]&lt;br /&gt;
* [http://wiki.gentoo.org/wiki/Network_bridge Gentoo Wiki - Network Bridge]&lt;br /&gt;
&lt;br /&gt;
[[Category:Workarounds]]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3112</id>
		<title>Manually adding a new bridge</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3112"/>
		<updated>2014-02-12T14:21:58Z</updated>

		<summary type="html">&lt;p&gt;David: /* Remove a VLAN on a bonding interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
The following page describes the steps to manually add a new Ethernet bridge (&amp;lt;code&amp;gt;vmbrX&amp;lt;/code&amp;gt;) to an existing stoney cloud installation.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
To be able to add and configure a new bridge, you need to have the following informations present:&lt;br /&gt;
* VLAN ID, such as &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP prefix, such as &amp;lt;code&amp;gt;192.0.2.0/24&amp;lt;/code&amp;gt;&lt;br /&gt;
* Default gateway address  (if any), such as &amp;lt;code&amp;gt;192.0.2.1&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP address for the DHCP server on the VM node, such as &amp;lt;code&amp;gt;192.0.2.13&amp;lt;/code&amp;gt;&lt;br /&gt;
* Broadcast address, such as &amp;lt;code&amp;gt;192.0.2.255&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure, that you have configured the new VLAN on all involved switches and routers beforehand.&lt;br /&gt;
&lt;br /&gt;
= Configuration =&lt;br /&gt;
== Add the new VLAN on top of the bonding interface ==&lt;br /&gt;
Login to the first VM node and manually add the new VLAN to the existing bonding interface (&amp;lt;code&amp;gt;bond0&amp;lt;/code&amp;gt;). In the following example VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; is added:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip link add link bond0 name vlan141 type vlan id 141&lt;br /&gt;
ip link set vlan141 up&lt;br /&gt;
ip link show vlan141&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
71: vlan141@bond0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP mode DEFAULT &lt;br /&gt;
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to bring the newly configured VLAN up after a system reboot, the network configuration needs to be extended. Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and add the following entry:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# VLAN (802.1q support)&lt;br /&gt;
 &lt;br /&gt;
vlans_bond0=&amp;quot;130 120 110 140 141&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# pub VLAN&lt;br /&gt;
vlan140_name=&amp;quot;vlan140&amp;quot;&lt;br /&gt;
config_vlan140=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new vlan at the end of the VLAN section&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a new bridging device ==&lt;br /&gt;
As the new VLAN interface is now up, an additional bridge can be added.&lt;br /&gt;
&lt;br /&gt;
Again the network configuration needs to be edited. Append the configuration of the new bridge, below the existing &amp;lt;code&amp;gt;vmbr0&amp;lt;/code&amp;gt; bridge configuration. In the following example the bridge &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt; is added on top of VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; with a prefix of &amp;lt;code&amp;gt;192.0.2.13/24&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# Bridging (802.1d) interfaces&lt;br /&gt;
&lt;br /&gt;
bridge_vmbr0=&amp;quot;vlanXXX&amp;quot;&lt;br /&gt;
bridge_add_vlanXXX=&amp;quot;vmbr0&amp;quot;&lt;br /&gt;
config_vmbr0=&amp;quot;XXX.XXX.XXX.XXX/XX brd XXX.XXX.XXX.XXX&amp;quot;&lt;br /&gt;
routes_vmbr0=&amp;quot;default via XXX.XXX.XXX.XXX&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new bridge at the end of the bridge section&lt;br /&gt;
bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
config_vmbr4=&amp;quot;192.0.2.13/24 brd 192.0.2.255&amp;quot;&lt;br /&gt;
rc_net_vmbr4_provide=&amp;quot;!net&amp;quot; # Otherwise stopping or restarting the bridge, will bring all net-services down.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To bring the bridge up, an init script is required. Simply symlink the &amp;lt;code&amp;gt;net.lo&amp;lt;/code&amp;gt; script to the new bridge name&#039;s script, here &amp;lt;code&amp;gt;net.vmbr4&amp;lt;/code&amp;gt; is assumed:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.vmbr4&lt;br /&gt;
rc-update add net.vmbr4 default&lt;br /&gt;
/etc/init.d/net.vmbr4 start&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * Caching service dependencies ...                                       [ ok ]&lt;br /&gt;
 * Bringing up interface vmbr4&lt;br /&gt;
 *   Creating bridge vmbr4 ...&lt;br /&gt;
 *   Adding ports to vmbr4&lt;br /&gt;
 *     vlan141 ...                                                        [ ok ]&lt;br /&gt;
 *   192.0.2.13/24 ...                                                    [ ok ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check if everything looks fine:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip addr show vmbr4 &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
72: vmbr4: &amp;lt;BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP &lt;br /&gt;
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
    inet 192.0.2.13/24 brd 192.0.2.255 scope global vmbr4&lt;br /&gt;
       valid_lft forever preferred_lft forever&lt;br /&gt;
&lt;br /&gt;
bridge name	bridge id		STP enabled	interfaces&lt;br /&gt;
vmbr4		8000.3860779c9840	no		vlan141&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or if you would like to copy&amp;amp;paste:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vlanId=141&lt;br /&gt;
bridgeName=vmbr4&lt;br /&gt;
nodeIp=192.0.2.13&lt;br /&gt;
prefixLength=24&lt;br /&gt;
broadcast=192.0.2.255&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
bridge_${bridgeName}=&amp;quot;vlan${vlanId}&amp;quot;&lt;br /&gt;
bridge_add_vlan${vlanId}=&amp;quot;${bridgeName}&amp;quot;&lt;br /&gt;
config_${bridgeName}=&amp;quot;${nodeIp}/${prefixLength} brd ${broadcast}&amp;quot;&lt;br /&gt;
rc_net_${bridgeName}_provide=&amp;quot;!net&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.${bridgeName}&lt;br /&gt;
rc-update add net.${bridgeName} default&lt;br /&gt;
/etc/init.d/net.${bridgeName} start&lt;br /&gt;
ip addr show ${bridgeName} &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Delete a bridging device ==&lt;br /&gt;
Tear the bridge down but check if it would also stop all network services:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Set your bridge name&lt;br /&gt;
bridgeName=&amp;lt;NAME OF YOUR BRIDGE&amp;gt;   # e.g.: vmbr4&lt;br /&gt;
&lt;br /&gt;
# Check if it excludes the net services&lt;br /&gt;
grep rc_net_${bridgeName}_provide /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If grep produces output you might consider running the initscript with the &#039;&#039;-D&#039;&#039; options (otherwise network services, like sshd, might get stopped).&lt;br /&gt;
&lt;br /&gt;
Otherwise just stop the bridge and remove the initscript:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/etc/init.d/net.${bridgeName} stop&lt;br /&gt;
&lt;br /&gt;
rc-update del net.${bridgeName} default&lt;br /&gt;
&lt;br /&gt;
rm /etc/init.d/net.${bridgeName}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remove the bridge from the network configuration:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
### Remove the options for the bridge you want to delete&lt;br /&gt;
#bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
#bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
#config_vmbr4=&amp;quot;192.0.2.13/24 brd 192.0.2.255&amp;quot;&lt;br /&gt;
#rc_net_vmbr4_provide=&amp;quot;!net&amp;quot; # Otherwise stopping or restarting the bridge, will bring all net-services down.&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Remove a VLAN on a bonding interface ==&lt;br /&gt;
Delete the VLAN from the interface bond0:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Set your vlan id&lt;br /&gt;
vlanId=&amp;lt;VLAN ID&amp;gt;   # e.g. 141&lt;br /&gt;
&lt;br /&gt;
# Shut the vlan down&lt;br /&gt;
ip link set vlan${vlanId} down&lt;br /&gt;
&lt;br /&gt;
# Remove it from the interface bond0&lt;br /&gt;
ip link delete vlan${vlanId} type vlan&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and remove your VLAN:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
### Remove your vlan options&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
# vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
# config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap10 Gentoo Handbook - VLAN (802.1q support)]&lt;br /&gt;
* [https://wiki.archlinux.org/index.php/VLAN ArchWiki - VLAN]&lt;br /&gt;
* [http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge Linux Foundation - Bridge]&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap7 Gentoo Handbook - Bridging (802.1d support)]&lt;br /&gt;
* [http://wiki.gentoo.org/wiki/Network_bridge Gentoo Wiki - Network Bridge]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3111</id>
		<title>Manually adding a new bridge</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3111"/>
		<updated>2014-02-12T14:20:00Z</updated>

		<summary type="html">&lt;p&gt;David: /* Delete a bridging device */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
The following page describes the steps to manually add a new Ethernet bridge (&amp;lt;code&amp;gt;vmbrX&amp;lt;/code&amp;gt;) to an existing stoney cloud installation.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
To be able to add and configure a new bridge, you need to have the following informations present:&lt;br /&gt;
* VLAN ID, such as &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP prefix, such as &amp;lt;code&amp;gt;192.0.2.0/24&amp;lt;/code&amp;gt;&lt;br /&gt;
* Default gateway address  (if any), such as &amp;lt;code&amp;gt;192.0.2.1&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP address for the DHCP server on the VM node, such as &amp;lt;code&amp;gt;192.0.2.13&amp;lt;/code&amp;gt;&lt;br /&gt;
* Broadcast address, such as &amp;lt;code&amp;gt;192.0.2.255&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure, that you have configured the new VLAN on all involved switches and routers beforehand.&lt;br /&gt;
&lt;br /&gt;
= Configuration =&lt;br /&gt;
== Add the new VLAN on top of the bonding interface ==&lt;br /&gt;
Login to the first VM node and manually add the new VLAN to the existing bonding interface (&amp;lt;code&amp;gt;bond0&amp;lt;/code&amp;gt;). In the following example VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; is added:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip link add link bond0 name vlan141 type vlan id 141&lt;br /&gt;
ip link set vlan141 up&lt;br /&gt;
ip link show vlan141&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
71: vlan141@bond0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP mode DEFAULT &lt;br /&gt;
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to bring the newly configured VLAN up after a system reboot, the network configuration needs to be extended. Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and add the following entry:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# VLAN (802.1q support)&lt;br /&gt;
 &lt;br /&gt;
vlans_bond0=&amp;quot;130 120 110 140 141&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# pub VLAN&lt;br /&gt;
vlan140_name=&amp;quot;vlan140&amp;quot;&lt;br /&gt;
config_vlan140=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new vlan at the end of the VLAN section&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a new bridging device ==&lt;br /&gt;
As the new VLAN interface is now up, an additional bridge can be added.&lt;br /&gt;
&lt;br /&gt;
Again the network configuration needs to be edited. Append the configuration of the new bridge, below the existing &amp;lt;code&amp;gt;vmbr0&amp;lt;/code&amp;gt; bridge configuration. In the following example the bridge &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt; is added on top of VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; with a prefix of &amp;lt;code&amp;gt;192.0.2.13/24&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# Bridging (802.1d) interfaces&lt;br /&gt;
&lt;br /&gt;
bridge_vmbr0=&amp;quot;vlanXXX&amp;quot;&lt;br /&gt;
bridge_add_vlanXXX=&amp;quot;vmbr0&amp;quot;&lt;br /&gt;
config_vmbr0=&amp;quot;XXX.XXX.XXX.XXX/XX brd XXX.XXX.XXX.XXX&amp;quot;&lt;br /&gt;
routes_vmbr0=&amp;quot;default via XXX.XXX.XXX.XXX&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new bridge at the end of the bridge section&lt;br /&gt;
bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
config_vmbr4=&amp;quot;192.0.2.13/24 brd 192.0.2.255&amp;quot;&lt;br /&gt;
rc_net_vmbr4_provide=&amp;quot;!net&amp;quot; # Otherwise stopping or restarting the bridge, will bring all net-services down.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To bring the bridge up, an init script is required. Simply symlink the &amp;lt;code&amp;gt;net.lo&amp;lt;/code&amp;gt; script to the new bridge name&#039;s script, here &amp;lt;code&amp;gt;net.vmbr4&amp;lt;/code&amp;gt; is assumed:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.vmbr4&lt;br /&gt;
rc-update add net.vmbr4 default&lt;br /&gt;
/etc/init.d/net.vmbr4 start&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * Caching service dependencies ...                                       [ ok ]&lt;br /&gt;
 * Bringing up interface vmbr4&lt;br /&gt;
 *   Creating bridge vmbr4 ...&lt;br /&gt;
 *   Adding ports to vmbr4&lt;br /&gt;
 *     vlan141 ...                                                        [ ok ]&lt;br /&gt;
 *   192.0.2.13/24 ...                                                    [ ok ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check if everything looks fine:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip addr show vmbr4 &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
72: vmbr4: &amp;lt;BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP &lt;br /&gt;
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
    inet 192.0.2.13/24 brd 192.0.2.255 scope global vmbr4&lt;br /&gt;
       valid_lft forever preferred_lft forever&lt;br /&gt;
&lt;br /&gt;
bridge name	bridge id		STP enabled	interfaces&lt;br /&gt;
vmbr4		8000.3860779c9840	no		vlan141&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or if you would like to copy&amp;amp;paste:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vlanId=141&lt;br /&gt;
bridgeName=vmbr4&lt;br /&gt;
nodeIp=192.0.2.13&lt;br /&gt;
prefixLength=24&lt;br /&gt;
broadcast=192.0.2.255&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
bridge_${bridgeName}=&amp;quot;vlan${vlanId}&amp;quot;&lt;br /&gt;
bridge_add_vlan${vlanId}=&amp;quot;${bridgeName}&amp;quot;&lt;br /&gt;
config_${bridgeName}=&amp;quot;${nodeIp}/${prefixLength} brd ${broadcast}&amp;quot;&lt;br /&gt;
rc_net_${bridgeName}_provide=&amp;quot;!net&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.${bridgeName}&lt;br /&gt;
rc-update add net.${bridgeName} default&lt;br /&gt;
/etc/init.d/net.${bridgeName} start&lt;br /&gt;
ip addr show ${bridgeName} &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Delete a bridging device ==&lt;br /&gt;
Tear the bridge down but check if it would also stop all network services:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Set your bridge name&lt;br /&gt;
bridgeName=&amp;lt;NAME OF YOUR BRIDGE&amp;gt;   # e.g.: vmbr4&lt;br /&gt;
&lt;br /&gt;
# Check if it excludes the net services&lt;br /&gt;
grep rc_net_${bridgeName}_provide /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If grep produces output you might consider running the initscript with the &#039;&#039;-D&#039;&#039; options (otherwise network services, like sshd, might get stopped).&lt;br /&gt;
&lt;br /&gt;
Otherwise just stop the bridge and remove the initscript:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/etc/init.d/net.${bridgeName} stop&lt;br /&gt;
&lt;br /&gt;
rc-update del net.${bridgeName} default&lt;br /&gt;
&lt;br /&gt;
rm /etc/init.d/net.${bridgeName}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remove the bridge from the network configuration:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
### Remove the options for the bridge you want to delete&lt;br /&gt;
#bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
#bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
#config_vmbr4=&amp;quot;192.0.2.13/24 brd 192.0.2.255&amp;quot;&lt;br /&gt;
#rc_net_vmbr4_provide=&amp;quot;!net&amp;quot; # Otherwise stopping or restarting the bridge, will bring all net-services down.&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Remove a VLAN on a bonding interface ==&lt;br /&gt;
Delete the VLAN from the interface bond0:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Set your vlan id&lt;br /&gt;
vlanId=&amp;lt;VLAN ID&amp;gt;   # e.g. 141&lt;br /&gt;
&lt;br /&gt;
# Shut the vlan down&lt;br /&gt;
ip link set vlan${vlanId} down&lt;br /&gt;
&lt;br /&gt;
# Remove it from the interface bond0&lt;br /&gt;
ip link delete link bond0 name vlan${vlanId} type vlan id ${vlanId}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and remove your VLAN:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
### Remove your vlan options&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
# vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
# config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap10 Gentoo Handbook - VLAN (802.1q support)]&lt;br /&gt;
* [https://wiki.archlinux.org/index.php/VLAN ArchWiki - VLAN]&lt;br /&gt;
* [http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge Linux Foundation - Bridge]&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap7 Gentoo Handbook - Bridging (802.1d support)]&lt;br /&gt;
* [http://wiki.gentoo.org/wiki/Network_bridge Gentoo Wiki - Network Bridge]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3110</id>
		<title>Manually adding a new bridge</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3110"/>
		<updated>2014-02-12T14:18:21Z</updated>

		<summary type="html">&lt;p&gt;David: /* Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
The following page describes the steps to manually add a new Ethernet bridge (&amp;lt;code&amp;gt;vmbrX&amp;lt;/code&amp;gt;) to an existing stoney cloud installation.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
To be able to add and configure a new bridge, you need to have the following informations present:&lt;br /&gt;
* VLAN ID, such as &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP prefix, such as &amp;lt;code&amp;gt;192.0.2.0/24&amp;lt;/code&amp;gt;&lt;br /&gt;
* Default gateway address  (if any), such as &amp;lt;code&amp;gt;192.0.2.1&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP address for the DHCP server on the VM node, such as &amp;lt;code&amp;gt;192.0.2.13&amp;lt;/code&amp;gt;&lt;br /&gt;
* Broadcast address, such as &amp;lt;code&amp;gt;192.0.2.255&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure, that you have configured the new VLAN on all involved switches and routers beforehand.&lt;br /&gt;
&lt;br /&gt;
= Configuration =&lt;br /&gt;
== Add the new VLAN on top of the bonding interface ==&lt;br /&gt;
Login to the first VM node and manually add the new VLAN to the existing bonding interface (&amp;lt;code&amp;gt;bond0&amp;lt;/code&amp;gt;). In the following example VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; is added:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip link add link bond0 name vlan141 type vlan id 141&lt;br /&gt;
ip link set vlan141 up&lt;br /&gt;
ip link show vlan141&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
71: vlan141@bond0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP mode DEFAULT &lt;br /&gt;
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to bring the newly configured VLAN up after a system reboot, the network configuration needs to be extended. Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and add the following entry:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# VLAN (802.1q support)&lt;br /&gt;
 &lt;br /&gt;
vlans_bond0=&amp;quot;130 120 110 140 141&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# pub VLAN&lt;br /&gt;
vlan140_name=&amp;quot;vlan140&amp;quot;&lt;br /&gt;
config_vlan140=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new vlan at the end of the VLAN section&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a new bridging device ==&lt;br /&gt;
As the new VLAN interface is now up, an additional bridge can be added.&lt;br /&gt;
&lt;br /&gt;
Again the network configuration needs to be edited. Append the configuration of the new bridge, below the existing &amp;lt;code&amp;gt;vmbr0&amp;lt;/code&amp;gt; bridge configuration. In the following example the bridge &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt; is added on top of VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; with a prefix of &amp;lt;code&amp;gt;192.0.2.13/24&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# Bridging (802.1d) interfaces&lt;br /&gt;
&lt;br /&gt;
bridge_vmbr0=&amp;quot;vlanXXX&amp;quot;&lt;br /&gt;
bridge_add_vlanXXX=&amp;quot;vmbr0&amp;quot;&lt;br /&gt;
config_vmbr0=&amp;quot;XXX.XXX.XXX.XXX/XX brd XXX.XXX.XXX.XXX&amp;quot;&lt;br /&gt;
routes_vmbr0=&amp;quot;default via XXX.XXX.XXX.XXX&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new bridge at the end of the bridge section&lt;br /&gt;
bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
config_vmbr4=&amp;quot;192.0.2.13/24 brd 192.0.2.255&amp;quot;&lt;br /&gt;
rc_net_vmbr4_provide=&amp;quot;!net&amp;quot; # Otherwise stopping or restarting the bridge, will bring all net-services down.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To bring the bridge up, an init script is required. Simply symlink the &amp;lt;code&amp;gt;net.lo&amp;lt;/code&amp;gt; script to the new bridge name&#039;s script, here &amp;lt;code&amp;gt;net.vmbr4&amp;lt;/code&amp;gt; is assumed:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.vmbr4&lt;br /&gt;
rc-update add net.vmbr4 default&lt;br /&gt;
/etc/init.d/net.vmbr4 start&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * Caching service dependencies ...                                       [ ok ]&lt;br /&gt;
 * Bringing up interface vmbr4&lt;br /&gt;
 *   Creating bridge vmbr4 ...&lt;br /&gt;
 *   Adding ports to vmbr4&lt;br /&gt;
 *     vlan141 ...                                                        [ ok ]&lt;br /&gt;
 *   192.0.2.13/24 ...                                                    [ ok ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check if everything looks fine:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip addr show vmbr4 &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
72: vmbr4: &amp;lt;BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP &lt;br /&gt;
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
    inet 192.0.2.13/24 brd 192.0.2.255 scope global vmbr4&lt;br /&gt;
       valid_lft forever preferred_lft forever&lt;br /&gt;
&lt;br /&gt;
bridge name	bridge id		STP enabled	interfaces&lt;br /&gt;
vmbr4		8000.3860779c9840	no		vlan141&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or if you would like to copy&amp;amp;paste:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vlanId=141&lt;br /&gt;
bridgeName=vmbr4&lt;br /&gt;
nodeIp=192.0.2.13&lt;br /&gt;
prefixLength=24&lt;br /&gt;
broadcast=192.0.2.255&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
bridge_${bridgeName}=&amp;quot;vlan${vlanId}&amp;quot;&lt;br /&gt;
bridge_add_vlan${vlanId}=&amp;quot;${bridgeName}&amp;quot;&lt;br /&gt;
config_${bridgeName}=&amp;quot;${nodeIp}/${prefixLength} brd ${broadcast}&amp;quot;&lt;br /&gt;
rc_net_${bridgeName}_provide=&amp;quot;!net&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.${bridgeName}&lt;br /&gt;
rc-update add net.${bridgeName} default&lt;br /&gt;
/etc/init.d/net.${bridgeName} start&lt;br /&gt;
ip addr show ${bridgeName} &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Delete a bridging device ==&lt;br /&gt;
Tear the bridge down but check if it would also stop all network services:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Set your bridge name&lt;br /&gt;
bridgeName=&amp;lt;NAME OF YOUR BRIDGE&amp;gt;   # e.g.: vmbr4&lt;br /&gt;
&lt;br /&gt;
# Check if it excludes the net services&lt;br /&gt;
grep rc_net_${bridgeName}_provide /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If grep produces output you might consider running the initscript with the &#039;&#039;-D&#039;&#039; options (otherwise network services, like sshd, might get stopped).&lt;br /&gt;
&lt;br /&gt;
Otherwise just stop the bridge and remove the initscript:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/etc/init.d/net.vmbr4 start&lt;br /&gt;
&lt;br /&gt;
rc-update add net.vmbr4 default&lt;br /&gt;
&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.vmbr4&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remove the bridge from the network configuration:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
### Remove the options for the bridge you want to delete&lt;br /&gt;
#bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
#bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
#config_vmbr4=&amp;quot;192.0.2.13/24 brd 192.0.2.255&amp;quot;&lt;br /&gt;
#rc_net_vmbr4_provide=&amp;quot;!net&amp;quot; # Otherwise stopping or restarting the bridge, will bring all net-services down.&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Remove a VLAN on a bonding interface ==&lt;br /&gt;
Delete the VLAN from the interface bond0:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Set your vlan id&lt;br /&gt;
vlanId=&amp;lt;VLAN ID&amp;gt;   # e.g. 141&lt;br /&gt;
&lt;br /&gt;
# Shut the vlan down&lt;br /&gt;
ip link set vlan${vlanId} down&lt;br /&gt;
&lt;br /&gt;
# Remove it from the interface bond0&lt;br /&gt;
ip link delete link bond0 name vlan${vlanId} type vlan id ${vlanId}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and remove your VLAN:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
### Remove your vlan options&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
# vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
# config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap10 Gentoo Handbook - VLAN (802.1q support)]&lt;br /&gt;
* [https://wiki.archlinux.org/index.php/VLAN ArchWiki - VLAN]&lt;br /&gt;
* [http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge Linux Foundation - Bridge]&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap7 Gentoo Handbook - Bridging (802.1d support)]&lt;br /&gt;
* [http://wiki.gentoo.org/wiki/Network_bridge Gentoo Wiki - Network Bridge]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3101</id>
		<title>Manually adding a new bridge</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=Manually_adding_a_new_bridge&amp;diff=3101"/>
		<updated>2014-02-12T10:47:17Z</updated>

		<summary type="html">&lt;p&gt;David: /* Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
The following page describes the steps to manually add a new Ethernet bridge (&amp;lt;code&amp;gt;vmbrX&amp;lt;/code&amp;gt;) to an existing stoney cloud installation.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
To be able to add and configure a new bridge, you need to have the following informations present:&lt;br /&gt;
* VLAN ID, such as &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP prefix, such as &amp;lt;code&amp;gt;192.0.2.0/24&amp;lt;/code&amp;gt;&lt;br /&gt;
* Default gateway address  (if any), such as &amp;lt;code&amp;gt;192.0.2.1&amp;lt;/code&amp;gt;&lt;br /&gt;
* IP address for the DHCP server on the VM node, such as &amp;lt;code&amp;gt;192.0.2.13&amp;lt;/code&amp;gt;&lt;br /&gt;
* Broadcast address, such as &amp;lt;code&amp;gt;192.0.2.255&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure, that you have configured the new VLAN on all involved switches and routers beforehand.&lt;br /&gt;
&lt;br /&gt;
= Configuration =&lt;br /&gt;
== Add the new VLAN on top of the bonding interface ==&lt;br /&gt;
Login to the first VM node and manually add the new VLAN to the existing bonding interface (&amp;lt;code&amp;gt;bond0&amp;lt;/code&amp;gt;). In the following example VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; is added:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip link add link bond0 name vlan141 type vlan id 141&lt;br /&gt;
ip link set vlan141 up&lt;br /&gt;
ip link show vlan141&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
71: vlan141@bond0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP mode DEFAULT &lt;br /&gt;
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to bring the newly configured VLAN up after a system reboot, the network configuration needs to be extended. Edit &amp;lt;code&amp;gt;/etc/conf.d/net&amp;lt;/code&amp;gt; and add the following entry:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# VLAN (802.1q support)&lt;br /&gt;
 &lt;br /&gt;
vlans_bond0=&amp;quot;130 120 110 140 141&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# pub VLAN&lt;br /&gt;
vlan140_name=&amp;quot;vlan140&amp;quot;&lt;br /&gt;
config_vlan140=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new vlan at the end of the VLAN section&lt;br /&gt;
# pub2 VLAN&lt;br /&gt;
vlan141_name=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
config_vlan141=&amp;quot;null&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# [...]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Create a new bridging device ==&lt;br /&gt;
As the new VLAN interface is now up, an additional bridge can be added.&lt;br /&gt;
&lt;br /&gt;
Again the network configuration needs to be edited. Append the configuration of the new bridge, below the existing &amp;lt;code&amp;gt;vmbr0&amp;lt;/code&amp;gt; bridge configuration. In the following example the bridge &amp;lt;code&amp;gt;vmbr4&amp;lt;/code&amp;gt; is added on top of VLAN &amp;lt;code&amp;gt;141&amp;lt;/code&amp;gt; with a prefix of &amp;lt;code&amp;gt;192.0.2.13/24&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$EDITOR /etc/conf.d/net&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# [...]&lt;br /&gt;
&lt;br /&gt;
#-----------------------------------------------------------------------------&lt;br /&gt;
# Bridging (802.1d) interfaces&lt;br /&gt;
&lt;br /&gt;
bridge_vmbr0=&amp;quot;vlanXXX&amp;quot;&lt;br /&gt;
bridge_add_vlanXXX=&amp;quot;vmbr0&amp;quot;&lt;br /&gt;
config_vmbr0=&amp;quot;XXX.XXX.XXX.XXX/XX brd XXX.XXX.XXX.XXX&amp;quot;&lt;br /&gt;
routes_vmbr0=&amp;quot;default via XXX.XXX.XXX.XXX&amp;quot;&lt;br /&gt;
&lt;br /&gt;
### Add your new bridge at the end of the bridge section&lt;br /&gt;
bridge_vmbr4=&amp;quot;vlan141&amp;quot;&lt;br /&gt;
bridge_add_vlan141=&amp;quot;vmbr4&amp;quot;&lt;br /&gt;
config_vmbr4=&amp;quot;192.0.2.13/24 brd 192.0.2.255&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To bring the bridge up, an init script is required. Simply symlink the &amp;lt;code&amp;gt;net.lo&amp;lt;/code&amp;gt; script to the new bridge name&#039;s script, here &amp;lt;code&amp;gt;net.vmbr4&amp;lt;/code&amp;gt; is assumed:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.vmbr4&lt;br /&gt;
rc-update add net.vmbr4 default&lt;br /&gt;
/etc/init.d/net.vmbr4 start&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * Caching service dependencies ...                                       [ ok ]&lt;br /&gt;
 * Bringing up interface vmbr4&lt;br /&gt;
 *   Creating bridge vmbr4 ...&lt;br /&gt;
 *   Adding ports to vmbr4&lt;br /&gt;
 *     vlan141 ...                                                        [ ok ]&lt;br /&gt;
 *   192.0.2.13/24 ...                                                    [ ok ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check if everything looks fine:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ip addr show vmbr4 &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
72: vmbr4: &amp;lt;BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP &lt;br /&gt;
    link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
    inet 192.0.2.13/24 brd 192.0.2.255 scope global vmbr4&lt;br /&gt;
       valid_lft forever preferred_lft forever&lt;br /&gt;
&lt;br /&gt;
bridge name	bridge id		STP enabled	interfaces&lt;br /&gt;
vmbr4		8000.3860779c9840	no		vlan141&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or if you would like to copy&amp;amp;paste:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vlanId=141&lt;br /&gt;
bridgeName=vmbr4&lt;br /&gt;
nodeIp=192.0.2.13&lt;br /&gt;
prefixLength=24&lt;br /&gt;
broadcast=192.0.2.255&lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; /etc/conf.d/net&lt;br /&gt;
&lt;br /&gt;
bridge_${bridgeName}=&amp;quot;vlan${vlanId}&amp;quot;&lt;br /&gt;
bridge_add_vlan${vlanId}=&amp;quot;${bridgeName}&amp;quot;&lt;br /&gt;
config_${bridgeName}=&amp;quot;${nodeIp}/${prefixLength} brd ${broadcast}&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
ln -s /etc/init.d/net.lo /etc/init.d/net.${bridgeName}&lt;br /&gt;
rc-update add net.${bridgeName} default&lt;br /&gt;
/etc/init.d/net.${bridgeName} start&lt;br /&gt;
ip addr show ${bridgeName} &amp;amp;&amp;amp; brctl show&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap10 Gentoo Handbook - VLAN (802.1q support)]&lt;br /&gt;
* [https://wiki.archlinux.org/index.php/VLAN ArchWiki - VLAN]&lt;br /&gt;
* [http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge Linux Foundation - Bridge]&lt;br /&gt;
* [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&amp;amp;chap=3#doc_chap7 Gentoo Handbook - Bridging (802.1d support)]&lt;br /&gt;
* [http://wiki.gentoo.org/wiki/Network_bridge Gentoo Wiki - Network Bridge]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=stoney_conductor:_VM_Backup&amp;diff=2949</id>
		<title>stoney conductor: VM Backup</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=stoney_conductor:_VM_Backup&amp;diff=2949"/>
		<updated>2014-01-30T13:21:48Z</updated>

		<summary type="html">&lt;p&gt;David: /* How to exclude a machine from the backup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
This page describes how the VMs and VM-Templates are backed-up and restored inside the [http://www.stoney-cloud.org stoney cloud].&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
TBD: PKL. Bitte bitte bei folgenden Attributen den Platzbedarf aufzeigen (wie kommt man auf die minimale Grösse)&lt;br /&gt;
* sstBackupRootDirectory: file:///var/backup/virtualization&lt;br /&gt;
* sstBackupRetainDirectory: file:///var/virtualization/retain&lt;br /&gt;
* sstBackupRamDiskLocation: file:///var/cache/kvmbackup&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* A working stoney cloud, installed according to [[stoney cloud: Single-Node Installation]] or [[stoney cloud: Multi-Node Installation]].&lt;br /&gt;
* The backup configuration must be set: [[stoney_conductor:_OpenLDAP_directory_data_organisation#Backup | stoney conductor: OpenLDAP directory data organisation]].&lt;br /&gt;
&lt;br /&gt;
= Backup =&lt;br /&gt;
== Basic idea ==&lt;br /&gt;
The main idea to backup a VM or a VM-Template is, to divide the task into three subtasks: &lt;br /&gt;
* Snapshot: Save the machines state (CPU, Memory and Disk)&lt;br /&gt;
* Merge: Merge the Disk-Image-Snapshot with the Live-Image&lt;br /&gt;
* Retain: Export the snapshot files&lt;br /&gt;
A more detailed and technical description for these three sub-processes can be found [[#Sub-Processes | here]].&lt;br /&gt;
&lt;br /&gt;
Furthermore there is an control instance, which can independently call these three sub-processes for a given machine. Like that, the stoney cloud is able to handle different cases:&lt;br /&gt;
=== Backup a single machine ===&lt;br /&gt;
The procedure for backing up a single machine is very simple. Just call the three sub-processes (snapshot, merge and retain) one after the other. So the control instance would do some very basic stuff: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
object machine = args[0];&lt;br /&gt;
&lt;br /&gt;
if( snapshot( machine ) )&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    if ( merge( machine ) )&lt;br /&gt;
    {&lt;br /&gt;
&lt;br /&gt;
        if ( retain( machine ) )&lt;br /&gt;
        {&lt;br /&gt;
            printf(&amp;quot;Successfully backed up machine %s\n&amp;quot;, machine);&lt;br /&gt;
&lt;br /&gt;
        } else&lt;br /&gt;
        {&lt;br /&gt;
            printf(&amp;quot;Error while retaining machine %s: %s\n&amp;quot;, machine, error);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    } else&lt;br /&gt;
    {&lt;br /&gt;
        printf(&amp;quot;Error while merging machine %s: %s\n&amp;quot;, machine, error);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
} else&lt;br /&gt;
{&lt;br /&gt;
    printf(&amp;quot;Error while snapshotting machine %s: %s\n&amp;quot;, machine, error);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Backup multiple machines at the same time ===&lt;br /&gt;
When backing up multiple machines at the same time, we need to make sure that the downtime for the machines are as close together as possible. Therefore the control instance should call first the snapshot process for all machines. After every machine has been snapshotted, the control instance can call the merge and retain process for every machine. The most important part here is, that the control instance somehow remembers, if the snapshot for a given machine was successful or not. Because if the snapshot failed, it must not call the merge and retain process. So the control instance needs a little bit more logic: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
object machines[] = args[0];&lt;br /&gt;
object successful_snapshots[];&lt;br /&gt;
&lt;br /&gt;
# Snapshot all machines&lt;br /&gt;
for( int i = 0; i &amp;lt;  sizeof(machines) / sizeof(object) ; i++ )&lt;br /&gt;
{&lt;br /&gt;
    # If the snapshot was successful, put the machine into the &lt;br /&gt;
    # successful_snapshots array&lt;br /&gt;
    if ( snapshot( machines[i] ) )&lt;br /&gt;
    {&lt;br /&gt;
        successful_snapshots[machines[i]];&lt;br /&gt;
    } else&lt;br /&gt;
    {&lt;br /&gt;
        printf(&amp;quot;Error while snapshotting machine %s: %s\n&amp;quot;, machines[i],error);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Merge and reatin all successful_snapshot machines&lt;br /&gt;
for ( int i = 0; i &amp;lt;  sizeof(successful_snapshots) / sizeof(object) ; i++ ) )&lt;br /&gt;
{&lt;br /&gt;
    # Check if the element at this position is not null, then the snapshot &lt;br /&gt;
    # for this machine was successful&lt;br /&gt;
    if ( successful_snapshots[i] )&lt;br /&gt;
    {&lt;br /&gt;
        if ( merge( successful_snapshots[i] ) )&lt;br /&gt;
        {&lt;br /&gt;
            if ( retain( successful_snapshots[i] ) )&lt;br /&gt;
            {&lt;br /&gt;
              printf(&amp;quot;Successfully backed-up machine %s\n&amp;quot;, successful_snapshots[i]);&lt;br /&gt;
            } else&lt;br /&gt;
            {&lt;br /&gt;
                printf(&amp;quot;Error while retaining machine %s: %s\n&amp;quot;, successful_snapshots[i],error);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
        } else&lt;br /&gt;
        {&lt;br /&gt;
            printf(&amp;quot;Error while merging machine %s: %s\n&amp;quot;, successful_snapshots[i],error);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sub-Processes ===&lt;br /&gt;
==== Snapshot ====&lt;br /&gt;
# Create a snapshot with state:&lt;br /&gt;
#* If the VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; is running:&lt;br /&gt;
#** Save the state of VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; to the file &amp;lt;code&amp;gt;vm-001.state&amp;lt;/code&amp;gt; (This file can either be created on a RAM-Disk or directly in the retain location. This example however saves the file to a RAM-Disk): &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;virsh save vm-001 /path/to/ram-disk/vm-001.state&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#** After this command, the VMs CPU and memory state is represented by the file &amp;lt;code&amp;gt;/path/to/ram-disk/vm-001.state&amp;lt;/code&amp;gt; and the VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; is shut down.&lt;br /&gt;
#* If the VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; is shut down: &lt;br /&gt;
#** Create a fake state file for the VM: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;echo &amp;quot;Machine is not runnung, no state file&amp;quot; &amp;gt; /path/to/ram-disk/vm-001.state&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Move the disk image &amp;lt;code&amp;gt;/path/to/images/vm-001.qcow2&amp;lt;/code&amp;gt; to the retain location: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;mv /path/to/images/vm-001.qcow2 /path/to/retain/vm-001.qcow2&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#* &#039;&#039;&#039;Please note:&#039;&#039;&#039; The retain directory (&amp;lt;code&amp;gt;/path/to/retain/&amp;lt;/code&amp;gt;) &#039;&#039;&#039;has to be&#039;&#039;&#039; on the same partition as the images directory (&amp;lt;code&amp;gt;/path/to/images/&amp;lt;/code&amp;gt;). This will make the &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; operation very fast (only renaming the inode). So the downtime (remember the VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; is shut down) is as short as possible. &lt;br /&gt;
#* &#039;&#039;&#039;Please note&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;:&#039;&#039;&#039; If the VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; has more than just one disk-image, repeat this step for every disk-image&lt;br /&gt;
# Create the new (empty) disk image with the old as backing store file: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;qemu-img create -f qcow2 -b /path/to/retain/vm-001.qcow2 /path/to/images/vm-001.qcow2&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#* &#039;&#039;&#039;Please note:&#039;&#039;&#039; If the VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; has more than just one disk-image, repeat this step for every disk-image&lt;br /&gt;
# Set correct ownership and permission to the newly created image:&lt;br /&gt;
#* &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;chmod 660 /path/to/images/vm-001.qcow2&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#* &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;chown root:vm-storage /path/to/images/vm-001.qcow2&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#* &#039;&#039;&#039;Please note:&#039;&#039;&#039; If the VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; has more than just one disk-image, repeat these steps for every disk-image&lt;br /&gt;
# Save the VMs XML description&lt;br /&gt;
#* Save the current XML description of VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; to a file at the retain location: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;virsh dumpxml vm-001 &amp;gt; /path/to/retain/vm-001.xml&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Save the backend entry&lt;br /&gt;
#* There is no generic command to save the backend entry (since the command depends on the backend). Important here is, that the backend entry of the VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; is saved to the retain location: &amp;lt;code&amp;gt;/path/to/retain/vm-001.backend&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restore the VMs &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; from its saved state (this will also start the VM): &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;virsh restore /path/to/ram-disk/vm-001.state&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#* &#039;&#039;&#039;Please note:&#039;&#039;&#039; After this operation the VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; is running again (continues where we stopped it), and we have a consistent backup for the VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt;:&lt;br /&gt;
#** The file &amp;lt;code&amp;gt;/path/to/ram-disk/vm-001.state&amp;lt;/code&amp;gt; contains the CPU and memory state of VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; at time T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
#** The file &amp;lt;code&amp;gt;/path/to/retain/vm-001.qcow2&amp;lt;/code&amp;gt; contains the disk state of VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; at time T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
#*** &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;&#039;&#039;&#039;Important:&#039;&#039;&#039;&amp;lt;/font&amp;gt; Remember: The live-disk-image &amp;lt;code&amp;gt;/path/to/images/vm-001.qcow2&amp;lt;/code&amp;gt; still contains a reference to this file!! So you cannot delete or move it!!!&lt;br /&gt;
#** The file &amp;lt;code&amp;gt;/path/to/retain/vm-001.xml&amp;lt;/code&amp;gt; contains the XML description of VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; at time T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
#** The file &amp;lt;code&amp;gt;/path/to/retain/vm-001.backend&amp;lt;/code&amp;gt; contains the backend entry of VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; at time T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
# Move the state file from the RAM-Disk to the retain location (if you used the RAM-Disk to save the VMs state)&lt;br /&gt;
#* &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;mv /path/to/ram-disk/vm-001.state /path/to/retain/vm-001.state&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also: [[stoney_conductor:_prov_backup_kvm#Snapshot | Snapshot workflow ]]&lt;br /&gt;
&lt;br /&gt;
==== Merge ====&lt;br /&gt;
# Check if the VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; is running&lt;br /&gt;
#* If not, start the VM in paused state: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;virsh start --paused vm-001&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Merge the live-disk-image (&amp;lt;code&amp;gt;/path/to/images/vm-001.qcow2&amp;lt;/code&amp;gt;) with its backing store file (&amp;lt;code&amp;gt;/path/to/retain/vm-001.qcow2&amp;lt;/code&amp;gt;): &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;virsh qemu-monitor-command vm-001 --hmp &amp;quot;block_stream drive-virtio-disk0&amp;quot;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#* &#039;&#039;&#039;Please note:&#039;&#039;&#039; If a VM has more than just one disk-image, repeat this step for every image. Just increase the number at the end of the command. So command to merge the second disk image would be: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;virsh qemu-monitor-command vm-001 --hmp &amp;quot;block_stream drive-virtio-disk1&amp;quot;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# If the machine is running in paused state (means we started it in 1. because it was not running), stop it again: &lt;br /&gt;
#* &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;virsh shutdown vm-001&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note:&#039;&#039;&#039; After these steps, the live-disk-image &amp;lt;code&amp;gt;/path/to/image/vm-001.qcow2&amp;lt;/code&amp;gt; no longer contains a reference to the image at the retain location (&amp;lt;code&amp;gt;/path/to/retain/vm-001.qcow2&amp;lt;/code&amp;gt;). This is important for the [[#Retain | retain process]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also: [[stoney_conductor:_prov_backup_kvm#Merge | Merge workflow]]&lt;br /&gt;
&lt;br /&gt;
==== Retain ====&lt;br /&gt;
# Move the all the files in from the retain directory (&amp;lt;code&amp;gt;/path/to/retain/&amp;lt;/code&amp;gt;) to the backup directory (&amp;lt;code&amp;gt;/path/to/backup/&amp;lt;/code&amp;gt;)&lt;br /&gt;
## Move the VMs state file to the backup directory&lt;br /&gt;
##* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;mv /path/to/retain/vm-001.state /path/to/backup/vm-001.state&amp;lt;/source&amp;gt;&lt;br /&gt;
## Move the VMs disk image to the backup directory&lt;br /&gt;
##* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;mv /path/to/retain/vm-001.qcow2 /path/to/backup/vm-001.qcow2&amp;lt;/source&amp;gt;&lt;br /&gt;
##** &#039;&#039;&#039;Please note:&#039;&#039;&#039; If the VM &amp;lt;code&amp;gt;vm-001&amp;lt;/code&amp;gt; has more than just one disk image, repeat this step for each disk image&lt;br /&gt;
## Move the VMs XML description file to the backup directory&lt;br /&gt;
##* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;mv /path/to/retain/vm-001.xml /path/to/backup/vm-001.xml&amp;lt;/source&amp;gt;&lt;br /&gt;
## Move the VMs backend entry file to the backup directory&lt;br /&gt;
##* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;mv /path/to/retain/vm-001.backend /path/to/backup/vm-001.backend&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also [[stoney_conductor:_prov_backup_kvm#Retain | Retain workflow]]&lt;br /&gt;
&lt;br /&gt;
== Communication through backend ==&lt;br /&gt;
Since the stoney cloud is (as the name says already) a cloud solution, it makes sense to have a backend (in our case openLDAP) involved in the whole process. Like that it is possible to run the backup jobs decentralized on every vm-node. The control instance can then modify the backend, and theses changes are seen by the diffenrent backup daemons on the vm-nodes. So the communication could look like shown in the following picture (Figure 1): &lt;br /&gt;
&lt;br /&gt;
[[File:Daemon-communication.png|800px|thumbnail|none|Figure 1: Communication between the control instance and the prov-backup-kvm daemon through the LDAP backend]]&lt;br /&gt;
&lt;br /&gt;
=== Control-Instance Daemon Interaction for creating a Backup with LDIF Examples ===&lt;br /&gt;
The step numbers correspond with the graphical overview from above.&lt;br /&gt;
&lt;br /&gt;
==== Step 00: Backup Configuration for a virtual machine ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The following backup configuration says, that the backup should be done daily, at 03:00 hours (localtime).&lt;br /&gt;
# * * * * * command to be executed&lt;br /&gt;
# - - - - -&lt;br /&gt;
# | | | | |&lt;br /&gt;
# | | | | +----- day of week (0 - 6) (Sunday=0)&lt;br /&gt;
# | | | +------- month (1 - 12)&lt;br /&gt;
# | | +--------- day of month (1 - 31)&lt;br /&gt;
# | +----------- hour (0 - 23)&lt;br /&gt;
# +------------- min (0 - 59)&lt;br /&gt;
# localtime in the crontab entry&lt;br /&gt;
dn: ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
objectclass: top&lt;br /&gt;
objectclass: organizationalUnit&lt;br /&gt;
objectclass: sstVirtualizationBackupObjectClass&lt;br /&gt;
objectclass: sstCronObjectClass&lt;br /&gt;
ou: backup&lt;br /&gt;
description: This sub tree contains the backup plan for the virtual machine kvm-005.&lt;br /&gt;
sstCronMinute: 0&lt;br /&gt;
sstCronHour: 3&lt;br /&gt;
sstCronDay: *&lt;br /&gt;
sstCronMonth: *&lt;br /&gt;
sstCronDayOfWeek: *&lt;br /&gt;
sstCronActive: TRUE&lt;br /&gt;
sstBackupRootDirectory: file:///var/backup/virtualization&lt;br /&gt;
sstBackupRetainDirectory: file:///var/virtualization/retain&lt;br /&gt;
sstBackupRamDiskLocation: file:///mnt/ramdisk-test&lt;br /&gt;
sstVirtualizationDiskImageFormat: qcow2&lt;br /&gt;
sstVirtualizationDiskImageOwner: root&lt;br /&gt;
sstVirtualizationDiskImageGroup: vm-storage&lt;br /&gt;
sstVirtualizationDiskImagePermission: 0660&lt;br /&gt;
sstBackupNumberOfIterations: 1&lt;br /&gt;
sstVirtualizationVirtualMachineForceStart: FALSE&lt;br /&gt;
sstVirtualizationBandwidthMerge: 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 01: Initialize Backup Sub Tree (Control instance daemon) ====&lt;br /&gt;
The sub tree &#039;&#039;&#039; ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&#039;&#039;&#039; reflects the time, when the backup is planned (in the form of [YYYY][MM][DD]T[hh][mm][ss]Z ([http://en.wikipedia.org/wiki/ISO_8601 ISO 8601]) and it should be written at the time, when the backup is planned and should be executed. The section &#039;&#039;&#039;20121002T010000Z&#039;&#039;&#039; means the following:&lt;br /&gt;
* Year: 2012&lt;br /&gt;
* Month: 10&lt;br /&gt;
* Day of Month: 02&lt;br /&gt;
* Hour of Day: 01&lt;br /&gt;
* Minutes: 00&lt;br /&gt;
* Seconds: 00&lt;br /&gt;
Please be aware the the time is to be written in UTC (see also the comment in the LDIF example below).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This entry is the place holder for the backup, which is to be executed at 03:00 hours (localtime with daylight-saving). This&lt;br /&gt;
# leads to the 20121002T010000Z timestamp (which is written in UTC).&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
objectclass: top&lt;br /&gt;
objectclass: sstProvisioning&lt;br /&gt;
objectclass: organizationalUnit&lt;br /&gt;
ou: 20121002T010000Z&lt;br /&gt;
sstProvisioningExecutionDate: 0&lt;br /&gt;
sstProvisioningMode: initialize&lt;br /&gt;
sstProvisioningReturnValue: 0&lt;br /&gt;
sstProvisioningState: 20121002T014513Z&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 02: Finalize the Initialization (Control instance daemon) ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is updated with current time by the fc-brokerd, when sstProvisioningMode is modified.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 20121002T010001Z&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: initialized&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 03: Start the Snapshot Process (Control instance daemon) ====&lt;br /&gt;
With the setting of the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;snapshot&#039;&#039;&#039;, the actual backup process is kicked off by the Control instance daemon.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is set to zero by the fc-brokerd, when sstProvisioningMode is modified to&lt;br /&gt;
# snapshot (this way the Provisioning-Backup-VKM daemon knows, that it must start the snapshotting process).&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 0&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: snapshot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 04: Starting the Snapshot Process (Provisioning-Backup-KVM daemon) ====&lt;br /&gt;
As soon as the Provisioning-Backup-KVM daemon receives the snapshot command, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;snapshotting&#039;&#039;&#039; to tell the Control instance daemon and other interested parties, that it is snapshotting the virtual machine or virtual machine template.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningMode is set to snapshotting by the Provisioning-Backup-VKM daemon.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: snapshotting&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 05: Finalizing the Snapshot Process (Provisioning-Backup-KVM daemon) ====&lt;br /&gt;
As soon as the Provisioning-Backup-KVM daemon has executed the snapshot command, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;snapshotted&#039;&#039;&#039;, the &#039;&#039;&#039;sstProvisioningState&#039;&#039;&#039; to the current timestamp (UTC) and &#039;&#039;&#039;sstProvisioningReturnValue&#039;&#039;&#039; to zero to tell the Control instance daemon and other interested parties, that the snapshot of the virtual machine or virtual machine template is finished.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is set with the current timestamp by the Provisioning-Backup-VKM daemon, when&lt;br /&gt;
# the attributes sstProvisioningReturnValue and sstProvisioningMode are set.&lt;br /&gt;
# With this combination, the fc-brokerd knows, that it can proceed.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 20121002T010011Z&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningReturnValue&lt;br /&gt;
sstProvisioningReturnValue: 0&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: snapshotted&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 06: Start the Merge Process (Control instance daemon) ====&lt;br /&gt;
With the setting of the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;merge&#039;&#039;&#039;, the Control instance daemon tells the Provisioning-Backup-KVM daemon to merge the backing file disk image back into the current disk image.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is set to zero by the fc-brokerd, when sstProvisioningMode is modified to&lt;br /&gt;
# merge (this way the Provisioning-Backup-VKM daemon knows, that it must start the merging process).&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 0&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: merge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 07: Starting the Merge Process (Provisioning-Backup-KVM daemon) ====&lt;br /&gt;
As soon as the Provisioning-Backup-KVM daemon receives the merge command, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;merging&#039;&#039;&#039; to tell the Control instance daemon and other interested parties, that it is merging the virtual machine or virtual machine template.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningMode is set to merging by the Provisioning-Backup-VKM daemon.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: merging&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 08: Finalizing the Merging Process (Provisioning-Backup-KVM daemon) ====&lt;br /&gt;
As soon as the Provisioning-Backup-KVM daemon has executed the merge command, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;merged&#039;&#039;&#039;, the &#039;&#039;&#039;sstProvisioningState&#039;&#039;&#039; to the current timestamp (UTC) and &#039;&#039;&#039;sstProvisioningReturnValue&#039;&#039;&#039; to zero to tell the Control instance daemon and other interested parties, that the merging of the virtual machine or virtual machine template is finished.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is set with the current timestamp by the Provisioning-Backup-VKM daemon, when&lt;br /&gt;
# the attributes sstProvisioningReturnValue and sstProvisioningMode are set.&lt;br /&gt;
# With this combination, the fc-brokerd knows, that it can proceed.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 20121002T010500Z&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningReturnValue&lt;br /&gt;
sstProvisioningReturnValue: 0&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: merged&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 09: Start the Retain Process (Control instance daemon) ====&lt;br /&gt;
With the setting of the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;retain&#039;&#039;&#039;, the Control instance daemon tells the Provisioning-Backup-KVM daemon to retain (copy and then delete) all the necessary files to the configured backup location.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is set to zero by the fc-brokerd, when sstProvisioningMode is modified to&lt;br /&gt;
# retain (this way the Provisioning-Backup-VKM daemon knows, that it must start the retaining process).&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 0&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: retain&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 10: Starting the Retain Process (Provisioning-Backup-KVM daemon) ====&lt;br /&gt;
As soon as the Provisioning-Backup-KVM daemon receives the retain command, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;retaining&#039;&#039;&#039; to tell the Control instance daemon and other interested parties, that it is retaining the necessary files to the configured backup location.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningMode is set to retaining by the Provisioning-Backup-VKM daemon.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: retaining&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 11: Finalizing the Retaing Process (Provisioning-Backup-KVM daemon) ====&lt;br /&gt;
As soon as the Provisioning-Backup-KVM daemon has executed the retain command, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;retained&#039;&#039;&#039;, the &#039;&#039;&#039;sstProvisioningState&#039;&#039;&#039; to the current timestamp (UTC) and &#039;&#039;&#039;sstProvisioningReturnValue&#039;&#039;&#039; to zero to tell the Control instance daemon and other interested parties, that the retaining of all the necessary files to the configured backup location is finished.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is set with the current timestamp by the Provisioning-Backup-VKM daemon, when&lt;br /&gt;
# the attributes sstProvisioningReturnValue and sstProvisioningMode are set.&lt;br /&gt;
# With this combination, the fc-brokerd knows, that it can proceed.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 20121002T012000Z&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningReturnValue&lt;br /&gt;
sstProvisioningReturnValue: 0&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: retained&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 12: Finalizing the Backup Process (Control instance daemon) ====&lt;br /&gt;
As soon as the Control instance daemon notices, that the attribute &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; ist set to &#039;&#039;&#039;retained&#039;&#039;&#039;, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;finished&#039;&#039;&#039; and the &#039;&#039;&#039;sstProvisioningState&#039;&#039;&#039; to the current timestamp (UTC). All interested parties now know, that the backup process is finished, there for a new backup process could be started.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is updated with current time by the fc-brokerd, when sstProvisioningMode is&lt;br /&gt;
# set to finished.&lt;br /&gt;
# All interested parties now know, that the backup process is finished, there for a new backup process could be started.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 20121002T012001Z&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: finished&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Current Implementation (Backup) ==&lt;br /&gt;
Since we do not have a working control instance, we need to have a workaround for backing up the machines: &lt;br /&gt;
&lt;br /&gt;
* We do already have a BackupKVMWrapper.pl script (File-Backend) which executes the three [[#Sub-Processes | sub-processes ]] in the correct order for a given list of machines (see [[#Backup multiple machines at the same_time]]).&lt;br /&gt;
* We do already have the implementation for the whole backup with the LDAP-Backend (see [[ stoney conductor: prov backup kvm ]]).&lt;br /&gt;
* We can now combine these two existing scripts and create a wrapper (lets call it LDAPKVMWrapper) which, in some way, adds some logic to the BackupKVMWrapper.pl. In fact the LDAPKVMWrapper wrapper will generate the list of machines which need a backup.&lt;br /&gt;
&lt;br /&gt;
The behaviour on our servers is as follows (c.f. Figure 2):&lt;br /&gt;
# The (decentralized) LDAPKVMWrapper wrapper (which is executed everyday via cronjob) generates a list off all machines running on the current host.&lt;br /&gt;
#* Currently on the hosts the cronjobs looks like: &amp;lt;code&amp;gt;00 01 * * * /usr/bin/LDAPKVMWrapper.pl | logger -t Backup-KVM&amp;lt;/code&amp;gt;&lt;br /&gt;
#* For each of these machines:&lt;br /&gt;
#** Check if the machine is excluded from the backup, if yes, remove the machine from the list&lt;br /&gt;
#** Check if the last backup was successful, if not, remove the machine from the list&lt;br /&gt;
# Update the backup subtree for each machine in the list&lt;br /&gt;
#* Remove the old backup leaf (the &amp;quot;yesterday-leaf&amp;quot;), and add a new one (the &amp;quot;today-leaf&amp;quot;) &lt;br /&gt;
#* After this step, the machines are ready to be backed up&lt;br /&gt;
# Call the BackupKVMWrapper.pl script with the machines list as a parameter&lt;br /&gt;
# Wait for the BackupKVMWrapper.pl script to finish&lt;br /&gt;
# Go again through all machines and update the backup subtree a last time&lt;br /&gt;
#* Check if the backup was successful, if yes, set sstProvisioningMode = finished (see also TBD)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:wrapper-interaction.png|500px|thumbnail|none|Figure 2: How the two wrapper interact with the LDAP backend]]&lt;br /&gt;
&lt;br /&gt;
* If for some reason something does not work at all, the whole backup process can be deactivated by simply disabling the LDAPKVMWrapper cronjob&lt;br /&gt;
** &amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&lt;br /&gt;
** Comment the LDAPKVMWrapper cronjob line: &amp;lt;code&amp;gt;#00 01 * * * /usr/bin/LDAPKVMWrapper.pl | logger -t Backup-KVM&amp;lt;/code&amp;gt;&lt;br /&gt;
=== How to exclude a machine from the backup ===&lt;br /&gt;
Login to one of the [[VM-Node | vm-nodes]] and execute the following command&lt;br /&gt;
&lt;br /&gt;
If you want to exclude a machine from the backup run you simply need to add the following entry to your LDAP directory: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
machineuuid=&amp;quot;&amp;lt;UUID OF THE MACHINE-NAME&amp;gt;&amp;quot; # e.g.: b9d13dbc-9ab7-4948-9daa-a5709de83dc2&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF | ldapadd -D cn=Manager,o=stepping-stone,c=ch -H ldaps://ldapm.stepping-stone.ch/ -W -x&lt;br /&gt;
dn: ou=backup,sstVirtualMachine=${machineuuid},ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
objectclass: top&lt;br /&gt;
objectclass: organizationalUnit&lt;br /&gt;
objectclass: sstVirtualizationBackupObjectClass&lt;br /&gt;
ou: backup&lt;br /&gt;
sstbackupexcludefrombackup: TRUE&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the backup subtree in the LDAP directory already exists, you need to add the sstbackupexcludefrombackup attribute: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
machineuuid=&amp;quot;&amp;lt;UUID OF THE MACHINE-NAME&amp;gt;&amp;quot; # e.g.: b9d13dbc-9ab7-4948-9daa-a5709de83dc2&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF | ldapadd -D cn=Manager,o=stepping-stone,c=ch -H ldaps://ldapm.stepping-stone.ch/ -W -x&lt;br /&gt;
dn: ou=backup,sstVirtualMachine=${machineuuid},ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: add&lt;br /&gt;
objectclass: top&lt;br /&gt;
objectclass: organizationalUnit&lt;br /&gt;
objectclass: sstVirtualizationBackupObjectClass&lt;br /&gt;
sstbackupexcludefrombackup: TRUE&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Re-include the machine to the backup ====&lt;br /&gt;
If you want to re include a machine, simply delete the machines whole backup subtree. It will be recreated during the next backup run.&lt;br /&gt;
&lt;br /&gt;
== Next steps == &lt;br /&gt;
&lt;br /&gt;
= Restore =&lt;br /&gt;
== Basic idea ==&lt;br /&gt;
The restore process, similar to the backup process, can be divided into three sub-processes: &lt;br /&gt;
* Unretain the small files: Copy the small files (backend entry, XML description) from the backup directory to the retain directory&lt;br /&gt;
* Unretain the big files: Copy the big files (state file, disk image(s)) form the backup directory to the retain directory&lt;br /&gt;
* Restore the machine: Replace the live disk image(s) by the one(s) from the backup and restore the machine from the state file&lt;br /&gt;
&lt;br /&gt;
Additionally the restore process can also be divided into two phases: &lt;br /&gt;
* User-Interaction phase: After the &amp;quot;unretain small files&amp;quot; the user needs to decide two things:&lt;br /&gt;
** On conflicts between the backend entry file and the XML description, the user need to decide how to resolve this conflict(s)&lt;br /&gt;
** The user can also abort the restore process up to this point. After that the restore can not be aborted or undone! &lt;br /&gt;
* Non-User-Interaction phase: The daemons communicate through the backend between each other and the restore process continues without further user input (c.f. [[#Communication_through_backend_2 | Communication through backend]])&lt;br /&gt;
&lt;br /&gt;
=== Sub Processes ===&lt;br /&gt;
==== Unretain small files ====&lt;br /&gt;
This workflow assumes that the backup directory is on the same physical server as the retain directory (protocol is file://)&lt;br /&gt;
# Copy the backend-entry file from the backup directory to the retain directory:&lt;br /&gt;
#* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;cp -p /path/to/backup/vm-001.backend /path/to/retain/vm-001.backend&amp;lt;/source&amp;gt;&lt;br /&gt;
# Copy the XML description from the from the backup directory to the retain directory:&lt;br /&gt;
#* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;cp -p /path/to/backup/vm-001.xml /path/to/retain/vm-001.xml&amp;lt;/source&amp;gt;&lt;br /&gt;
# Compare the backend-entry file (the one in the retain directory) with the live-backend entry&lt;br /&gt;
#* Resolve all conflicts between these two backend entries&lt;br /&gt;
#** Modify the backend entry at the retain location accordingly&lt;br /&gt;
# Apply the same changes for the XML description at the retain location (backend entry and XML description need to be consistent).&lt;br /&gt;
&lt;br /&gt;
==== Unretain large files ====&lt;br /&gt;
# Copy the state file from the backup directory to the retain directory:&lt;br /&gt;
#* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;cp -p /path/to/backup/vm-001.state /path/to/retain/vm-001.state&amp;lt;/source&amp;gt;&lt;br /&gt;
# Copy the disk image(s) from the backup directory to the retain directory:&lt;br /&gt;
#* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;cp -p /path/to/backup/vm-001.qcow2 /path/to/retain/vm-001.qcow2&amp;lt;/source&amp;gt;&lt;br /&gt;
#** &#039;&#039;&#039;Important:&#039;&#039;&#039; If a VM has more than just one disk image, repeat this step for every disk image&lt;br /&gt;
&lt;br /&gt;
==== Restore the VM ====&lt;br /&gt;
# Shutdown the VM if it is running:&lt;br /&gt;
#* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;virsh shutdown vm-001&amp;lt;/source&amp;gt;&lt;br /&gt;
# Undefine the VM if it is still defined: &lt;br /&gt;
#* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;virsh undefine vm-001&amp;lt;/source&amp;gt;&lt;br /&gt;
# Overwrite the original disk image:&lt;br /&gt;
#* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;mv /path/to/retain/vm-001.qcow2 /path/to/images/vm-001.qcow2&amp;lt;/source&amp;gt;&lt;br /&gt;
#** &#039;&#039;&#039;Important:&#039;&#039;&#039; If a VM has more than just one disk image, repeat this step for every disk image&lt;br /&gt;
# Restore the VMs backend entry: &lt;br /&gt;
#* Write the backend entry from the retain location (&amp;lt;code&amp;gt;/path/to/retain/vm-001.backend&amp;lt;/code&amp;gt;) to the backend&lt;br /&gt;
# Overwrite the VMs XML description with the one from the retain location &lt;br /&gt;
#* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;cp -p /path/to/retain/vm-001.xml /path/to/xmls/vm-001.xml&amp;lt;/source&amp;gt;&lt;br /&gt;
# Restore the VM from the state file with the corrected XML&lt;br /&gt;
#* &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;virsh restore /path/to/retain/vm-001.state --xml /path/to/xmls/vm-001.xml&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Communication through backend ==&lt;br /&gt;
The actual KVM-Restore process is controlled completely by the Control instance daemon via the OpenLDAP directory. See [[#OpenLDAP Directory Integration|OpenLDAP Directory Integration]] the involved attributes and possible values.&lt;br /&gt;
&lt;br /&gt;
[[File:Daemon-interaction-restore.png|thumb|500px|none|Figure 3: Communication between all involved parties during the restore process]]&lt;br /&gt;
&lt;br /&gt;
You can modify/update these interactions by editing [[File:Restore-Interaction.xmi]] (you may need [http://uml.sourceforge.net/ Umbrello UML Modeller] diagram programme for KDE to display the content properly).&lt;br /&gt;
&lt;br /&gt;
=== Control instance Daemon Interaction for restoring a Backup with LDIF Examples ===&lt;br /&gt;
==== Step 01: Start the unretainSmallFiles process (Control instance daemon) ====&lt;br /&gt;
The first step of the restore process is to copy the small files (in this case the XML file and the LDIF) from the configured backup location to the configured retain location. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is set to zero by the Control instance daemon, when sstProvisioningMode is modified to &lt;br /&gt;
# unretainSmallFiles (this way the Provisioning-Backup-VKM daemon knows, that it must start the unretainSmallFiles process).&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 0&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: unretainSmallFiles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 02: Starting the unretainSmallFiles process (Provisioning-Backup-KVM daemon) ====&lt;br /&gt;
As soon as the Provisioning-Backup-KVM daemon receives the command to unretain the small files, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;unretainingSmallFiles&#039;&#039;&#039; to tell the Control instance daemon and other interested parties, that it is unretaining the small files for the virtual machine or virtual machine template.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningMode is set to unretainingSmallFiles by the Provisioning-Backup-VKM daemon.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: unretainingSmallFiles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 03: Finalizing the unretainSmallFiles process (Provisioning-Backup-KVM daemon) ====&lt;br /&gt;
As soon as the Provisioning-Backup-KVM daemon has executed the commands to unretain the small files, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;unretainedSmallFiles&#039;&#039;&#039;, the &#039;&#039;&#039;sstProvisioningState&#039;&#039;&#039; to the current timestamp (UTC) and &#039;&#039;&#039;sstProvisioningReturnValue&#039;&#039;&#039; to zero to tell the Control instance daemon and other interested parties, that the unretaining of all the small files from the configured backup location is finished.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is set with the current timestamp by the Provisioning-Backup-VKM daemon, when&lt;br /&gt;
# the attributes sstProvisioningReturnValue and sstProvisioningMode are set.&lt;br /&gt;
# With this combination, the Control instance daemon knows, that it can proceed.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 20121002T012000Z&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningReturnValue&lt;br /&gt;
sstProvisioningReturnValue: 0&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: unretainedSmallFiles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 05: Start the unretainLargeFiles process (Control instance daemon) ====&lt;br /&gt;
Next step in the restore process is to copy the large files (state file and disk images) from the configured backup directory to the configured retain directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is set to zero by the Control instance daemon, when sstProvisioningMode is modified to &lt;br /&gt;
# unretainLargeFiles (this way the Provisioning-Backup-VKM daemon knows, that it must start the unretainLargeFiles process).&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 0&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: unretainLargeFiles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 06: Starting the unretainLargeFiles process (Provisioning-Backup-KVM daemon) ====&lt;br /&gt;
As soon as the Provisioning-Backup-KVM daemon receives the command to unretain the large files, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;unretainingLargeFiles&#039;&#039;&#039; to tell the Control instance daemon and other interested parties, that it is unretaining the large files for the virtual machine or virtual machine template.&lt;br /&gt;
&lt;br /&gt;
In the meantime the vm-manager merges the LDIF we have unretained in [[#Step_02:_Starting_the_unretainSmallFiles_process_.28Provisioning-Backup-KVM_daemon.29 | step 02]] with the one in the live directory to sort out possible differences in the configuration of the virtual machine.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningMode is set to unretainingSmallFiles by the Provisioning-Backup-VKM daemon.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: unretainingLargeFiles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 07: Finalizing the unretainLargeFiles process (Provisioning-Backup-KVM daemon) ====&lt;br /&gt;
As soon as the Provisioning-Backup-KVM daemon has executed the commands to unretain the large files, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;unretainedLargeFiles&#039;&#039;&#039;, the &#039;&#039;&#039;sstProvisioningState&#039;&#039;&#039; to the current timestamp (UTC) and &#039;&#039;&#039;sstProvisioningReturnValue&#039;&#039;&#039; to zero to tell the Control instance daemon and other interested parties, that the unretaining of all the large files from the configured backup location is finished.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is set with the current timestamp by the Provisioning-Backup-VKM daemon, when&lt;br /&gt;
# the attributes sstProvisioningReturnValue and sstProvisioningMode are set.&lt;br /&gt;
# With this combination, the Control instance daemon knows, that it can proceed.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 20121002T012000Z&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningReturnValue&lt;br /&gt;
sstProvisioningReturnValue: 0&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: unretainedLargeFiles&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 09: Start the restore process (Control instance daemon) ====&lt;br /&gt;
Since we now have all necessary files in the configured retain location, the restore process can be started. There we simply copy the disk images back to their original location and restore the VM from the state file (which is also at the configured retain location)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is set to zero by the Control instance daemon, when sstProvisioningMode is modified to &lt;br /&gt;
# restore (this way the Provisioning-Backup-VKM daemon knows, that it must start the restore process).&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 0&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: restore&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 10: Starting the restore process (Provisioning-Backup-KVM daemon) ====&lt;br /&gt;
As soon as the Provisioning-Backup-KVM daemon receives the restore command, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;restoring&#039;&#039;&#039; to tell the Control instance daemon and other interested parties, that it is restoring the virtual machine or virtual machine template.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningMode is set to restoring by the Provisioning-Backup-VKM daemon.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: restoring&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 11: Finalizing the restore process (Provisioning-Backup-KVM daemon) ====&lt;br /&gt;
As soon as the Provisioning-Backup-KVM daemon has executed the restore command, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;restored&#039;&#039;&#039;, the &#039;&#039;&#039;sstProvisioningState&#039;&#039;&#039; to the current timestamp (UTC) and &#039;&#039;&#039;sstProvisioningReturnValue&#039;&#039;&#039; to zero to tell the Control instance daemon and other interested parties, that the restore process is finished.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is set with the current timestamp by the Provisioning-Backup-VKM daemon, when&lt;br /&gt;
# the attributes sstProvisioningReturnValue and sstProvisioningMode are set.&lt;br /&gt;
# With this combination, the Control instance daemon knows, that it can proceed.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 20121002T012000Z&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningReturnValue&lt;br /&gt;
sstProvisioningReturnValue: 0&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: restored&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Step 12: Finalizing the restore process (Control instance daemon) ====&lt;br /&gt;
As soon as the Control instance daemon notices, that the attribute &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; ist set to &#039;&#039;&#039;restored&#039;&#039;&#039;, it sets the &#039;&#039;&#039;sstProvisioningMode&#039;&#039;&#039; to &#039;&#039;&#039;finished&#039;&#039;&#039; and the &#039;&#039;&#039;sstProvisioningState&#039;&#039;&#039; to the current timestamp (UTC). All interested parties now know, that the restore process is finished.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The attribute sstProvisioningState is updated with current time by the Control instance daemon, when sstProvisioningMode is&lt;br /&gt;
# set to finished.&lt;br /&gt;
# All interested parties now know, that the restore process is finished.&lt;br /&gt;
dn: ou=20121002T010000Z,ou=backup,sstVirtualMachine=kvm-005,ou=virtual machines,ou=virtualization,ou=services,o=stepping-stone,c=ch&lt;br /&gt;
changetype: modify&lt;br /&gt;
replace: sstProvisioningState&lt;br /&gt;
sstProvisioningState: 20121002T012001Z&lt;br /&gt;
-&lt;br /&gt;
replace: sstProvisioningMode&lt;br /&gt;
sstProvisioningMode: finished&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Current Implementation (Restore) ==&lt;br /&gt;
* Since the prov-backup-kvm daemon is not running on the vm-nodes (c.f. [[stoney_conductor:_Backup#State_of_the_art]]), the restore process does not work when clicking the icon in the webinterface. &lt;br /&gt;
* Resolving the conflicts in the backend and XML description file is not yet done&lt;br /&gt;
** Actually all steps not executed by prov-backup-kvm are not yet properly implemented (c.f. [[stoney_conductor:_prov_backup_kvm#Restore]])&lt;br /&gt;
* The implementation is done, but the last step from the [[#Restore_2 | restore process ]] is different:&lt;br /&gt;
** The &amp;lt;code&amp;gt;virsh restore&amp;lt;/code&amp;gt; command is not executed with the &amp;lt;code&amp;gt;--xml&amp;lt;/code&amp;gt; option, the XML from the state file is taken when restoring the machine. Therefore the conflicts are not properly resolved. &lt;br /&gt;
*** --[[User:Pat|Pat]] ([[User talk:Pat|talk]]) 09:41, 29 October 2013 (CET): Currently the [http://search.cpan.org/~danberr/Sys-Virt-1.1.3/lib/Sys/Virt.pm Sys::Virt] library does not support the --xml parameter when restoring a domain&lt;br /&gt;
&lt;br /&gt;
=== How to manually restore a machine from backup ===&lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: Before you continue with this guide, make sure that you have no other possibility to restore the machine. It might be easier and safer to get lost files from the online backup if the machine has one set up.&lt;br /&gt;
&lt;br /&gt;
If you really have to restore the machine from the backup:&lt;br /&gt;
# Stop the machine from via the [https://cloud.stepping-stone.ch/vm-manager/ web interface]&lt;br /&gt;
# Login (as root) on the [[VM-Node]] the machine was running on&lt;br /&gt;
&lt;br /&gt;
As a first step, you would like to set some useful bash variables to be able to copy paste the following guide:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Double check all variables you are setting here. If one is not correct, you will restore a running machine or overwrite a live-disk image!&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
machinename=&amp;quot;&amp;lt;MACHINE-NAME&amp;gt;&amp;quot; # For example: machinename=&amp;quot;b6dc3d27-5981-4b18-8f3f-31ed3d21a3c6&amp;quot;&lt;br /&gt;
vmpool=&amp;quot;&amp;lt;VM-POOL&amp;gt;&amp;quot; # For example vmpool=&amp;quot;0f83f084-8080-413e-b558-b678e504836e&amp;quot;&lt;br /&gt;
vmtype=&amp;quot;&amp;lt;VM-TYPE&amp;gt;&amp;quot; # For example vmtype=&amp;quot;vm-persistent&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Change to the backup directory for the given machine and check the iterations:&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
cd /var/backup/virtualization/${vmtype}/${vmpool}/${machinename}&lt;br /&gt;
ls -al&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Change into the most recent iteration&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
cd 2014...&lt;br /&gt;
ls -al&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
In there you should have: &lt;br /&gt;
* The state file &amp;lt;MACHINE-NAME&amp;gt;.state.&amp;lt;BACKUP-DATE&amp;gt; (for example b6dc3d27-5981-4b18-8f3f-31ed3d21a3c6.state.20140109T134445Z)&lt;br /&gt;
* The XML description &amp;lt;MACHINE-NAME&amp;gt;.xml.&amp;lt;BACKUP-DATE&amp;gt; (for example b6dc3d27-5981-4b18-8f3f-31ed3d21a3c6.xml.20140109T134445Z)&lt;br /&gt;
* The ldif file &amp;lt;MACHINE-NAME&amp;gt;.ldif.&amp;lt;BACKUP-DATE&amp;gt; (for example b6dc3d27-5981-4b18-8f3f-31ed3d21a3c6.ldif.20140109T134445Z)&lt;br /&gt;
* And at least one disk image &amp;lt;DISK-IMAGE&amp;gt;.qcow2.&amp;lt;BACKUP-DATE&amp;gt; (for example 8798561b-d5de-471b-a6fc-ec2b4831ed12.qcow2.20140109T134445Z)&lt;br /&gt;
Now you should save the backup date and the disk image(s) in a variable&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
backupdate=&amp;quot;&amp;lt;BACKUP-DATE&amp;gt;&amp;quot; # For example: backupdate=&amp;quot;20140109T134445Z&amp;quot;&lt;br /&gt;
diskimage1=&amp;quot;&amp;lt;DISK-IMAGE-1&amp;gt;.qcow2&amp;quot; # For example: diskimage1=&amp;quot;8798561b-d5de-471b-a6fc-ec2b4831ed12.qcow2&amp;quot;&lt;br /&gt;
diskimage2=&amp;quot;&amp;lt;DISK-IMAGE-2&amp;gt;.qcow2&amp;quot; # For example: diskimage2=&amp;quot;aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee.qcow2&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Have again a look at the different variables and &#039;&#039;&#039;double check them again&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
echo &amp;quot;Machine Name = ${machinename}&amp;quot;&lt;br /&gt;
echo &amp;quot;VM Pool = ${vmpool}&amp;quot;&lt;br /&gt;
echo &amp;quot;VM Type = ${vmtype}&amp;quot;&lt;br /&gt;
echo &amp;quot;Backup date = ${backupdate}&amp;quot;&lt;br /&gt;
echo &amp;quot;Disk Image 1 = ${diskimage1}&amp;quot;&lt;br /&gt;
echo &amp;quot;Disk Image 2 = ${diskimage2}&amp;quot;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy all these files to the retain location:&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
currentdate=`date --utc +&#039;%Y%m%dT%H%M%SZ&#039;`&lt;br /&gt;
mkdir -p /var/virtualization/retain/${vmtype}/${vmpool}/${machinename}/${currentdate}&lt;br /&gt;
cp -p /var/backup/virtualization/${vmtype}/${vmpool}/${machinename}/${backupdate}/${machinename}.ldif.${backupdate} /var/virtualization/retain/${vmtype}/${vmpool}/${machinename}/${currentdate}/&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--Check if there is a difference between the current XML file and the one from the backup&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
diff -Naur /etc/libvirt/qemu/${machinename}.xml /var/virtualization/retain/${vmtype}/${vmpool}/${machinename}/${currentdate}/${machinename}.xml.${backupdate}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
and &#039;&#039;&#039;edit the file at the retain location&#039;&#039;&#039; according to your needs.--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; Now you are entering the critical part. You won&#039;t be able to undo the following steps&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Check if there is a difference between the current LDAP entry and the one from the backup&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
domain=&amp;quot;&amp;lt;DOMAIN&amp;gt;&amp;quot; # For example domain=&amp;quot;stoney-cloud.org&amp;quot;&lt;br /&gt;
ldapbase=&amp;quot;&amp;lt;LDAPBASE&amp;gt;&amp;quot; # For expample ldapbase=&amp;quot;dc=stoney-cloud,dc=org&amp;quot;&lt;br /&gt;
ldapsearch -H ldaps://ldapm.${domain} -b &amp;quot;sstVirtualMachine=${machinename},ou=virtual machines,ou=virtualization,ou=services,${ldapbase}&amp;quot; -s sub -x -LLL -o ldif-wrap=no -D &amp;quot;cn=Manager,${ldapbase}&amp;quot; -W  &amp;quot;(objectclass=*)&amp;quot; &amp;gt; /tmp/${machinename}.ldif&lt;br /&gt;
diff -Naur /tmp/${machinename}.ldif /var/virtualization/retain/${vmtype}/${vmpool}/${machinename}/${currentdate}/${machinename}.ldif.${backupdate}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
and &#039;&#039;&#039;edit the file at the retain location&#039;&#039;&#039; according to your needs.&lt;br /&gt;
&lt;br /&gt;
If there are no differences (or the differences are not important) you can skip the following step. Otherwise use the [https://cloud.stepping-stone.ch/phpldapadmin PhpLdapAdmin] to delete the machine from the LDAP directory (do not forget to delete the dhcp entry &amp;lt;code&amp;gt;dn: cn=&amp;lt;MACHINE-NAME&amp;gt;,ou=virtual machines,cn=192.168.140.0,cn=config-01,ou=dhcp,ou=networks,ou=virtualization,ou=services,dc=stoney-cloud,dc=org&amp;lt;/code&amp;gt;). Then add the LDIF (the one you just edited) to the LDAP (first do some general replacement)&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
sed -i\&lt;br /&gt;
 -e &#039;s/snapshotting/finished/&#039;\&lt;br /&gt;
 -e &#039;/member.*/d&#039;\&lt;br /&gt;
 /var/virtualization/retain/${vmtype}/${vmpool}/${machinename}/${currentdate}/${machinename}.ldif.${backupdate}&lt;br /&gt;
&lt;br /&gt;
/usr/bin/ldapadd -H &amp;quot;ldaps://ldapm.${domain}&amp;quot; -x -D &amp;quot;cn=Manager,${ldapbase}&amp;quot; -W -f /var/virtualization/retain/${vmtype}/${vmpool}/${machinename}/${currentdate}/${machinename}.ldif.${backupdate}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Undefine the machine&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
virsh undefine ${machinename}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy all the disk images from the backup location back to their original location&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
cp -p /var/backup/virtualization/${vmtype}/${vmpool}/${machinename}/${backupdate}/${diskimage1}.${backupdate} /var/virtualization/${vmtype}/${vmpool}/${diskimage1}&lt;br /&gt;
cp -p /var/backup/virtualization/${vmtype}/${vmpool}/${machinename}/${backupdate}/${diskimage2}.${backupdate} /var/virtualization/${vmtype}/${vmpool}/${diskimage2}&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And restore the domain from the state file from the backup location with the XML from the retain location (the one you might have edited)&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
virsh restore /var/backup/virtualization/${vmtype}/${vmpool}/${machinename}/${backupdate}/${machinename}.state.${backupdate}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the machine should be up and running again. Continuing where it was stopped when taking the backup.&lt;br /&gt;
&lt;br /&gt;
If everything is OK, you can cleanup the created files and directories&lt;br /&gt;
&amp;lt;source lang=&#039;bash&#039;&amp;gt;&lt;br /&gt;
rm -rf /var/virtualization/retain/${vmtype}/${vmpool}/${machinename}/${currentdate}&lt;br /&gt;
rm /tmp/${machinename}.ldif&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Next steps ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: stoney conductor]]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=stoney_cloud:_Multi-Node_Installation&amp;diff=1135</id>
		<title>stoney cloud: Multi-Node Installation</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=stoney_cloud:_Multi-Node_Installation&amp;diff=1135"/>
		<updated>2013-09-06T09:28:46Z</updated>

		<summary type="html">&lt;p&gt;David: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Specialized Installation ==&lt;br /&gt;
=== Primary-Master-Node (vm-node-01) ===&lt;br /&gt;
If you configured a additional Backup Volume on the Storage Nodes, you want to mount them now in the VM-Node.&lt;br /&gt;
&lt;br /&gt;
Log into the Primary-Master-Node and execute the node-configuration script as follows:&lt;br /&gt;
 /usr/sbin/fc-node-configuration --node-type primary-master-node&lt;br /&gt;
&lt;br /&gt;
==== Manual Steps ====&lt;br /&gt;
Install a transfer user.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
lvcreate -L 60G -n transfer local0&lt;br /&gt;
&lt;br /&gt;
mkfs.xfs -L &amp;quot;OSBD_transfe&amp;quot; /dev/local0/transfer &lt;br /&gt;
&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
&lt;br /&gt;
LABEL=OSBD_transfe  /home/transfer    xfs      noatime,nodev,nosuid,noexec  0 2&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
mount /home/transfer&lt;br /&gt;
adduser -d transfer&lt;br /&gt;
# passwd transfer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=stoney_cloud:_Multi-Node_Installation&amp;diff=1122</id>
		<title>stoney cloud: Multi-Node Installation</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=stoney_cloud:_Multi-Node_Installation&amp;diff=1122"/>
		<updated>2013-09-06T07:44:29Z</updated>

		<summary type="html">&lt;p&gt;David: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Specialized Installation ==&lt;br /&gt;
=== Primary-Master-Node (vm-node-01) ===&lt;br /&gt;
If you configured a additional Backup Volume on the Storage Nodes, you want to mount them now in the VM-Node.&lt;br /&gt;
&lt;br /&gt;
Log into the Primary-Master-Node and execute the node-configuration script as follows:&lt;br /&gt;
 /usr/sbin/fc-node-configuration --node-type primary-master-node&lt;br /&gt;
&lt;br /&gt;
==== Manual Steps ====&lt;br /&gt;
Install a transfer user.&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=stoney_cloud:_Multi-Node_Installation&amp;diff=1121</id>
		<title>stoney cloud: Multi-Node Installation</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=stoney_cloud:_Multi-Node_Installation&amp;diff=1121"/>
		<updated>2013-09-06T07:42:09Z</updated>

		<summary type="html">&lt;p&gt;David: Created page with &amp;quot;   Category:Documentation&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=stoney_backup:_Server_set-up&amp;diff=1013</id>
		<title>stoney backup: Server set-up</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=stoney_backup:_Server_set-up&amp;diff=1013"/>
		<updated>2013-08-28T14:12:33Z</updated>

		<summary type="html">&lt;p&gt;David: /* sshd keys */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Abstract =&lt;br /&gt;
This document describes server setup for the stoney cloud (Online) Backup service, built upon the [http://www.gentoo.org/ Gentoo] Linux distribution.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
After working through this documentation, you will be able to set up and configure your own (Online) Backup service server.&lt;br /&gt;
&lt;br /&gt;
= Software Installation =&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
A working stoney cloud installation.&lt;br /&gt;
&lt;br /&gt;
== USE-Flages ==&lt;br /&gt;
For a full OpenLDAP directory installation:&lt;br /&gt;
 echo &amp;quot;net-nds/openldap overlays perl sasl&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&lt;br /&gt;
For a minimal OpenLDAP directory installation (just the necessary tools):&lt;br /&gt;
 echo &amp;quot;sys-auth/nss-pam-ldapd sasl&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
 echo &amp;quot;sys-auth/nss-pam-ldapd ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;net-nds/openldap ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;sys-fs/quota ldap&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&lt;br /&gt;
For the prov-backup-rsnapshot daemon&lt;br /&gt;
 echo &amp;quot;dev-perl/Net-SMTPS ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;perl-core/Switch ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
== Emerge ==&lt;br /&gt;
 emerge ⁻va nss-pam-ldapd&lt;br /&gt;
 emerge -va rsnapshot&lt;br /&gt;
 emerge -va quota&lt;br /&gt;
 emerge -va dev-perl/Config-IniFiles&lt;br /&gt;
 emerge -va dev-perl/LockFile-Simple&lt;br /&gt;
 emerge -va dev-perl/Net-SMTPS&lt;br /&gt;
 emerge -va dev-perl/perl-ldap&lt;br /&gt;
 emerge -va virtual/perl-Switch&lt;br /&gt;
 emerge -va dev-perl/Parallel-ForkManager&lt;br /&gt;
 emerge -va dev-perl/XML-Simple&lt;br /&gt;
 emerge -va dev-perl/Date-Calc&lt;br /&gt;
 emerge -va dev-perl/DateManip&lt;br /&gt;
 emerge -va dev-perl/DateTime-Format-Strptime&lt;br /&gt;
 emerge -va dev-perl/text-template&lt;br /&gt;
 emerge -va perl-core/Switch&lt;br /&gt;
&lt;br /&gt;
=== CPAN ===&lt;br /&gt;
Install the Time::Stopwatch, XML::Validator::Schema and Schedule::Cron::Events lib form CPAN (no ebuild available)&lt;br /&gt;
 cpan&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cpan[1]&amp;gt; install Time::Stopwatch&lt;br /&gt;
  LWP not available&lt;br /&gt;
Fetching with Net::FTP:&lt;br /&gt;
ftp://tux.rainside.sk/CPAN/authors/01mailrc.txt.gz&lt;br /&gt;
Going to read &#039;/root/.cpan/sources/authors/01mailrc.txt.gz&#039;&lt;br /&gt;
...&lt;br /&gt;
  ILTZU/Time-Stopwatch-1.00.tar.gz&lt;br /&gt;
  /usr/bin/make install  -- OK&lt;br /&gt;
&lt;br /&gt;
cpan[2]&amp;gt; install XML::Validator::Schema&lt;br /&gt;
Going to read &#039;/root/.cpan/Metadata&#039;&lt;br /&gt;
...&lt;br /&gt;
  SAMTREGAR/XML-Validator-Schema-1.10.tar.gz&lt;br /&gt;
  /usr/bin/make install  -- OK&lt;br /&gt;
&lt;br /&gt;
cpan[3]&amp;gt; install Schedule::Cron::Events&lt;br /&gt;
Going to read &#039;/root/.cpan/Metadata&#039;&lt;br /&gt;
...&lt;br /&gt;
  /usr/bin/make install  -- OK&lt;br /&gt;
&lt;br /&gt;
cpan[4]&amp;gt; exit&lt;br /&gt;
Terminal does not support GetHistory.&lt;br /&gt;
Lockfile removed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Software Configuration =&lt;br /&gt;
== Quota ==&lt;br /&gt;
=== 32-bit Project Identifier Support ===&lt;br /&gt;
We need to enable 32-bit project identifier support (PROJID32BIT feature) for our naming scheme (uid numbers larger than 65&#039;536):&lt;br /&gt;
 mkfs.xfs &#039;&#039;&#039;-i projid32bit=1&#039;&#039;&#039; /dev/vdb1&lt;br /&gt;
&lt;br /&gt;
=== Mount ===&lt;br /&gt;
Make sure, that you have user quota (uqota) and project quota (pquota) set as options on the chosen mount point in /etc/fstab. For example:&lt;br /&gt;
 /dev/vdb1               /var/backup     xfs             noatime,uquota,pquota   0 0&lt;br /&gt;
&lt;br /&gt;
=== Verify ===&lt;br /&gt;
Some important options for xfs_quota:&lt;br /&gt;
* -x: Enable expert mode.&lt;br /&gt;
* -c: Pass arguments on the command line. Multiple arguments may be given.&lt;br /&gt;
&lt;br /&gt;
Remount the file system /var/backup and check, if /var/backup has the desired values:&lt;br /&gt;
 xfs_quota -x -c state /var/backup&lt;br /&gt;
&lt;br /&gt;
As you can see (items marked bold), we have achieved our goal:&lt;br /&gt;
 User quota state on /var/backup (/dev/vdb1)&lt;br /&gt;
   Accounting: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Enforcement: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Inode: #131 (3 blocks, 2 extents)&lt;br /&gt;
 Group quota state on /var/backup (/dev/vdb1)&lt;br /&gt;
   Accounting: OFF&lt;br /&gt;
   Enforcement: OFF&lt;br /&gt;
  Inode: #809717 (1 blocks, 1 extents)&lt;br /&gt;
 Project quota state on /var/backup (/dev/vdb1)&lt;br /&gt;
   Accounting: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Enforcement: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Inode: #809717 (1 blocks, 1 extents)&lt;br /&gt;
 Blocks grace time: [7 days 00:00:30]&lt;br /&gt;
 Inodes grace time: [7 days 00:00:30]&lt;br /&gt;
 Realtime Blocks grace time: [7 days 00:00:30]&lt;br /&gt;
&lt;br /&gt;
=== User Quotas ===&lt;br /&gt;
==== Adding a User Quota ====&lt;br /&gt;
Set a quota of 1 Gigabyte for the user 4000187 (the values are in kilobytes, so 1048576 kilobyte are 1024 megabytes which corresponds to 1 gigabyte):&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1048576k 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Or in bytes:&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1073741824 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Read the quota information for the user 4000187:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
 /dev/vdb1                    0          0    1048576   00 [--------] /var/backup&lt;br /&gt;
&lt;br /&gt;
If the user has data in the project, that belongs to him, the result will change:&lt;br /&gt;
 /dev/vdb1               512000          0    1048576   00 [--------] /var/backup&lt;br /&gt;
&lt;br /&gt;
==== Modifiying a User Quota ====&lt;br /&gt;
To modify a users quota, you just set a new quota (limit):&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1048576k 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Read the quota information for the user 4000187:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
 /dev/vdb1                    0          0    1048576   00 [--------] /var/backup&lt;br /&gt;
&lt;br /&gt;
If the user has data in the project, that belongs to him, the result will change:&lt;br /&gt;
 /dev/vdb1               512000          0    1048576   00 [--------] /var/backup&lt;br /&gt;
&lt;br /&gt;
==== Removing a User Quota ====&lt;br /&gt;
Removing a quota for a user:&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=0 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
The following command should give you an empty result:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
=== Project (Directory) Quotas ===&lt;br /&gt;
==== Adding a Project (Directory) Quota ====&lt;br /&gt;
The XFS file system additionally allows you to set quotas on individual directory hierarchies in the file system that are known as managed trees. Each managed tree is uniquely identified by a project ID and an optional project name. We&#039;ll use the following values in the examples:&lt;br /&gt;
* project_ID: The uid of the online backup account (4000187).&lt;br /&gt;
* project_name: The uid of the online backup account (4000187). This could be a human readable name.&lt;br /&gt;
* mountpoint: The mountpoint of the xfs-filesystem (/var/backup). See the &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt; entry from above.&lt;br /&gt;
* directory: The directory of the project (187/4000187), starting from the mountpoint of the xfs-filesystem (/var/backup).&lt;br /&gt;
&lt;br /&gt;
Define a unique project ID for the directory hierarchy in the &amp;lt;code&amp;gt;/etc/projects&amp;lt;/code&amp;gt; file (project_ID:mountpoint/directory):&lt;br /&gt;
 echo &amp;quot;4000187:/var/backup/187/4000187&amp;quot; &amp;gt;&amp;gt; /etc/projects&lt;br /&gt;
&lt;br /&gt;
Create an entry in the &amp;lt;code&amp;gt;/etc/projid&amp;lt;/code&amp;gt; file that maps a project name to the project ID (project_name:project_ID):&lt;br /&gt;
 echo &amp;quot;4000187:4000187&amp;quot; &amp;gt;&amp;gt; /etc/projid&lt;br /&gt;
&lt;br /&gt;
Set Project:&lt;br /&gt;
 xfs_quota -x -c &#039;project -s -p /var/backup/187/4000187 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Set Quota (limit) on Project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=1048576k 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Check your Quota (limit)&lt;br /&gt;
 xfs_quota -x -c &#039;quota -p 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Check the Quota:&lt;br /&gt;
* &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt;: increase verbosity in reporting (also dumps zero values).&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt;: suppress the initial header.&lt;br /&gt;
* &amp;lt;code&amp;gt;-p&amp;lt;/code&amp;gt;: display project quota information.&lt;br /&gt;
* &amp;lt;code&amp;gt;-h&amp;lt;/code&amp;gt;: human readable format.&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -p 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
 /dev/vdb1                    0          0    1048576   00 [--------] /var/backup&lt;br /&gt;
&lt;br /&gt;
If you copied data into the project, the output will look something like:&lt;br /&gt;
 /dev/vdb1               512000          0    1048576   00 [--------] /var/backup&lt;br /&gt;
&lt;br /&gt;
To give you an overall view of the whole system:&lt;br /&gt;
 xfs_quota -x -c report /var/backup&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
User quota on /var/backup (/dev/vdb1)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
User ID          Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
root          1024000          0          0     00 [--------]&lt;br /&gt;
4000187             0          0    1048576     00 [--------]&lt;br /&gt;
&lt;br /&gt;
Project quota on /var/backup (/dev/vdb1)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
Project ID       Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
4000187        512000          0    1048576     00 [--------]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modifying a Project (Directory) Quota ====&lt;br /&gt;
To modify a project (directory) quota, you just set an new quota (limit) on the chosen project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=1048576k 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Check your quota (limit)&lt;br /&gt;
 xfs_quota -x -c &#039;quota -p 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
==== Removing a Project (Directory) Quota ====&lt;br /&gt;
Removing a quota from a project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=0 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Chreck the results:&lt;br /&gt;
 xfs_quota -x -c report /var/backup&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
User quota on /var/backup (/dev/vdb1)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
User ID          Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
root           512000          0          0     00 [--------]&lt;br /&gt;
4000187             0          0       1024     00 [--------]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the line with the Project ID 4000187 has disappeared:&lt;br /&gt;
 4000187        512000          0    1048576     00 [--------]&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to remove the project from &amp;lt;code&amp;gt;/etc/projects&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/etc/projid&amp;lt;/code&amp;gt;:&lt;br /&gt;
 sed -i -e &#039;/4000187/d&#039; /etc/projects&lt;br /&gt;
 sed -i -e &#039;/4000187/d&#039; /etc/projid&lt;br /&gt;
&lt;br /&gt;
=== Some important notes concerning XFS ===&lt;br /&gt;
# The &#039;&#039;&#039;quotacheck&#039;&#039;&#039; command has no effect on XFS filesystems. The first time quota accounting is turned on (at mount time), XFS does an automatic quotacheck internally; afterwards, the quota system will always be completely consistent until quotas are manually turned off. &lt;br /&gt;
# There is &#039;&#039;&#039;no need for quota file(s)&#039;&#039;&#039; in the root of the XFS filesystem.&lt;br /&gt;
&lt;br /&gt;
== OpenSSH ==&lt;br /&gt;
Configure the OpenSSH daemon:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vi /etc/ssh/sshd_config&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set following options:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
PubkeyAuthentication yes&lt;br /&gt;
PasswordAuthentication yes&lt;br /&gt;
UsePAM yes&lt;br /&gt;
Subsystem     sftp   internal-sftp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure, that &amp;lt;code&amp;gt;Subsystem     sftp   internal-sftp&amp;lt;/code&amp;gt; is the last line in the configuration file.&lt;br /&gt;
&lt;br /&gt;
We want to reduce the numbers of chroot environments in one folder. As the &amp;lt;code&amp;gt;ChrootDirectory&amp;lt;/code&amp;gt; configuration option only allows &amp;lt;code&amp;gt;%h&amp;lt;/code&amp;gt; (home directory of the user) and &amp;lt;code&amp;gt;%u&amp;lt;/code&amp;gt; (username of the user), we need to create the necessary matching rules in the form of:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Match User *000&lt;br /&gt;
  ChrootDirectory /var/backup/000/%u&lt;br /&gt;
Match&lt;br /&gt;
Match User *001&lt;br /&gt;
  ChrootDirectory /var/backup/001/%u&lt;br /&gt;
Match&lt;br /&gt;
...&lt;br /&gt;
Match User *999&lt;br /&gt;
  ChrootDirectory /var/backup/999/%u&lt;br /&gt;
Match&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The creation of the matching rules is done by executing the following bash commands:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
FILE=/etc/ssh/sshd_config;&lt;br /&gt;
&lt;br /&gt;
for ((x=0; x&amp;lt;1000; x+=1)); \&lt;br /&gt;
do \&lt;br /&gt;
  printf &amp;quot;Match User *%03d\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;  ChrootDirectory /var/backup/%03d/%%u\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;Match\n&amp;quot; &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to restart the OpenSSH daemon:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/etc/init.d/sshd restart&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== OpenLDAP ==&lt;br /&gt;
 /etc/openldap/ldap.conf&lt;br /&gt;
&lt;br /&gt;
== nss-pam-ldapd ==&lt;br /&gt;
 /etc/nslcd.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is the configuration file for the LDAP nameservice&lt;br /&gt;
# switch library&#039;s nslcd daemon. It configures the mapping&lt;br /&gt;
# between NSS names (see /etc/nsswitch.conf) and LDAP&lt;br /&gt;
# information in the directory.&lt;br /&gt;
# See the manual page nslcd.conf(5) for more information.&lt;br /&gt;
&lt;br /&gt;
# The user and group nslcd should run as.&lt;br /&gt;
uid nslcd&lt;br /&gt;
gid nslcd&lt;br /&gt;
&lt;br /&gt;
# The uri pointing to the LDAP server to use for name lookups.&lt;br /&gt;
# Multiple entries may be specified. The address that is used&lt;br /&gt;
# here should be resolvable without using LDAP (obviously).&lt;br /&gt;
#uri ldap://127.0.0.1/&lt;br /&gt;
#uri ldaps://127.0.0.1/&lt;br /&gt;
#uri ldapi://%2fvar%2frun%2fldapi_sock/&lt;br /&gt;
# Note: %2f encodes the &#039;/&#039; used as directory separator&lt;br /&gt;
uri ldaps://ldapm.tombstone.ch&lt;br /&gt;
&lt;br /&gt;
# The LDAP version to use (defaults to 3&lt;br /&gt;
# if supported by client library)&lt;br /&gt;
#ldap_version 3&lt;br /&gt;
&lt;br /&gt;
# The distinguished name of the search base.&lt;br /&gt;
base dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# The distinguished name to bind to the server with.&lt;br /&gt;
# Optional: default is to bind anonymously.&lt;br /&gt;
binddn cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# The credentials to bind with.&lt;br /&gt;
# Optional: default is no credentials.&lt;br /&gt;
# Note that if you set a bindpw you should check the permissions of this file.&lt;br /&gt;
bindpw myverysecretpassword&lt;br /&gt;
&lt;br /&gt;
# The distinguished name to perform password modifications by root by.&lt;br /&gt;
#rootpwmoddn cn=admin,dc=example,dc=com&lt;br /&gt;
&lt;br /&gt;
# The default search scope.&lt;br /&gt;
#scope sub&lt;br /&gt;
#scope one&lt;br /&gt;
#scope base&lt;br /&gt;
&lt;br /&gt;
# Customize certain database lookups.&lt;br /&gt;
#base   group  ou=Groups,dc=example,dc=com&lt;br /&gt;
base   group  ou=groups,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
base   passwd ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
base   shadow ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
#scope  group  onelevel&lt;br /&gt;
#scope  hosts  sub&lt;br /&gt;
&lt;br /&gt;
#filter group  (&amp;amp;(objectClass=posixGroup)(sstIsActive=TRUE))&lt;br /&gt;
filter passwd (&amp;amp;(objectClass=posixAccount)(sstIsActive=TRUE))&lt;br /&gt;
filter shadow (&amp;amp;(objectClass=shadowAccount)(sstIsActive=TRUE))&lt;br /&gt;
&lt;br /&gt;
# Bind/connect timelimit.&lt;br /&gt;
#bind_timelimit 30&lt;br /&gt;
&lt;br /&gt;
# Search timelimit.&lt;br /&gt;
#timelimit 30&lt;br /&gt;
&lt;br /&gt;
# Idle timelimit. nslcd will close connections if the&lt;br /&gt;
# server has not been contacted for the number of seconds.&lt;br /&gt;
#idle_timelimit 3600&lt;br /&gt;
&lt;br /&gt;
# Use StartTLS without verifying the server certificate.&lt;br /&gt;
#ssl start_tls&lt;br /&gt;
tls_reqcert never&lt;br /&gt;
&lt;br /&gt;
# CA certificates for server certificate verification&lt;br /&gt;
#tls_cacertdir /etc/ssl/certs&lt;br /&gt;
#tls_cacertfile /etc/ssl/ca.cert&lt;br /&gt;
&lt;br /&gt;
# Seed the PRNG if /dev/urandom is not provided&lt;br /&gt;
#tls_randfile /var/run/egd-pool&lt;br /&gt;
&lt;br /&gt;
# SSL cipher suite&lt;br /&gt;
# See man ciphers for syntax&lt;br /&gt;
#tls_ciphers TLSv1&lt;br /&gt;
&lt;br /&gt;
# Client certificate and key&lt;br /&gt;
# Use these, if your server requires client authentication.&lt;br /&gt;
#tls_cert&lt;br /&gt;
#tls_key&lt;br /&gt;
&lt;br /&gt;
# Mappings for Services for UNIX 3.5&lt;br /&gt;
#filter passwd (objectClass=User)&lt;br /&gt;
#map    passwd uid              msSFU30Name&lt;br /&gt;
#map    passwd userPassword     msSFU30Password&lt;br /&gt;
#map    passwd homeDirectory    msSFU30HomeDirectory&lt;br /&gt;
#map    passwd homeDirectory    msSFUHomeDirectory&lt;br /&gt;
#filter shadow (objectClass=User)&lt;br /&gt;
#map    shadow uid              msSFU30Name&lt;br /&gt;
#map    shadow userPassword     msSFU30Password&lt;br /&gt;
#filter group  (objectClass=Group)&lt;br /&gt;
#map    group  member           msSFU30PosixMember&lt;br /&gt;
&lt;br /&gt;
# Mappings for Services for UNIX 2.0&lt;br /&gt;
#filter passwd (objectClass=User)&lt;br /&gt;
#map    passwd uid              msSFUName&lt;br /&gt;
#map    passwd userPassword     msSFUPassword&lt;br /&gt;
#map    passwd homeDirectory    msSFUHomeDirectory&lt;br /&gt;
#map    passwd gecos            msSFUName&lt;br /&gt;
#filter shadow (objectClass=User)&lt;br /&gt;
#map    shadow uid              msSFUName&lt;br /&gt;
#map    shadow userPassword     msSFUPassword&lt;br /&gt;
#map    shadow shadowLastChange pwdLastSet&lt;br /&gt;
#filter group  (objectClass=Group)&lt;br /&gt;
#map    group  member           posixMember&lt;br /&gt;
&lt;br /&gt;
# Mappings for Active Directory&lt;br /&gt;
#pagesize 1000&lt;br /&gt;
#referrals off&lt;br /&gt;
#idle_timelimit 800&lt;br /&gt;
#filter passwd (&amp;amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))&lt;br /&gt;
#map    passwd uid              sAMAccountName&lt;br /&gt;
#map    passwd homeDirectory    unixHomeDirectory&lt;br /&gt;
#map    passwd gecos            displayName&lt;br /&gt;
#filter shadow (&amp;amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))&lt;br /&gt;
#map    shadow uid              sAMAccountName&lt;br /&gt;
#map    shadow shadowLastChange pwdLastSet&lt;br /&gt;
#filter group  (objectClass=group)&lt;br /&gt;
&lt;br /&gt;
# Alternative mappings for Active Directory&lt;br /&gt;
# (replace the SIDs in the objectSid mappings with the value for your domain)&lt;br /&gt;
#pagesize 1000&lt;br /&gt;
#referrals off&lt;br /&gt;
#idle_timelimit 800&lt;br /&gt;
#filter passwd (&amp;amp;(objectClass=user)(objectClass=person)(!(objectClass=computer)))&lt;br /&gt;
#map    passwd uid           cn&lt;br /&gt;
#map    passwd uidNumber     objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
#map    passwd gidNumber     objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
#map    passwd homeDirectory &amp;quot;/home/$cn&amp;quot;&lt;br /&gt;
#map    passwd gecos         displayName&lt;br /&gt;
#map    passwd loginShell    &amp;quot;/bin/bash&amp;quot;&lt;br /&gt;
#filter group (|(objectClass=group)(objectClass=person))&lt;br /&gt;
#map    group gidNumber      objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
&lt;br /&gt;
# Mappings for AIX SecureWay&lt;br /&gt;
#filter passwd (objectClass=aixAccount)&lt;br /&gt;
#map    passwd uid              userName&lt;br /&gt;
#map    passwd userPassword     passwordChar&lt;br /&gt;
#map    passwd uidNumber        uid&lt;br /&gt;
#map    passwd gidNumber        gid&lt;br /&gt;
#filter group  (objectClass=aixAccessGroup)&lt;br /&gt;
#map    group  cn               groupName&lt;br /&gt;
#map    group  gidNumber        gid&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 /etc/nsswitch.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd:      files ldap&lt;br /&gt;
shadow:      files ldap&lt;br /&gt;
group:       files ldap&lt;br /&gt;
&lt;br /&gt;
# passwd:    db files nis&lt;br /&gt;
# shadow:    db files nis&lt;br /&gt;
# group:     db files nis&lt;br /&gt;
&lt;br /&gt;
hosts:       files dns&lt;br /&gt;
networks:    files dns&lt;br /&gt;
&lt;br /&gt;
services:    db files&lt;br /&gt;
protocols:   db files&lt;br /&gt;
rpc:         db files&lt;br /&gt;
ethers:      db files&lt;br /&gt;
netmasks:    files&lt;br /&gt;
netgroup:    files&lt;br /&gt;
bootparams:  files&lt;br /&gt;
&lt;br /&gt;
automount:   files&lt;br /&gt;
aliases:     files&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== system-auth ==&lt;br /&gt;
 vi /etc/pam.d/system-auth&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auth        required    pam_env.so&lt;br /&gt;
auth      sufficient  pam_unix.so try_first_pass likeauth nullok&lt;br /&gt;
auth      sufficient  pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
auth      required pam_deny.so&lt;br /&gt;
&lt;br /&gt;
account   sufficient  pam_ldap.so minimum_uid=1000&lt;br /&gt;
account     required    pam_unix.so&lt;br /&gt;
account   sufficient  pam_ldap.so minimum_uid=1000&lt;br /&gt;
&lt;br /&gt;
password  sufficient    pam_unix.so try_first_pass  nullok sha512 shadow&lt;br /&gt;
password  sufficient  pam_ldap.so minimum_uid=1000 try_first_pass&lt;br /&gt;
password   required     pam_deny.so&lt;br /&gt;
&lt;br /&gt;
session     required    pam_limits.so&lt;br /&gt;
session     required    pam_env.so&lt;br /&gt;
session     required    pam_unix.so&lt;br /&gt;
session   optional    pam_ldap.so minimum_uid=1000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== sshd keys ==&lt;br /&gt;
If you migrate from a existing backup server, you might want to copy the ssh host keys to the new server. If you do so clients want see a difference between the two hosts as the fingerprint remains the same. Copy the following files from the existing host to the new:&lt;br /&gt;
* /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_ecdsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_key&lt;br /&gt;
* /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_dsa_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_ecdsa_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_rsa_key.pub&lt;br /&gt;
&lt;br /&gt;
Set the correct permissions on the new host:&lt;br /&gt;
 chmod 600 /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_key /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
&lt;br /&gt;
And restart the ssh daemon. &#039;&#039;Caution&#039;&#039;: do not close your existing ssh session as long as you are not sure the ssh daemon restarted properly and you can login again.&lt;br /&gt;
 /etc/init.d/sshd restart&lt;br /&gt;
&lt;br /&gt;
== sshd_config ==&lt;br /&gt;
&lt;br /&gt;
 vi /etc/ssh/sshd_config&lt;br /&gt;
&lt;br /&gt;
Changes:&lt;br /&gt;
 PasswordAuthentication yes&lt;br /&gt;
 UsePAM yes&lt;br /&gt;
 #AllowUsers&lt;br /&gt;
&lt;br /&gt;
== rsnapshot ==&lt;br /&gt;
Install the source&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /var/work&lt;br /&gt;
git clone --recursive https://github.com/stepping-stone/backup-util.git&lt;br /&gt;
cd backup-util/bin&lt;br /&gt;
ln -s ../perl-utils/lib/PerlUtil/ PerlUtil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 vi /var/work/backup-util/etc/snapshot.conf &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[General]&lt;br /&gt;
MaxParallelProcesses = 5&lt;br /&gt;
Rsnapshot_command = /usr/bin/nice -n 19 /usr/bin/rsnapshot  -c /etc/rsnapshot/rsnapshot.conf.%uid% %interval%&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
Host = ldaps://ldapm.tombstone.ch&lt;br /&gt;
Port = 636&lt;br /&gt;
User = cn=Manager,dc=foss-cloud,dc=org&lt;br /&gt;
Password = &amp;lt;Password&amp;gt;&lt;br /&gt;
CA_Path = /etc/ssl/certs&lt;br /&gt;
Accounts_Base = ou=accounts,ou=backup,ou=services,dc=foss-cloud,dc=org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Cronjobs ===&lt;br /&gt;
 crontab -e&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
# Rsnapshot for all users&lt;br /&gt;
30 22 * * * /var/work/backup-util/bin/snapshot.pl --interval daily&lt;br /&gt;
15 22 * * sun /var/work/backup-util/bin/snapshot.pl --interval weekly&lt;br /&gt;
00 22 1 * * /var/work/backup-util/bin/snapshot.pl --interval monthly&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== prov-backup-rsnapshot ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /var/work&lt;br /&gt;
git clone --recursive https://github.com/stepping-stone/prov-backup-rsnapshot.git&lt;br /&gt;
cd /var/work/prov-backup-rsnapshot/Provisioning/etc/Provisioning/&lt;br /&gt;
ln -s ../../../etc/Provisioning/Backup/ Backup&lt;br /&gt;
cd /var/work/prov-backup-rsnapshot/Provisioning/lib/Provisioning/&lt;br /&gt;
ln -s ../../../lib/Provisioning/Backup/ Backup&lt;br /&gt;
chmod -R a+rX /var/work&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
The configuration file is currently located in the /var/work/prov-backup-rsnapshot directory: &lt;br /&gt;
 vi /var/work/prov-backup-rsnapshot/etc/Provisioning/Backup/Rsnapshot_test.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Copyright (C) 2013 stepping stone GmbH&lt;br /&gt;
#                    Switzerland&lt;br /&gt;
#                    http://www.stepping-stone.ch&lt;br /&gt;
#                    support@stepping-stone.ch&lt;br /&gt;
#&lt;br /&gt;
# Authors:&lt;br /&gt;
#  Pat Kläy &amp;lt;pat.klaey@stepping-stone.ch&amp;gt;&lt;br /&gt;
#  &lt;br /&gt;
# Licensed under the EUPL, Version 1.1.&lt;br /&gt;
#&lt;br /&gt;
# You may not use this work except in compliance with the&lt;br /&gt;
# Licence.&lt;br /&gt;
# You may obtain a copy of the Licence at:&lt;br /&gt;
#&lt;br /&gt;
# http://www.osor.eu/eupl&lt;br /&gt;
#&lt;br /&gt;
# Unless required by applicable law or agreed to in&lt;br /&gt;
# writing, software distributed under the Licence is&lt;br /&gt;
# distributed on an &amp;quot;AS IS&amp;quot; basis,&lt;br /&gt;
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either&lt;br /&gt;
# express or implied.&lt;br /&gt;
# See the Licence for the specific language governing&lt;br /&gt;
# permissions and limitations under the Licence.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Global]&lt;br /&gt;
# If true the script logs every information to the log-file.&lt;br /&gt;
LOG_DEBUG = 1&lt;br /&gt;
&lt;br /&gt;
# If true the script logs additional information to the log-file.&lt;br /&gt;
LOG_INFO = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs warnings to the log-file.&lt;br /&gt;
LOG_WARNING = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs errors to the log-file.&lt;br /&gt;
LOG_ERR = 1&lt;br /&gt;
&lt;br /&gt;
ENVIRONMENT = &lt;br /&gt;
 &lt;br /&gt;
[Database]&lt;br /&gt;
BACKEND = LDAP&lt;br /&gt;
SERVER = ldaps://ldapm.tombstone.ch&lt;br /&gt;
PORT = 636&lt;br /&gt;
ADMIN_USER = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
ADMIN_PASSWORD = &amp;lt;PASSWORD&amp;gt;&lt;br /&gt;
SERVICE_SUBTREE = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
COOKIE_FILE = /var/work/prov-backup-rsnapshot/Provisioning/etc/Provisioning/Backup/rnsapshot.cookie&lt;br /&gt;
DEFAULT_COOKIE = rid=001,csn=&lt;br /&gt;
SEARCH_FILTER = (&amp;amp;(entryCSN&amp;gt;=%entryCSN%)(objectClass=*))&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
MODUS = selfcare&lt;br /&gt;
TRANSPORTAPI = LocalCLI&lt;br /&gt;
SERVICE = Backup&lt;br /&gt;
TYPE = Rsnapshot&lt;br /&gt;
&lt;br /&gt;
SYSLOG = Backup-Rsnapshot&lt;br /&gt;
&lt;br /&gt;
[Gateway]&lt;br /&gt;
HOST = localhost&lt;br /&gt;
USER = provisioning&lt;br /&gt;
DSA_FILE = none&lt;br /&gt;
&lt;br /&gt;
[Backup]&lt;br /&gt;
RSNAPSHOT_CONFIG_FILE = /etc/rsnapshot/rsnapshot.conf.%uid%&lt;br /&gt;
SET_QUOTA_CMD = /usr/sbin/setquota&lt;br /&gt;
CREATE_CHROOT_CMD = /root/createDummyBackupDirectory.sh # You might want to change this for the productive system&lt;br /&gt;
MOUNTPOINT = / # You might want to change this for the productive system&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Init Scripts ===&lt;br /&gt;
Currently we just create very basic init scripts which start and stop the deamon: &lt;br /&gt;
 /etc/init.d/prov-backup-rsnapshot&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/sbin/runscript&lt;br /&gt;
# Copyright 1999-2013 Gentoo Foundation&lt;br /&gt;
# Distributed under the terms of the GNU General Public License v2&lt;br /&gt;
# $Header: $&lt;br /&gt;
&lt;br /&gt;
depend() {&lt;br /&gt;
    need net&lt;br /&gt;
    after slapd&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
start() {&lt;br /&gt;
    ebegin &amp;quot;Starting backup-rsnapshot provisioning daemon&amp;quot;&lt;br /&gt;
    start-stop-daemon --start \&lt;br /&gt;
        --background \&lt;br /&gt;
        --user ${USER:-root}:${GROUP:-root} \&lt;br /&gt;
        --make-pidfile \&lt;br /&gt;
        --pidfile &amp;quot;${PIDFILE}&amp;quot; \&lt;br /&gt;
        --exec /var/work/prov-backup-rsnapshot/Provisioning/bin/provisioning.pl \&lt;br /&gt;
        --interpreted \&lt;br /&gt;
        -- ${OPTIONS} \&lt;br /&gt;
            -c /var/work/prov-backup-rsnapshot/Provisioning/etc/Provisioning/Backup/Rsnapshot_test.conf \&lt;br /&gt;
            -g /var/work/prov-backup-rsnapshot/Provisioning/etc/Provisioning/Global.conf&lt;br /&gt;
    eend $?&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stop() {&lt;br /&gt;
    ebegin &amp;quot;Stopping backup-rsnapshot provisioning daemon&amp;quot;&lt;br /&gt;
    start-stop-daemon --stop \&lt;br /&gt;
        --pidfile &amp;quot;${PIDFILE}&amp;quot;&lt;br /&gt;
    eend $?&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 /etc/conf.d/prov-backup-rsnapshot&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
USER=&amp;quot;root&amp;quot;&lt;br /&gt;
GROUP=&amp;quot;root&amp;quot;&lt;br /&gt;
&lt;br /&gt;
PIDFILE=&amp;quot;/run/prov-backup-rsnapshot.pid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# OPTIONS=&amp;quot;...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== Run-Level ====&lt;br /&gt;
 rc-update add prov-backup-rsnapshot default&lt;br /&gt;
&lt;br /&gt;
== schedule warning ==&lt;br /&gt;
To install the new schedule warning script you have to execute the following commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /var/work/&lt;br /&gt;
git clone --recursive https://github.com/stepping-stone/backup-surveillance.git&lt;br /&gt;
cd backup-surveillance/bin/&lt;br /&gt;
ln -s ../perl-utils/lib/PerlUtil/ PerlUtil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 vi /var/work/backup-surveillance/etc/config.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[XML]&lt;br /&gt;
SCHEDULE_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/scheduler.xml&lt;br /&gt;
SCHEDULE_XSD = %configpath%/../etc/schema/scheduler_schema.xsd&lt;br /&gt;
BACKUP_ENDED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupEnded.xml&lt;br /&gt;
BACKUP_ENDED_XSD =  %configpath%/../etc/schema/backupended_schema.xsd&lt;br /&gt;
BACKUP_STARTED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupStarted.xml&lt;br /&gt;
BACKUP_STARTED_XSD =   %configpath%/../etc/schema/backupstarted_schema.xsd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[TEMPLATE]&lt;br /&gt;
Salutation_Default_de-CH = Liebe Kundin / Lieber Kunde&lt;br /&gt;
Salutation_m_de-CH = Sehr geehrter Herr&lt;br /&gt;
Salutation_f_de-CH = Sehr geehrte Frau&lt;br /&gt;
Salutation_Default_en-GB = Dear customer&lt;br /&gt;
Salutation_m_en-GB = Dear Mr.&lt;br /&gt;
Salutation_f_en-GB = Dear Mrs.&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
&lt;br /&gt;
SERVER = ldaps://ldapm.tombstone.ch&lt;br /&gt;
PORT = 636&lt;br /&gt;
DEBUG = 1&lt;br /&gt;
&lt;br /&gt;
ADMIN_DN = cn=Manager,dc=foss-cloud,dc=org &lt;br /&gt;
ADMIN_PASSWORD = &amp;lt;Password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
BACKUP_BASE = ou=accounts,ou=backup,ou=services,dc=foss-cloud,dc=org&lt;br /&gt;
PEOPLE_BASE = ou=people,dc=foss-cloud,dc=org&lt;br /&gt;
RESELLER_BASE = ou=reseller,ou=configuration,ou=backup,ou=services,dc=foss-cloud,dc=org&lt;br /&gt;
SCOPE = sub&lt;br /&gt;
&lt;br /&gt;
[MAIL]&lt;br /&gt;
mailTo = &lt;br /&gt;
host = mail.stepping-stone.ch&lt;br /&gt;
port = 587&lt;br /&gt;
username = &lt;br /&gt;
password = &lt;br /&gt;
from = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== writeAccountSize ==&lt;br /&gt;
If you have already installed the [[Backup_(Server_Setup)#rsnapshot | rsnapshot]] script, you also have the writeAccountSize script. Otherwise follow [[Backup_(Server_Setup)#rsnapshot | these instructions (installation only)]]&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 vi /var/work/backup-util/etc/writeAccountSize.conf &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Global]&lt;br /&gt;
INCOMING_DIRECTORY = /incoming&lt;br /&gt;
ACCOUNT_SIZE_FILE = /etc/backupSize&lt;br /&gt;
SNAPSHOTS = 1&lt;br /&gt;
&lt;br /&gt;
[Syslog]&lt;br /&gt;
SYSLOG = rsnapshot&lt;br /&gt;
&lt;br /&gt;
[Directory]&lt;br /&gt;
LDAP_SERVER = ldaps://ldapm.tombstone.ch&lt;br /&gt;
LDAP_PORT = 636&lt;br /&gt;
LDAP_BIND_DN = cn=Manager,dc=foss-cloud,dc=org&lt;br /&gt;
LDAP_BIND_PW = &amp;lt;password&amp;gt;&lt;br /&gt;
LDAP_BASE_DN = ou=accounts,ou=backup,ou=services,dc=foss-cloud,dc=org&lt;br /&gt;
LDAP_PERSON_BASE = ou=people,dc=foss-cloud,dc=org&lt;br /&gt;
LDAP_RESELLER_BASE = ou=reseller,ou=configuration,ou=backup,ou=services,dc=foss-cloud,dc=org&lt;br /&gt;
LDAP_EMAIL_ATTRIBUTE = mail&lt;br /&gt;
&lt;br /&gt;
[Notification]&lt;br /&gt;
EMAIL_SENDER = stepping stone GmbH Supprt &amp;lt;support@stepping-stone.ch&amp;gt;&lt;br /&gt;
EMAIL_ALERT_THRESHOLD = 85&lt;br /&gt;
&lt;br /&gt;
Salutation_Default_de-CH = Liebe Kundin / Lieber Kunde&lt;br /&gt;
Salutation_m_de-CH = Sehr geehrter Herr&lt;br /&gt;
Salutation_f_de-CH = Sehr geehrte Frau&lt;br /&gt;
Salutation_Default_en-GB = Dear customer&lt;br /&gt;
Salutation_m_en-GB = Dear Mr.&lt;br /&gt;
Salutation_f_en-GB = Dear Mrs.&lt;br /&gt;
&lt;br /&gt;
[MAIL]&lt;br /&gt;
host = mail.stepping-stone.ch&lt;br /&gt;
port = 587&lt;br /&gt;
username = support@stepping-stone.ch&lt;br /&gt;
password = &amp;lt;password&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* [http://www.openldap.org/ OpenLDAP], an open source implementation of the Lightweight Directory Access Protocol.&lt;br /&gt;
* [http://arthurdejong.org/nss-pam-ldapd/ nss-pam-ldapd], a Name Service Switch (NSS) module that allows your LDAP server to provide user account, group, host name, alias, netgroup, and basically any other information that you would normally get from /etc flat files or NIS.&lt;br /&gt;
* [http://www.gentoo.org/doc/de/ldap-howto.xml Gentoo Leitfaden zur OpenLDAP Authentifikation].&lt;br /&gt;
* [http://wiki.gentoo.org/wiki/Centralized_authentication_using_OpenLDAP Centralized authentication using OpenLDAP].&lt;br /&gt;
* [https://code.google.com/p/openssh-lpk/source/browse/trunk/schemas/openssh-lpk_openldap.schema openssh-lpk_openldap.schema] OpenSSH LDAP Public Keys.&lt;br /&gt;
* [http://sourceforge.net/projects/linuxquota/ linuxquota] Linux DiskQuota.&lt;br /&gt;
* [http://www.rsnapshot.org/ rsnapshot], a remote filesystem snapshot utility, based on rsync.&lt;br /&gt;
* [http://olivier.sessink.nl/jailkit/ Jailkit], set of utilities to limit user accounts to specific files using chroot() and or specific commands. Also includes a tool to build a chroot environment.&lt;br /&gt;
* [http://www.busybox.net/ Busybox] BusyBox combines tiny versions of many common UNIX utilities into a single small executable. Useful to reduce the number of files (and thus the complexity) when building a chroot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=stoney_backup:_Server_set-up&amp;diff=1012</id>
		<title>stoney backup: Server set-up</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=stoney_backup:_Server_set-up&amp;diff=1012"/>
		<updated>2013-08-28T14:12:12Z</updated>

		<summary type="html">&lt;p&gt;David: /* sshd_config */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Abstract =&lt;br /&gt;
This document describes server setup for the stoney cloud (Online) Backup service, built upon the [http://www.gentoo.org/ Gentoo] Linux distribution.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
After working through this documentation, you will be able to set up and configure your own (Online) Backup service server.&lt;br /&gt;
&lt;br /&gt;
= Software Installation =&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
A working stoney cloud installation.&lt;br /&gt;
&lt;br /&gt;
== USE-Flages ==&lt;br /&gt;
For a full OpenLDAP directory installation:&lt;br /&gt;
 echo &amp;quot;net-nds/openldap overlays perl sasl&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&lt;br /&gt;
For a minimal OpenLDAP directory installation (just the necessary tools):&lt;br /&gt;
 echo &amp;quot;sys-auth/nss-pam-ldapd sasl&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
 echo &amp;quot;sys-auth/nss-pam-ldapd ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;net-nds/openldap ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;sys-fs/quota ldap&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&lt;br /&gt;
For the prov-backup-rsnapshot daemon&lt;br /&gt;
 echo &amp;quot;dev-perl/Net-SMTPS ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
 echo &amp;quot;perl-core/Switch ~amd64&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.keywords&lt;br /&gt;
&lt;br /&gt;
== Emerge ==&lt;br /&gt;
 emerge ⁻va nss-pam-ldapd&lt;br /&gt;
 emerge -va rsnapshot&lt;br /&gt;
 emerge -va quota&lt;br /&gt;
 emerge -va dev-perl/Config-IniFiles&lt;br /&gt;
 emerge -va dev-perl/LockFile-Simple&lt;br /&gt;
 emerge -va dev-perl/Net-SMTPS&lt;br /&gt;
 emerge -va dev-perl/perl-ldap&lt;br /&gt;
 emerge -va virtual/perl-Switch&lt;br /&gt;
 emerge -va dev-perl/Parallel-ForkManager&lt;br /&gt;
 emerge -va dev-perl/XML-Simple&lt;br /&gt;
 emerge -va dev-perl/Date-Calc&lt;br /&gt;
 emerge -va dev-perl/DateManip&lt;br /&gt;
 emerge -va dev-perl/DateTime-Format-Strptime&lt;br /&gt;
 emerge -va dev-perl/text-template&lt;br /&gt;
 emerge -va perl-core/Switch&lt;br /&gt;
&lt;br /&gt;
=== CPAN ===&lt;br /&gt;
Install the Time::Stopwatch, XML::Validator::Schema and Schedule::Cron::Events lib form CPAN (no ebuild available)&lt;br /&gt;
 cpan&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cpan[1]&amp;gt; install Time::Stopwatch&lt;br /&gt;
  LWP not available&lt;br /&gt;
Fetching with Net::FTP:&lt;br /&gt;
ftp://tux.rainside.sk/CPAN/authors/01mailrc.txt.gz&lt;br /&gt;
Going to read &#039;/root/.cpan/sources/authors/01mailrc.txt.gz&#039;&lt;br /&gt;
...&lt;br /&gt;
  ILTZU/Time-Stopwatch-1.00.tar.gz&lt;br /&gt;
  /usr/bin/make install  -- OK&lt;br /&gt;
&lt;br /&gt;
cpan[2]&amp;gt; install XML::Validator::Schema&lt;br /&gt;
Going to read &#039;/root/.cpan/Metadata&#039;&lt;br /&gt;
...&lt;br /&gt;
  SAMTREGAR/XML-Validator-Schema-1.10.tar.gz&lt;br /&gt;
  /usr/bin/make install  -- OK&lt;br /&gt;
&lt;br /&gt;
cpan[3]&amp;gt; install Schedule::Cron::Events&lt;br /&gt;
Going to read &#039;/root/.cpan/Metadata&#039;&lt;br /&gt;
...&lt;br /&gt;
  /usr/bin/make install  -- OK&lt;br /&gt;
&lt;br /&gt;
cpan[4]&amp;gt; exit&lt;br /&gt;
Terminal does not support GetHistory.&lt;br /&gt;
Lockfile removed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Software Configuration =&lt;br /&gt;
== Quota ==&lt;br /&gt;
=== 32-bit Project Identifier Support ===&lt;br /&gt;
We need to enable 32-bit project identifier support (PROJID32BIT feature) for our naming scheme (uid numbers larger than 65&#039;536):&lt;br /&gt;
 mkfs.xfs &#039;&#039;&#039;-i projid32bit=1&#039;&#039;&#039; /dev/vdb1&lt;br /&gt;
&lt;br /&gt;
=== Mount ===&lt;br /&gt;
Make sure, that you have user quota (uqota) and project quota (pquota) set as options on the chosen mount point in /etc/fstab. For example:&lt;br /&gt;
 /dev/vdb1               /var/backup     xfs             noatime,uquota,pquota   0 0&lt;br /&gt;
&lt;br /&gt;
=== Verify ===&lt;br /&gt;
Some important options for xfs_quota:&lt;br /&gt;
* -x: Enable expert mode.&lt;br /&gt;
* -c: Pass arguments on the command line. Multiple arguments may be given.&lt;br /&gt;
&lt;br /&gt;
Remount the file system /var/backup and check, if /var/backup has the desired values:&lt;br /&gt;
 xfs_quota -x -c state /var/backup&lt;br /&gt;
&lt;br /&gt;
As you can see (items marked bold), we have achieved our goal:&lt;br /&gt;
 User quota state on /var/backup (/dev/vdb1)&lt;br /&gt;
   Accounting: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Enforcement: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Inode: #131 (3 blocks, 2 extents)&lt;br /&gt;
 Group quota state on /var/backup (/dev/vdb1)&lt;br /&gt;
   Accounting: OFF&lt;br /&gt;
   Enforcement: OFF&lt;br /&gt;
  Inode: #809717 (1 blocks, 1 extents)&lt;br /&gt;
 Project quota state on /var/backup (/dev/vdb1)&lt;br /&gt;
   Accounting: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Enforcement: &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
   Inode: #809717 (1 blocks, 1 extents)&lt;br /&gt;
 Blocks grace time: [7 days 00:00:30]&lt;br /&gt;
 Inodes grace time: [7 days 00:00:30]&lt;br /&gt;
 Realtime Blocks grace time: [7 days 00:00:30]&lt;br /&gt;
&lt;br /&gt;
=== User Quotas ===&lt;br /&gt;
==== Adding a User Quota ====&lt;br /&gt;
Set a quota of 1 Gigabyte for the user 4000187 (the values are in kilobytes, so 1048576 kilobyte are 1024 megabytes which corresponds to 1 gigabyte):&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1048576k 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Or in bytes:&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1073741824 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Read the quota information for the user 4000187:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
 /dev/vdb1                    0          0    1048576   00 [--------] /var/backup&lt;br /&gt;
&lt;br /&gt;
If the user has data in the project, that belongs to him, the result will change:&lt;br /&gt;
 /dev/vdb1               512000          0    1048576   00 [--------] /var/backup&lt;br /&gt;
&lt;br /&gt;
==== Modifiying a User Quota ====&lt;br /&gt;
To modify a users quota, you just set a new quota (limit):&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=1048576k 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Read the quota information for the user 4000187:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
 /dev/vdb1                    0          0    1048576   00 [--------] /var/backup&lt;br /&gt;
&lt;br /&gt;
If the user has data in the project, that belongs to him, the result will change:&lt;br /&gt;
 /dev/vdb1               512000          0    1048576   00 [--------] /var/backup&lt;br /&gt;
&lt;br /&gt;
==== Removing a User Quota ====&lt;br /&gt;
Removing a quota for a user:&lt;br /&gt;
 xfs_quota -x -c &#039;limit bhard=0 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
The following command should give you an empty result:&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -u 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
=== Project (Directory) Quotas ===&lt;br /&gt;
==== Adding a Project (Directory) Quota ====&lt;br /&gt;
The XFS file system additionally allows you to set quotas on individual directory hierarchies in the file system that are known as managed trees. Each managed tree is uniquely identified by a project ID and an optional project name. We&#039;ll use the following values in the examples:&lt;br /&gt;
* project_ID: The uid of the online backup account (4000187).&lt;br /&gt;
* project_name: The uid of the online backup account (4000187). This could be a human readable name.&lt;br /&gt;
* mountpoint: The mountpoint of the xfs-filesystem (/var/backup). See the &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt; entry from above.&lt;br /&gt;
* directory: The directory of the project (187/4000187), starting from the mountpoint of the xfs-filesystem (/var/backup).&lt;br /&gt;
&lt;br /&gt;
Define a unique project ID for the directory hierarchy in the &amp;lt;code&amp;gt;/etc/projects&amp;lt;/code&amp;gt; file (project_ID:mountpoint/directory):&lt;br /&gt;
 echo &amp;quot;4000187:/var/backup/187/4000187&amp;quot; &amp;gt;&amp;gt; /etc/projects&lt;br /&gt;
&lt;br /&gt;
Create an entry in the &amp;lt;code&amp;gt;/etc/projid&amp;lt;/code&amp;gt; file that maps a project name to the project ID (project_name:project_ID):&lt;br /&gt;
 echo &amp;quot;4000187:4000187&amp;quot; &amp;gt;&amp;gt; /etc/projid&lt;br /&gt;
&lt;br /&gt;
Set Project:&lt;br /&gt;
 xfs_quota -x -c &#039;project -s -p /var/backup/187/4000187 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Set Quota (limit) on Project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=1048576k 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Check your Quota (limit)&lt;br /&gt;
 xfs_quota -x -c &#039;quota -p 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Check the Quota:&lt;br /&gt;
* &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt;: increase verbosity in reporting (also dumps zero values).&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt;: suppress the initial header.&lt;br /&gt;
* &amp;lt;code&amp;gt;-p&amp;lt;/code&amp;gt;: display project quota information.&lt;br /&gt;
* &amp;lt;code&amp;gt;-h&amp;lt;/code&amp;gt;: human readable format.&lt;br /&gt;
 xfs_quota -x -c &#039;quota -v -N -p 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
 /dev/vdb1                    0          0    1048576   00 [--------] /var/backup&lt;br /&gt;
&lt;br /&gt;
If you copied data into the project, the output will look something like:&lt;br /&gt;
 /dev/vdb1               512000          0    1048576   00 [--------] /var/backup&lt;br /&gt;
&lt;br /&gt;
To give you an overall view of the whole system:&lt;br /&gt;
 xfs_quota -x -c report /var/backup&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
User quota on /var/backup (/dev/vdb1)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
User ID          Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
root          1024000          0          0     00 [--------]&lt;br /&gt;
4000187             0          0    1048576     00 [--------]&lt;br /&gt;
&lt;br /&gt;
Project quota on /var/backup (/dev/vdb1)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
Project ID       Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
4000187        512000          0    1048576     00 [--------]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Modifying a Project (Directory) Quota ====&lt;br /&gt;
To modify a project (directory) quota, you just set an new quota (limit) on the chosen project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=1048576k 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Check your quota (limit)&lt;br /&gt;
 xfs_quota -x -c &#039;quota -p 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
==== Removing a Project (Directory) Quota ====&lt;br /&gt;
Removing a quota from a project:&lt;br /&gt;
 xfs_quota -x -c &#039;limit -p bhard=0 4000187&#039; /var/backup&lt;br /&gt;
&lt;br /&gt;
Chreck the results:&lt;br /&gt;
 xfs_quota -x -c report /var/backup&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
User quota on /var/backup (/dev/vdb1)&lt;br /&gt;
                               Blocks                     &lt;br /&gt;
User ID          Used       Soft       Hard    Warn/Grace     &lt;br /&gt;
---------- -------------------------------------------------- &lt;br /&gt;
root           512000          0          0     00 [--------]&lt;br /&gt;
4000187             0          0       1024     00 [--------]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the line with the Project ID 4000187 has disappeared:&lt;br /&gt;
 4000187        512000          0    1048576     00 [--------]&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to remove the project from &amp;lt;code&amp;gt;/etc/projects&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/etc/projid&amp;lt;/code&amp;gt;:&lt;br /&gt;
 sed -i -e &#039;/4000187/d&#039; /etc/projects&lt;br /&gt;
 sed -i -e &#039;/4000187/d&#039; /etc/projid&lt;br /&gt;
&lt;br /&gt;
=== Some important notes concerning XFS ===&lt;br /&gt;
# The &#039;&#039;&#039;quotacheck&#039;&#039;&#039; command has no effect on XFS filesystems. The first time quota accounting is turned on (at mount time), XFS does an automatic quotacheck internally; afterwards, the quota system will always be completely consistent until quotas are manually turned off. &lt;br /&gt;
# There is &#039;&#039;&#039;no need for quota file(s)&#039;&#039;&#039; in the root of the XFS filesystem.&lt;br /&gt;
&lt;br /&gt;
== OpenSSH ==&lt;br /&gt;
Configure the OpenSSH daemon:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vi /etc/ssh/sshd_config&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set following options:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
PubkeyAuthentication yes&lt;br /&gt;
PasswordAuthentication yes&lt;br /&gt;
UsePAM yes&lt;br /&gt;
Subsystem     sftp   internal-sftp&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure, that &amp;lt;code&amp;gt;Subsystem     sftp   internal-sftp&amp;lt;/code&amp;gt; is the last line in the configuration file.&lt;br /&gt;
&lt;br /&gt;
We want to reduce the numbers of chroot environments in one folder. As the &amp;lt;code&amp;gt;ChrootDirectory&amp;lt;/code&amp;gt; configuration option only allows &amp;lt;code&amp;gt;%h&amp;lt;/code&amp;gt; (home directory of the user) and &amp;lt;code&amp;gt;%u&amp;lt;/code&amp;gt; (username of the user), we need to create the necessary matching rules in the form of:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Match User *000&lt;br /&gt;
  ChrootDirectory /var/backup/000/%u&lt;br /&gt;
Match&lt;br /&gt;
Match User *001&lt;br /&gt;
  ChrootDirectory /var/backup/001/%u&lt;br /&gt;
Match&lt;br /&gt;
...&lt;br /&gt;
Match User *999&lt;br /&gt;
  ChrootDirectory /var/backup/999/%u&lt;br /&gt;
Match&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The creation of the matching rules is done by executing the following bash commands:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
FILE=/etc/ssh/sshd_config;&lt;br /&gt;
&lt;br /&gt;
for ((x=0; x&amp;lt;1000; x+=1)); \&lt;br /&gt;
do \&lt;br /&gt;
  printf &amp;quot;Match User *%03d\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;  ChrootDirectory /var/backup/%03d/%%u\n&amp;quot; $x &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
  printf &amp;quot;Match\n&amp;quot; &amp;gt;&amp;gt; ${FILE}; \&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to restart the OpenSSH daemon:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/etc/init.d/sshd restart&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== OpenLDAP ==&lt;br /&gt;
 /etc/openldap/ldap.conf&lt;br /&gt;
&lt;br /&gt;
== nss-pam-ldapd ==&lt;br /&gt;
 /etc/nslcd.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# This is the configuration file for the LDAP nameservice&lt;br /&gt;
# switch library&#039;s nslcd daemon. It configures the mapping&lt;br /&gt;
# between NSS names (see /etc/nsswitch.conf) and LDAP&lt;br /&gt;
# information in the directory.&lt;br /&gt;
# See the manual page nslcd.conf(5) for more information.&lt;br /&gt;
&lt;br /&gt;
# The user and group nslcd should run as.&lt;br /&gt;
uid nslcd&lt;br /&gt;
gid nslcd&lt;br /&gt;
&lt;br /&gt;
# The uri pointing to the LDAP server to use for name lookups.&lt;br /&gt;
# Multiple entries may be specified. The address that is used&lt;br /&gt;
# here should be resolvable without using LDAP (obviously).&lt;br /&gt;
#uri ldap://127.0.0.1/&lt;br /&gt;
#uri ldaps://127.0.0.1/&lt;br /&gt;
#uri ldapi://%2fvar%2frun%2fldapi_sock/&lt;br /&gt;
# Note: %2f encodes the &#039;/&#039; used as directory separator&lt;br /&gt;
uri ldaps://ldapm.tombstone.ch&lt;br /&gt;
&lt;br /&gt;
# The LDAP version to use (defaults to 3&lt;br /&gt;
# if supported by client library)&lt;br /&gt;
#ldap_version 3&lt;br /&gt;
&lt;br /&gt;
# The distinguished name of the search base.&lt;br /&gt;
base dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# The distinguished name to bind to the server with.&lt;br /&gt;
# Optional: default is to bind anonymously.&lt;br /&gt;
binddn cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
&lt;br /&gt;
# The credentials to bind with.&lt;br /&gt;
# Optional: default is no credentials.&lt;br /&gt;
# Note that if you set a bindpw you should check the permissions of this file.&lt;br /&gt;
bindpw myverysecretpassword&lt;br /&gt;
&lt;br /&gt;
# The distinguished name to perform password modifications by root by.&lt;br /&gt;
#rootpwmoddn cn=admin,dc=example,dc=com&lt;br /&gt;
&lt;br /&gt;
# The default search scope.&lt;br /&gt;
#scope sub&lt;br /&gt;
#scope one&lt;br /&gt;
#scope base&lt;br /&gt;
&lt;br /&gt;
# Customize certain database lookups.&lt;br /&gt;
#base   group  ou=Groups,dc=example,dc=com&lt;br /&gt;
base   group  ou=groups,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
base   passwd ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
base   shadow ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
#scope  group  onelevel&lt;br /&gt;
#scope  hosts  sub&lt;br /&gt;
&lt;br /&gt;
#filter group  (&amp;amp;(objectClass=posixGroup)(sstIsActive=TRUE))&lt;br /&gt;
filter passwd (&amp;amp;(objectClass=posixAccount)(sstIsActive=TRUE))&lt;br /&gt;
filter shadow (&amp;amp;(objectClass=shadowAccount)(sstIsActive=TRUE))&lt;br /&gt;
&lt;br /&gt;
# Bind/connect timelimit.&lt;br /&gt;
#bind_timelimit 30&lt;br /&gt;
&lt;br /&gt;
# Search timelimit.&lt;br /&gt;
#timelimit 30&lt;br /&gt;
&lt;br /&gt;
# Idle timelimit. nslcd will close connections if the&lt;br /&gt;
# server has not been contacted for the number of seconds.&lt;br /&gt;
#idle_timelimit 3600&lt;br /&gt;
&lt;br /&gt;
# Use StartTLS without verifying the server certificate.&lt;br /&gt;
#ssl start_tls&lt;br /&gt;
tls_reqcert never&lt;br /&gt;
&lt;br /&gt;
# CA certificates for server certificate verification&lt;br /&gt;
#tls_cacertdir /etc/ssl/certs&lt;br /&gt;
#tls_cacertfile /etc/ssl/ca.cert&lt;br /&gt;
&lt;br /&gt;
# Seed the PRNG if /dev/urandom is not provided&lt;br /&gt;
#tls_randfile /var/run/egd-pool&lt;br /&gt;
&lt;br /&gt;
# SSL cipher suite&lt;br /&gt;
# See man ciphers for syntax&lt;br /&gt;
#tls_ciphers TLSv1&lt;br /&gt;
&lt;br /&gt;
# Client certificate and key&lt;br /&gt;
# Use these, if your server requires client authentication.&lt;br /&gt;
#tls_cert&lt;br /&gt;
#tls_key&lt;br /&gt;
&lt;br /&gt;
# Mappings for Services for UNIX 3.5&lt;br /&gt;
#filter passwd (objectClass=User)&lt;br /&gt;
#map    passwd uid              msSFU30Name&lt;br /&gt;
#map    passwd userPassword     msSFU30Password&lt;br /&gt;
#map    passwd homeDirectory    msSFU30HomeDirectory&lt;br /&gt;
#map    passwd homeDirectory    msSFUHomeDirectory&lt;br /&gt;
#filter shadow (objectClass=User)&lt;br /&gt;
#map    shadow uid              msSFU30Name&lt;br /&gt;
#map    shadow userPassword     msSFU30Password&lt;br /&gt;
#filter group  (objectClass=Group)&lt;br /&gt;
#map    group  member           msSFU30PosixMember&lt;br /&gt;
&lt;br /&gt;
# Mappings for Services for UNIX 2.0&lt;br /&gt;
#filter passwd (objectClass=User)&lt;br /&gt;
#map    passwd uid              msSFUName&lt;br /&gt;
#map    passwd userPassword     msSFUPassword&lt;br /&gt;
#map    passwd homeDirectory    msSFUHomeDirectory&lt;br /&gt;
#map    passwd gecos            msSFUName&lt;br /&gt;
#filter shadow (objectClass=User)&lt;br /&gt;
#map    shadow uid              msSFUName&lt;br /&gt;
#map    shadow userPassword     msSFUPassword&lt;br /&gt;
#map    shadow shadowLastChange pwdLastSet&lt;br /&gt;
#filter group  (objectClass=Group)&lt;br /&gt;
#map    group  member           posixMember&lt;br /&gt;
&lt;br /&gt;
# Mappings for Active Directory&lt;br /&gt;
#pagesize 1000&lt;br /&gt;
#referrals off&lt;br /&gt;
#idle_timelimit 800&lt;br /&gt;
#filter passwd (&amp;amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))&lt;br /&gt;
#map    passwd uid              sAMAccountName&lt;br /&gt;
#map    passwd homeDirectory    unixHomeDirectory&lt;br /&gt;
#map    passwd gecos            displayName&lt;br /&gt;
#filter shadow (&amp;amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))&lt;br /&gt;
#map    shadow uid              sAMAccountName&lt;br /&gt;
#map    shadow shadowLastChange pwdLastSet&lt;br /&gt;
#filter group  (objectClass=group)&lt;br /&gt;
&lt;br /&gt;
# Alternative mappings for Active Directory&lt;br /&gt;
# (replace the SIDs in the objectSid mappings with the value for your domain)&lt;br /&gt;
#pagesize 1000&lt;br /&gt;
#referrals off&lt;br /&gt;
#idle_timelimit 800&lt;br /&gt;
#filter passwd (&amp;amp;(objectClass=user)(objectClass=person)(!(objectClass=computer)))&lt;br /&gt;
#map    passwd uid           cn&lt;br /&gt;
#map    passwd uidNumber     objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
#map    passwd gidNumber     objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
#map    passwd homeDirectory &amp;quot;/home/$cn&amp;quot;&lt;br /&gt;
#map    passwd gecos         displayName&lt;br /&gt;
#map    passwd loginShell    &amp;quot;/bin/bash&amp;quot;&lt;br /&gt;
#filter group (|(objectClass=group)(objectClass=person))&lt;br /&gt;
#map    group gidNumber      objectSid:S-1-5-21-3623811015-3361044348-30300820&lt;br /&gt;
&lt;br /&gt;
# Mappings for AIX SecureWay&lt;br /&gt;
#filter passwd (objectClass=aixAccount)&lt;br /&gt;
#map    passwd uid              userName&lt;br /&gt;
#map    passwd userPassword     passwordChar&lt;br /&gt;
#map    passwd uidNumber        uid&lt;br /&gt;
#map    passwd gidNumber        gid&lt;br /&gt;
#filter group  (objectClass=aixAccessGroup)&lt;br /&gt;
#map    group  cn               groupName&lt;br /&gt;
#map    group  gidNumber        gid&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 /etc/nsswitch.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd:      files ldap&lt;br /&gt;
shadow:      files ldap&lt;br /&gt;
group:       files ldap&lt;br /&gt;
&lt;br /&gt;
# passwd:    db files nis&lt;br /&gt;
# shadow:    db files nis&lt;br /&gt;
# group:     db files nis&lt;br /&gt;
&lt;br /&gt;
hosts:       files dns&lt;br /&gt;
networks:    files dns&lt;br /&gt;
&lt;br /&gt;
services:    db files&lt;br /&gt;
protocols:   db files&lt;br /&gt;
rpc:         db files&lt;br /&gt;
ethers:      db files&lt;br /&gt;
netmasks:    files&lt;br /&gt;
netgroup:    files&lt;br /&gt;
bootparams:  files&lt;br /&gt;
&lt;br /&gt;
automount:   files&lt;br /&gt;
aliases:     files&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== system-auth ==&lt;br /&gt;
 vi /etc/pam.d/system-auth&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auth        required    pam_env.so&lt;br /&gt;
auth      sufficient  pam_unix.so try_first_pass likeauth nullok&lt;br /&gt;
auth      sufficient  pam_ldap.so minimum_uid=1000 use_first_pass&lt;br /&gt;
auth      required pam_deny.so&lt;br /&gt;
&lt;br /&gt;
account   sufficient  pam_ldap.so minimum_uid=1000&lt;br /&gt;
account     required    pam_unix.so&lt;br /&gt;
account   sufficient  pam_ldap.so minimum_uid=1000&lt;br /&gt;
&lt;br /&gt;
password  sufficient    pam_unix.so try_first_pass  nullok sha512 shadow&lt;br /&gt;
password  sufficient  pam_ldap.so minimum_uid=1000 try_first_pass&lt;br /&gt;
password   required     pam_deny.so&lt;br /&gt;
&lt;br /&gt;
session     required    pam_limits.so&lt;br /&gt;
session     required    pam_env.so&lt;br /&gt;
session     required    pam_unix.so&lt;br /&gt;
session   optional    pam_ldap.so minimum_uid=1000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== sshd keys ==&lt;br /&gt;
If you migrate from a existing backup server, you might want to copy the ssh host keys to the new server. If you do so clients want see a difference between the two hosts as the fingerprint remains the same. Copy the following files from the existing host to the new:&lt;br /&gt;
* /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_ecdsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_key&lt;br /&gt;
* /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
* /etc/ssh/ssh_host_dsa_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_ecdsa_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_key.pub&lt;br /&gt;
* /etc/ssh/ssh_host_rsa_key.pub&lt;br /&gt;
&lt;br /&gt;
Set the correct permissions on the new host:&lt;br /&gt;
 chmod 600 /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_key /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
&lt;br /&gt;
And restart the ssh daemon. &#039;&#039;Caution&#039;&#039;: do not close your existing ssh session as long as you are not sure the ssh daemon restarted properly and you can login again.&lt;br /&gt;
&lt;br /&gt;
== sshd_config ==&lt;br /&gt;
&lt;br /&gt;
 vi /etc/ssh/sshd_config&lt;br /&gt;
&lt;br /&gt;
Changes:&lt;br /&gt;
 PasswordAuthentication yes&lt;br /&gt;
 UsePAM yes&lt;br /&gt;
 #AllowUsers&lt;br /&gt;
&lt;br /&gt;
== rsnapshot ==&lt;br /&gt;
Install the source&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /var/work&lt;br /&gt;
git clone --recursive https://github.com/stepping-stone/backup-util.git&lt;br /&gt;
cd backup-util/bin&lt;br /&gt;
ln -s ../perl-utils/lib/PerlUtil/ PerlUtil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 vi /var/work/backup-util/etc/snapshot.conf &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[General]&lt;br /&gt;
MaxParallelProcesses = 5&lt;br /&gt;
Rsnapshot_command = /usr/bin/nice -n 19 /usr/bin/rsnapshot  -c /etc/rsnapshot/rsnapshot.conf.%uid% %interval%&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
Host = ldaps://ldapm.tombstone.ch&lt;br /&gt;
Port = 636&lt;br /&gt;
User = cn=Manager,dc=foss-cloud,dc=org&lt;br /&gt;
Password = &amp;lt;Password&amp;gt;&lt;br /&gt;
CA_Path = /etc/ssl/certs&lt;br /&gt;
Accounts_Base = ou=accounts,ou=backup,ou=services,dc=foss-cloud,dc=org&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Cronjobs ===&lt;br /&gt;
 crontab -e&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
# Rsnapshot for all users&lt;br /&gt;
30 22 * * * /var/work/backup-util/bin/snapshot.pl --interval daily&lt;br /&gt;
15 22 * * sun /var/work/backup-util/bin/snapshot.pl --interval weekly&lt;br /&gt;
00 22 1 * * /var/work/backup-util/bin/snapshot.pl --interval monthly&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== prov-backup-rsnapshot ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /var/work&lt;br /&gt;
git clone --recursive https://github.com/stepping-stone/prov-backup-rsnapshot.git&lt;br /&gt;
cd /var/work/prov-backup-rsnapshot/Provisioning/etc/Provisioning/&lt;br /&gt;
ln -s ../../../etc/Provisioning/Backup/ Backup&lt;br /&gt;
cd /var/work/prov-backup-rsnapshot/Provisioning/lib/Provisioning/&lt;br /&gt;
ln -s ../../../lib/Provisioning/Backup/ Backup&lt;br /&gt;
chmod -R a+rX /var/work&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
The configuration file is currently located in the /var/work/prov-backup-rsnapshot directory: &lt;br /&gt;
 vi /var/work/prov-backup-rsnapshot/etc/Provisioning/Backup/Rsnapshot_test.conf&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Copyright (C) 2013 stepping stone GmbH&lt;br /&gt;
#                    Switzerland&lt;br /&gt;
#                    http://www.stepping-stone.ch&lt;br /&gt;
#                    support@stepping-stone.ch&lt;br /&gt;
#&lt;br /&gt;
# Authors:&lt;br /&gt;
#  Pat Kläy &amp;lt;pat.klaey@stepping-stone.ch&amp;gt;&lt;br /&gt;
#  &lt;br /&gt;
# Licensed under the EUPL, Version 1.1.&lt;br /&gt;
#&lt;br /&gt;
# You may not use this work except in compliance with the&lt;br /&gt;
# Licence.&lt;br /&gt;
# You may obtain a copy of the Licence at:&lt;br /&gt;
#&lt;br /&gt;
# http://www.osor.eu/eupl&lt;br /&gt;
#&lt;br /&gt;
# Unless required by applicable law or agreed to in&lt;br /&gt;
# writing, software distributed under the Licence is&lt;br /&gt;
# distributed on an &amp;quot;AS IS&amp;quot; basis,&lt;br /&gt;
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either&lt;br /&gt;
# express or implied.&lt;br /&gt;
# See the Licence for the specific language governing&lt;br /&gt;
# permissions and limitations under the Licence.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Global]&lt;br /&gt;
# If true the script logs every information to the log-file.&lt;br /&gt;
LOG_DEBUG = 1&lt;br /&gt;
&lt;br /&gt;
# If true the script logs additional information to the log-file.&lt;br /&gt;
LOG_INFO = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs warnings to the log-file.&lt;br /&gt;
LOG_WARNING = 1&lt;br /&gt;
&lt;br /&gt;
#If true the script logs errors to the log-file.&lt;br /&gt;
LOG_ERR = 1&lt;br /&gt;
&lt;br /&gt;
ENVIRONMENT = &lt;br /&gt;
 &lt;br /&gt;
[Database]&lt;br /&gt;
BACKEND = LDAP&lt;br /&gt;
SERVER = ldaps://ldapm.tombstone.ch&lt;br /&gt;
PORT = 636&lt;br /&gt;
ADMIN_USER = cn=Manager,dc=stoney-cloud,dc=org&lt;br /&gt;
ADMIN_PASSWORD = &amp;lt;PASSWORD&amp;gt;&lt;br /&gt;
SERVICE_SUBTREE = ou=accounts,ou=backup,ou=services,dc=stoney-cloud,dc=org&lt;br /&gt;
COOKIE_FILE = /var/work/prov-backup-rsnapshot/Provisioning/etc/Provisioning/Backup/rnsapshot.cookie&lt;br /&gt;
DEFAULT_COOKIE = rid=001,csn=&lt;br /&gt;
SEARCH_FILTER = (&amp;amp;(entryCSN&amp;gt;=%entryCSN%)(objectClass=*))&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
MODUS = selfcare&lt;br /&gt;
TRANSPORTAPI = LocalCLI&lt;br /&gt;
SERVICE = Backup&lt;br /&gt;
TYPE = Rsnapshot&lt;br /&gt;
&lt;br /&gt;
SYSLOG = Backup-Rsnapshot&lt;br /&gt;
&lt;br /&gt;
[Gateway]&lt;br /&gt;
HOST = localhost&lt;br /&gt;
USER = provisioning&lt;br /&gt;
DSA_FILE = none&lt;br /&gt;
&lt;br /&gt;
[Backup]&lt;br /&gt;
RSNAPSHOT_CONFIG_FILE = /etc/rsnapshot/rsnapshot.conf.%uid%&lt;br /&gt;
SET_QUOTA_CMD = /usr/sbin/setquota&lt;br /&gt;
CREATE_CHROOT_CMD = /root/createDummyBackupDirectory.sh # You might want to change this for the productive system&lt;br /&gt;
MOUNTPOINT = / # You might want to change this for the productive system&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Init Scripts ===&lt;br /&gt;
Currently we just create very basic init scripts which start and stop the deamon: &lt;br /&gt;
 /etc/init.d/prov-backup-rsnapshot&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/sbin/runscript&lt;br /&gt;
# Copyright 1999-2013 Gentoo Foundation&lt;br /&gt;
# Distributed under the terms of the GNU General Public License v2&lt;br /&gt;
# $Header: $&lt;br /&gt;
&lt;br /&gt;
depend() {&lt;br /&gt;
    need net&lt;br /&gt;
    after slapd&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
start() {&lt;br /&gt;
    ebegin &amp;quot;Starting backup-rsnapshot provisioning daemon&amp;quot;&lt;br /&gt;
    start-stop-daemon --start \&lt;br /&gt;
        --background \&lt;br /&gt;
        --user ${USER:-root}:${GROUP:-root} \&lt;br /&gt;
        --make-pidfile \&lt;br /&gt;
        --pidfile &amp;quot;${PIDFILE}&amp;quot; \&lt;br /&gt;
        --exec /var/work/prov-backup-rsnapshot/Provisioning/bin/provisioning.pl \&lt;br /&gt;
        --interpreted \&lt;br /&gt;
        -- ${OPTIONS} \&lt;br /&gt;
            -c /var/work/prov-backup-rsnapshot/Provisioning/etc/Provisioning/Backup/Rsnapshot_test.conf \&lt;br /&gt;
            -g /var/work/prov-backup-rsnapshot/Provisioning/etc/Provisioning/Global.conf&lt;br /&gt;
    eend $?&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stop() {&lt;br /&gt;
    ebegin &amp;quot;Stopping backup-rsnapshot provisioning daemon&amp;quot;&lt;br /&gt;
    start-stop-daemon --stop \&lt;br /&gt;
        --pidfile &amp;quot;${PIDFILE}&amp;quot;&lt;br /&gt;
    eend $?&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 /etc/conf.d/prov-backup-rsnapshot&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
USER=&amp;quot;root&amp;quot;&lt;br /&gt;
GROUP=&amp;quot;root&amp;quot;&lt;br /&gt;
&lt;br /&gt;
PIDFILE=&amp;quot;/run/prov-backup-rsnapshot.pid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# OPTIONS=&amp;quot;...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== Run-Level ====&lt;br /&gt;
 rc-update add prov-backup-rsnapshot default&lt;br /&gt;
&lt;br /&gt;
== schedule warning ==&lt;br /&gt;
To install the new schedule warning script you have to execute the following commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /var/work/&lt;br /&gt;
git clone --recursive https://github.com/stepping-stone/backup-surveillance.git&lt;br /&gt;
cd backup-surveillance/bin/&lt;br /&gt;
ln -s ../perl-utils/lib/PerlUtil/ PerlUtil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 vi /var/work/backup-surveillance/etc/config.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[XML]&lt;br /&gt;
SCHEDULE_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/scheduler.xml&lt;br /&gt;
SCHEDULE_XSD = %configpath%/../etc/schema/scheduler_schema.xsd&lt;br /&gt;
BACKUP_ENDED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupEnded.xml&lt;br /&gt;
BACKUP_ENDED_XSD =  %configpath%/../etc/schema/backupended_schema.xsd&lt;br /&gt;
BACKUP_STARTED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupStarted.xml&lt;br /&gt;
BACKUP_STARTED_XSD =   %configpath%/../etc/schema/backupstarted_schema.xsd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[TEMPLATE]&lt;br /&gt;
Salutation_Default_de-CH = Liebe Kundin / Lieber Kunde&lt;br /&gt;
Salutation_m_de-CH = Sehr geehrter Herr&lt;br /&gt;
Salutation_f_de-CH = Sehr geehrte Frau&lt;br /&gt;
Salutation_Default_en-GB = Dear customer&lt;br /&gt;
Salutation_m_en-GB = Dear Mr.&lt;br /&gt;
Salutation_f_en-GB = Dear Mrs.&lt;br /&gt;
&lt;br /&gt;
[LDAP]&lt;br /&gt;
&lt;br /&gt;
SERVER = ldaps://ldapm.tombstone.ch&lt;br /&gt;
PORT = 636&lt;br /&gt;
DEBUG = 1&lt;br /&gt;
&lt;br /&gt;
ADMIN_DN = cn=Manager,dc=foss-cloud,dc=org &lt;br /&gt;
ADMIN_PASSWORD = &amp;lt;Password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
BACKUP_BASE = ou=accounts,ou=backup,ou=services,dc=foss-cloud,dc=org&lt;br /&gt;
PEOPLE_BASE = ou=people,dc=foss-cloud,dc=org&lt;br /&gt;
RESELLER_BASE = ou=reseller,ou=configuration,ou=backup,ou=services,dc=foss-cloud,dc=org&lt;br /&gt;
SCOPE = sub&lt;br /&gt;
&lt;br /&gt;
[MAIL]&lt;br /&gt;
mailTo = &lt;br /&gt;
host = mail.stepping-stone.ch&lt;br /&gt;
port = 587&lt;br /&gt;
username = &lt;br /&gt;
password = &lt;br /&gt;
from = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== writeAccountSize ==&lt;br /&gt;
If you have already installed the [[Backup_(Server_Setup)#rsnapshot | rsnapshot]] script, you also have the writeAccountSize script. Otherwise follow [[Backup_(Server_Setup)#rsnapshot | these instructions (installation only)]]&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
 vi /var/work/backup-util/etc/writeAccountSize.conf &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Global]&lt;br /&gt;
INCOMING_DIRECTORY = /incoming&lt;br /&gt;
ACCOUNT_SIZE_FILE = /etc/backupSize&lt;br /&gt;
SNAPSHOTS = 1&lt;br /&gt;
&lt;br /&gt;
[Syslog]&lt;br /&gt;
SYSLOG = rsnapshot&lt;br /&gt;
&lt;br /&gt;
[Directory]&lt;br /&gt;
LDAP_SERVER = ldaps://ldapm.tombstone.ch&lt;br /&gt;
LDAP_PORT = 636&lt;br /&gt;
LDAP_BIND_DN = cn=Manager,dc=foss-cloud,dc=org&lt;br /&gt;
LDAP_BIND_PW = &amp;lt;password&amp;gt;&lt;br /&gt;
LDAP_BASE_DN = ou=accounts,ou=backup,ou=services,dc=foss-cloud,dc=org&lt;br /&gt;
LDAP_PERSON_BASE = ou=people,dc=foss-cloud,dc=org&lt;br /&gt;
LDAP_RESELLER_BASE = ou=reseller,ou=configuration,ou=backup,ou=services,dc=foss-cloud,dc=org&lt;br /&gt;
LDAP_EMAIL_ATTRIBUTE = mail&lt;br /&gt;
&lt;br /&gt;
[Notification]&lt;br /&gt;
EMAIL_SENDER = stepping stone GmbH Supprt &amp;lt;support@stepping-stone.ch&amp;gt;&lt;br /&gt;
EMAIL_ALERT_THRESHOLD = 85&lt;br /&gt;
&lt;br /&gt;
Salutation_Default_de-CH = Liebe Kundin / Lieber Kunde&lt;br /&gt;
Salutation_m_de-CH = Sehr geehrter Herr&lt;br /&gt;
Salutation_f_de-CH = Sehr geehrte Frau&lt;br /&gt;
Salutation_Default_en-GB = Dear customer&lt;br /&gt;
Salutation_m_en-GB = Dear Mr.&lt;br /&gt;
Salutation_f_en-GB = Dear Mrs.&lt;br /&gt;
&lt;br /&gt;
[MAIL]&lt;br /&gt;
host = mail.stepping-stone.ch&lt;br /&gt;
port = 587&lt;br /&gt;
username = support@stepping-stone.ch&lt;br /&gt;
password = &amp;lt;password&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* [http://www.openldap.org/ OpenLDAP], an open source implementation of the Lightweight Directory Access Protocol.&lt;br /&gt;
* [http://arthurdejong.org/nss-pam-ldapd/ nss-pam-ldapd], a Name Service Switch (NSS) module that allows your LDAP server to provide user account, group, host name, alias, netgroup, and basically any other information that you would normally get from /etc flat files or NIS.&lt;br /&gt;
* [http://www.gentoo.org/doc/de/ldap-howto.xml Gentoo Leitfaden zur OpenLDAP Authentifikation].&lt;br /&gt;
* [http://wiki.gentoo.org/wiki/Centralized_authentication_using_OpenLDAP Centralized authentication using OpenLDAP].&lt;br /&gt;
* [https://code.google.com/p/openssh-lpk/source/browse/trunk/schemas/openssh-lpk_openldap.schema openssh-lpk_openldap.schema] OpenSSH LDAP Public Keys.&lt;br /&gt;
* [http://sourceforge.net/projects/linuxquota/ linuxquota] Linux DiskQuota.&lt;br /&gt;
* [http://www.rsnapshot.org/ rsnapshot], a remote filesystem snapshot utility, based on rsync.&lt;br /&gt;
* [http://olivier.sessink.nl/jailkit/ Jailkit], set of utilities to limit user accounts to specific files using chroot() and or specific commands. Also includes a tool to build a chroot environment.&lt;br /&gt;
* [http://www.busybox.net/ Busybox] BusyBox combines tiny versions of many common UNIX utilities into a single small executable. Useful to reduce the number of files (and thus the complexity) when building a chroot. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>David</name></author>
	</entry>
</feed>