From 61a9b0bac4e17612f29bea434aaa39511942d0dd Mon Sep 17 00:00:00 2001 From: Valentin Vidic Date: Mon, 7 Mar 2011 15:27:41 +0100 Subject: [PATCH 1/1] Initial version. --- debian/changelog | 5 + debian/compat | 1 + debian/config | 64 ++++++++++ debian/control | 17 +++ debian/copyright | 31 +++++ debian/install | 2 + debian/po/POTFILES.in | 1 + debian/po/templates.pot | 73 +++++++++++ debian/postinst | 320 +++++++++++++++++++++++++++++++++++++++++++++++ debian/postrm | 41 ++++++ debian/rules | 13 ++ debian/source/format | 1 + debian/templates | 22 ++++ gpg/pubring.gpg | Bin 0 -> 1311 bytes gpg/trustdb.gpg | Bin 0 -> 40 bytes sysbackup.pem | 23 ++++ 16 files changed, 614 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/config create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/install create mode 100644 debian/po/POTFILES.in create mode 100644 debian/po/templates.pot create mode 100644 debian/postinst create mode 100644 debian/postrm create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/templates create mode 100644 gpg/pubring.gpg create mode 100644 gpg/secring.gpg create mode 100644 gpg/trustdb.gpg create mode 100644 sysbackup.pem diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..ed33f95 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +bacula-cn (20110307) unstable; urgency=low + + * Initial Release. + + -- Valentin Vidic Thu, 07 Mar 2011 14:32:30 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/config b/debian/config new file mode 100644 index 0000000..1fe6e1f --- /dev/null +++ b/debian/config @@ -0,0 +1,64 @@ +#! /bin/sh +set -e + +. /usr/share/debconf/confmodule + +# Guess default hostname +HOST=$( hostname -f ) +db_get bacula-cn/hostname || true +if [ -z "$RET" ]; then + db_set bacula-cn/hostname "$HOST" +fi + +# Guess default ip +. /usr/share/carnet-tools/functions.sh +cp_get_ifaddr +IP=$RET +db_get bacula-cn/ip || true +if [ -z "$RET" ]; then + db_set bacula-cn/ip "$IP" +fi + +# Sample contact +db_get bacula-cn/contact || true +if [ -z "$RET" ]; then + db_set bacula-cn/contact "Ime Prezime " +fi + +# Check hostname +while true; do + ! db_input high bacula-cn/hostname && [ $? -eq 30 ] && break + db_go || true + + db_get bacula-cn/hostname + [ -z "$RET" ] && continue + echo "$RET" | grep -Eqi '^[a-z0-9-]+(\.[a-z0-9.-]+)+$' || continue + + break +done + +# Check ip +while true; do + ! db_input high bacula-cn/ip && [ $? -eq 30 ] && break + db_go || true + + db_get bacula-cn/ip + [ -z "$RET" ] && continue + echo "$RET" | grep -Eqi '^[0-9]{1,3}(\.[0-9]{1,3}){3}$' || continue + + break +done + +# Check contact +while true; do + ! db_input high bacula-cn/contact && [ $? -eq 30 ] && break + db_go || true + + db_get bacula-cn/contact + [ -z "$RET" ] && continue + echo "$RET" | grep -Eqi '^([^@]*<)?[a-z0-9.+-]+@[a-z0-9-]+(\.[a-z0-9.-]+)+>?$' || continue + + break +done + +exit 0 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..ae305f3 --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: bacula-cn +Section: admin +Priority: extra +Maintainer: Grupa za izradu paketa +Uploaders: Valentin Vidic +Build-Depends-Indep: debhelper (>= 7.0.50~), po-debconf +Standards-Version: 3.9.1 +Bugs: mailto:paketi@carnet.hr +Vcs-Git: http://ftp.carnet.hr/carnet-debian/scm/bacula-cn.git +Vcs-Browser: http://ftp.carnet.hr/carnet-debian/scm/?p=bacula-cn.git;a=summary + +Package: bacula-cn +Architecture: all +Depends: bacula-fd (>= 5), bacula-console (>= 5), openssl, gnupg, debconf (>= 0.5) | debconf-2.0, carnet-tools-cn, ${misc:Depends} +Description: Network backup configuration for CARNet members + This package install Bacula client daemon and configures it for use + with CARNet backup service for member institutions. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..2555ba8 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,31 @@ +This work was packaged for Debian by: + + Valentin Vidic on Thu, 03 Mar 2011 14:32:30 +0100 + +Copyright: + + + +License: + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This package 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +On Debian systems, the complete text of the GNU General +Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + +The Debian packaging is: + + Copyright (C) 2011 Valentin Vidic + +and is licensed under the GPL version 3, see above. diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..d4e38e6 --- /dev/null +++ b/debian/install @@ -0,0 +1,2 @@ +sysbackup.pem etc/bacula/ +gpg var/lib/bacula-cn/ diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in new file mode 100644 index 0000000..cef83a3 --- /dev/null +++ b/debian/po/POTFILES.in @@ -0,0 +1 @@ +[type: gettext/rfc822deb] templates diff --git a/debian/po/templates.pot b/debian/po/templates.pot new file mode 100644 index 0000000..f16f8fc --- /dev/null +++ b/debian/po/templates.pot @@ -0,0 +1,73 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: bacula-cn@packages.debian.org\n" +"POT-Creation-Date: 2011-03-04 17:32+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../templates:1001 +msgid "Naziv posluzitelja:" +msgstr "" + +#. Type: string +#. Description +#: ../templates:1001 +msgid "" +"Unesite puno ime posluzitelja koji se dodaje u backup sustav. Najcesce se " +"koristi oblik ime.ustanova.hr." +msgstr "" + +#. Type: string +#. Description +#: ../templates:2001 +msgid "IP adresa posluzitelja:" +msgstr "" + +#. Type: string +#. Description +#: ../templates:2001 +msgid "" +"Unesite javnu IP adresu posluzitelja. Putem ove adrese obavljat ce se " +"backup posluzitelja." +msgstr "" + +#. Type: string +#. Description +#: ../templates:3001 +msgid "Kontakt adresa:" +msgstr "" + +#. Type: string +#. Description +#: ../templates:3001 +msgid "Unesite ime i kontakt adresu administratora posluzitelja u obliku:" +msgstr "" + +#. Type: string +#. Description +#: ../templates:3001 +msgid "Ime Prezime " +msgstr "" + +#. Type: string +#. Description +#: ../templates:3001 +msgid "" +"Ova adresa koristit ce se prilikom slanja zahtjeva za pokretanje usluge " +"backupa i za kontakt u slucaju problema. Zbog toga molimo da unesete radecu " +"mail adresu." +msgstr "" diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..78a47ec --- /dev/null +++ b/debian/postinst @@ -0,0 +1,320 @@ +#!/bin/sh +# postinst script for bacula-cn +# +# see: dh_installdeb(1) + +set -e + +# Source debconf library. +. /usr/share/debconf/confmodule + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +generate_fd_config() { + FD_CONFIG=/etc/bacula/bacula-fd.conf + + if [ -s $FD_CONFIG ] && grep -q 'PKI Keypair' $FD_CONFIG; then + echo $FD_CONFIG already exists, skipping. + else + umask 077 + + if [ -e $FD_CONFIG -a ! -e $FD_CONFIG.bak ]; then + cp -av $FD_CONFIG $FD_CONFIG.bak + fi + + echo Generating $FD_CONFIG + CONFIG_CHANGED=1 + cat >$FD_CONFIG <$BCONSOLE_CONFIG </dev/null`" ]; then + invoke-rc.d bacula-fd restart || exit $? + else + /etc/init.d/bacula-fd restart || exit $? + fi + fi +} + +send_mail() { + REQUEST_FILE=/etc/bacula/bacula-fd.txt + GPG_HOME=/var/lib/bacula-cn/gpg + + BOUNDARY=$( head -20 /dev/urandom | openssl dgst -sha1 ) + GPG="gpg --homedir $GPG_HOME --batch --encrypt --armour --recipient rt@tt.carnet.hr --always-trust" + + if [ -z "$CONFIG_CHANGED" ]; then + echo Config has not changed, skipping request. + return + fi + + umask 077 + chmod 0700 $GPG_HOME + echo Generating request in $REQUEST_FILE + + # Header + cat > $REQUEST_FILE <> $REQUEST_FILE <> $REQUEST_FILE + +# attachment: client config +cat >> $REQUEST_FILE <> $REQUEST_FILE +# Requested by $CONTACT on $DATE +Client { + Name = $HOST-fd + Address = $IP + Password = "$PASS_FD" # password for bacula-fd(8) + @/etc/bacula/include/client-debian-default.conf + + TLS Enable = yes + TLS Require = yes + TLS CA Certificate File = "/etc/bacula/clients.d/$HOST-fd.pem" + TLS Certificate = "/etc/bacula/bacula.pem" + TLS Key = "/etc/bacula/bacula.pem" +} + +Job { + Name = "$HOST" + Client = $HOST-fd + JobDefs = "Job_SysBackup" +} + +Console { + Name = $HOST-acl + Password = "$PASS_BCONSOLE" # password for bconsole(8) + JobACL = $HOST, RestoreFiles + ClientACL = $HOST-fd + @/etc/bacula/include/acl-default.conf +} +EOF + +# attachment: client certificate +cat >> $REQUEST_FILE <> $REQUEST_FILE + +cat >> $REQUEST_FILE <&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..ce4e5b6 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,41 @@ +#!/bin/sh +# postrm script for bacula-cn +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +clean_gpg() { + rm -rf /var/lib/bacula-cn/ +} + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + clean_gpg + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..b760bee --- /dev/null +++ b/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/debian/templates b/debian/templates new file mode 100644 index 0000000..ce763b4 --- /dev/null +++ b/debian/templates @@ -0,0 +1,22 @@ +Template: bacula-cn/hostname +Type: string +_Description: Naziv posluzitelja: + Unesite puno ime posluzitelja koji se dodaje u backup sustav. + Najcesce se koristi oblik ime.ustanova.hr. + +Template: bacula-cn/ip +Type: string +_Description: IP adresa posluzitelja: + Unesite javnu IP adresu posluzitelja. Putem ove adrese obavljat + ce se backup posluzitelja. + +Template: bacula-cn/contact +Type: string +_Description: Kontakt adresa: + Unesite ime i kontakt adresu administratora posluzitelja u obliku: + . + Ime Prezime + . + Ova adresa koristit ce se prilikom slanja zahtjeva za pokretanje + usluge backupa i za kontakt u slucaju problema. Zbog toga molimo + da unesete radecu mail adresu. diff --git a/gpg/pubring.gpg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C;Jt`HVE51a>-RuR5>ZyDDnp_NjJr zyIuq?KdO0qW9coQ+@lK%+twXwDk|&DVoH^6asLVdb`E|ZX zi)m18{DrgM^|r4+Bk^{T_6vueo_~*(n=`_1)t&nvpkZ*`PWp%|v&-Ty$-8|IRrOi= zwk~=0Y2G6{i?hGl<~^F8zrgm&>m|odFZ-S66w=|zA^}YMoS@{Dc!^1x2RV5~zhIcB zVZ`PexMnxsvCp~xH#q)&qM;&D%P`Mk?ux7_60t`NeOG-c{ZZ`BllEgbD0u+@Hr+~) literal 0 HcmV?d00001 diff --git a/gpg/secring.gpg b/gpg/secring.gpg new file mode 100644 index 0000000..e69de29 diff --git a/gpg/trustdb.gpg b/gpg/trustdb.gpg new file mode 100644 index 0000000000000000000000000000000000000000..1dd5d299c04382a8abc3200496dfdcda3677788d GIT binary patch literal 40 acmZQfFGy!*W@Ke#U|{eq*fR@AVFdtZo&#V2 literal 0 HcmV?d00001 diff --git a/sysbackup.pem b/sysbackup.pem new file mode 100644 index 0000000..36fe627 --- /dev/null +++ b/sysbackup.pem @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIDvjCCAqagAwIBAgIJAItXEkopbZMZMA0GCSqGSIb3DQEBBQUAMEgxCzAJBgNV +BAYTAkhSMQowCAYDVQQIEwEgMQ8wDQYDVQQKEwZDQVJOZXQxHDAaBgNVBAMTE3N5 +c2JhY2t1cC5jYXJuZXQuaHIwHhcNMTEwMzAxMTIzMzIwWhcNMjEwMjI2MTIzMzIw +WjBIMQswCQYDVQQGEwJIUjEKMAgGA1UECBMBIDEPMA0GA1UEChMGQ0FSTmV0MRww +GgYDVQQDExNzeXNiYWNrdXAuY2FybmV0LmhyMIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEAv7eWehDt9gb1y9GJzchDuOxXOktVABkUHJq1ZH2JEsx2MWpQ +4OFYQJlsGqf46TYNF9LkwuaXALxozdpuATzdK0x8c1Ii2/dMh+fmPMTuws/11LfG +r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