]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/tests/encrypt-test
authorGit Backport Process <git@bacula.org>
Wed, 2 Sep 2020 13:11:54 +0000 (15:11 +0200)
committerEric Bollengier <eric@baculasystems.com>
Tue, 1 Mar 2022 14:36:18 +0000 (15:36 +0100)
This commit is the result of the squash of the following main commits:

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Jul 21 10:28:13 2020 +0200

    regress: Add copyright to regress scripts

Author: Kern Sibbald <kern@sibbald.com>
Date:   Sat Jul 16 10:37:54 2016 +0200

    regress: use correct variable to execute scripts

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Dec 10 16:35:08 2013 +0100

    regress: Add encrypt-test to test new PkiCipher and PkiDigest directives

regress/tests/encrypt-test [new file with mode: 0755]

diff --git a/regress/tests/encrypt-test b/regress/tests/encrypt-test
new file mode 100755 (executable)
index 0000000..010e515
--- /dev/null
@@ -0,0 +1,133 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2020 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Run tests with encryption configuration (cipher and digest)
+#
+TestName="encrypt-test"
+JobName=Crypto
+. scripts/functions
+
+scripts/cleanup
+scripts/copy-crypto-confs
+echo "${cwd}/build" >${cwd}/tmp/file-list
+
+$bperl -e 'add_attribute("$conf/bacula-fd.conf", "Pki Cipher", "aes256", "FileDaemon")'
+
+change_jobname NightlySave $JobName
+start_test
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+@$out ${cwd}/tmp/log1.out
+label storage=File volume=TestVolume001
+END_OF_DATA
+
+run_bacula
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out ${cwd}/tmp/log1.out
+@#setdebug level=10 fd
+purge volume=TestVolume001 yes
+run level=full job=$JobName yes
+wait
+messages
+@# 
+@# now do a restore
+@#
+@$out ${cwd}/tmp/log2.out
+@#setdebug level=10 fd
+restore where=${cwd}/tmp/bacula-restores storage=File
+5
+mark *
+done
+yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+
+check_two_logs
+check_restore_diff
+
+################################################################
+# test with a different combination
+
+$bperl -e 'add_attribute("$conf/bacula-fd.conf", "Pki Digest", "sha256", "FileDaemon")'
+$bperl -e 'add_attribute("$conf/bacula-fd.conf", "Pki Cipher", "aes192", "FileDaemon")'
+$scripts/bacula-ctl-fd restart
+
+rm -rf $cwd/tmp/bacula-restores
+
+run_bconsole
+check_two_logs
+check_restore_diff
+
+################################################################
+
+# $bperl -e 'add_attribute("$conf/bacula-fd.conf", "Pki Digest", "sha512", "FileDaemon")'
+# $scripts/bacula-ctl-fd restart
+# 
+# rm -rf $cwd/tmp/bacula-restores
+# 
+# run_bconsole
+# check_two_logs
+# check_restore_diff
+
+################################################################
+
+$bperl -e 'add_attribute("$conf/bacula-fd.conf", "Pki Cipher", "blowfish", "FileDaemon")'
+$scripts/bacula-ctl-fd restart
+
+rm -rf $cwd/tmp/bacula-restores
+
+run_bconsole
+check_two_logs
+check_restore_diff
+
+################################################################
+
+touch $cwd/build/po/fr.po
+
+$bperl -e 'add_attribute("$conf/bacula-fd.conf", "Pki Cipher", "aes256", "FileDaemon")'
+
+# run incremental job with a different cipher
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out ${cwd}/tmp/log1.out
+@#setdebug level=10 fd
+run job=$JobName yes
+wait
+messages
+@# 
+@# now do a restore
+@#
+@$out ${cwd}/tmp/log2.out
+@#setdebug level=10 fd
+restore where=${cwd}/tmp/bacula-restores storage=File
+5
+mark *
+done
+yes
+wait
+messages
+quit
+END_OF_DATA
+
+$scripts/bacula-ctl-fd restart
+
+rm -rf $cwd/tmp/bacula-restores
+
+run_bconsole
+check_two_logs
+check_restore_diff
+
+################################################################
+
+check_for_zombie_jobs storage=File 
+stop_bacula
+
+end_test