Commit Graph

1113 Commits (8676191d4561878a4ed0a0c76117f8f96d93b48a)

Author SHA1 Message Date
Axel Burri 8676191d45 change version to 0.32.0; update Changelog 2022-02-05 19:34:54 +01:00
Axel Burri 8cc74fecc1 btrbk: default timestamp_format=long
This is a relict of early days of btrbk, and I have already hesitated
for too long to change the default from legacy "short" to sane "long"
format.

Tests show that the scheduling behaves in a sane/expected way if this
change is applied unattended. I suppose everybody who has
preserve_hour_of_day set is already using timestamp_format=long.
2022-02-05 18:47:49 +01:00
znerol c5273a8745 documentation: fix openssh website URL 2021-11-06 17:24:52 +01:00
Axel Burri ca166d47b6 btrbk: add safe_commands config option
For the paranoid. For convenience, filename checking was removed in
[1], and quoting was (hopefully) implemented correctly in [2].

Allowing special characters as well as UTF8 leave behind a bad
feeling, as there are many special cases that needs to be taken care
of (e.g. newlines in file names, right-to-left encoding, etc.). In
order to mitigate attacks expoiting these error classes, leave an
option to power users which do only allow "sane" characters in their
filename hierarchy.

  [1] 6a29b08f00 btrbk: remove filename restrictions
  [2] acc7f9fc83 btrbk: quote unsafe characters in shell commands
2021-11-06 16:40:47 +01:00
Axel Burri 4f72ad123f btrbk: tidy error message 2021-11-06 16:09:51 +01:00
Axel Burri 2b21d1528c documentation: add "reference time" subsection 2021-11-06 13:50:38 +01:00
Axel Burri ed814aed5a documentation: rephrase retention policy 2021-11-06 13:27:22 +01:00
Axel Burri cb38b7efa4 btrbk: parse additional "btrfs subvolume show" lines from btrfs-progs-5.14.2 2021-10-24 10:39:16 +02:00
Axel Burri c538702d8c btrbk: abort on unexpected only if receive target is not present 2021-10-04 19:17:36 +02:00
Axel Burri 4234fb2965 btrbk-verify: cleanup 2021-09-04 17:15:56 +02:00
Axel Burri d554afab10 btrbk-verify: allow ssh-user without ssh-identity
Required e.g. if a ssh-agent is already running, and we want to set
user=root for rsync.
2021-09-04 16:57:05 +02:00
Axel Burri bef13275d3 btrbk: fix regression: print quoted rsh command in table output
regression from: 27388c7589 btrbk: treat all filenames as unsafe
2021-09-04 15:46:57 +02:00
Axel Burri 1bda5fd978 btrbk: tidy safe_cmd; die if quoting leading dash for command
This should never happen, as all our filenames are checked to be
absolute.
2021-09-04 15:46:09 +02:00
Axel Burri d1247359f8 btrbk: always return abort key 2021-08-28 14:49:12 +02:00
Axel Burri faec607d02 btrbk: drop deprecated -r,--resume-only argument
Deprecated as of btrbk v0.26.0 (more than 3 years ago).
2021-08-28 14:06:10 +02:00
Axel Burri 3f84345bed btrbk: tidy logging 2021-08-28 14:06:10 +02:00
Axel Burri 5dc2375a75 btrbk: fix raw file deletion 2021-08-28 14:06:10 +02:00
Axel Burri 424127441d btrbk: fix unsafe path for btrfs send to file 2021-08-28 14:06:10 +02:00
Axel Burri fe53198661 btrbk: drop support for deprecated raw format
Raw backups created by btrbk < 0.26.0 are now ignored:

   *.btrfs_<received_uuid>[@<parent_uuid>][.gz|bz2|xz][.gpg][.split][.part]
2021-08-28 14:06:02 +02:00
Axel Burri d7653a9e0a documentation: add incremental_prefs; adapt incremental_clones 2021-08-27 17:20:47 +02:00
Axel Burri 85c2d14287 btrbk: change incremental_prefs defaults
New defaults gives the btrbk_direct_leaf snapshots higher preference
than the global ones resolved by parent-uuid (which are best-guess).

This way the parent has a higher chance of being a backup created by
btrbk, which results in "btrfs receive" to start work on a snapshot of
this (and preferably not on the "best-guess" ones).
2021-08-27 17:20:47 +02:00
Axel Burri bde0c10a6c btrbk: add incremental_prefs config option 2021-08-27 17:20:47 +02:00
Axel Burri 6ca00feeb6 btrbk: tidy parent selection
Preparatory for incremental_prefs feature, no functional changes.
2021-08-27 17:20:47 +02:00
Axel Burri 10a6f51730 btrbk: remove deprecation on incremental_clones
btrbk does not set config defaults to global scope for deprecated
keys.
2021-08-27 17:20:47 +02:00
Axel Burri 9f877a4670 btrbk: remove extra clone source, deprecate numeric incremental_clones 2021-08-27 17:20:47 +02:00
Axel Burri 1cb958ee30 btrbk: add "match" target for deprecated options 2021-08-27 17:20:39 +02:00
Axel Burri ad6298bf37 btrbk: add global split_match (cosmetics) 2021-08-19 17:16:50 +02:00
Axel Burri eb69bc883e btrbk: refactor mountinfo
- Create tree from /proc/self/mountinfo, and use it to find mount
  points.

