From 0e2dcd5c88ac2def3dbceff09ae12849d771937e Mon Sep 17 00:00:00 2001 From: Sebastian Lederer Date: Fri, 28 Jun 2013 17:49:12 +0200 Subject: [PATCH] Import univention-bareos package Signed-off-by: Marco van Wieringen --- platforms/univention/62univention-bareos.inst | 42 ++ .../63univention-bareos-uninstall.uinst | 24 + platforms/univention/LICENSE_AGREEMENT | 17 + platforms/univention/bareos.schema | 56 +++ platforms/univention/debian/changelog | 378 +++++++++++++++ platforms/univention/debian/compat | 1 + platforms/univention/debian/config | 17 + platforms/univention/debian/control | 29 ++ platforms/univention/debian/files | 2 + platforms/univention/debian/rules | 54 +++ platforms/univention/debian/substvars | 1 + .../debian/univention-bareos-schema.conffiles | 0 .../debian/univention-bareos-schema.dirs | 1 + .../debian/univention-bareos-schema.install | 1 + .../debian/univention-bareos-schema.postinst | 9 + .../debian/univention-bareos-schema.substvars | 1 + .../debian/univention-bareos.conffiles | 0 .../debian/univention-bareos.config | 17 + .../univention/debian/univention-bareos.dirs | 22 + .../debian/univention-bareos.install | 16 + .../debian/univention-bareos.postinst | 70 +++ .../debian/univention-bareos.postrm | 27 ++ .../debian/univention-bareos.preinst | 9 + .../univention/debian/univention-bareos.prerm | 22 + .../debian/univention-bareos.substvars | 1 + ...ivention-bareos.univention-config-registry | 35 ++ ...areos.univention-config-registry-variables | 41 ++ .../univention-bareos.univention-service | 20 + .../univention/etc/bareos/bareos-dir.conf | 360 ++++++++++++++ .../univention/etc/bareos/bareos-fd.conf | 54 +++ .../univention/etc/bareos/bareos-sd.conf | 72 +++ platforms/univention/etc/bareos/bconsole.conf | 16 + .../main/pg_hba.conf.d/25-univention-bareos | 1 + platforms/univention/fd-generic.template | 19 + platforms/univention/fd-windows.template | 23 + platforms/univention/job-generic.template | 18 + platforms/univention/job-windows.template | 18 + platforms/univention/postgres_create.sql | 442 ++++++++++++++++++ platforms/univention/restart_director | 3 + platforms/univention/univention-bareos.cron | 1 + platforms/univention/univention-bareos.ini | 53 +++ platforms/univention/univention-bareos.py | 224 +++++++++ 42 files changed, 2217 insertions(+) create mode 100755 platforms/univention/62univention-bareos.inst create mode 100755 platforms/univention/63univention-bareos-uninstall.uinst create mode 100644 platforms/univention/LICENSE_AGREEMENT create mode 100644 platforms/univention/bareos.schema create mode 100644 platforms/univention/debian/changelog create mode 100644 platforms/univention/debian/compat create mode 100755 platforms/univention/debian/config create mode 100644 platforms/univention/debian/control create mode 100644 platforms/univention/debian/files create mode 100755 platforms/univention/debian/rules create mode 100644 platforms/univention/debian/substvars create mode 100644 platforms/univention/debian/univention-bareos-schema.conffiles create mode 100644 platforms/univention/debian/univention-bareos-schema.dirs create mode 100644 platforms/univention/debian/univention-bareos-schema.install create mode 100644 platforms/univention/debian/univention-bareos-schema.postinst create mode 100644 platforms/univention/debian/univention-bareos-schema.substvars create mode 100644 platforms/univention/debian/univention-bareos.conffiles create mode 100644 platforms/univention/debian/univention-bareos.config create mode 100644 platforms/univention/debian/univention-bareos.dirs create mode 100644 platforms/univention/debian/univention-bareos.install create mode 100644 platforms/univention/debian/univention-bareos.postinst create mode 100644 platforms/univention/debian/univention-bareos.postrm create mode 100644 platforms/univention/debian/univention-bareos.preinst create mode 100644 platforms/univention/debian/univention-bareos.prerm create mode 100644 platforms/univention/debian/univention-bareos.substvars create mode 100644 platforms/univention/debian/univention-bareos.univention-config-registry create mode 100644 platforms/univention/debian/univention-bareos.univention-config-registry-variables create mode 100644 platforms/univention/debian/univention-bareos.univention-service create mode 100644 platforms/univention/etc/bareos/bareos-dir.conf create mode 100644 platforms/univention/etc/bareos/bareos-fd.conf create mode 100644 platforms/univention/etc/bareos/bareos-sd.conf create mode 100644 platforms/univention/etc/bareos/bconsole.conf create mode 100644 platforms/univention/etc/postgresql/8.4/main/pg_hba.conf.d/25-univention-bareos create mode 100644 platforms/univention/fd-generic.template create mode 100644 platforms/univention/fd-windows.template create mode 100644 platforms/univention/job-generic.template create mode 100644 platforms/univention/job-windows.template create mode 100755 platforms/univention/postgres_create.sql create mode 100755 platforms/univention/restart_director create mode 100644 platforms/univention/univention-bareos.cron create mode 100644 platforms/univention/univention-bareos.ini create mode 100644 platforms/univention/univention-bareos.py diff --git a/platforms/univention/62univention-bareos.inst b/platforms/univention/62univention-bareos.inst new file mode 100755 index 00000000000..77cb6f1a00e --- /dev/null +++ b/platforms/univention/62univention-bareos.inst @@ -0,0 +1,42 @@ +#!/bin/sh + +VERSION=1 + +. /usr/share/univention-lib/base.sh +. /usr/share/univention-lib/ldap.sh +. /usr/share/univention-join/joinscripthelper.lib +joinscript_init + +eval "$(univention-config-registry shell)" + +ucs_addServiceToLocalhost "Bareos Backup" "$@" + +# keep "cn=custom attributes,cn=univention,$ldap_base" clean +univention-directory-manager container/cn create "$@" --ignore_exists \ + --position "cn=custom attributes,cn=univention,$ldap_base" \ + --set name="bareos" || die + +# extend to more modules? domaincontroller_master? +univention-directory-manager settings/extended_attribute create "$@" \ + --ignore_exists \ + --position="cn=bareos,cn=custom attributes,cn=univention,$ldap_base" \ + --set name=bareos-enabled \ + --set module=computers/linux \ + --set module=computers/ubuntu \ + --set module=computers/windows \ + --set module=computers/ipmanagedclient \ + --set tabName="Bareos Backup" \ + --set tabPosition=2 \ + --set ldapMapping="bareosEnableJob" \ + --set objectClass="bareosClientHost" \ + --set longDescription="schedule backup for this host (the bareos client needs to be installed)" \ + --set shortDescription="enable backup job" \ + --set translationShortDescription='"de_DE" "Backup-Job aktivieren"' \ + --set translationLongDescription='"de_DE" "Backup für diesen Rechner durchführen (Bareos-Client muss installiert sein)"' \ + --set CLIName=bareos \ + --set mayChange=1 \ + --set syntax='OkOrNot' || die + +joinscript_save_current_version + +exit 0 diff --git a/platforms/univention/63univention-bareos-uninstall.uinst b/platforms/univention/63univention-bareos-uninstall.uinst new file mode 100755 index 00000000000..162aafe2738 --- /dev/null +++ b/platforms/univention/63univention-bareos-uninstall.uinst @@ -0,0 +1,24 @@ +#!/bin/sh + +VERSION=1 + +. /usr/share/univention-lib/base.sh +. /usr/share/univention-lib/ldap.sh +. /usr/share/univention-join/joinscripthelper.lib + +joinscript_init + +SERVICE="Bareos Backup" + +eval "$(univention-config-registry shell)" + +ucs_removeServiceFromLocalhost "${SERVICE}" "$@" + +if ucs_isServiceUnused "${SERVICE}" "$@"; then + # simply remove them all + univention-directory-manager container/cn remove "$@" --dn "cn=bareos,cn=custom attributes,cn=univention,$ldap_base" +fi + +joinscript_remove_script_from_status_file univention-bareos + +exit 0 diff --git a/platforms/univention/LICENSE_AGREEMENT b/platforms/univention/LICENSE_AGREEMENT new file mode 100644 index 00000000000..30279382b56 --- /dev/null +++ b/platforms/univention/LICENSE_AGREEMENT @@ -0,0 +1,17 @@ + Bareos - Backup Archiving REcovery Open Sourced + + Copyright (C) 2000-2012 Free Software Foundation Europe e.V. + Copyright (C) 2013-2013 Bareos GmbH & Co. KG + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see http://www.gnu.org/licenses/ diff --git a/platforms/univention/bareos.schema b/platforms/univention/bareos.schema new file mode 100644 index 00000000000..5c320b0dad9 --- /dev/null +++ b/platforms/univention/bareos.schema @@ -0,0 +1,56 @@ +objectidentifier DASS 1.3.6.1.4.1.22346 +objectidentifier DASS.BAREOS DASS:6 +objectidentifier DASS.BAREOS.OC DASS.BAREOS:4 +objectidentifier DASS.BAREOS.Attr DASS.BAREOS:6 +# +# schema file for Univention/Bareos attributes +# +# $Id: bareos-attributes.schema 8731 2013-04-19 13:22:10Z slederer $ +# + +attributeType ( DASS.BAREOS.Attr:2.1 + NAME 'bareosCommon' + DESC 'common bareos attributes' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) + +attributeType ( DASS.BAREOS.Attr:2.2 + NAME 'bareosSchedule' + DESC 'backup schedule' + SUP bareosCommon ) + +attributeType ( DASS.BAREOS.Attr:2.3 + NAME 'bareosFileSet' + DESC 'fileset to use for this bareos client' + SUP bareosCommon ) + +attributeType ( DASS.BAREOS.Attr:2.4 + NAME 'bareosOptions' + DESC 'options for the backup job' + SUP bareosCommon ) + +attributeType ( DASS.BAREOS.Attr:2.5 + NAME 'bareosProfile' + DESC 'job defaults' + SUP bareosCommon ) + +attributeType ( DASS.BAREOS.Attr:2.6 + NAME 'bareosEnableJob' + DESC 'enable job for this client' + SUP bareosCommon ) + +# +# schema file for Univention-Bareos objectclasses +# + +# +# $Id: bareos-objectclasses.schema 8731 2013-04-19 13:22:10Z slederer $ +# + +objectClass ( DASS.BAREOS.OC:2.1 NAME 'bareosClientHost' + DESC 'a system that should be backed up by the bareos server' + SUP top + MAY ( bareosSchedule $ bareosFileSet $ bareosOptions $ + bareosProfile $ bareosEnableJob ) + AUXILIARY ) diff --git a/platforms/univention/debian/changelog b/platforms/univention/debian/changelog new file mode 100644 index 00000000000..7a4a33e713b --- /dev/null +++ b/platforms/univention/debian/changelog @@ -0,0 +1,378 @@ +univention-bareos (12.4.4ucs3-1) squeeze;urgency=low + * packaging: + - better description for ucr variables + -- Sebastian Lederer Mon, 24 Jun 2013 12:00:00 +0100 + +univention-bareos (12.4.4ucs2-1) squeeze;urgency=low + * packaging: + - fix permissions of join scripts + -- Sebastian Lederer Mon, 24 Jun 2013 12:00:00 +0100 + +univention-bareos (12.4.4ucs1-3) squeeze;urgency=low + * templates: + - fix typo + -- Sebastian Lederer Thu, 20 Jun 2013 12:00:00 +0100 + +univention-bareos (12.4.4ucs1-2) squeeze;urgency=low + * templates: + - fix typo + -- Sebastian Lederer Thu, 20 Jun 2013 12:00:00 +0100 + +univention-bareos (12.4.4ucs1-1) squeeze;urgency=low + * packaging: + - new bareos release + - more ucr variables + -- Sebastian Lederer Thu, 20 Jun 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs10-1) squeeze;urgency=low + * listener plugin: + - fix bug when reading domain attribute + -- Sebastian Lederer Wed, 16 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs9-7) squeeze;urgency=low + * packaging: + - depend on postgresql-8.4 instead of postgresql which comes from + unmaintained repo + -- Sebastian Lederer Wed, 16 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs9-3) squeeze;urgency=low + * packaging: + - fix rules + -- Sebastian Lederer Wed, 15 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs9-2) squeeze;urgency=low + * packaging: + - typo in dependencies + -- Sebastian Lederer Wed, 15 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs9-1) squeeze;urgency=low + * install scripts: + - use debhelper macro + * univention templates: + - fix typo in variable names + -- Sebastian Lederer Wed, 15 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs8-2) squeeze;urgency=low + * prerm script: + - correct file name for unjoin script + -- Sebastian Lederer Wed, 08 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs8-1) squeeze;urgency=low + * restart script: + - send output to /dev/null + -- Sebastian Lederer Wed, 08 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs7-1) squeeze;urgency=low + * listener: + - always use fqdn for client names + -- Sebastian Lederer Wed, 08 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs6-1) squeeze;urgency=low + * univention packaging: + - remove univention template files for schema package from main package + -- Sebastian Lederer Wed, 08 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs5-3) squeeze;urgency=low + * univention packaging: + - clean old debian files and rebuild + -- Sebastian Lederer Wed, 08 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs5-2) squeeze;urgency=low + * univention packaging: + - remove template info file from univention-bareos-schema.install + -- Sebastian Lederer Wed, 08 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs4-1) squeeze;urgency=low + * univention packaging: + - ignore some errors on prerm script + -- Sebastian Lederer Wed, 08 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs3-1) squeeze;urgency=low + * univention packaging: + - put schema file into correct directory + -- Sebastian Lederer Wed, 06 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs2-3) squeeze;urgency=low + * packaging: + - still some files packages incorrectly + -- Sebastian Lederer Wed, 06 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs2-2) squeeze;urgency=low + * packaging: + - fix path in univention-bareos.dirs + -- Sebastian Lederer Wed, 06 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs2-2) squeeze;urgency=low + * installation: + - use new univention install helpers + -- Sebastian Lederer Wed, 06 May 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs1-3) squeeze;urgency=low + * packaging: + - fiddling around with strange debconf stuff + -- Sebastian Lederer Wed, 26 Apr 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs1-2) squeeze;urgency=low + * packaging: + - fiddling around with strange debconf stuff + -- Sebastian Lederer Wed, 26 Apr 2013 12:00:00 +0100 + +univention-bareos (12.4.3ucs1-1) squeeze;urgency=low + * listener plugin: + - change timestamp on main include file if job configuration changes + -- Sebastian Lederer Wed, 26 Apr 2013 12:00:00 +0100 + +univention-bareos (12.4.3-1) squeeze;urgency=low + * packaging: + - new version number to prepare for release + -- Sebastian Lederer Wed, 25 Apr 2013 12:00:00 +0100 + +univention-bareos (0.22-1) squeeze;urgency=low + * templates: + - use fqdn in templates + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.22-1) squeeze;urgency=low + * listener plugin: + - function to determine server name + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.21-1) squeeze;urgency=low + * listener plugin: + - use correct debug level + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.20-1) squeeze;urgency=low + * listener plugin: + - use fqdns for templates + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.20-1) squeeze;urgency=low + * packaging: + - put some comments into fd-templates + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.19-1) squeeze;urgency=low + * cron: + - restart director at 0:30 (backup schedule starts at 1:00) + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.18-1) squeeze;urgency=low + * packaging: + - make cron-restart script work on first run + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.17-1) squeeze;urgency=low + * packaging: + - add cron entry, cron-restart script + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.16-2) squeeze;urgency=low + * packaging: + - fix permissions for fd-clients directory on install + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.16-1) squeeze;urgency=low + * univention templates: + - remove templates for postgres 7.4 and 8.3 + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.15-2) squeeze;urgency=low + * packaging: + - remove/purge of univention-bareos-schema does not work + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.15-1) squeeze;urgency=low + * packaging: + - install/remove extended attributes + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.14-1) squeeze;urgency=low + * directory listener: + - create bareos client configuration files + -- Sebastian Lederer Wed, 24 Apr 2013 12:00:00 +0100 + +univention-bareos (0.13-5) squeeze;urgency=low + * packaging: + - trying to fix subpackaging stuff + -- Sebastian Lederer Wed, 22 Apr 2013 12:00:00 +0100 + +univention-bareos (0.13-4) squeeze;urgency=low + * packaging: + - trying to fix subpackaging stuff + -- Sebastian Lederer Wed, 22 Apr 2013 12:00:00 +0100 + +univention-bareos (0.13-3) squeeze;urgency=low + * packaging: + - trying to fix subpackaging stuff + -- Sebastian Lederer Wed, 22 Apr 2013 12:00:00 +0100 + +univention-bareos (0.13-2) squeeze;urgency=low + * packaging: + - trying to fix subpackaging stuff + -- Sebastian Lederer Wed, 22 Apr 2013 12:00:00 +0100 + +univention-bareos (0.13-1) squeeze;urgency=low + * packaging: + - split into sub-packages for ldap schema + -- Sebastian Lederer Wed, 19 Apr 2013 12:00:00 +0100 + +univention-bareos (0.12-2) squeeze;urgency=low + * packaging: + - do not remove schema on removal + -- Sebastian Lederer Wed, 19 Apr 2013 12:00:00 +0100 + +univention-bareos (0.12-1) squeeze;urgency=low + * config files: + - fix ldap schema + -- Sebastian Lederer Wed, 19 Apr 2013 12:00:00 +0100 + +univention-bareos (0.11-1) squeeze;urgency=low + * config files: + - install bareos ldap schema + -- Sebastian Lederer Wed, 19 Apr 2013 12:00:00 +0100 + +univention-bareos (0.10-1) squeeze;urgency=low + * config files: + - template for bconsole.conf + -- Sebastian Lederer Wed, 19 Apr 2013 12:00:00 +0100 + +univention-bareos (0.9-1) squeeze;urgency=low + * config files: + - backup job for ucs server + -- Sebastian Lederer Wed, 18 Apr 2013 12:00:00 +0100 + +univention-bareos (0.8-2) squeeze;urgency=low + * packaging: + - restart file daemon and storage daemon in postinst script + -- Sebastian Lederer Wed, 18 Apr 2013 12:00:00 +0100 + +univention-bareos (0.8-1) squeeze;urgency=low + * config files: + - use passwords from .rndpass in templates + -- Sebastian Lederer Wed, 18 Apr 2013 12:00:00 +0100 + +univention-bareos (0.7-1) squeeze;urgency=low + * config files: + - fix dir template + -- Sebastian Lederer Wed, 17 Apr 2013 12:00:00 +0100 + +univention-bareos (0.6-2) squeeze;urgency=low + * packaging: + - need moar dependencies + -- Sebastian Lederer Wed, 17 Apr 2013 12:00:00 +0100 + +univention-bareos (0.6-1) squeeze;urgency=low + * config files: + - fix: univention templates for dir/sd/fd + -- Sebastian Lederer Wed, 17 Apr 2013 12:00:00 +0100 + +univention-bareos (0.5-1) squeeze;urgency=low + * config files: + - fix: univention templates for dir/sd/fd + -- Sebastian Lederer Wed, 17 Apr 2013 12:00:00 +0100 + +univention-bareos (0.4-1) squeeze;urgency=low + * config files: + - fix: univention templates for dir/sd + -- Sebastian Lederer Wed, 17 Apr 2013 12:00:00 +0100 + +univention-bareos (0.3-1) squeeze;urgency=low + * config files: + - fix: univention templates for dir/sd + -- Sebastian Lederer Wed, 17 Apr 2013 12:00:00 +0100 + +univention-bareos (0.2-1) squeeze;urgency=low + * config files: + - univention templates for dir/sd + -- Sebastian Lederer Wed, 17 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-17) squeeze;urgency=low + * packaging: + - start bareos director in postinst + -- Sebastian Lederer Wed, 17 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-16) squeeze;urgency=low + * packaging: + - stop director in prerm before removing the database + -- Sebastian Lederer Wed, 17 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-15) squeeze;urgency=low + * packaging: + - stop director in prerm before removing the database + -- Sebastian Lederer Wed, 17 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-14) squeeze;urgency=low + * packaging: + - reload postgres instead of restart in postinst + -- Sebastian Lederer Wed, 17 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-13) squeeze;urgency=low + * packaging: + - problem with postgres start script and a file descriptor leak + -- Sebastian Lederer Wed, 15 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-12) squeeze;urgency=low + * packaging: + - problem with postgres start script and a file descriptor leak + -- Sebastian Lederer Wed, 15 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-11) squeeze;urgency=low + * packaging: + - bareos wants SQL_ASCII encoding on the database + -- Sebastian Lederer Wed, 15 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-10) squeeze;urgency=low + * packaging: + - debugging dbconfig-common stuff + -- Sebastian Lederer Wed, 15 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-9) squeeze;urgency=low + * packaging: + - debugging dbconfig-common stuff + -- Sebastian Lederer Wed, 15 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-8) squeeze;urgency=low + * packaging: + - debugging dbconfig-common stuff + -- Sebastian Lederer Wed, 15 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-7) squeeze;urgency=low + * packaging: + - fix name of dbconfig pgsql script + -- Sebastian Lederer Wed, 15 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-6) squeeze;urgency=low + * packaging: + - debugging + -- Sebastian Lederer Wed, 15 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-5) squeeze;urgency=low + * packaging: + - debugging + -- Sebastian Lederer Wed, 15 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-4) squeeze;urgency=low + * packaging: + - debugging + -- Sebastian Lederer Wed, 15 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-3) squeeze;urgency=low + * packaging: + - debugging + -- Sebastian Lederer Wed, 15 Apr 2013 12:00:00 +0100 + +univention-bareos (0.1-2) squeeze;urgency=low + * dbconfig-common stuff: + - try to set a default password + -- Sebastian Lederer Wed, 19 Mar 2013 12:00:00 +0100 + +univention-bareos (0.1-1) squeeze;urgency=low + * dbconfig-common stuff: + -remove shell commands from create-tables-script + -- Sebastian Lederer Wed, 19 Mar 2013 12:00:00 +0100 + +univention-bareos (0.0-1) squeeze;urgency=low + * testing: + - fiddling around with dbconfig-common crap + -- Sebastian Lederer Wed, 19 Mar 2013 12:00:00 +0100 diff --git a/platforms/univention/debian/compat b/platforms/univention/debian/compat new file mode 100644 index 00000000000..7f8f011eb73 --- /dev/null +++ b/platforms/univention/debian/compat @@ -0,0 +1 @@ +7 diff --git a/platforms/univention/debian/config b/platforms/univention/debian/config new file mode 100755 index 00000000000..9ddcf82931d --- /dev/null +++ b/platforms/univention/debian/config @@ -0,0 +1,17 @@ +#!/bin/sh +# config maintainer script for univention-bareos + +dbc_dbuser=bareos +dbc_dbname=bareos +dbc_authmethod_user=ident + +# source debconf stuff +. /usr/share/debconf/confmodule +# source dbconfig-common shell library, and call the hook function +if [ -f /usr/share/dbconfig-common/dpkg/config.pgsql ]; then + . /usr/share/dbconfig-common/dpkg/config.pgsql +DEBIAN_FRONTEND=noninteractive;export DEBIAN_FRONTEND + dbc_go univention-bareos $@ +fi + +# ... rest of your code ... diff --git a/platforms/univention/debian/control b/platforms/univention/debian/control new file mode 100644 index 00000000000..5624586bdc8 --- /dev/null +++ b/platforms/univention/debian/control @@ -0,0 +1,29 @@ +Source: univention-bareos +Section: contrib/admin +Priority: optional +Maintainer: Sebastian Lederer +Build-Depends: debhelper (>= 4.0.0), + ucslint, + univention-config-dev, + dh-make,devscripts,build-essential,acl-dev,autotools-dev,libacl1-dev,libcap-dev,liblzo2-dev,libqt4-dev,libreadline-dev,libssl-dev,libwrap0-dev,libx11-dev,libsqlite3-dev,libmysqlclient-dev,libpq-dev,mtx,ncurses-dev,pkg-config,python-dev,zlib1g-dev,univention-config-dev,ucslint +Standards-Version: 3.6.1 + +Package: univention-bareos +Architecture: all +Depends: univention-postgresql, postgresql-8.4, bareos (>= 12.4.4) , bareos-database-common, bareos-database-postgresql, + dbconfig-common, bareos-database-tools, + univention-join (>> 5.0.20-1.436), + shell-univention-lib (>> 2.0.17-1.125) +Description: meta package for univention-bareos-integration + This package integrates the bareos backup solution into + UCS. The package provides automatic configuration of the + bareos director, local file daemon and storage daemon. + +Package: univention-bareos-schema +Architecture: all +Depends: shell-univention-lib (>> 2.0.17-1.125) +Breaks: univention-ldap-server (<< 9.0.20-1.580.201303211526) +Description: LDAP schema extension for Bareos + This package provides the LDAP schema extension + which enables the backup configuration for client + systems from the Univention Management Console diff --git a/platforms/univention/debian/files b/platforms/univention/debian/files new file mode 100644 index 00000000000..b68f7eaa351 --- /dev/null +++ b/platforms/univention/debian/files @@ -0,0 +1,2 @@ +univention-bareos_12.4.3ucs1-3_all.deb contrib/admin optional +univention-bareos-schema_12.4.3ucs1-3_all.deb contrib/admin optional diff --git a/platforms/univention/debian/rules b/platforms/univention/debian/rules new file mode 100755 index 00000000000..39fd8f2aedf --- /dev/null +++ b/platforms/univention/debian/rules @@ -0,0 +1,54 @@ +#!/usr/bin/make -f + +myroot=$(CURDIR)/debian/univention-bareos +schemaroot=$(CURDIR)/debian/univention-bareos-schema + +# Add here any variable or target overrides you need. +clean: + dh_testdir + dh_testroot + dh_clean + +build: + +install_app_data: + dh_testdir + dh_testroot + dh_prep + dh_installdirs -v + univention-install-config-registry + # dbconfig-common + cp postgres_create.sql $(myroot)/usr/share/dbconfig-common/data/univention-bareos/install/pgsql + cp fd-windows.template $(myroot)/etc/bareos/autogenerated/fd-configs/windows.template + cp fd-generic.template $(myroot)/etc/bareos/autogenerated/fd-configs/generic.template + cp job-windows.template $(myroot)/etc/bareos/autogenerated/clients/windows.template + cp job-generic.template $(myroot)/etc/bareos/autogenerated/clients/generic.template + cp univention-bareos.py $(myroot)/usr/lib/univention-directory-listener/system + cp restart_director $(myroot)/usr/share/univention-bareos + cp univention-bareos.cron $(myroot)/etc/cron.d/univention-bareos + install -m 755 62univention-bareos.inst $(myroot)/usr/lib/univention-install/ + install -m 755 63univention-bareos-uninstall.uinst $(myroot)/usr/lib/univention-uninstall/ + cp bareos.schema $(schemaroot)/usr/share/univention-bareos-schema/univention-bareos.schema + +install_package_data: + dh_installchangelogs + dh_compress + dh_installdebconf + dh_installdeb + dh_installdocs + dh_fixperms + dh_gencontrol + dh_md5sums + dh_builddeb + dh_lintian + +override_dh_auto_install: + univention-install-config-registry + dh_auto_install + + +install: install_app_data install_package_data +binary-indep: build install +binary-arch: binary-indep +binary: binary-indep +.PHONY: clean install install_app_data install_package_data diff --git a/platforms/univention/debian/substvars b/platforms/univention/debian/substvars new file mode 100644 index 00000000000..a8fe3cff5d2 --- /dev/null +++ b/platforms/univention/debian/substvars @@ -0,0 +1 @@ +misc:Depends=debconf (>= 0.5) | debconf-2.0 diff --git a/platforms/univention/debian/univention-bareos-schema.conffiles b/platforms/univention/debian/univention-bareos-schema.conffiles new file mode 100644 index 00000000000..e69de29bb2d diff --git a/platforms/univention/debian/univention-bareos-schema.dirs b/platforms/univention/debian/univention-bareos-schema.dirs new file mode 100644 index 00000000000..2b2388180d6 --- /dev/null +++ b/platforms/univention/debian/univention-bareos-schema.dirs @@ -0,0 +1 @@ +usr/share/univention-bareos-schema diff --git a/platforms/univention/debian/univention-bareos-schema.install b/platforms/univention/debian/univention-bareos-schema.install new file mode 100644 index 00000000000..8adff9b2628 --- /dev/null +++ b/platforms/univention/debian/univention-bareos-schema.install @@ -0,0 +1 @@ +/usr/share/univention-ldap/schema/univention-bareos.schema diff --git a/platforms/univention/debian/univention-bareos-schema.postinst b/platforms/univention/debian/univention-bareos-schema.postinst new file mode 100644 index 00000000000..c85e3df360d --- /dev/null +++ b/platforms/univention/debian/univention-bareos-schema.postinst @@ -0,0 +1,9 @@ +#!/bin/sh + +. /usr/share/univention-lib/all.sh +if [ "$1" = "configure" ]; then + + ucs_registerLDAPSchema /usr/share/univention-bareos-schema/univention-bareos.schema +fi + +exit 0 diff --git a/platforms/univention/debian/univention-bareos-schema.substvars b/platforms/univention/debian/univention-bareos-schema.substvars new file mode 100644 index 00000000000..abd3ebebc30 --- /dev/null +++ b/platforms/univention/debian/univention-bareos-schema.substvars @@ -0,0 +1 @@ +misc:Depends= diff --git a/platforms/univention/debian/univention-bareos.conffiles b/platforms/univention/debian/univention-bareos.conffiles new file mode 100644 index 00000000000..e69de29bb2d diff --git a/platforms/univention/debian/univention-bareos.config b/platforms/univention/debian/univention-bareos.config new file mode 100644 index 00000000000..9ddcf82931d --- /dev/null +++ b/platforms/univention/debian/univention-bareos.config @@ -0,0 +1,17 @@ +#!/bin/sh +# config maintainer script for univention-bareos + +dbc_dbuser=bareos +dbc_dbname=bareos +dbc_authmethod_user=ident + +# source debconf stuff +. /usr/share/debconf/confmodule +# source dbconfig-common shell library, and call the hook function +if [ -f /usr/share/dbconfig-common/dpkg/config.pgsql ]; then + . /usr/share/dbconfig-common/dpkg/config.pgsql +DEBIAN_FRONTEND=noninteractive;export DEBIAN_FRONTEND + dbc_go univention-bareos $@ +fi + +# ... rest of your code ... diff --git a/platforms/univention/debian/univention-bareos.dirs b/platforms/univention/debian/univention-bareos.dirs new file mode 100644 index 00000000000..0779a8ef28a --- /dev/null +++ b/platforms/univention/debian/univention-bareos.dirs @@ -0,0 +1,22 @@ +usr/share/dbconfig-common/data/univention-bareos/install +usr/lib/univention-directory-listener +usr/lib/univention-directory-listener/system +usr/lib/univention-install +usr/lib/univention-uninstall +usr/share/univention-ldap/schema +usr/share/univention-bareos +etc/cron.d +etc/bareos/autogenerated +etc/bareos/autogenerated/fd-configs +etc/bareos/autogenerated/fd-secrets +etc/bareos/autogenerated/clients +etc/univention/templates +etc/univention/templates/files +etc/univention/templates/files/etc +etc/univention/templates/files/etc/bareos +etc/univention/templates/files/etc/postgresql +etc/univention/templates/files/etc/postgresql/8.4 +etc/univention/templates/files/etc/postgresql/8.4/main +etc/univention/templates/files/etc/postgresql/8.4/main/pg_hba.conf.d +etc/univention/service.info/services +etc/univention/registry.info/variables diff --git a/platforms/univention/debian/univention-bareos.install b/platforms/univention/debian/univention-bareos.install new file mode 100644 index 00000000000..177b457d4fd --- /dev/null +++ b/platforms/univention/debian/univention-bareos.install @@ -0,0 +1,16 @@ +/usr/share/univention-bareos/restart_director +/usr/lib/univention-install/62univention-bareos.inst +/usr/share/dbconfig-common/data/univention-bareos/install/pgsql +/etc/cron.d/univention-bareos +/etc/univention/templates/info/univention-bareos.info +/etc/univention/templates/files/etc/bareos/bareos-fd.conf +/etc/univention/templates/files/etc/bareos/bconsole.conf +/etc/univention/templates/files/etc/bareos/bareos-dir.conf +/etc/univention/templates/files/etc/bareos/bareos-sd.conf +/etc/univention/templates/files/etc/postgresql +/etc/univention/templates/files/etc/postgresql/8.4 +/etc/univention/templates/files/etc/postgresql/8.4/main +/etc/univention/templates/files/etc/postgresql/8.4/main/pg_hba.conf.d +/etc/univention/templates/files/etc/postgresql/8.4/main/pg_hba.conf.d/25-univention-bareos +/etc/univention/service.info/services/univention-bareos.cfg +/etc/univention/registry.info/variables/univention-bareos.cfg diff --git a/platforms/univention/debian/univention-bareos.postinst b/platforms/univention/debian/univention-bareos.postinst new file mode 100644 index 00000000000..570e0088a11 --- /dev/null +++ b/platforms/univention/debian/univention-bareos.postinst @@ -0,0 +1,70 @@ +#!/bin/sh +# source debconf stuff +. /usr/share/debconf/confmodule +. /usr/share/dbconfig-common/dpkg/postinst.pgsql + +#DEBHELPER# + +dbc_pgsql_createdb_encoding="SQL_ASCII" +dbc_go univention-bareos $@ + +. /usr/share/univention-lib/all.sh + +exec 3>/dev/null + +# ... rest of your code ... +if [ "$1" = "configure" ]; then + + # on upgrade, set backup_myself to yes if it was not set + filestorage=$(ucr get bareos/filestorage) + backup_myself=$(ucr get bareos/backup_myself) + if [ -n "$filestorage" -a -z "$backup_myself" ] + then + ucr set bareos/backup_myself=yes + fi + + # defaults + ucr set \ + bareos/pgsql/user?bareos \ + bareos/pgsql/database?bareos \ + bareos/filestorage?/var/lib/bareos/storage \ + bareos/max_incr_volumes?1 \ + bareos/max_diff_volumes?1 \ + bareos/max_full_volumes?1 \ + bareos/backup_myself?no + + ucr commit /etc/bareos/bareos-dir.conf /etc/bareos/bareos-sd.conf \ + /etc/bareos/bareos-fd.conf /etc/bareos/bconsole.conf \ + /etc/postgresql/8.4/main/pg_hba.conf + + touch /etc/bareos/autogenerated/clients.include + + chmod go-rwx /etc/bareos/autogenerated/fd-secrets + chmod go-rwx /etc/bareos/autogenerated/fd-configs + + # activate our listener plugin + invoke-rc.d univention-directory-listener restart + + # reload is sufficient for postgres to reload the pg_hba.conf file + invoke-rc.d postgresql reload + + # restart bareos + invoke-rc.d bareos-dir restart + invoke-rc.d bareos-sd restart + invoke-rc.d bareos-fd restart + + + # firewall exceptions + ucr set \ + security/packetfilter/package/univention-bareos/tcp/9101/all="ACCEPT" \ + security/packetfilter/package/univention-bareos/tcp/9101/all/en="bareos-dir" \ + security/packetfilter/package/univention-bareos/tcp/9102/all="ACCEPT" \ + security/packetfilter/package/univention-bareos/tcp/9102/all/en="bareos-fd" \ + security/packetfilter/package/univention-bareos/tcp/9103/all="ACCEPT" \ + security/packetfilter/package/univention-bareos/tcp/9103/all/en="bareos-sd" + [ -x "/etc/init.d/univention-firewall" ] && invoke-rc.d univention-firewall restart + + call_joinscript 62univention-bareos.inst +fi + +exit 0 diff --git a/platforms/univention/debian/univention-bareos.postrm b/platforms/univention/debian/univention-bareos.postrm new file mode 100644 index 00000000000..d929335f60c --- /dev/null +++ b/platforms/univention/debian/univention-bareos.postrm @@ -0,0 +1,27 @@ +#!/bin/sh + +set -e +#set -x + +#DEBHELPER# + +if [ -f /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule +fi +if [ -f /usr/share/dbconfig-common/dpkg/postrm.pgsql ]; then + . /usr/share/dbconfig-common/dpkg/postrm.pgsql +fi +dbc_go univention-bareos $@ + +invoke-rc.d bareos-dir stop || true + +invoke-rc.d univention-directory-listener restart + +. /usr/share/univention-lib/all.sh + +. /usr/share/univention-join/joinscripthelper.lib + +if [ "$1" = "remove" ]; then + call_unjoinscript 63univention-bareos-uninstall.uinst + joinscript_remove_script_from_status_file univention-bareos +fi diff --git a/platforms/univention/debian/univention-bareos.preinst b/platforms/univention/debian/univention-bareos.preinst new file mode 100644 index 00000000000..8088519956f --- /dev/null +++ b/platforms/univention/debian/univention-bareos.preinst @@ -0,0 +1,9 @@ +#!/bin/sh + +#DEBHELPER# + +if [ "$1" = "install" ]; then + test -e /usr/lib/univention-install/63univention-bareos-uninstall.uinst && rm /usr/lib/univention-install/63univention-bareos-uninstall.uinst +fi + +exit 0 diff --git a/platforms/univention/debian/univention-bareos.prerm b/platforms/univention/debian/univention-bareos.prerm new file mode 100644 index 00000000000..ed64f5294db --- /dev/null +++ b/platforms/univention/debian/univention-bareos.prerm @@ -0,0 +1,22 @@ +#!/bin/sh + +#set -x + + +set -e + +. /usr/share/debconf/confmodule +. /usr/share/dbconfig-common/dpkg/prerm.pgsql +dbc_go univention-bareos $@ + +#DEBHELPER# + +if [ "$1" = remove ] +then + invoke-rc.d bareos-dir stop || true + file="/usr/lib/univention-uninstall/63univention-bareos-uninstall.uinst" + if [ -r "$file" ] + then + cp "$file" /usr/lib/univention-install/ + fi +fi diff --git a/platforms/univention/debian/univention-bareos.substvars b/platforms/univention/debian/univention-bareos.substvars new file mode 100644 index 00000000000..e30d4c1f68f --- /dev/null +++ b/platforms/univention/debian/univention-bareos.substvars @@ -0,0 +1 @@ +misc:Depends=debconf (>= 0.5) | debconf-2.0, univention-config (>= 7.0.25) diff --git a/platforms/univention/debian/univention-bareos.univention-config-registry b/platforms/univention/debian/univention-bareos.univention-config-registry new file mode 100644 index 00000000000..4ec453ec6f8 --- /dev/null +++ b/platforms/univention/debian/univention-bareos.univention-config-registry @@ -0,0 +1,35 @@ +Type: multifile +Multifile: etc/postgresql/8.4/main/pg_hba.conf + +Type: subfile +Multifile: etc/postgresql/8.4/main/pg_hba.conf +Subfile: etc/postgresql/8.4/main/pg_hba.conf.d/25-univention-bareos +Variables: bareos/pgsql/.* + +Type: file +File: etc/bareos/bareos-dir.conf +Variables: bareos/pgsql/database +Variables: bareos/pgsql/user +Variables: bareos/filestorage +Variables: hostname +Variables: domainname + +Type: file +File: etc/bareos/bareos-sd.conf +Variables: bareos/filestorage +Variables: hostname +Variables: domainname +Variables: bareos/backup_myself +Variables: bareos/max_incr_volumes +Variables: bareos/max_diff_volumes +Variables: bareos/max_full_volumes + +Type: file +File: etc/bareos/bareos-fd.conf +Variables: hostname +Variables: domainname + +Type: file +File: etc/bareos/bconsole.conf +Variables: hostname +Variables: domainname diff --git a/platforms/univention/debian/univention-bareos.univention-config-registry-variables b/platforms/univention/debian/univention-bareos.univention-config-registry-variables new file mode 100644 index 00000000000..3825303ecce --- /dev/null +++ b/platforms/univention/debian/univention-bareos.univention-config-registry-variables @@ -0,0 +1,41 @@ +[bareos/filestorage] +Description[de]=Speicherort für Backup-Volumes (bareos) +Description[en]=Directory for backup volumes (bareos) +Type=str +Categories=backup + +[bareos/backup_myself] +Description[de]=Eigensicherung aktivieren (yes/no) +Description[en]=Enable backup job for the server itself (yes/no) +Type=bool +Categories=backup + +[bareos/max_incr_volumes] +Description[de]=Maximale Anzahl der Volumes (10GB) im Pool für Incremental-Backups +Description[en]=Maximum number of volumes (10GB) for the incremental backup pool +Type=int +Categories=backup + +[bareos/max_diff_volumes] +Description[de]=Maximale Anzahl der Volumes (10GB) im Pool für Differential-Backups +Description[en]=Maximum number of volumes (10GB) for the differential backup pool +Type=int +Categories=backup + +[bareos/max_full_volumes] +Description[de]=Maximale Anzahl der Volumes (10GB) im Pool für Full-Backups +Description[en]=Maximum number of volumes (10GB) for the full backup pool +Type=int +Categories=backup + +[bareos/pgsql/database] +Description[de]=Datenbankname für die Bareos-Datenbank (bareos). +Description[en]=Name of the bareos postgres database (bareos). +Type=str +Categories=backup + +[bareos/pgsql/user] +Description[de]=Benutzername für die Bareos-Datenbank (bareos). +Description[en]=Name of the bareos postgres user (bareos). +Type=str +Categories=backup diff --git a/platforms/univention/debian/univention-bareos.univention-service b/platforms/univention/debian/univention-bareos.univention-service new file mode 100644 index 00000000000..3c10595d463 --- /dev/null +++ b/platforms/univention/debian/univention-bareos.univention-service @@ -0,0 +1,20 @@ +[bareos-director] +description[de]=Dienst zum Steuern von Backups +description[en]=Service for coordinating backups +icon=service/bareos-dir +programs=/usr/sbin/bareos-dir -c /etc/bareos/bareos-dir.conf +start_type=bareos/dir/autostart + +[bareos-sd] +description[de]=Dienst für den Zugriff auf Sicherungsmedien +description[en]=Service for accessing backup media +icon=service/bareos-sd +programs=/usr/sbin/bareos-sd -c /etc/bareos/bareos-sd.conf +start_type=bareos/sd/autostart + +[bareos-fd] +description[de]=Dienst für den Zugriff auf zu sichernde Systeme +description[en]=Service for accessing systems for backup +icon=service/bareos-fd +programs=/usr/sbin/bareos-fd -c /etc/bareos/bareos-fd.conf +start_type=bareos/fd/autostart diff --git a/platforms/univention/etc/bareos/bareos-dir.conf b/platforms/univention/etc/bareos/bareos-dir.conf new file mode 100644 index 00000000000..fe439555e66 --- /dev/null +++ b/platforms/univention/etc/bareos/bareos-dir.conf @@ -0,0 +1,360 @@ +@%@UCRWARNING=# @%@ +# +# Default Bareos Director Configuration file for disk-only backup +# (C) Bareos GmbH & Co.KG +# +# You have to configure the following for your environment: +# +# (#1) Email Address for bareos disaster recovery. +# Specify a mailaddress outside of your backupserver. +# There will be one mail per day. +# +# (#2) Email Address for bareos reports. (Mail Command) +# This mail address will recieve a report about each backup job. +# It will be sent after the backupjob is complete. +# Has to be configured twice ("Standard" and "Daemon" Message Ressources) +# +# (#3) Email Address for bareos operator. (Operator Command) +# This mail address will recieve a mail immediately when the +# bareos system needs an operator intervention. +# May be the same address as in (#2) +# +# +# This disk-only setup stores all data into /var/lib/bareos/storage +# +# In the following description of the backup scheme, a reference number +# shows where this property is set in the configuration file. +# +# The preconfigured backup scheme is as follows: +# +# Full Backups are done on first Saturday at 01:00 (#4) +# Full Backups are written into the "Full" Pool (#5) +# Full Backups are kept for 365 Days (#6) +# +# Differential Backups are done on 2nd to 5th Saturday at 01:00 (#7) +# Differential Backups are written into the "Differential" Pool (#8) +# Differential Backups are kept for 90 Days (#9) +# +# Incremental Backups are done monday to friday at 01:00 (#10) +# Incremental Backups are written into the "Incremental" Pool (#11) +# Incremental Backups are kept for 30 Days (#12) +# +# +# +# For Bareos release 13.2.0 (09 April 2013) -- debian 6.0.6 +# +# +Director { # define myself + Name = @%@hostname@%@.@%@domainname@%@-dir + QueryFile = "/usr/lib/bareos/scripts/query.sql" + Maximum Concurrent Jobs = 10 +@!@ +with open('/etc/bareos/.rndpwd','r') as f: + for l in f.readlines(): + if 'DIRECTOR_PASSWORD' in l: + print " Password = \"%s\"" % (l.split('=')[1].strip()) +@!@ + Messages = Daemon + + # remove comment in next line to load plugins from specified directory + # Plugin Directory = /usr/lib/bareos/plugins +} + +JobDefs { + Name = "DefaultJob" + Type = Backup + Level = Incremental + Client = @%@hostname@%@.@%@domainname@%@-fd + FileSet = "Linux All" + Schedule = "WeeklyCycle" + Storage = File + Messages = Standard + Pool = Incremental + Priority = 10 + Write Bootstrap = "/var/lib/bareos/%c.bsr" + Full Backup Pool = Full # write Full Backups into "Full" Pool (#5) + Differential Backup Pool = Differential # write Diff Backups into "Differential" Pool (#8) + Incremental Backup Pool = Incremental # write Incr Backups into "Incremental" Pool (#11) +} + +# +# Define the main nightly save backup job +# By default, this job will back up to disk in /var/lib/bareos/storage + +Job { + Name = "Backup-@%@hostname@%@.@%@domainname@%@" + JobDefs = "DefaultJob" + FileSet = "UCS PDC" + Enabled = "@%@bareos/backup_myself@%@" +} + +# +# Backup the catalog database (after the nightly save) +# +Job { + Name = "BackupCatalog" + JobDefs = "DefaultJob" + Level = Full + FileSet="Catalog" + Schedule = "WeeklyCycleAfterBackup" + + # This creates an ASCII copy of the catalog + # Arguments to make_catalog_backup.pl are: + # make_catalog_backup.pl + RunBeforeJob = "/usr/lib/bareos/scripts/make_catalog_backup.pl MyCatalog" + + # This deletes the copy of the catalog + RunAfterJob = "/usr/lib/bareos/scripts/delete_catalog_backup" + + # This sends the bootstrap via mail for disaster recovery. + # Should be sent to another system, please change recipient accordingly + Write Bootstrap = "|/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \" -s \"Bootstrap for Job %j\" root@localhost" # (#1) + Priority = 11 # run after main backup +} + +# +# Standard Restore template, to be changed by Console program +# Only one such job is needed for all Jobs/Clients/Storage ... +# +Job { + Name = "RestoreFiles" + Type = Restore + Client=@%@hostname@%@.@%@domainname@%@-fd + FileSet = "Linux All" + Storage = File + Pool = Incremental + Messages = Standard + Where = /tmp/bareos-restores +} + + +FileSet { + Name = "Windows All Drives" + Enable VSS = yes + Include { + Options { + Signature = MD5 + Drive Type = fixed + IgnoreCase = yes + WildFile = "[A-Z]:/pagefile.sys" + WildDir = "[A-Z]:/RECYCLER" + WildDir = "[A-Z]:/$RECYCLE.BIN" + WildDir = "[A-Z]:/System Volume Information" + Exclude = yes + } + File = / + } +} + + +FileSet { + Name = "Linux All" + Include { + Options { + Signature = MD5 # calculate md5 checksum per file + One FS = No # change into other filessytems + FS Type = ext2 # filesystems of given types will be backed up + FS Type = ext3 # others will be ignored + FS Type = ext4 + FS Type = xfs + FS Type = reiserfs + FS Type = jfs + } + File = / + } + # Things that usually have to be excluded + # You have to exclude /var/lib/bareos/storage + # on your bareos server + Exclude { + File = /var/lib/bareos + File = /var/lib/bareos/storage + File = /proc + File = /tmp + File = /.journal + File = /.fsck + } + +} + +FileSet { + Name = "UCS PDC" + Include { + Options { + Signature = MD5 # calculate md5 checksum per file + One FS = No # change into other filessytems + FS Type = ext2 # filesystems of given types will be backed up + FS Type = ext3 # others will be ignored + FS Type = ext4 + FS Type = xfs + } + File = / + } + # Things that usually have to be excluded + # You have to exclude /var/lib/bareos/storage + # on your bareos server + Exclude { + File = /var/lib/bareos + File = /var/lib/bareos/storage + File = /proc + File = /tmp + File = /.journal + File = /.fsck + } +} + +Schedule { + Name = "WeeklyCycle" + Run = Full 1st sat at 01:00 # (#4) + Run = Differential 2nd-5th sat at 01:00 # (#7) + Run = Incremental mon-fri at 01:00 # (#10) +} + +# This schedule does the catalog. It starts after the WeeklyCycle +Schedule { + Name = "WeeklyCycleAfterBackup" + Run = Full mon-fri at 01:10 +} + +# This is the backup of the catalog +FileSet { + Name = "Catalog" + Include { + Options { + signature = MD5 + } + File = "/var/lib/bareos/bareos.sql" # database dump + File = "/etc/bareos" # configuration + } +} + +# Client (File Services) to backup +Client { + Name = @%@hostname@%@.@%@domainname@%@-fd + Address = @%@hostname@%@.@%@domainname@%@ +@!@ +with open('/etc/bareos/.rndpwd','r') as f: + for l in f.readlines(): + if 'CLIENT_PASSWORD' in l: + print " Password = \"%s\"" % (l.split('=')[1].strip()) +@!@ + File Retention = 30 days # 30 days + Job Retention = 6 months # six months + AutoPrune = no # Prune expired Jobs/Files +} + +# +# Definition of file storage device +# +Storage { + Name = File +@!@ +with open('/etc/bareos/.rndpwd','r') as f: + for l in f.readlines(): + if 'STORAGE_PASSWORD' in l: + print " Password = \"%s\"" % (l.split('=')[1].strip()) +@!@ +# Do not use "localhost" here + Address = @%@hostname@%@.@%@domainname@%@ # N.B. Use a fully qualified name here + Device = FileStorage + Media Type = File +} + +# +# Generic catalog service +# +Catalog { + Name = MyCatalog + # Uncomment the following lines if you want the dbi driver + # dbdriver = "dbi:postgresql"; dbaddress = 127.0.0.1; dbport = + dbdriver = "postgresql" + dbname = "@%@bareos/pgsql/database@%@" + dbuser = "@%@bareos/pgsql/user@%@" + dbpassword = "" +} + +# +# Reasonable message delivery -- send most everything to email address and to the console +# +Messages { + Name = Standard + mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos: %t %e of %c %l\" %r" + operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos: Intervention needed for %j\" %r" + mail = root@localhost = all, !skipped # (#2) + operator = root@localhost = mount # (#3) + console = all, !skipped, !saved + append = "/var/log/bareos/bareos.log" = all, !skipped + catalog = all +} + +# +# Message delivery for daemon messages (no job). +# +Messages { + Name = Daemon + mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos daemon message\" %r" + mail = root@localhost = all, !skipped # (#2) + console = all, !skipped, !saved + append = "/var/log/bareos/bareos.log" = all, !skipped +} + + +# +# Full Pool definition +# +Pool { + Name = Full + Pool Type = Backup + Recycle = yes # Bareos can automatically recycle Volumes + AutoPrune = yes # Prune expired volumes + Volume Retention = 365 days # How long should the Full Backups be kept? (#6) + Maximum Volume Bytes = 10G # Limit Volume size to something reasonable + Maximum Volumes = @%@bareos/max_full_volumes@%@ # Limit number of Volumes in Pool + Label Format = "Full-" # Volumes will be labeled "Full-" +} + +# +# Differential Pool definition +# +Pool { + Name = Differential + Pool Type = Backup + Recycle = yes # Bareos can automatically recycle Volumes + AutoPrune = yes # Prune expired volumes + Volume Retention = 90 days # How long should the Differential Backups be kept? (#9) + Maximum Volume Bytes = 10G # Limit Volume size to something reasonable + Maximum Volumes = @%@bareos/max_diff_volumes@%@ # Limit number of Volumes in Pool + Label Format = "Differential-" # Volumes will be labeled "Differential-" +} + +# +# Incremental Pool definition +# +Pool { + Name = Incremental + Pool Type = Backup + Recycle = yes # Bareos can automatically recycle Volumes + AutoPrune = yes # Prune expired volumes + Volume Retention = 30 days # How long should the Incremental Backups be kept? (#12) + Maximum Volume Bytes = 10G # Limit Volume size to something reasonable + Maximum Volumes = @%@bareos/max_incr_volumes@%@ # Limit number of Volumes in Pool + Label Format = "Incremental-" # Volumes will be labeled "Incremental-" +} + +# +# Scratch pool definition +# +Pool { + Name = Scratch + Pool Type = Backup +} + +# +# Restricted console used by tray-monitor to get the status of the director +# +Console { + Name = @%@hostname@%@.@%@domainname@%@-mon + Password = "monitor" + CommandACL = status, .status +} + +@/etc/bareos/autogenerated/clients.include diff --git a/platforms/univention/etc/bareos/bareos-fd.conf b/platforms/univention/etc/bareos/bareos-fd.conf new file mode 100644 index 00000000000..cfce426c636 --- /dev/null +++ b/platforms/univention/etc/bareos/bareos-fd.conf @@ -0,0 +1,54 @@ +@%@UCRWARNING=# @%@ +# +# Default Bareos File Daemon Configuration file +# +# For Bareos release 12.4.2 (03 March 2013) -- debian 6.0.6 +# +# There is not much to change here except perhaps the +# File daemon Name to +# + +# +# List Directors who are permitted to contact this File daemon +# +Director { + Name = @%@hostname@%@.@%@domainname@%@-dir +@!@ +with open('/etc/bareos/.rndpwd','r') as f: + for l in f.readlines(): + if 'CLIENT_PASSWORD' in l: + print " Password = \"%s\"" % (l.split('=')[1].strip()) +@!@ +} + +# +# Restricted Director, used by tray-monitor to get the +# status of the file daemon +# +Director { + Name = @%@hostname@%@.@%@domainname@%@-mon +@!@ +with open('/etc/bareos/.rndpwd','r') as f: + for l in f.readlines(): + if 'CLIENT_MONITOR_PASSWORD' in l: + print " Password = \"%s\"" % (l.split('=')[1].strip()) +@!@ + Monitor = yes +} + +# +# "Global" File daemon configuration specifications +# +FileDaemon { # this is me + Name = @%@hostname@%@.@%@domainname@%@-fd + Maximum Concurrent Jobs = 20 + + # remove comment in next line to load plugins from specified directory + # Plugin Directory = /usr/lib/bareos/plugins +} + +# Send all messages except skipped files back to Director +Messages { + Name = Standard + director = @%@hostname@%@.@%@domainname@%@-dir = all, !skipped, !restored +} diff --git a/platforms/univention/etc/bareos/bareos-sd.conf b/platforms/univention/etc/bareos/bareos-sd.conf new file mode 100644 index 00000000000..2e25f9a038d --- /dev/null +++ b/platforms/univention/etc/bareos/bareos-sd.conf @@ -0,0 +1,72 @@ +@%@UCRWARNING=# @%@ +# +# Default Bareos Storage Daemon Configuration file +# +# For Bareos release 13.2.0 (09 April 2013) -- debian 6.0.6 +# +# You may need to change the name of your tape drive +# on the "Archive Device" directive in the Device +# resource. If you change the Name and/or the +# "Media Type" in the Device resource, please ensure +# that dird.conf has corresponding changes. +# + +Storage { # definition of myself + Name = @%@hostname@%@.@%@domainname@%@-sd + Maximum Concurrent Jobs = 20 + + # remove comment in next line to load plugins from specified directory + # Plugin Directory = /usr/lib/bareos/plugins +} + +# +# List Directors who are permitted to contact Storage daemon +# +Director { + Name = @%@hostname@%@.@%@domainname@%@-dir +@!@ +with open('/etc/bareos/.rndpwd','r') as f: + for l in f.readlines(): + if 'STORAGE_PASSWORD' in l: + print " Password = \"%s\"" % (l.split('=')[1].strip()) +@!@ +} + +# +# Restricted Director, used by tray-monitor to get the +# status of the storage daemon +# +Director { + Name = @%@hostname@%@.@%@domainname@%@-mon +@!@ +with open('/etc/bareos/.rndpwd','r') as f: + for l in f.readlines(): + if 'STORAGE_MONITOR_PASSWORD' in l: + print " Password = \"%s\"" % (l.split('=')[1].strip()) +@!@ + Monitor = yes +} + +# +# Devices supported by this Storage daemon +# To connect, the Director's bareos-dir.conf must have the same Name and MediaType. +# +Device { + Name = FileStorage + Media Type = File + Archive Device = @%@bareos/filestorage@%@ + LabelMedia = yes; # lets Bareos label unlabeled media + Random Access = Yes; + AutomaticMount = yes; # when device opened, read it + RemovableMedia = no; + AlwaysOpen = no; +} + +# +# Send all messages to the Director, +# mount messages also are sent to the email address +# +Messages { + Name = Standard + director = @%@hostname@%@.@%@domainname@%@-dir = all +} diff --git a/platforms/univention/etc/bareos/bconsole.conf b/platforms/univention/etc/bareos/bconsole.conf new file mode 100644 index 00000000000..3bd63f33738 --- /dev/null +++ b/platforms/univention/etc/bareos/bconsole.conf @@ -0,0 +1,16 @@ +@%@UCRWARNING=# @%@ +# +# Bareos User Agent (or Console) Configuration File +# + +Director { + Name = @%@hostname@%@.@%@domainname@%@-dir + DIRport = 9101 + address = @%@hostname@%@.@%@domainname@%@ +@!@ +with open('/etc/bareos/.rndpwd','r') as f: + for l in f.readlines(): + if 'DIRECTOR_PASSWORD' in l: + print " Password = \"%s\"" % (l.split('=')[1].strip()) +@!@ +} diff --git a/platforms/univention/etc/postgresql/8.4/main/pg_hba.conf.d/25-univention-bareos b/platforms/univention/etc/postgresql/8.4/main/pg_hba.conf.d/25-univention-bareos new file mode 100644 index 00000000000..dbeeed709f9 --- /dev/null +++ b/platforms/univention/etc/postgresql/8.4/main/pg_hba.conf.d/25-univention-bareos @@ -0,0 +1 @@ +local @%@bareos/pgsql/database@%@ @%@bareos/pgsql/user@%@ ident diff --git a/platforms/univention/fd-generic.template b/platforms/univention/fd-generic.template new file mode 100644 index 00000000000..b059cfcb47a --- /dev/null +++ b/platforms/univention/fd-generic.template @@ -0,0 +1,19 @@ +# +# This file needs to be copied to the backup client +# as /etc/bareos/bareos-fd.conf +# + + Director { + Name = ${server_name}-dir + Password = "$password" + } + FileDaemon { + Name = ${client_name}-fd + WorkingDirectory = /var/lib/bareos + Pid Directory = /var/run + Maximum Concurrent Jobs = 20 + } + Messages { + Name = Standard + director = ${server_name}-dir = all, !skipped, !restored + } diff --git a/platforms/univention/fd-windows.template b/platforms/univention/fd-windows.template new file mode 100644 index 00000000000..d6a1497fa71 --- /dev/null +++ b/platforms/univention/fd-windows.template @@ -0,0 +1,23 @@ +# +# This file needs to be copied onto the client +# (usually into the directory C:\ProgramData\Bareos) +# with bareos-fd.conf as the file name. +# +# You can also let the windows installer generate this file +# by calling setup.exe with the following parameters: +# +# +# setup.exe /DIRECTORNAME=${server_name} /CLIENTNAME=${client_name} /CLIENTPASSWORD="${password}" +# + + Director { + Name = ${server_name}-dir + Password = "$password" + } + FileDaemon { + Name = ${client_name}-fd + } + Messages { + Name = Standard + director = ${server_name}-dir = all, !skipped, !restored + } diff --git a/platforms/univention/job-generic.template b/platforms/univention/job-generic.template new file mode 100644 index 00000000000..72771efbc9b --- /dev/null +++ b/platforms/univention/job-generic.template @@ -0,0 +1,18 @@ +Client { + Name = "${client_name}-fd" + Address = "$client_name" + Password = "${password}" + + File Retention = 30 days # 30 days + Job Retention = 6 months # six months + AutoPrune = no # Prune expired Jobs/Files +} + +Job { + Name = "Backup-${client_name}" + Client = "${client_name}-fd" + JobDefs = "DefaultJob" + FileSet = "Linux All" + Schedule = "WeeklyCycle" + Enabled = "$enable" +} diff --git a/platforms/univention/job-windows.template b/platforms/univention/job-windows.template new file mode 100644 index 00000000000..72a2088041b --- /dev/null +++ b/platforms/univention/job-windows.template @@ -0,0 +1,18 @@ +Client { + Name = "${client_name}-fd" + Address = "$client_name" + Password = "${password}" + + File Retention = 30 days # 30 days + Job Retention = 6 months # six months + AutoPrune = no # Prune expired Jobs/Files +} + +Job { + Name = "Backup-${client_name}" + Client = "${client_name}-fd" + JobDefs = "DefaultJob" + FileSet = "Windows All Drives" + Schedule = "WeeklyCycle" + Enabled = "$enable" +} diff --git a/platforms/univention/postgres_create.sql b/platforms/univention/postgres_create.sql new file mode 100755 index 00000000000..510cf61e897 --- /dev/null +++ b/platforms/univention/postgres_create.sql @@ -0,0 +1,442 @@ +CREATE TABLE Filename +( + FilenameId SERIAL NOT NULL, + Name TEXT NOT NULL, + PRIMARY KEY (FilenameId) +); + +ALTER TABLE Filename ALTER COLUMN Name SET STATISTICS 1000; +CREATE UNIQUE INDEX filename_name_idx ON Filename (Name); + +CREATE TABLE Path +( + PathId SERIAL NOT NULL, + Path TEXT NOT NULL, + PRIMARY KEY (PathId) +); + +ALTER TABLE Path ALTER COLUMN Path SET STATISTICS 1000; +CREATE UNIQUE INDEX path_name_idx ON Path (Path); + +-- We strongly recommend to avoid the temptation to add new indexes. +-- In general, these will cause very significant performance +-- problems in other areas. A better approch is to carefully check +-- that all your memory configuation parameters are +-- suitable for the size of your installation. If you backup +-- millions of files, you need to adapt the database memory +-- configuration parameters concerning sorting, joining and global +-- memory. By DEFAULT, sort and join parameters are very small +-- (sometimes 8Kb), and having sufficient memory specified by those +-- parameters is extremely important to run fast. + +-- In File table +-- FileIndex can be 0 for FT_DELETED files +-- FileNameId can link to Filename.Name='' for directories +CREATE TABLE File +( + FileId BIGSERIAL NOT NULL, + FileIndex INTEGER NOT NULL DEFAULT 0, + JobId INTEGER NOT NULL, + PathId INTEGER NOT NULL, + FilenameId INTEGER NOT NULL, + DeltaSeq SMALLINT NOT NULL DEFAULT 0, + MarkId INTEGER NOT NULL DEFAULT 0, + LStat TEXT NOT NULL, + Md5 TEXT NOT NULL, + PRIMARY KEY (FileId) +); + +CREATE INDEX file_jpfid_idx ON File (JobId, PathId, FilenameId); +CREATE INDEX file_jobid_idx ON File (JobId); + +-- +-- Add this if you have a good number of job +-- that run at the same time +-- ALTER SEQUENCE file_fileid_seq CACHE 1000; + +-- +-- Possibly add one or more of the following indexes +-- if your Verifies are too slow, but they can slow down +-- backups. +-- +-- CREATE INDEX file_pathid_idx ON file(pathid); +-- CREATE INDEX file_filenameid_idx ON file(filenameid); + +CREATE TABLE RestoreObject ( + RestoreObjectId SERIAL NOT NULL, + ObjectName TEXT NOT NULL, + RestoreObject BYTEA NOT NULL, + PluginName TEXT NOT NULL, + ObjectLength INTEGER DEFAULT 0, + ObjectFullLength INTEGER DEFAULT 0, + ObjectIndex INTEGER DEFAULT 0, + ObjectType INTEGER DEFAULT 0, + FileIndex INTEGER DEFAULT 0, + JobId INTEGER, + ObjectCompression INTEGER DEFAULT 0, + PRIMARY KEY(RestoreObjectId) +); +CREATE INDEX restore_jobid_idx ON RestoreObject(JobId); + +CREATE TABLE Job +( + JobId SERIAL NOT NULL, + Job TEXT NOT NULL, + Name TEXT NOT NULL, + Type CHAR(1) NOT NULL, + Level CHAR(1) NOT NULL, + ClientId INTEGER DEFAULT 0, + JobStatus CHAR(1) NOT NULL, + SchedTime TIMESTAMP WITHOUT TIME ZONE, + StartTime TIMESTAMP WITHOUT TIME ZONE, + EndTime TIMESTAMP WITHOUT TIME ZONE, + RealEndTime TIMESTAMP WITHOUT TIME ZONE, + JobTDate BIGINT DEFAULT 0, + VolSessionId INTEGER DEFAULT 0, + volSessionTime INTEGER DEFAULT 0, + JobFiles INTEGER DEFAULT 0, + JobBytes BIGINT DEFAULT 0, + ReadBytes BIGINT DEFAULT 0, + JobErrors INTEGER DEFAULT 0, + JobMissingFiles INTEGER DEFAULT 0, + PoolId INTEGER DEFAULT 0, + FilesetId INTEGER DEFAULT 0, + PriorJobid INTEGER DEFAULT 0, + PurgedFiles SMALLINT DEFAULT 0, + HasBase SMALLINT DEFAULT 0, + HasCache SMALLINT DEFAULT 0, + Reviewed SMALLINT DEFAULT 0, + Comment TEXT, + PRIMARY KEY (JobId) +); + +CREATE INDEX job_name_idx ON job (Name); + +-- Create a table like Job for long term statistics +CREATE TABLE JobHisto (LIKE Job); +CREATE INDEX jobhisto_idx ON JobHisto (StartTime); + +CREATE TABLE Location ( + LocationId SERIAL NOT NULL, + Location TEXT NOT NULL, + Cost INTEGER DEFAULT 0, + Enabled SMALLINT, + PRIMARY KEY (LocationId) +); + +CREATE TABLE Fileset +( + FileSetId SERIAL NOT NULL, + Fileset TEXT NOT NULL, + Md5 TEXT NOT NULL, + CreateTime TIMESTAMP WITHOUT TIME ZONE NOT NULL, + PRIMARY KEY (filesetid) +); + +CREATE INDEX fileset_name_idx ON fileset (fileset); + +CREATE TABLE JobMedia +( + JobMediaId SERIAL NOT NULL, + JobId INTEGER NOT NULL, + MediaId INTEGER NOT NULL, + FirstIndex INTEGER DEFAULT 0, + LastIndex INTEGER DEFAULT 0, + StartFile INTEGER DEFAULT 0, + EndFile INTEGER DEFAULT 0, + StartBlock BIGINT DEFAULT 0, + EndBlock BIGINT DEFAULT 0, + VolIndex INTEGER DEFAULT 0, + PRIMARY KEY (jobmediaid) +); + +CREATE INDEX job_media_job_id_media_id_idx ON jobmedia (JobId, MediaId); + +CREATE TABLE Media +( + MediaId SERIAL NOT NULL, + VolumeName TEXT NOT NULL, + Slot INTEGER DEFAULT 0, + PoolId INTEGER DEFAULT 0, + MediaType TEXT NOT NULL, + MediaTypeId INTEGER DEFAULT 0, + LabelType INTEGER DEFAULT 0, + FirstWritten TIMESTAMP WITHOUT TIME ZONE, + LastWritten TIMESTAMP WITHOUT TIME ZONE, + LabelDate TIMESTAMP WITHOUT TIME ZONE, + VolJobs INTEGER DEFAULT 0, + VolFiles INTEGER DEFAULT 0, + VolBlocks INTEGER DEFAULT 0, + VolMounts INTEGER DEFAULT 0, + VolBytes BIGINT DEFAULT 0, + VolErrors INTEGER DEFAULT 0, + VolWrites INTEGER DEFAULT 0, + VolCapacityBytes BIGINT DEFAULT 0, + VolStatus TEXT NOT NULL + CHECK (VolStatus IN ('Full', 'Archive', 'Append', + 'Recycle', 'Purged', 'Read-Only', 'Disabled', + 'Error', 'Busy', 'Used', 'Cleaning', 'Scratch')), + Enabled SMALLINT DEFAULT 1, + Recycle SMALLINT DEFAULT 0, + ActionOnPurge SMALLINT DEFAULT 0, + VolRetention BIGINT DEFAULT 0, + VolUseDuration BIGINT DEFAULT 0, + MaxVolJobs INTEGER DEFAULT 0, + MaxVolFiles INTEGER DEFAULT 0, + MaxVolBytes BIGINT DEFAULT 0, + InChanger SMALLINT DEFAULT 0, + StorageId INTEGER DEFAULT 0, + DeviceId INTEGER DEFAULT 0, + MediaAddressing SMALLINT DEFAULT 0, + VolReadTime BIGINT DEFAULT 0, + VolWriteTime BIGINT DEFAULT 0, + EndFile INTEGER DEFAULT 0, + EndBlock BIGINT DEFAULT 0, + LocationId INTEGER DEFAULT 0, + RecycleCount INTEGER DEFAULT 0, + InitialWrite TIMESTAMP WITHOUT TIME ZONE, + ScratchPoolId INTEGER DEFAULT 0, + RecyclePoolId INTEGER DEFAULT 0, + EncryptionKey TEXT, + Comment TEXT, + PRIMARY KEY (MediaId) +); + +CREATE UNIQUE INDEX media_volumename_id ON Media (VolumeName); +CREATE INDEX media_poolid_idx ON Media (PoolId); +CREATE INDEX media_storageid_idx ON Media (StorageId); + +CREATE TABLE MediaType ( + MediaTypeId SERIAL, + MediaType TEXT NOT NULL, + ReadOnly INTEGER DEFAULT 0, + PRIMARY KEY(MediaTypeId) +); + +CREATE TABLE Storage ( + StorageId SERIAL, + Name TEXT NOT NULL, + AutoChanger INTEGER DEFAULT 0, + PRIMARY KEY(StorageId) +); + +CREATE TABLE Device ( + DeviceId SERIAL, + Name TEXT NOT NULL, + MediaTypeId INTEGER NOT NULL, + StorageId INTEGER NOT NULL, + DevMounts INTEGER NOT NULL DEFAULT 0, + DevReadBytes BIGINT NOT NULL DEFAULT 0, + DevWriteBytes BIGINT NOT NULL DEFAULT 0, + DevReadBytesSinceCleaning BIGINT NOT NULL DEFAULT 0, + DevWriteBytesSinceCleaning BIGINT NOT NULL DEFAULT 0, + DevReadTime BIGINT NOT NULL DEFAULT 0, + DevWriteTime BIGINT NOT NULL DEFAULT 0, + DevReadTimeSinceCleaning BIGINT NOT NULL DEFAULT 0, + DevWriteTimeSinceCleaning BIGINT NOT NULL DEFAULT 0, + CleaningDate TIMESTAMP WITHOUT TIME ZONE, + CleaningPeriod BIGINT NOT NULL DEFAULT 0, + PRIMARY KEY(DeviceId) +); + +CREATE TABLE Pool +( + PoolId SERIAL NOT NULL, + Name TEXT NOT NULL, + NumVols INTEGER DEFAULT 0, + MaxVols INTEGER DEFAULT 0, + UseOnce SMALLINT DEFAULT 0, + UseCatalog SMALLINT DEFAULT 0, + AcceptAnyVolume SMALLINT DEFAULT 0, + VolRetention BIGINT DEFAULT 0, + VolUseDuration BIGINT DEFAULT 0, + MaxVolJobs INTEGER DEFAULT 0, + MaxVolFiles INTEGER DEFAULT 0, + MaxVolBytes BIGINT DEFAULT 0, + AutoPrune SMALLINT DEFAULT 0, + Recycle SMALLINT DEFAULT 0, + ActionOnPurge SMALLINT DEFAULT 0, + PoolType TEXT + CHECK (PoolType IN ('Backup', 'Copy', 'Cloned', 'Archive', + 'Migration', 'Scratch')), + LabelType INTEGER DEFAULT 0, + LabelFormat TEXT NOT NULL, + Enabled SMALLINT DEFAULT 1, + ScratchPoolId INTEGER DEFAULT 0, + RecyclePoolId INTEGER DEFAULT 0, + NextPoolId INTEGER DEFAULT 0, + MigrationHighBytes BIGINT DEFAULT 0, + MigrationLowBytes BIGINT DEFAULT 0, + MigrationTime BIGINT DEFAULT 0, + PRIMARY KEY (PoolId) +); + +CREATE INDEX pool_name_idx ON Pool (Name); + +CREATE TABLE Client +( + ClientId SERIAL NOT NULL, + Name TEXT NOT NULL, + UName TEXT NOT NULL, + AutoPrune SMALLINT DEFAULT 0, + FileRetention BIGINT DEFAULT 0, + JobRetention BIGINT DEFAULT 0, + PRIMARY KEY (ClientId) +); + +CREATE UNIQUE INDEX client_name_idx ON Client (Name); + +CREATE TABLE Log +( + LogId SERIAL NOT NULL, + JobId INTEGER NOT NULL, + Time TIMESTAMP WITHOUT TIME ZONE, + LogText TEXT NOT NULL, + PRIMARY KEY (LogId) +); +CREATE INDEX log_name_idx ON Log (JobId); + +CREATE TABLE LocationLog ( + LocLogId SERIAL NOT NULL, + Date TIMESTAMP WITHOUT TIME ZONE, + Comment TEXT NOT NULL, + MediaId INTEGER DEFAULT 0, + LocationId INTEGER DEFAULT 0, + NewVolStatus TEXT NOT NULL + CHECK (NewVolStatus IN ('Full', 'Archive', 'Append', + 'Recycle', 'Purged', 'Read-Only', 'Disabled', + 'Error', 'Busy', 'Used', 'Cleaning', 'Scratch')), + newenabled SMALLINT, + PRIMARY KEY(LocLogId) +); + +CREATE TABLE counters +( + Counter TEXT NOT NULL, + MinValue INTEGER DEFAULT 0, + MaxValue INTEGER DEFAULT 0, + CurrentValue INTEGER DEFAULT 0, + wrapcounter TEXT NOT NULL, + PRIMARY KEY (Counter) +); + +CREATE TABLE basefiles +( + BaseId SERIAL NOT NULL, + JobId INTEGER NOT NULL, + FileId BIGINT NOT NULL, + FileIndex INTEGER, + BaseJobId INTEGER, + PRIMARY KEY (BaseId) +); + +CREATE INDEX basefiles_jobid_idx ON BaseFiles (JobId); + +CREATE TABLE unsavedfiles +( + UnsavedId INTEGER NOT NULL, + JobId INTEGER NOT NULL, + PathId INTEGER NOT NULL, + FilenameId INTEGER NOT NULL, + PRIMARY KEY (UnsavedId) +); + +CREATE TABLE CDImages +( + MediaId INTEGER NOT NULL, + LastBurn TIMESTAMP WITHOUT TIME ZONE NOT NULL, + PRIMARY KEY (MediaId) +); + +CREATE TABLE PathHierarchy +( + PathId INTEGER NOT NULL, + PPathId INTEGER NOT NULL, + CONSTRAINT pathhierarchy_pkey PRIMARY KEY (PathId) +); + +CREATE INDEX pathhierarchy_ppathid + ON PathHierarchy (PPathId); + +CREATE TABLE PathVisibility +( + PathId INTEGER NOT NULL, + JobId INTEGER NOT NULL, + Size BIGINT DEFAULT 0, + Files INTEGER DEFAULT 0, + CONSTRAINT pathvisibility_pkey PRIMARY KEY (JobId, PathId) +); +CREATE INDEX pathvisibility_jobid + ON PathVisibility (JobId); + +CREATE TABLE version +( + VersionId INTEGER NOT NULL +); + +CREATE TABLE Status ( + JobStatus CHAR(1) NOT NULL, + JobStatusLong TEXT, + Severity INTEGER, + PRIMARY KEY (JobStatus) +); + +CREATE TABLE Quota ( + ClientId INTEGER NOT NULL, + GraceTime BIGINT DEFAULT 0, + QuotaLimit BIGINT DEFAULT 0, + PRIMARY KEY (ClientId) +); + +CREATE TABLE NDMPLevelMap ( + ClientId INTEGER NOT NULL, + FilesetId INTEGER DEFAULT 0, + FileSystem TEXT NOT NULL, + PathId INTEGER NOT NULL, + CONSTRAINT NDMPLevelMap_pkey PRIMARY KEY (ClientId, FilesetId, FileSystem) +); + +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('C', 'Created, not yet running',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('R', 'Running',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('B', 'Blocked',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('T', 'Completed successfully', 10); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('E', 'Terminated with errors', 25); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('e', 'Non-fatal error',20); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('f', 'Fatal error',100); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('D', 'Verify found differences',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('A', 'Canceled by user',90); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('F', 'Waiting for Client',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('S', 'Waiting for Storage daemon',15); +INSERT INTO Status (JobStatus,JobStatusLong) VALUES + ('m', 'Waiting for new media'); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('M', 'Waiting for media mount',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('s', 'Waiting for storage resource',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('j', 'Waiting for job resource',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('c', 'Waiting for client resource',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('d', 'Waiting on maximum jobs',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('t', 'Waiting on start time',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('p', 'Waiting on higher priority jobs',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('a', 'SD despooling attributes',15); +INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES + ('i', 'Doing batch insert file records',15); + +INSERT INTO Version (VersionId) VALUES (2001); diff --git a/platforms/univention/restart_director b/platforms/univention/restart_director new file mode 100755 index 00000000000..78bdd34d18e --- /dev/null +++ b/platforms/univention/restart_director @@ -0,0 +1,3 @@ +#!/bin/sh +cd /etc/bareos/autogenerated +test clients.include -nt .timestamp -o ! -f .timestamp && service bareos-dir restart >/dev/null && touch .timestamp diff --git a/platforms/univention/univention-bareos.cron b/platforms/univention/univention-bareos.cron new file mode 100644 index 00000000000..244873de32f --- /dev/null +++ b/platforms/univention/univention-bareos.cron @@ -0,0 +1 @@ +30 0 * * * /usr/share/univention-bareos/restart_director diff --git a/platforms/univention/univention-bareos.ini b/platforms/univention/univention-bareos.ini new file mode 100644 index 00000000000..b3d683d6fd4 --- /dev/null +++ b/platforms/univention/univention-bareos.ini @@ -0,0 +1,53 @@ +[Application] +ID=bareos +Name=Bareos Backup +Version=12.4.4ucs3-1 + +EmailRequired=True +NotifyVendor=True + +Description=scalable open source network backup solution +LongDescription=Bareos (Backup Archiving Recovery Open Sourced) is a reliable, + network-based open source software for backup, archiving and recovery + of data for all well-established operating systems. In the year 2010 + emerged from the Bacula Project, Bareos was and is actively developed as + a fork and enriched with lots of new features. Thus Bareos today offers + among other features LTO hardware encryption, bandwitdth limitation and + new practical console commands. The source code of Bareos is available + on Github under the AGPL v3 license. Additionally + Bareos offers binary package repositories for the most important Linux + distributions as well as for Windows. ATTENTION: After installation, + you need to review at least the UCR variables + bareos/filestorage, bareos/backup_myself and bareos/max_*_volumes + for proper operation. + +Screenshot= +Categories=Administration + +Vendor=Bareos GmbH und Co. KG +Website=http://www.bareos.org/en/HOWTO/articles/bareos-univention-documentation.html +WebsiteVendor=http://www.bareos.com +Contact=info@bareos.com +NotificationEmail=info@bareos.com +LicenseFile=LICENSE_AGREEMENT + +ConflictedApps= +ConflictedSystemPackages=univention-bacula,bacula-director-common,bacula-fd,bacula-sd +DefaultPackages=univention-bareos +DefaultPackagesMaster=univention-bareos-schema + +[de] +Description=Leistungsfähige Open-Source-Backup-Lösung +LongDescription=Bareos (Backup Archiving Recovery Open Sourced) ist eine zuverlässige, + netzwerkübergreifende Open Source Software zur Sicherung, Archivierung + und Wiederherstellung von Daten aller gängigen Betriebssysteme. Im Jahr + 2010 hervorgegangen aus dem Projekt Bacula wurde und wird Bareos als + Fork aktiv weiterentwickelt und mit vielen neuen Features angereichert. + So bietet Bareos heute unter anderem eine LTO Hardware-Verschlüsselung, + eine Bandbreitenbegrenzung und neue praktische Konsolen-Kommandos. Der + Quellcode von Bareos ist auf Github verfügbar und steht unter der Lizenz + AGPL v3. Zudem stellt Bareos fertige Pakete über Repositories für die + wichtigsten Linux Distributionen sowie für Windows bereit. + ACHTUNG: Nach der Installation sollten die UCR-Variablen + bareos/filestorage, bareos/backup_myself und bareos/max_*_volumes geprüft werden, + um einen korrekten Betrieb zu gewährleisten. diff --git a/platforms/univention/univention-bareos.py b/platforms/univention/univention-bareos.py new file mode 100644 index 00000000000..ea36a2bb889 --- /dev/null +++ b/platforms/univention/univention-bareos.py @@ -0,0 +1,224 @@ +# -*- coding: utf-8 -*- +# +# Univention SSL +"""Bareos Client Configuration Listener Module.""" +# + +__package__ = '' # workaround for PEP 366 +from listener import configRegistry, setuid, unsetuid +import grp +import os +import stat + +import univention.debug as ud +import subprocess +import string +import random + +name = 'bareos' +description = 'Generate Bareos Configuration for Clients' +filter = '(objectClass=bareosClientHost)' +attributes = [] + +PATH_PREFIX='/etc/bareos/autogenerated' +FD_CONFIG_PATH=PATH_PREFIX+'/fd-configs' +SECRETS_PATH=PATH_PREFIX+'/fd-secrets' +JOBS_PATH=PATH_PREFIX+'/clients' +INCLUDES_PATH=PATH_PREFIX+'/clients.include' + +JOB_DISABLED='Not' + +bareos_gid=grp.getgrnam('bareos').gr_gid + +def getFqdn(entry): + if not entry.has_key('cn'): + return None + + name = entry['cn'][0] + if entry.has_key('associatedDomain'): + name = name + '.' + entry['associatedDomain'][0] + + return name + +def initialize(): + """Initialize the module once on first start or after clean.""" + ud.debug(ud.LISTENER, ud.INFO, 'BAREOS: Initialize') + +def handler(dn, new, old): + """Handle changes to 'dn'.""" + setuid(0) + try: + # if configRegistry['server/role'] != 'domaincontroller_master': + # return + + # ud.debug(ud.LISTENER, ud.INFO, 'BAREOS: handler '+dn+' '+str(bareos_gid)) + + if new and not old: + # changeType: add + name=getFqdn(new) + processClient(name,new) + + elif old and not new: + # changeType: delete + try: + name = getFqdn(old) + processClient(name,old,delete=True) + except: + pass + else: + # changeType: modify + name=getFqdn(new) + processClient(name,new) + finally: + unsetuid() + +def clean(): + """Handle request to clean-up the module.""" + return + +def postrun(): + """Transition from prepared-state to not-prepared.""" + return + + +def processClient(client_name,entry,delete=False): + if client_name==None: + return + + client_type='generic' + if 'univentionWindows' in entry['objectClass']: + client_type='windows' + + if delete==True: + removeClient(client_name,client_type) + return + + if entry.has_key('bareosEnableJob'): + if entry['bareosEnableJob'][0]==JOB_DISABLED: + removeClient(client_name,client_type) + return + + addClient(client_name,client_type) + +def addClient(client_name,client_type): + createFDConfig(client_name,client_type) + createClientJob(client_name,client_type) + addClientInclude(client_name) + +def removeClient(client_name,client_type): + if client_name==None: + return + # removeClientInclude(client_name) + # removeClientJob(client_name) + disableClientJob(client_name,client_type) + addClientInclude(client_name) + +def getClientSecret(client_name): + path=SECRETS_PATH+'/'+client_name + password=None + + try: + f=open(path,'r') + password=f.read().strip() + except: + password=createClientSecret(client_name) + + return password + +def getServerName(): + server_name=configRegistry['hostname'] + domain=configRegistry['domainname'] + if domain: + server_name=server_name+'.'+configRegistry['domainname'] + return server_name + +def createFDConfig(client_name,client_type): + path=FD_CONFIG_PATH+'/'+client_name+'.conf' + password=getClientSecret(client_name) + server_name=getServerName() + + templatefile=FD_CONFIG_PATH+'/'+client_type+'.template' + os.umask(077) + with open(templatefile,'r') as f: + content=f.read() + + t=string.Template(content) + with open(path,"w") as f: + f.write(t.substitute(password=password,client_name=client_name,server_name=server_name)) + os.chown(path,-1,0) + +def createClientSecret(client_name): + path=SECRETS_PATH+'/'+client_name + + char_set = string.ascii_uppercase + string.digits + string.ascii_lowercase + password=''.join(random.sample(char_set*40,40)) + os.umask(077) + with open(path,'w') as f: + f.write(password) + os.chown(path,-1,0) + return password + + +def removeClientJob(client_name): + path=JOBS_PATH+'/'+client_name+'.include' + os.remove(path) + +def createClientJob(client_name,client_type,enable='Yes'): + password=getClientSecret(client_name) + server_name=getServerName() + + path=JOBS_PATH+'/'+client_name+'.include' + templatefile=JOBS_PATH+'/'+client_type+'.template' + os.umask(077) + with open(templatefile,'r') as f: + content=f.read() + + t=string.Template(content) + with open(path,"w") as f: + f.write(t.substitute(enable=enable, \ + password=password,client_name=client_name,server_name=server_name)) + os.chown(path,-1,bareos_gid) + os.chmod(path,stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP) + +def disableClientJob(client_name,client_type): + createClientJob(client_name,client_type,'No') + +def getClientIncludePath(client_name): + return '@'+JOBS_PATH+'/'+client_name+'.include' + +def addClientInclude(client_name): + # is the client already in the include list? + if isClientIncluded(client_name): + # update the timestamp on the file + # to let the cron script know the configuration + # has changed + os.utime(INCLUDES_PATH,None) + return + + # if not, add it at the end of the file + with open(INCLUDES_PATH,'a') as f: + f.write(getClientIncludePath(client_name)) + f.write('\n') + +def isClientIncluded(client_name): + want=getClientIncludePath(client_name) + with open(INCLUDES_PATH,'r') as f: + for l in f.readlines(): + if want in l: + return True + return False + +def removeClientInclude(client_name): + if not isClientIncluded(client_name): + return + + want=getClientIncludePath(client_name) + lines=[] + with open(INCLUDES_PATH,'r+') as f: + lines=f.readlines() + f.seek(0) + f.truncate(0) + for l in lines: + if want in l: + continue + f.write(l)