From 58ebf9d2efc8b75765da5950631dce6fe633da79 Mon Sep 17 00:00:00 2001 From: "William Hirigoyen (Evolix)" Date: Wed, 10 Nov 2021 15:24:56 +0100 Subject: [PATCH 01/37] Add time unit for retention policy status display (bkctld status). --- lib/bkctld-status | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bkctld-status b/lib/bkctld-status index e815927..e375610 100755 --- a/lib/bkctld-status +++ b/lib/bkctld-status @@ -18,7 +18,7 @@ incs_policy="0" if [ -r "${incs_policy_file}" ]; then days=$(grep "^\+" "${incs_policy_file}" | grep --count "day") months=$(grep "^\+" "${incs_policy_file}" | grep --count "month") - incs_policy="${days}/${months}" + incs_policy="${days}d/${months}m" fi status="OFF" From edcec2d619e5c1f2341de8e4623f2cdbf0568000 Mon Sep 17 00:00:00 2001 From: "William Hirigoyen (Evolix)" Date: Tue, 16 Nov 2021 17:45:37 +0100 Subject: [PATCH 02/37] Add location of build files in docs/debian.md. --- docs/debian.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/debian.md b/docs/debian.md index e99b0cf..2bb9843 100644 --- a/docs/debian.md +++ b/docs/debian.md @@ -49,3 +49,6 @@ Launch git-buildpackage : ~~~ gbp buildpackage ~~~ + +The generated build files (including the `.deb`) are located in the `/tmp/bkctld/` directory. + From 0aa233d9396436c6ac9cf39540522f75549e394d Mon Sep 17 00:00:00 2001 From: "William Hirigoyen (Evolix)" Date: Wed, 17 Nov 2021 15:34:39 +0100 Subject: [PATCH 03/37] Exclude /var/tmp from backups in zzz_evobackup --- zzz_evobackup | 1 + 1 file changed, 1 insertion(+) diff --git a/zzz_evobackup b/zzz_evobackup index ee47aa6..c906c64 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -432,6 +432,7 @@ if [ "${SYNC_TASKS}" = "1" ]; then --exclude "/var/spool/smtpd" \ --exclude "/var/spool/squid" \ --exclude "/var/state" \ + --exclude "/var/tmp" \ --exclude "lxc/*/rootfs/usr/doc" \ --exclude "lxc/*/rootfs/usr/obj" \ --exclude "lxc/*/rootfs/usr/share/doc" \ From bca2d1147e65a04faef0d02e151d9c8dfd948c13 Mon Sep 17 00:00:00 2001 From: "William Hirigoyen (Evolix)" Date: Wed, 17 Nov 2021 15:55:03 +0100 Subject: [PATCH 04/37] Fix apt source.list --- docs/install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install.md b/docs/install.md index bfb6d7d..5760174 100644 --- a/docs/install.md +++ b/docs/install.md @@ -5,7 +5,7 @@ A Debian package is available in the Evolix repository ~~~ -echo "http://pub.evolix.net/jessie/" >> /etc/apt/sources.list +echo "deb http://pub.evolix.net/ stretch" >> /etc/apt/sources.list apt update apt install bkctld ~~~ From 4f9b56d7a4f65a537342910e5447221f29537533 Mon Sep 17 00:00:00 2001 From: Brice Waegeneire Date: Wed, 17 Nov 2021 15:13:58 +0100 Subject: [PATCH 05/37] Add bullseye to to the test suite --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 144f9c3..96d4030 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +* Run the test suite on Bullseye (ext4/btrfs) in addition of Stretch and Buster (ext4/btrfs) + ### Changed ### Deprecated From 0b777b4a3f6b1874e33f3e8dea24b07702973edc Mon Sep 17 00:00:00 2001 From: "William Hirigoyen (Evolix)" Date: Fri, 3 Dec 2021 15:16:59 +0100 Subject: [PATCH 06/37] Add a header for bktcld status output. --- bkctld | 1 + lib/bkctld-status | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bkctld b/bkctld index 05ba7a7..0dcba68 100755 --- a/bkctld +++ b/bkctld @@ -116,6 +116,7 @@ case "${subcommand}" in ;; "status") jail_name="${2:-}" + printf '%-30s %-10s %-10s %-10s %-40s\n' 'Jail name' 'Status' 'Port' 'Retention policy (day/month)' 'IP' if [ "${jail_name}" = "all" ] || [ -z "${jail_name}" ]; then for jail in $("${LIBDIR}/bkctld-list"); do "${LIBDIR}/bkctld-${subcommand}" "${jail}" diff --git a/lib/bkctld-status b/lib/bkctld-status index e375610..e815927 100755 --- a/lib/bkctld-status +++ b/lib/bkctld-status @@ -18,7 +18,7 @@ incs_policy="0" if [ -r "${incs_policy_file}" ]; then days=$(grep "^\+" "${incs_policy_file}" | grep --count "day") months=$(grep "^\+" "${incs_policy_file}" | grep --count "month") - incs_policy="${days}d/${months}m" + incs_policy="${days}/${months}" fi status="OFF" From f8db74797097f478f6744c7e07c0ddcfd2dd649b Mon Sep 17 00:00:00 2001 From: "William Hirigoyen (Evolix)" Date: Fri, 3 Dec 2021 15:36:54 +0100 Subject: [PATCH 07/37] Header in uppercase, enlarge column RETENTION --- bkctld | 2 +- lib/bkctld-status | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bkctld b/bkctld index 0dcba68..a69ba92 100755 --- a/bkctld +++ b/bkctld @@ -116,7 +116,7 @@ case "${subcommand}" in ;; "status") jail_name="${2:-}" - printf '%-30s %-10s %-10s %-10s %-40s\n' 'Jail name' 'Status' 'Port' 'Retention policy (day/month)' 'IP' + printf '%-30s %-10s %-10s %-25s %-40s\n' 'JAIL NAME' 'STATUS' 'PORT' 'RETENTION (DAY/MONTH)' 'IP' if [ "${jail_name}" = "all" ] || [ -z "${jail_name}" ]; then for jail in $("${LIBDIR}/bkctld-list"); do "${LIBDIR}/bkctld-${subcommand}" "${jail}" diff --git a/lib/bkctld-status b/lib/bkctld-status index e815927..72b23ad 100755 --- a/lib/bkctld-status +++ b/lib/bkctld-status @@ -27,4 +27,4 @@ status="OFF" port=$("${LIBDIR}/bkctld-port" "${jail_name}") ip=$("${LIBDIR}/bkctld-ip" "${jail_name}" | xargs | tr -s ' ' ',') -echo "${jail_name} ${status} ${port} ${incs_policy} ${ip}" | awk '{ printf("%- 30s %- 10s %- 10s %- 10s %- 40s\n", $1, $2, $3, $4, $5); }' +echo "${jail_name} ${status} ${port} ${incs_policy} ${ip}" | awk '{ printf("%- 30s %- 10s %- 10s %- 25s %- 40s\n", $1, $2, $3, $4, $5); }' From b9bd67488b991056d6371fb7194ab4b574e7bc02 Mon Sep 17 00:00:00 2001 From: "William Hirigoyen (Evolix)" Date: Fri, 24 Dec 2021 10:04:27 +0100 Subject: [PATCH 08/37] Reduce IP column width to avoid empty ligne return --- bkctld | 2 +- lib/bkctld-status | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bkctld b/bkctld index a69ba92..03535d3 100755 --- a/bkctld +++ b/bkctld @@ -116,7 +116,7 @@ case "${subcommand}" in ;; "status") jail_name="${2:-}" - printf '%-30s %-10s %-10s %-25s %-40s\n' 'JAIL NAME' 'STATUS' 'PORT' 'RETENTION (DAY/MONTH)' 'IP' + printf '%-30s %-10s %-10s %-25s %-20s\n' 'JAIL NAME' 'STATUS' 'PORT' 'RETENTION (DAY/MONTH)' 'IP' if [ "${jail_name}" = "all" ] || [ -z "${jail_name}" ]; then for jail in $("${LIBDIR}/bkctld-list"); do "${LIBDIR}/bkctld-${subcommand}" "${jail}" diff --git a/lib/bkctld-status b/lib/bkctld-status index 72b23ad..b7cadbb 100755 --- a/lib/bkctld-status +++ b/lib/bkctld-status @@ -27,4 +27,4 @@ status="OFF" port=$("${LIBDIR}/bkctld-port" "${jail_name}") ip=$("${LIBDIR}/bkctld-ip" "${jail_name}" | xargs | tr -s ' ' ',') -echo "${jail_name} ${status} ${port} ${incs_policy} ${ip}" | awk '{ printf("%- 30s %- 10s %- 10s %- 25s %- 40s\n", $1, $2, $3, $4, $5); }' +echo "${jail_name} ${status} ${port} ${incs_policy} ${ip}" | awk '{ printf("%- 30s %- 10s %- 10s %- 25s %- 20s\n", $1, $2, $3, $4, $5); }' From e6d8f73b421bcec02d76c43ac049cfc8580b710c Mon Sep 17 00:00:00 2001 From: "William Hirigoyen (Evolix)" Date: Fri, 24 Dec 2021 11:36:55 +0100 Subject: [PATCH 09/37] Add exclusions LXC tmp zzz_evobackup --- zzz_evobackup | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zzz_evobackup b/zzz_evobackup index c906c64..ad5e059 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -433,6 +433,7 @@ if [ "${SYNC_TASKS}" = "1" ]; then --exclude "/var/spool/squid" \ --exclude "/var/state" \ --exclude "/var/tmp" \ + --exclude "lxc/*/rootfs/tmp" \ --exclude "lxc/*/rootfs/usr/doc" \ --exclude "lxc/*/rootfs/usr/obj" \ --exclude "lxc/*/rootfs/usr/share/doc" \ @@ -445,6 +446,7 @@ if [ "${SYNC_TASKS}" = "1" ]; then --exclude "lxc/*/rootfs/var/log" \ --exclude "lxc/*/rootfs/var/run" \ --exclude "lxc/*/rootfs/var/state" \ + --exclude "lxc/*/rootfs/var/tmp" \ --exclude "/home/mysqltmp" \ ${rep} \ /etc \ From 3042b72a785570439f55adbe4334201dc9be2e93 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Tue, 25 Jan 2022 17:18:38 +0100 Subject: [PATCH 10/37] evobackup: store log file in /var/log/evobackup/ --- CHANGELOG.md | 2 ++ zzz_evobackup | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96d4030..b985f8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +* evobackup: store logs in /var/log/evobackup + ### Deprecated ### Removed diff --git a/zzz_evobackup b/zzz_evobackup index ad5e059..88890ee 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -39,9 +39,9 @@ LOCAL_BACKUP_DIR="/home/backup" SYSTEM=$(uname | tr '[:upper:]' '[:lower:]') # Store pid and logs in a file named after this program's name -PROGNAME=$(basename $0) +PROGNAME=$(basename "$0") PIDFILE="/var/run/${PROGNAME}.pid" -LOGFILE="/var/log/${PROGNAME}.log" +LOGFILE="/var/log/evobackup/${PROGNAME}.log" # Enable/Disable tasks LOCAL_TASKS=${LOCAL_TASKS:-1} @@ -53,6 +53,8 @@ BEGINNING=$(/bin/date +"%d-%m-%Y ; %H:%M") # shellcheck disable=SC2174 mkdir -p -m 700 ${LOCAL_BACKUP_DIR} +# shellcheck disable=SC2174 +mkdir -p -m 700 "$(dirname "${LOGFILE}")" PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin @@ -102,7 +104,7 @@ pick_server() { # Log errors to stderr printf "%s\\n" "${SERVERS_SSH_ERRORS}" >&2 # Log errors to logfile - printf "%s\\n" "${SERVERS_SSH_ERRORS}" >> $LOGFILE + printf "%s\\n" "${SERVERS_SSH_ERRORS}" >> "${LOGFILE}" return 1 fi @@ -133,10 +135,10 @@ if [ -e "${PIDFILE}" ]; then kill -9 "${pid}" printf "%s is still running (PID %s). Process has been killed" "$0" "${pid}\\n" >&2 else - rm -f ${PIDFILE} + rm -f "${PIDFILE}" fi fi -echo "$$" > ${PIDFILE} +echo "$$" > "${PIDFILE}" # shellcheck disable=SC2064 trap "rm -f ${PIDFILE}" EXIT @@ -464,12 +466,12 @@ END=$(/bin/date +"%d-%m-%Y ; %H:%M") printf "EvoBackup - %s - START %s ON %s (LOCAL_TASKS=%s SYNC_TASKS=%s)\\n" \ "${HOSTNAME}" "${BEGINNING}" "${SSH_SERVER}" "${LOCAL_TASKS}" "${SYNC_TASKS}" \ - >> $LOGFILE + >> "${LOGFILE}" printf "EvoBackup - %s - STOP %s ON %s (LOCAL_TASKS=%s SYNC_TASKS=%s)\\n" \ "${HOSTNAME}" "${END}" "${SSH_SERVER}" "${LOCAL_TASKS}" "${SYNC_TASKS}" \ - >> $LOGFILE + >> "${LOGFILE}" -tail -10 $LOGFILE | \ +tail -10 "${LOGFILE}" | \ mail -s "[info] EvoBackup - Client ${HOSTNAME}" \ ${MAIL} From 45f057bce837b18cb0b94f2eeba957a3a29af630 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Tue, 25 Jan 2022 19:01:54 +0100 Subject: [PATCH 11/37] /var/log is no longer excluded --- CHANGELOG.md | 1 + zzz_evobackup | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b985f8e..de3ecb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed * evobackup: store logs in /var/log/evobackup +* evobackup: /var/log is no longer excluded ### Deprecated diff --git a/zzz_evobackup b/zzz_evobackup index 88890ee..9b29cca 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -427,8 +427,6 @@ if [ "${SYNC_TASKS}" = "1" ]; then --exclude "/var/lib/postgresql" \ --exclude "/var/lib/sympa" \ --exclude "/var/lock" \ - --exclude "/var/log" \ - --exclude "/var/log/evobackup*" \ --exclude "/var/run" \ --exclude "/var/spool/postfix" \ --exclude "/var/spool/smtpd" \ From 06f6c54d8ceebadc0599ba732ead0281a1c7761a Mon Sep 17 00:00:00 2001 From: "William Hirigoyen (Evolix)" Date: Wed, 26 Jan 2022 09:18:30 +0100 Subject: [PATCH 12/37] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de3ecb4..e9729b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * Run the test suite on Bullseye (ext4/btrfs) in addition of Stretch and Buster (ext4/btrfs) +* evobackup : exclude tmp directories of LXC containers. +* Add a header in `bkctld status` output and improved columns width. ### Changed From 82e111adc808ce0d291646c6791618e6360153d6 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 26 Jan 2022 11:42:52 +0100 Subject: [PATCH 13/37] Reorganize logging --- zzz_evobackup | 106 ++++++++++++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 46 deletions(-) diff --git a/zzz_evobackup b/zzz_evobackup index 9b29cca..d68a1c6 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -38,23 +38,26 @@ LOCAL_BACKUP_DIR="/home/backup" # You can set "linux" or "bsd" manually or let it choose automatically SYSTEM=$(uname | tr '[:upper:]' '[:lower:]') -# Store pid and logs in a file named after this program's name +# Store pid in a file named after this program's name PROGNAME=$(basename "$0") PIDFILE="/var/run/${PROGNAME}.pid" -LOGFILE="/var/log/evobackup/${PROGNAME}.log" + +# Customize the log path if you have multiple scripts and with separate logs +LOGFILE="/var/log/evobackup.log" # Enable/Disable tasks LOCAL_TASKS=${LOCAL_TASKS:-1} SYNC_TASKS=${SYNC_TASKS:-1} +HOSTNAME=$(hostname) + ##### SETUP AND FUNCTIONS ############################################# -BEGINNING=$(/bin/date +"%d-%m-%Y ; %H:%M") +START_EPOCH=$(/bin/date +%s) +DATE_FORMAT="%Y-%m-%d %H:%M:%S" # shellcheck disable=SC2174 mkdir -p -m 700 ${LOCAL_BACKUP_DIR} -# shellcheck disable=SC2174 -mkdir -p -m 700 "$(dirname "${LOGFILE}")" PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin @@ -121,6 +124,15 @@ pick_server() { echo "${SERVERS}" | cut -d' ' -f${field} } +log() { + msg="${1:-$(cat /dev/stdin)}" + pid=$$ + printf "[%s] %s[%s]: %s\\n" \ + "$(/bin/date +${DATE_FORMAT})" "${PROGNAME}" "${pid}" "${msg}" \ + >> "${LOGFILE}" +} + +log "START GLOBAL - LOCAL_TASKS=${LOCAL_TASKS} SYNC_TASKS=${SYNC_TASKS}" ## Verify other evobackup process and kill if needed if [ -e "${PIDFILE}" ]; then @@ -145,6 +157,8 @@ trap "rm -f ${PIDFILE}" EXIT ##### LOCAL BACKUP #################################################### if [ "${LOCAL_TASKS}" = "1" ]; then + log "START LOCAL_TASKS" + # You can comment or uncomment sections below to customize the backup ## OpenLDAP : example with slapcat @@ -358,43 +372,44 @@ if [ "${LOCAL_TASKS}" = "1" ]; then #getfacl -R /usr > ${LOCAL_BACKUP_DIR}/rights-usr.txt #getfacl -R /home > ${LOCAL_BACKUP_DIR}/rights-home.txt + log "STOP LOCAL_TASKS" fi ##### REMOTE BACKUP ################################################### -n=0 -server="" -if [ "${SERVERS_FALLBACK}" = "1" ]; then - # We try to find a suitable server - while :; do - server=$(pick_server "${n}") - test $? = 0 || exit 2 - - if test_server "${server}"; then - break - else - server="" - n=$(( n + 1 )) - fi - done -else - # we force the server - server=$(pick_server "${n}") -fi - -SSH_SERVER=$(echo "${server}" | cut -d':' -f1) -SSH_PORT=$(echo "${server}" | cut -d':' -f2) - -HOSTNAME=$(hostname) - -if [ "${SYSTEM}" = "linux" ]; then - rep="/bin /boot /lib /opt /sbin /usr" -else - rep="/bsd /bin /sbin /usr" -fi - if [ "${SYNC_TASKS}" = "1" ]; then + n=0 + server="" + if [ "${SERVERS_FALLBACK}" = "1" ]; then + # We try to find a suitable server + while :; do + server=$(pick_server "${n}") + test $? = 0 || exit 2 + + if test_server "${server}"; then + break + else + server="" + n=$(( n + 1 )) + fi + done + else + # we force the server + server=$(pick_server "${n}") + fi + + SSH_SERVER=$(echo "${server}" | cut -d':' -f1) + SSH_PORT=$(echo "${server}" | cut -d':' -f2) + + if [ "${SYSTEM}" = "linux" ]; then + rep="/bin /boot /lib /opt /sbin /usr" + else + rep="/bsd /bin /sbin /usr" + fi + + log "START SYNC_TASKS - server=${server}" + # /!\ DO NOT USE COMMENTS in the rsync command /!\ # It breaks the command and destroys data, simply remove (or add) lines. @@ -456,20 +471,19 @@ if [ "${SYNC_TASKS}" = "1" ]; then -e "${RSH_COMMAND}" \ "root@${SSH_SERVER}:/var/backup/" \ | tail -30 >> $LOGFILE + + log "STOP SYNC_TASKS - server=${server}" fi ##### REPORTING ####################################################### -END=$(/bin/date +"%d-%m-%Y ; %H:%M") +STOP_EPOCH=$(/bin/date +%s) -printf "EvoBackup - %s - START %s ON %s (LOCAL_TASKS=%s SYNC_TASKS=%s)\\n" \ - "${HOSTNAME}" "${BEGINNING}" "${SSH_SERVER}" "${LOCAL_TASKS}" "${SYNC_TASKS}" \ - >> "${LOGFILE}" +start=$(/bin/date --date="@${START_EPOCH}" +"${DATE_FORMAT}") +stop=$(/bin/date --date="@${STOP_EPOCH}" +"${DATE_FORMAT}") +duration=$(( STOP_EPOCH - START_EPOCH )) -printf "EvoBackup - %s - STOP %s ON %s (LOCAL_TASKS=%s SYNC_TASKS=%s)\\n" \ - "${HOSTNAME}" "${END}" "${SSH_SERVER}" "${LOCAL_TASKS}" "${SYNC_TASKS}" \ - >> "${LOGFILE}" +log "STOP GLOBAL - start='${start}' stop='${stop}' duration=${duration}s" -tail -10 "${LOGFILE}" | \ - mail -s "[info] EvoBackup - Client ${HOSTNAME}" \ - ${MAIL} +tail -20 "${LOGFILE}" \ + | mail -s "[info] EvoBackup - Client ${HOSTNAME}" ${MAIL} From aba4a9f9926b37351c71abc998393c48bbbb3ad2 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Wed, 26 Jan 2022 12:00:07 +0100 Subject: [PATCH 14/37] =?UTF-8?q?am=C3=A9lioration=20du=20log=20d'erreurs?= =?UTF-8?q?=20SSH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zzz_evobackup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zzz_evobackup b/zzz_evobackup index d68a1c6..db475a3 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -89,6 +89,7 @@ test_server() { else # SSH connection failed new_error=$(printf "Failed to connect to \`%s' within %s seconds" "${item}" "${SSH_CONNECT_TIMEOUT}") + log "${new_error}" SERVERS_SSH_ERRORS=$(printf "%s\\n%s" "${SERVERS_SSH_ERRORS}" "${new_error}" | sed -e '/^$/d') return 1 @@ -102,12 +103,11 @@ pick_server() { if [ "${increment}" -ge "${list_length}" ]; then # We've reached the end of the list new_error="No more server available" + log "${new_error}" SERVERS_SSH_ERRORS=$(printf "%s\\n%s" "${SERVERS_SSH_ERRORS}" "${new_error}" | sed -e '/^$/d') # Log errors to stderr printf "%s\\n" "${SERVERS_SSH_ERRORS}" >&2 - # Log errors to logfile - printf "%s\\n" "${SERVERS_SSH_ERRORS}" >> "${LOGFILE}" return 1 fi From fa8d8cfd845a5e67658b3b656d5d0deed2881363 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 27 Jan 2022 12:05:18 +0100 Subject: [PATCH 15/37] zzz_evobackup: log version --- zzz_evobackup | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zzz_evobackup b/zzz_evobackup index db475a3..07f0893 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -20,6 +20,8 @@ set -u ##### Configuration ################################################### +VERSION="22.01" + # email adress for notifications MAIL=jdoe@example.com @@ -132,7 +134,7 @@ log() { >> "${LOGFILE}" } -log "START GLOBAL - LOCAL_TASKS=${LOCAL_TASKS} SYNC_TASKS=${SYNC_TASKS}" +log "START GLOBAL - VERSION=${VERSION} LOCAL_TASKS=${LOCAL_TASKS} SYNC_TASKS=${SYNC_TASKS}" ## Verify other evobackup process and kill if needed if [ -e "${PIDFILE}" ]; then From 15c9682be12bd9eed6cd863b673170d6beb4196f Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 27 Jan 2022 12:08:00 +0100 Subject: [PATCH 16/37] zzz_evobackup: use "backup-server-state script if available --- zzz_evobackup | 103 +++++++++++++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 39 deletions(-) diff --git a/zzz_evobackup b/zzz_evobackup index 07f0893..e87bbb1 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -313,66 +313,91 @@ if [ "${LOCAL_TASKS}" = "1" ]; then #megacli -CfgSave -f ${LOCAL_BACKUP_DIR}/megacli_conf.dump -a0 >/dev/null - ## Dump system and kernel versions - uname -a > ${LOCAL_BACKUP_DIR}/uname - ## Dump network routes with mtr and traceroute (warning: could be long with aggressive firewalls) for addr in 8.8.8.8 www.evolix.fr travaux.evolix.net; do mtr -r ${addr} > ${LOCAL_BACKUP_DIR}/mtr-${addr} traceroute -n ${addr} > ${LOCAL_BACKUP_DIR}/traceroute-${addr} 2>&1 done - ## Dump process with ps - ps auwwx >${LOCAL_BACKUP_DIR}/ps.out + server_state_dir="${LOCAL_BACKUP_DIR}/server-state" + + backup_server_state_bin=$(command -v backup-server-state) if [ "${SYSTEM}" = "linux" ]; then - ## Dump network connections with ss - ss -taupen > ${LOCAL_BACKUP_DIR}/netstat.out + if [ -n "${backup_server_state_bin}" ]; then + rm -rf "${server_state_dir}" - ## List Debian packages - dpkg -l > ${LOCAL_BACKUP_DIR}/packages - dpkg --get-selections > ${LOCAL_BACKUP_DIR}/packages.getselections - apt-cache dumpavail > ${LOCAL_BACKUP_DIR}/packages.available + ${backup_server_state_bin} --etc --dpkg-full --backup-directory "${server_state_dir}" + else + mkdir -p "${server_state_dir}" - ## Dump MBR / table partitions - disks=$(lsblk -l | grep disk | grep -v -E '(drbd|fd[0-9]+)' | awk '{print $1}') - for disk in ${disks}; do - dd if="/dev/${disk}" of="${LOCAL_BACKUP_DIR}/MBR-${disk}" bs=512 count=1 2>&1 | grep -Ev "(records in|records out|512 bytes)" - fdisk -l "/dev/${disk}" > "${LOCAL_BACKUP_DIR}/partitions-${disk}" 2>&1 - done - cat ${LOCAL_BACKUP_DIR}/partitions-* > ${LOCAL_BACKUP_DIR}/partitions + ## Dump system and kernel versions + uname -a > ${server_state_dir}/uname.txt - ## Dump iptables - if [ -x /sbin/iptables ]; then - { /sbin/iptables -L -n -v; /sbin/iptables -t filter -L -n -v; } > ${LOCAL_BACKUP_DIR}/iptables.txt - fi + ## Dump process with ps + ps auwwx > ${server_state_dir}/ps.txt - ## Dump findmnt(8) output - FINDMNT_BIN=$(command -v findmnt) - if [ -x "${FINDMNT_BIN}" ]; then - ${FINDMNT_BIN} > ${LOCAL_BACKUP_DIR}/findmnt.txt + ## Dump network connections with ss + ss -taupen > ${server_state_dir}/netstat.txt + + ## List Debian packages + dpkg -l > ${server_state_dir}/packages + dpkg --get-selections > ${server_state_dir}/packages.getselections + apt-cache dumpavail > ${server_state_dir}/packages.available + + ## Dump iptables + if [ -x /sbin/iptables ]; then + { /sbin/iptables -L -n -v; /sbin/iptables -t filter -L -n -v; } > ${server_state_dir}/iptables.txt + fi + + ## Dump findmnt(8) output + FINDMNT_BIN=$(command -v findmnt) + if [ -x "${FINDMNT_BIN}" ]; then + ${FINDMNT_BIN} > ${server_state_dir}/findmnt.txt + fi + + ## Dump MBR / table partitions + disks=$(lsblk -l | grep disk | grep -v -E '(drbd|fd[0-9]+)' | awk '{print $1}') + for disk in ${disks}; do + dd if="/dev/${disk}" of="${server_state_dir}/MBR-${disk}" bs=512 count=1 2>&1 | grep -Ev "(records in|records out|512 bytes)" + fdisk -l "/dev/${disk}" > "${server_state_dir}/partitions-${disk}" 2>&1 + done + cat ${server_state_dir}/partitions-* > ${server_state_dir}/partitions fi else - ## Dump network connections with fstat - fstat | head -1 > ${LOCAL_BACKUP_DIR}/netstat.out - fstat | grep internet >> ${LOCAL_BACKUP_DIR}/netstat.out + if [ -n "${backup_server_state_bin}" ]; then + rm -rf "${server_state_dir}" - ## List OpenBSD packages - pkg_info -m > ${LOCAL_BACKUP_DIR}/packages + ${backup_server_state_bin} --backup-directory "${server_state_dir}" + else + mkdir -p "${server_state_dir}" - ## Dump MBR / table partitions - disklabel sd0 > ${LOCAL_BACKUP_DIR}/partitions + ## Dump system and kernel versions + uname -a > ${server_state_dir}/uname - ## Dump pf infos - pfctl -sa > ${LOCAL_BACKUP_DIR}/pfctl-sa.txt + ## Dump process with ps + ps auwwx > ${server_state_dir}/ps.out + ## Dump network connections with fstat + fstat | head -1 > ${server_state_dir}/netstat.out + fstat | grep internet >> ${server_state_dir}/netstat.out + + ## List OpenBSD packages + pkg_info -m > ${server_state_dir}/packages + + ## Dump MBR / table partitions + disklabel sd0 > ${server_state_dir}/partitions + + ## Dump pf infos + pfctl -sa > ${server_state_dir}/pfctl-sa.txt + fi fi ## Dump rights - #getfacl -R /var > ${LOCAL_BACKUP_DIR}/rights-var.txt - #getfacl -R /etc > ${LOCAL_BACKUP_DIR}/rights-etc.txt - #getfacl -R /usr > ${LOCAL_BACKUP_DIR}/rights-usr.txt - #getfacl -R /home > ${LOCAL_BACKUP_DIR}/rights-home.txt + #getfacl -R /var > ${server_state_dir}/rights-var.txt + #getfacl -R /etc > ${server_state_dir}/rights-etc.txt + #getfacl -R /usr > ${server_state_dir}/rights-usr.txt + #getfacl -R /home > ${server_state_dir}/rights-home.txt log "STOP LOCAL_TASKS" fi From 0705625dbd56c46e723714e9f080cd963de37ccf Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 27 Jan 2022 13:55:14 +0100 Subject: [PATCH 17/37] fix date syntax --- zzz_evobackup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zzz_evobackup b/zzz_evobackup index e87bbb1..4f23756 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -114,7 +114,7 @@ pick_server() { fi # Extract the day of month, without leading 0 (which would give an octal based number) - today=$(date +%e) + today=$(/bin/date +%e) # A salt is useful to randomize the starting point in the list # but stay identical each time it's called for a server (based on hostname). salt=$(hostname | cksum | cut -d' ' -f1) @@ -130,7 +130,7 @@ log() { msg="${1:-$(cat /dev/stdin)}" pid=$$ printf "[%s] %s[%s]: %s\\n" \ - "$(/bin/date +${DATE_FORMAT})" "${PROGNAME}" "${pid}" "${msg}" \ + "$(/bin/date +"${DATE_FORMAT}")" "${PROGNAME}" "${pid}" "${msg}" \ >> "${LOGFILE}" } @@ -301,7 +301,7 @@ if [ "${LOCAL_TASKS}" = "1" ]; then # for snapshot in $(curl -s -XGET "localhost:9200/_snapshot/snaprepo/_all?pretty=true" | grep -Eo 'snapshot_[0-9]{4}-[0-9]{2}-[0-9]{2}' | head -n -10); do # curl -s -XDELETE "localhost:9200/_snapshot/snaprepo/${snapshot}" | grep -v -Fx '{"acknowledged":true}' # done - # date=$(date +%F) + # date=$(/bin/date +%F) # curl -s -XPUT "localhost:9200/_snapshot/snaprepo/snapshot_${date}?wait_for_completion=true" -o /tmp/es_snapshot_${date}.log ## RabbitMQ From 8b72415669d3e1e055757eee5682b0653aaf5502 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 27 Jan 2022 13:57:56 +0100 Subject: [PATCH 18/37] variable plus explicite --- zzz_evobackup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zzz_evobackup b/zzz_evobackup index 4f23756..d8993fa 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -506,11 +506,11 @@ fi STOP_EPOCH=$(/bin/date +%s) -start=$(/bin/date --date="@${START_EPOCH}" +"${DATE_FORMAT}") -stop=$(/bin/date --date="@${STOP_EPOCH}" +"${DATE_FORMAT}") +start_time=$(/bin/date --date="@${START_EPOCH}" +"${DATE_FORMAT}") +stop_time=$(/bin/date --date="@${STOP_EPOCH}" +"${DATE_FORMAT}") duration=$(( STOP_EPOCH - START_EPOCH )) -log "STOP GLOBAL - start='${start}' stop='${stop}' duration=${duration}s" +log "STOP GLOBAL - start='${start_time}' stop='${stop_time}' duration=${duration}s" tail -20 "${LOGFILE}" \ | mail -s "[info] EvoBackup - Client ${HOSTNAME}" ${MAIL} From 8020a357a60914ceb4350c06d8750b608942636b Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Fri, 28 Jan 2022 16:29:48 +0100 Subject: [PATCH 19/37] use force mode for backup-server-state --- zzz_evobackup | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/zzz_evobackup b/zzz_evobackup index d8993fa..c4b6914 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -325,9 +325,7 @@ if [ "${LOCAL_TASKS}" = "1" ]; then if [ "${SYSTEM}" = "linux" ]; then if [ -n "${backup_server_state_bin}" ]; then - rm -rf "${server_state_dir}" - - ${backup_server_state_bin} --etc --dpkg-full --backup-directory "${server_state_dir}" + ${backup_server_state_bin} --etc --dpkg-full --force --backup-directory "${server_state_dir}" else mkdir -p "${server_state_dir}" @@ -366,9 +364,7 @@ if [ "${LOCAL_TASKS}" = "1" ]; then fi else if [ -n "${backup_server_state_bin}" ]; then - rm -rf "${server_state_dir}" - - ${backup_server_state_bin} --backup-directory "${server_state_dir}" + ${backup_server_state_bin} --force --backup-directory "${server_state_dir}" else mkdir -p "${server_state_dir}" From dc70f9937ca17efee6c7c33e552e57335fe3d3da Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Mon, 31 Jan 2022 09:38:10 +0100 Subject: [PATCH 20/37] fix backup-server-state option --- zzz_evobackup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zzz_evobackup b/zzz_evobackup index c4b6914..d39c40a 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -325,7 +325,7 @@ if [ "${LOCAL_TASKS}" = "1" ]; then if [ "${SYSTEM}" = "linux" ]; then if [ -n "${backup_server_state_bin}" ]; then - ${backup_server_state_bin} --etc --dpkg-full --force --backup-directory "${server_state_dir}" + ${backup_server_state_bin} --etc --dpkg-full --force --backup-dir "${server_state_dir}" else mkdir -p "${server_state_dir}" @@ -364,7 +364,7 @@ if [ "${LOCAL_TASKS}" = "1" ]; then fi else if [ -n "${backup_server_state_bin}" ]; then - ${backup_server_state_bin} --force --backup-directory "${server_state_dir}" + ${backup_server_state_bin} --force --backup-dir "${server_state_dir}" else mkdir -p "${server_state_dir}" From 0a3d7996a77c104c4540cfb220162fc70e845f1f Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 3 Feb 2022 16:05:34 +0100 Subject: [PATCH 21/37] fix nettoyage de dumps PG --- zzz_evobackup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zzz_evobackup b/zzz_evobackup index d39c40a..4a84fef 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -228,9 +228,9 @@ if [ "${LOCAL_TASKS}" = "1" ]; then ## PostgreSQL ## Purge previous dumps - # rm ${LOCAL_BACKUP_DIR}/pg.*.gz - # rm ${LOCAL_BACKUP_DIR}/pg-backup.tar - # rm ${LOCAL_BACKUP_DIR}/postgresql/* + # rm -rf ${LOCAL_BACKUP_DIR}/pg.*.gz + # rm -rf ${LOCAL_BACKUP_DIR}/pg-backup.tar + # rm -rf ${LOCAL_BACKUP_DIR}/postgresql/* ## example with pg_dumpall (warning: you need space in ~postgres) # su - postgres -c "pg_dumpall > ~/pg.dump.bak" # mv ~postgres/pg.dump.bak ${LOCAL_BACKUP_DIR}/ From 43826224e32794b74406d92606267b1493b25469 Mon Sep 17 00:00:00 2001 From: "William Hirigoyen (Evolix)" Date: Tue, 22 Feb 2022 14:56:34 +0100 Subject: [PATCH 22/37] Fix insecable space --- lib/bkctld-init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bkctld-init b/lib/bkctld-init index 1e35f19..37a9f78 100755 --- a/lib/bkctld-init +++ b/lib/bkctld-init @@ -19,7 +19,7 @@ test -d "${jail_path}" && error "Skip jail \`${jail_name}' : it already exists" mkdir --parents "${CONFDIR}" "${JAILDIR}" btrfs_bin=$(command -v btrfs) -if [ -z ${btrfs_bin} ]; then +if [ -z ${btrfs_bin} ]; then error "btrfs not found. Please install brtfs-progs." fi From efd8d980c23b6ce0a0c1da4192c4eb6460074813 Mon Sep 17 00:00:00 2001 From: "William Hirigoyen (Evolix)" Date: Tue, 22 Feb 2022 15:30:32 +0100 Subject: [PATCH 23/37] Fix insecable space --- lib/bkctld-inc-lock | 4 ++-- lib/bkctld-remove | 2 +- lib/bkctld-rm | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/bkctld-inc-lock b/lib/bkctld-inc-lock index a71edf0..0888396 100755 --- a/lib/bkctld-inc-lock +++ b/lib/bkctld-inc-lock @@ -13,7 +13,7 @@ target_path="${2:?}" lock_target() { target="${1:?}" btrfs_bin=$(command -v btrfs) - if [ -z ${btrfs_bin} ]; then + if [ -z ${btrfs_bin} ]; then error "btrfs not found. Please install brtfs-progs." fi if is_btrfs "${target}"; then @@ -26,7 +26,7 @@ lock_target() { unlock_target() { target="${1:?}" btrfs_bin=$(command -v btrfs) - if [ -z ${btrfs_bin} ]; then + if [ -z ${btrfs_bin} ]; then error "btrfs not found. Please install brtfs-progs." fi if is_btrfs "${target}"; then diff --git a/lib/bkctld-remove b/lib/bkctld-remove index 731d414..fec8015 100755 --- a/lib/bkctld-remove +++ b/lib/bkctld-remove @@ -53,7 +53,7 @@ rm -f "${CONFDIR}/${jail_name}" rm -rf "$(jail_config_dir "${jail_name}")" btrfs_bin=$(command -v btrfs) -if [ -z ${btrfs_bin} ]; then +if [ -z ${btrfs_bin} ]; then error "btrfs not found. Please install brtfs-progs." fi diff --git a/lib/bkctld-rm b/lib/bkctld-rm index 926877e..c5b8dde 100755 --- a/lib/bkctld-rm +++ b/lib/bkctld-rm @@ -63,7 +63,7 @@ delete_inc_btrfs() { inc_path=$(inc_path "${jail_name}" "${inc_name}") btrfs_bin=$(command -v btrfs) - if [ -z ${btrfs_bin} ]; then + if [ -z ${btrfs_bin} ]; then error "btrfs not found. Please install brtfs-progs." fi From 7f0bb53cd2aefed170bce82ec57a838ec28015a2 Mon Sep 17 00:00:00 2001 From: Eric Morino Date: Wed, 2 Mar 2022 10:56:44 +0100 Subject: [PATCH 24/37] Add Mysql dump all variables on zzz_evobackup --- zzz_evobackup | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zzz_evobackup b/zzz_evobackup index 4a84fef..481e85b 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -191,6 +191,9 @@ if [ "${LOCAL_TASKS}" = "1" ]; then # mkdir -p -m 700 ${LOCAL_BACKUP_DIR}/mysql/ # pt-show-grants --flush --no-header > ${LOCAL_BACKUP_DIR}/mysql/all_grants.sql + # Dump all variables + # mysql -A -e"SHOW GLOBAL VARIABLES;" > ${LOCAL_BACKUP_DIR}/MySQLCurrentSettings.txt + ## example with SQL dump (schema only, no data) for each databases # mkdir -p -m 700 ${LOCAL_BACKUP_DIR}/mysql/ # for i in $(mysql --defaults-extra-file=/etc/mysql/debian.cnf -P 3306 -e 'show databases' -s --skip-column-names \ From 595be40c3816a01ce9b7e10c5322cc58c4174246 Mon Sep 17 00:00:00 2001 From: "William Hirigoyen (Evolix)" Date: Wed, 9 Mar 2022 16:16:35 +0100 Subject: [PATCH 25/37] Fix init btrfs check location, fix error msg spelling brtfs -> btrfs --- lib/bkctld-inc | 2 +- lib/bkctld-inc-lock | 2 +- lib/bkctld-init | 9 ++++----- lib/bkctld-remove | 2 +- lib/bkctld-rm | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/bkctld-inc b/lib/bkctld-inc index 049e5cf..58cc990 100755 --- a/lib/bkctld-inc +++ b/lib/bkctld-inc @@ -16,7 +16,7 @@ create_inc_btrfs() { btrfs_bin=$(command -v btrfs) if [ -z "${btrfs_bin}" ]; then - error "btrfs not found. Please install brtfs-progs." + error "btrfs not found. Please install btrfs-progs." fi if dry_run; then diff --git a/lib/bkctld-inc-lock b/lib/bkctld-inc-lock index 0888396..e3c704e 100755 --- a/lib/bkctld-inc-lock +++ b/lib/bkctld-inc-lock @@ -14,7 +14,7 @@ lock_target() { target="${1:?}" btrfs_bin=$(command -v btrfs) if [ -z ${btrfs_bin} ]; then - error "btrfs not found. Please install brtfs-progs." + error "btrfs not found. Please install btrfs-progs." fi if is_btrfs "${target}"; then ${btrfs_bin} property set -ts "${target}" ro true diff --git a/lib/bkctld-init b/lib/bkctld-init index 37a9f78..14a1000 100755 --- a/lib/bkctld-init +++ b/lib/bkctld-init @@ -18,12 +18,11 @@ test -d "${jail_path}" && error "Skip jail \`${jail_name}' : it already exists" # Create config and jails directory mkdir --parents "${CONFDIR}" "${JAILDIR}" -btrfs_bin=$(command -v btrfs) -if [ -z ${btrfs_bin} ]; then - error "btrfs not found. Please install brtfs-progs." -fi - if is_btrfs "$(dirname "${JAILDIR}")" || is_btrfs "${JAILDIR}"; then + btrfs_bin=$(command -v btrfs) + if [ -z ${btrfs_bin} ]; then + error "btrfs not found. Please install btrfs-progs." + fi ${btrfs_bin} subvolume create "${jail_path}" else mkdir --parents "${jail_path}" diff --git a/lib/bkctld-remove b/lib/bkctld-remove index fec8015..f3dc6c3 100755 --- a/lib/bkctld-remove +++ b/lib/bkctld-remove @@ -54,7 +54,7 @@ rm -rf "$(jail_config_dir "${jail_name}")" btrfs_bin=$(command -v btrfs) if [ -z ${btrfs_bin} ]; then - error "btrfs not found. Please install brtfs-progs." + error "btrfs not found. Please install btrfs-progs." fi if is_btrfs "${jail_path}"; then diff --git a/lib/bkctld-rm b/lib/bkctld-rm index c5b8dde..28caef8 100755 --- a/lib/bkctld-rm +++ b/lib/bkctld-rm @@ -64,7 +64,7 @@ delete_inc_btrfs() { btrfs_bin=$(command -v btrfs) if [ -z ${btrfs_bin} ]; then - error "btrfs not found. Please install brtfs-progs." + error "btrfs not found. Please install btrfs-progs." fi if dry_run; then From 8330918aad5293a3be3857736126bbcd33e9c7a7 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Fri, 18 Mar 2022 15:11:01 +0100 Subject: [PATCH 26/37] TODO: deal with empty lines --- lib/bkctld-check-incs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/bkctld-check-incs b/lib/bkctld-check-incs index 14093fe..6feb794 100755 --- a/lib/bkctld-check-incs +++ b/lib/bkctld-check-incs @@ -26,6 +26,9 @@ for jail_name in $("${LIBDIR}/bkctld-list"); do # read each line in jail configuration while read line; do + ## TODO + # deal with empty lines + # inc date in ISO format inc_iso=$(relative_date "${line}") # inc date in seconds from epoch From a658e2aa7f4b31a73b7f99ce8139b0459d5083c4 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Fri, 18 Mar 2022 15:23:26 +0100 Subject: [PATCH 27/37] use new firewall file path --- test/checks.bats | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/checks.bats b/test/checks.bats index 65a2ccc..bc6da3b 100644 --- a/test/checks.bats +++ b/test/checks.bats @@ -144,7 +144,8 @@ OUT @test "Check setup WARNING if firewall rules are not sourced" { /usr/lib/bkctld/bkctld-start ${JAILNAME} - firewall_rules_file="/etc/firewall.rc.jails" + mkdir /etc/minifirewall.d/ + firewall_rules_file="/etc/minifirewall.d/bkctld" set_variable "/etc/default/bkctld" "FIREWALL_RULES" "${firewall_rules_file}" echo "" > "${firewall_rules_file}" @@ -158,7 +159,8 @@ OUT @test "Check setup OK if firewall rules are sourced" { /usr/lib/bkctld/bkctld-start ${JAILNAME} - firewall_rules_file="/etc/firewall.rc.jails" + mkdir /etc/minifirewall.d/ + firewall_rules_file="/etc/minifirewall.d/bkctld" set_variable "/etc/default/bkctld" "FIREWALL_RULES" "${firewall_rules_file}" echo "" > "${firewall_rules_file}" From 959077327ae4e753bfc6868ec55efa0a4b820552 Mon Sep 17 00:00:00 2001 From: Jeremy Dubois Date: Fri, 25 Mar 2022 18:02:18 +0100 Subject: [PATCH 28/37] fix backup-server-state option for OpenBSD --- zzz_evobackup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zzz_evobackup b/zzz_evobackup index 481e85b..e7fc3dc 100755 --- a/zzz_evobackup +++ b/zzz_evobackup @@ -20,7 +20,7 @@ set -u ##### Configuration ################################################### -VERSION="22.01" +VERSION="22.03" # email adress for notifications MAIL=jdoe@example.com @@ -367,7 +367,7 @@ if [ "${LOCAL_TASKS}" = "1" ]; then fi else if [ -n "${backup_server_state_bin}" ]; then - ${backup_server_state_bin} --force --backup-dir "${server_state_dir}" + ${backup_server_state_bin} --etc --force --backup-dir "${server_state_dir}" else mkdir -p "${server_state_dir}" From 960dd97d68999a3e573d32e06be5362efa037b55 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Tue, 22 Mar 2022 15:33:00 +0100 Subject: [PATCH 29/37] Tell sed to follow symlinks --- Vagrantfile | 4 ++-- lib/bkctld-firewall | 2 +- lib/bkctld-ip | 2 +- lib/bkctld-port | 2 +- test/connectivity.bats | 2 +- test/test_helper.bash | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 9791669..796fc2b 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -28,8 +28,8 @@ DEBIAN_FRONTEND=noninteractive apt-get -yq install openssh-server btrfs-progs rs SCRIPT $pre_part = <