- Populate realpath cache from mount points, possibly reducing calls
  to `realpath`.

- Replace btrfs_mountpoint with vinfo_mountpoint(fs_type => 'btrfs)

- Tidy action "ls".

- Move code
2021-08-18 13:14:10 +02:00
Axel Burri 063c25ad24 btrbk: add sanity checks on mountinfo list 2021-08-18 13:14:10 +02:00
Axel Burri 2556492ec6 documentation: btrbk.conf.5: remove paragraph on filename restrictions 2021-08-18 13:14:10 +02:00
Axel Burri 6a29b08f00 btrbk: remove filename restrictions 2021-08-18 13:14:10 +02:00
Axel Burri b8370de9de documentation: terminate options using double dash "--" 2021-08-18 13:14:10 +02:00
Axel Burri 4b7b7cfc06 documentation: btrbk.1: rephrase --format=raw 2021-08-18 02:08:28 +02:00
Axel Burri af5d25c5a9 btrbk-verify: expect single quotes from btrbk raw table output 2021-08-18 02:08:28 +02:00
Axel Burri 81a04e4287 btrbk: use single quotes for raw table format 2021-08-18 02:08:28 +02:00
Axel Burri 48bf4f05b9 btrbk: fix table output for utf8 characters (require Text::CharWidth)
Use Text::CharWidth::mbswidth() if installed, fallback to
length(Encode::decode_utf8()), fallback to length().

 - Text::CharWidth handles wide chars (e.g. asian, taking up two
   columns on the terminal) correctly.

 - length(Encode::decode_utf8()) handles single-width chars only, and
   should be installed on most systems (perl >= v5.7.3).

 - langth() counts bytes, as we do not convert anything to UTF-8 in
   btrbk (NOT using `perl -CIOEioA` or binmode(STDOUT, ":utf8"))
2021-08-18 02:08:28 +02:00
Axel Burri 94a415e420 btrbk: check/sanitize leading/trailing whitespace on files 2021-08-18 02:08:28 +02:00
Axel Burri 77a39282de ssh_filter_btrbk.sh: allow quoted files 2021-08-18 02:08:28 +02:00
Axel Burri f7d3823d5d ssh_filter_btrbk.sh: fix files are always absolute 2021-08-18 02:08:28 +02:00
Axel Burri 3e9b581a54 btrbk: add --unsafe-filenames option 2021-08-18 02:08:28 +02:00
Axel Burri 1a7bbff767 btrbk: tidy run_cmd calls 2021-08-18 02:08:28 +02:00
Axel Burri 27388c7589 btrbk: treat all filenames as unsafe 2021-08-18 02:08:28 +02:00
Axel Burri 2933e65cbe btrbk: adapt usage of unsafe arguments for run_cmd 2021-08-18 02:08:28 +02:00
Axel Burri acc7f9fc83 btrbk: quote unsafe characters in shell commands
As filenames can contain meta characters like '$', we can't just put
ssh commands in double quotes. E.g. the following would trigger
variable expansion on local shell:

    ssh example.com "ls -l 'evil$x'"

Instead, we quote the ssh using single quotes (adding the need to
escape single quotes), while also quoting unsafe filenames using
single quotes. The above becomes:

    ssh example.com 'ls -l '\''evil$x'\'''

Or more complex, for a file named "file with'single quotes'":

    ssh example.com 'ls -l '\''file with'\''\'\'''\''single quotes'\''\'\'''\'''\'''

On the remote shell, this will expand to:

    ls -l 'file with'\''single quotes'\'''
2021-08-18 02:08:28 +02:00
Axel Burri d7f6d5fecf btrbk: accept quoted values in config 2021-08-18 02:08:28 +02:00
Axel Burri 5d94de9142 btrbk: use File::Spec for relative file arguments 2021-08-18 02:08:28 +02:00
Axel Burri eccb24ecd7 btrbk: fix action "usage"
Regression from:

   b658fba08c btrbk: print snapdir and targets for action "usage"
2021-08-18 02:08:28 +02:00
Axel Burri 3cf69f3537 btrbk: add missing table ralign 2021-08-18 02:08:28 +02:00
Axel Burri 2f88d5ab4c btrbk: check for deleted subvol before panicking 2021-08-18 02:08:28 +02:00
Axel Burri 6e7c8c409b btrbk: cosmetics: fix trace log 2021-08-18 02:08:28 +02:00