From 1bd4f64a580c2eda68de401b659e582582efea9a Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sun, 16 Apr 2023 20:15:12 +0200 Subject: [PATCH 01/14] documentation: rephrase lockfile --- doc/btrbk.1.asciidoc | 6 +++--- doc/btrbk.conf.5.asciidoc | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/btrbk.1.asciidoc b/doc/btrbk.1.asciidoc index b6eec38..d45cb8a 100644 --- a/doc/btrbk.1.asciidoc +++ b/doc/btrbk.1.asciidoc @@ -154,9 +154,9 @@ with ":RALIGN" are right-aligned. command (version >= 20180505) installed on the host running btrbk. --lockfile :: - Create lockfile on startup; checks lockfile before running - any btrfs commands (using perl "flock"), and exits if the lock is - held by another btrbk instance. Overrides configuration option + Place an exclusive lock on during program execution, using + flock(2). If the lock is held by another process, exit before + running any actions. Overrides configuration option "lockfile". Ignored on dryrun ('-n', '--dry-run'). --override =:: diff --git a/doc/btrbk.conf.5.asciidoc b/doc/btrbk.conf.5.asciidoc index 8a3d0c5..7478856 100644 --- a/doc/btrbk.conf.5.asciidoc +++ b/doc/btrbk.conf.5.asciidoc @@ -359,10 +359,10 @@ constraints. daemon, auth, lpr, news, cron, authpriv, local0..local7. *lockfile* |no:: - Create lockfile on startup; checks lockfile before running - any btrfs commands (using perl "flock"), and exits if the lock is - held by another btrbk instance. Ignored on dryrun ('-n', - '--dry-run'). See also '--lockfile' command-line option. + Place an exclusive lock on during program execution, using + flock(2). If the lock is held by another process, exit before + running any actions. Ignored on dryrun ('-n', '--dry-run'). See + also '--lockfile' command-line option. *backend* :: Backend filesystem utilities to be used for btrfs specific From 7779db68f1c5603a43759594ae6d0bc4efcdd2a0 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sun, 26 Mar 2023 15:34:02 +0200 Subject: [PATCH 02/14] btrbk: abort if cmdline specified config not found --- btrbk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/btrbk b/btrbk index c34302c..85b56a5 100755 --- a/btrbk +++ b/btrbk @@ -4319,7 +4319,7 @@ sub _config_collect_values sub init_config(@) { - my %defaults = ( CONTEXT => "meta", @_ ); + my %defaults = ( CONTEXT => "meta", SRC_FILE => "DEFAULTS", @_ ); # set defaults foreach (keys %config_options) { next if $config_options{$_}->{deprecated}; # don't pollute hash with deprecated options @@ -5582,8 +5582,9 @@ MAIN: $config = parse_config($config_file); exit 2 unless($config); } - elsif($fallback_default_config) { - INFO "Configuration file not found, falling back to defaults"; + elsif($fallback_default_config && !$config_cmdline) { + INFO "Configuration file not found: " . join(', ', @config_src); + INFO "Using default configuration"; $config = init_config(); } else { From 4e4594516b570b3f86aeaf12d07dd7670af8289d Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Thu, 8 Jun 2023 00:27:16 +0200 Subject: [PATCH 03/14] btrbk-mail: declare associative arrays --- contrib/cron/btrbk-mail | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/cron/btrbk-mail b/contrib/cron/btrbk-mail index c1359e6..66c1658 100755 --- a/contrib/cron/btrbk-mail +++ b/contrib/cron/btrbk-mail @@ -4,6 +4,8 @@ now=$(date +%Y%m%d) +declare -A rsync_src rsync_dst rsync_log rsync_rsh rsync_opt + ##### start config section ##### # Email recipients, separated by whitespace: From d1a26147cf309feecd48e874343a199f58625022 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Fri, 7 Jul 2023 01:45:32 +0200 Subject: [PATCH 04/14] btrbk-mail: add missing declare --- contrib/cron/btrbk-mail | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/cron/btrbk-mail b/contrib/cron/btrbk-mail index 66c1658..bf6bedb 100755 --- a/contrib/cron/btrbk-mail +++ b/contrib/cron/btrbk-mail @@ -5,6 +5,7 @@ now=$(date +%Y%m%d) declare -A rsync_src rsync_dst rsync_log rsync_rsh rsync_opt +declare -A sync_fs_onchange ##### start config section ##### From f94d847318da999c827387c8e57be02065d9410f Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Fri, 7 Jul 2023 01:46:57 +0200 Subject: [PATCH 05/14] btrbk-mail: add example to enable all rsync --- contrib/cron/btrbk-mail | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/cron/btrbk-mail b/contrib/cron/btrbk-mail index bf6bedb..1d620cf 100755 --- a/contrib/cron/btrbk-mail +++ b/contrib/cron/btrbk-mail @@ -33,7 +33,9 @@ rsync_opt[example_data]="-az --delete --inplace --numeric-ids --acls --xattrs" # If set, add "rsync_dst" to "sync_fs" (see below) if rsync reports files transferred #sync_fs_onchange[example_data]=yes -# Enabled rsync declarations (whitespace-separated list) +# Enable all rsync declarations (all indices of rsync_src array) +#rsync_enable=${!rsync_src[@]} +# Explicitely enable rsync declarations (whitespace-separated list) #rsync_enable="example_data" rsync_enable= From 3494173cf2faca13087e20e50ff8b049079a530d Mon Sep 17 00:00:00 2001 From: oldherl Date: Fri, 19 May 2023 18:10:24 +0800 Subject: [PATCH 06/14] doc: README.md: fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index edf8d45..0113085 100644 --- a/README.md +++ b/README.md @@ -428,7 +428,7 @@ host. For each backup, two files are created: * `/backup/home.YYYYMMDD.btrfs.xz.gpg.info`: sidecar file containing metadata used by btrbk. -I you are using raw _incremental_ backups, please make sure you +If you are using raw _incremental_ backups, please make sure you understand the implications (see [btrbk.conf(5)], TARGET TYPES). From ccec2395b7a6916286e949376eaf500ade94a847 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sat, 5 Aug 2023 20:56:39 +0200 Subject: [PATCH 07/14] documentation: fix spelling --- doc/btrbk.1.asciidoc | 2 +- doc/lsbtr.1.asciidoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/btrbk.1.asciidoc b/doc/btrbk.1.asciidoc index d45cb8a..daf6f5c 100644 --- a/doc/btrbk.1.asciidoc +++ b/doc/btrbk.1.asciidoc @@ -136,7 +136,7 @@ OPTIONS space-separated, quoted key=value pairs (machine readable). + If set to "col:", prints only the specified (comma-separated -list). Header lines are ommitted if the "h:" modifier is present. +list). Header lines are omitted if the "h:" modifier is present. Columns prefixed with "-" are collapsed if empty. Columns postfixed with ":RALIGN" are right-aligned. diff --git a/doc/lsbtr.1.asciidoc b/doc/lsbtr.1.asciidoc index de0786f..1a96b96 100644 --- a/doc/lsbtr.1.asciidoc +++ b/doc/lsbtr.1.asciidoc @@ -67,7 +67,7 @@ OPTIONS space-separated key="value" pairs (machine readable). + If set to "col:", prints only the specified (comma-separated -list). Header lines are ommitted if the "h:" modifier is present. +list). Header lines are omitted if the "h:" modifier is present. Columns prefixed with "-" are collapsed if empty. Columns postfixed with ":RALIGN" are right-aligned. From 57f43547cb2ae5d47bc3c82a30bb7cddf099e325 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sat, 5 Aug 2023 20:56:39 +0200 Subject: [PATCH 08/14] btrbk-mail: fix spelling --- contrib/cron/btrbk-mail | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/cron/btrbk-mail b/contrib/cron/btrbk-mail index 1d620cf..1dc3d22 100755 --- a/contrib/cron/btrbk-mail +++ b/contrib/cron/btrbk-mail @@ -35,7 +35,7 @@ rsync_opt[example_data]="-az --delete --inplace --numeric-ids --acls --xattrs" # Enable all rsync declarations (all indices of rsync_src array) #rsync_enable=${!rsync_src[@]} -# Explicitely enable rsync declarations (whitespace-separated list) +# Explicitly enable rsync declarations (whitespace-separated list) #rsync_enable="example_data" rsync_enable= From 59db547c91476f9f4241e759e1f2e7e18c0921f3 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Mon, 28 Aug 2023 19:14:35 +0200 Subject: [PATCH 09/14] documentation: fix stream_compress_adapt --- doc/btrbk.conf.5.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/btrbk.conf.5.asciidoc b/doc/btrbk.conf.5.asciidoc index 7478856..fb17f52 100644 --- a/doc/btrbk.conf.5.asciidoc +++ b/doc/btrbk.conf.5.asciidoc @@ -291,9 +291,9 @@ set to ``all'' (the default). Number of threads to use for . Only supported for "pigz", "pbzip2", "bzip3", "zstd" and recent versions of "xz". -*stream_compress_adapt* default|:: +*stream_compress_adapt* yes|no:: Enable adaptive compression for . Only supported - for "zstd" (version >= 1.3.6). + for "zstd" (version >= 1.3.6). Defaults to ``no''. *stream_buffer* |no:: Add a buffer to the btrfs send stream (locally, on uncompressed From 973771ed3569821ee6de4de923aa030fe05cb69b Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sun, 6 Jul 2025 00:56:29 +0200 Subject: [PATCH 10/14] btrbk: fix loglevel along with verbose --- btrbk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/btrbk b/btrbk index 85b56a5..6b15187 100755 --- a/btrbk +++ b/btrbk @@ -5294,7 +5294,7 @@ MAIN: my @exclude_cmdline; my ($config_cmdline, $lockfile_cmdline, $print_schedule, $preserve_snapshots, $preserve_backups, $wipe_snapshots, $skip_snapshots, $skip_backups, - $archive_raw, $extents_related, + $archive_raw, $extents_related, $loglevel_inc ); # Calling btrbk via "lsbtr" symlink acts as an alias for "btrbk ls", @@ -5306,7 +5306,7 @@ MAIN: 'help|h' => sub { HELP_MESSAGE; exit 0; }, 'version' => sub { VERSION_MESSAGE; exit 0; }, 'quiet|q' => \$quiet, - 'verbose|v' => sub { $loglevel = ($loglevel =~ /^[0-9]+$/) ? $loglevel+1 : 2; }, + 'verbose|v' => sub { $loglevel_inc++ }, 'loglevel|l=s' => \$loglevel, 'format=s' => \$output_format, 'single-column|1' => sub { $output_format = "single_column" }, @@ -5362,6 +5362,7 @@ MAIN: ERROR_HELP_MESSAGE; exit 2; } + $loglevel += $loglevel_inc // 0; $do_trace = 1 if($loglevel >= 4); require_data_dumper() if($do_trace || ($VERSION =~ /-dev$/)); From 8c60c53ebbc0014e0661763a9042fde48e45514e Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sun, 6 Jul 2025 01:06:16 +0200 Subject: [PATCH 11/14] btrbk: fix duplicate cmdline option -l in lsbtr --- btrbk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/btrbk b/btrbk index 6b15187..8c7c822 100755 --- a/btrbk +++ b/btrbk @@ -5307,7 +5307,6 @@ MAIN: 'version' => sub { VERSION_MESSAGE; exit 0; }, 'quiet|q' => \$quiet, 'verbose|v' => sub { $loglevel_inc++ }, - 'loglevel|l=s' => \$loglevel, 'format=s' => \$output_format, 'single-column|1' => sub { $output_format = "single_column" }, 'pretty' => \$output_pretty, @@ -5317,11 +5316,13 @@ MAIN: ); push @getopt_options, ($program_name eq "lsbtr") ? ( # "lsbtr" options + 'loglevel=s' => \$loglevel, 'long|l' => sub { $output_format = "table" }, 'uuid|u' => sub { $output_format = "long" }, 'raw' => sub { $output_format = "raw" }, ) : ( # "btrbk" options + 'loglevel|l=s' => \$loglevel, 'dry-run|n' => \$dryrun, 'exclude=s' => \@exclude_cmdline, 'preserve|p' => sub { $preserve_snapshots = "preserve", $preserve_backups = "preserve" }, From ebcc4bdd03cbce2da48a6b7c4975ff5c019d67dc Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sat, 29 Nov 2025 17:03:11 +0100 Subject: [PATCH 12/14] documentation: fix arch installation --- doc/install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/install.md b/doc/install.md index f566b13..75d8d4f 100644 --- a/doc/install.md +++ b/doc/install.md @@ -38,7 +38,7 @@ btrbk is in the official Fedora repos: https://src.fedoraproject.org/rpms/btrbk ### Arch Linux -btrbk is in AUR: https://aur.archlinux.org/packages/btrbk/ +btrbk is in the "extra" repository: https://archlinux.org/packages/extra/any/btrbk/ ### Alpine Linux From 29ca3c093205395bdeb9dd98677ab4139c458aec Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sun, 19 Jul 2026 16:16:39 +0200 Subject: [PATCH 13/14] ssh_filter_btrbk.sh: fix regex end-of-string anchor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix SSH command filter bypass in ssh_filter_btrbk.sh (CVE-2026-62943). The regex allowlist pattern in ssh_filter_btrbk.sh lacked a proper end-of-string anchor, allowing attackers to append arbitrary commands after a valid btrbk command prefix using pipe characters. Thanks to @machin0r for responsible disclosure.  Bug introduced in commit: 8d0d7edda7cc775b87fd450266b756885f1eaa80 --- ssh_filter_btrbk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ssh_filter_btrbk.sh b/ssh_filter_btrbk.sh index 0817563..d8adcb0 100755 --- a/ssh_filter_btrbk.sh +++ b/ssh_filter_btrbk.sh @@ -96,12 +96,12 @@ reject_filtered_cmd() # allow multiple paths (e.g. "btrfs subvolume snapshot ") allow_cmd_match="(${allow_list})( ${option_match})*( ${path_match})+" stream_in_match="(${decompress_match} \| )?(${mbuffer_match} \| )?" - stream_out_match="( \| ${mbuffer_match})?( \| ${compress_match}$)?" + stream_out_match="( \| ${mbuffer_match})?( \| ${compress_match})?" # `grep`’s `-q`-option is not used as it may cause an exit status of `0` even # when an error occurred. - allow_stream_match="^${stream_in_match}${allow_cmd_match}${stream_out_match}" + allow_stream_match="^${stream_in_match}${allow_cmd_match}${stream_out_match}$" if printf '%s' "${SSH_ORIGINAL_COMMAND}" | grep -E "${allow_stream_match}" >/dev/null 2>/dev/null; then return 0 fi From b4676b841865763901712153281de4b1291cedc6 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sun, 19 Jul 2026 16:16:52 +0200 Subject: [PATCH 14/14] change version to 0.32.7; update Changelog --- ChangeLog | 14 ++++++++++++++ btrbk | 4 ++-- doc/btrbk.1.asciidoc | 4 ++-- doc/btrbk.conf.5.asciidoc | 4 ++-- doc/lsbtr.1.asciidoc | 4 ++-- doc/ssh_filter_btrbk.1.asciidoc | 4 ++-- 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index de240ae..7058c59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +btrbk-0.32.7 + + * MIGRATION + - Update ssh_filter_btrbk.sh on remote hosts. + - All users using ssh_filter_btrbk.sh in their authorized_keys + configurations should upgrade immediately. + * This release fixes a critical security vulnerability + (CVE-2026-62943) in ssh_filter_btrbk.sh. + Specially crafted commands can bypass filter checks and execute + arbitrary commands. Applies to remote hosts using + ssh_filter_btrbk.sh in authorized_keys for command filtering. + Thanks to @machin0r for responsible disclosure. + * Minor bugfixes, spelling and documentation improvements. + btrbk-0.32.6 * Fix backup of unrelated (by parent_uuid) snapshots (close #339). diff --git a/btrbk b/btrbk index 8c7c822..143e731 100755 --- a/btrbk +++ b/btrbk @@ -2,7 +2,7 @@ # # btrbk - Create snapshots and remote backups of btrfs subvolumes # -# Copyright (C) 2014-2022 Axel Burri +# Copyright (C) 2014-2026 Axel Burri # # 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 @@ -35,7 +35,7 @@ use IPC::Open3 qw(open3); use Symbol qw(gensym); use Cwd qw(abs_path); -our $VERSION = '0.32.6'; +our $VERSION = '0.32.7'; our $AUTHOR = 'Axel Burri '; our $PROJECT_HOME = ''; diff --git a/doc/btrbk.1.asciidoc b/doc/btrbk.1.asciidoc index daf6f5c..02b2313 100644 --- a/doc/btrbk.1.asciidoc +++ b/doc/btrbk.1.asciidoc @@ -1,7 +1,7 @@ btrbk(1) ======== -:date: 2023-03-25 -:release-version: 0.32.6 +:date: 2026-07-19 +:release-version: 0.32.7 :man manual: Btrbk Manual :man source: Btrbk {release-version} diff --git a/doc/btrbk.conf.5.asciidoc b/doc/btrbk.conf.5.asciidoc index fb17f52..531ecef 100644 --- a/doc/btrbk.conf.5.asciidoc +++ b/doc/btrbk.conf.5.asciidoc @@ -1,7 +1,7 @@ btrbk.conf(5) ============= -:date: 2023-03-25 -:release-version: 0.32.6 +:date: 2026-07-19 +:release-version: 0.32.7 :man manual: Btrbk Manual :man source: Btrbk {release-version} diff --git a/doc/lsbtr.1.asciidoc b/doc/lsbtr.1.asciidoc index 1a96b96..cab1b94 100644 --- a/doc/lsbtr.1.asciidoc +++ b/doc/lsbtr.1.asciidoc @@ -1,7 +1,7 @@ lsbtr(1) ======== -:date: 2023-03-25 -:release-version: 0.32.6 +:date: 2026-07-19 +:release-version: 0.32.7 :man manual: Btrbk Manual :man source: Btrbk {release-version} diff --git a/doc/ssh_filter_btrbk.1.asciidoc b/doc/ssh_filter_btrbk.1.asciidoc index cc3883b..dc6ebac 100644 --- a/doc/ssh_filter_btrbk.1.asciidoc +++ b/doc/ssh_filter_btrbk.1.asciidoc @@ -1,7 +1,7 @@ ssh_filter_btrbk(1) =================== -:date: 2023-03-25 -:release-version: 0.32.6 +:date: 2026-07-19 +:release-version: 0.32.7 :man manual: Btrbk Manual :man source: Btrbk {release-version}