1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-25 17:27:31 +00:00
Commit graph

6836 commits

Author SHA1 Message Date
Thomas Waldmann
f2b085787b Item: disallow None value for .user/group/chunks/chunks_healthy
If we do not know the value, just do not have that key/value pair in the item.
2022-06-09 17:57:28 +02:00
Thomas Waldmann
64cc16a9f4 Item: fix xattr processing
Item.xattrs is now always a StableDict mapping bytes keys -> bytes values.

The special casing of empty values (b'') getting replaced by None was removed.
2022-06-09 17:57:28 +02:00
Thomas Waldmann
9d684120a2 Item: assert type also in property getter
also: fixed Item.xattrs to be StableDict (not just a dict, as the
msgpack unpacker gives us)
2022-06-09 17:57:28 +02:00
Thomas Waldmann
7b138cc710 Item: convert timestamps once, get rid of bigint code 2022-06-09 17:57:28 +02:00
Thomas Waldmann
8e58525fc6 Item: remove some decode= params
update_internal() makes sure they have the desired type already.
2022-06-09 17:57:28 +02:00
Thomas Waldmann
655c1b9cc2 update docstrings / comments 2022-06-09 17:57:28 +02:00
Thomas Waldmann
33444be926 more str vs bytes fixing 2022-06-09 17:57:28 +02:00
Thomas Waldmann
8e87f1111b cleanup msgpack related str/bytes mess, fixes #968
see ticket and borg.helpers.msgpack docstring.

this changeset implements the full migration to
msgpack 2.0 spec (use_bin_type=True, raw=False).

still needed compat to the past is done via want_bytes decoder in borg.item.
2022-06-09 17:57:28 +02:00
Thomas Waldmann
f8dbe5b542 cleanup msgpack related str/bytes mess, see #968
see ticket and borg.helpers.msgpack docstring.
2022-06-09 17:57:28 +02:00
TW
86fe8bdd57
Merge pull request #6703 from ThomasWaldmann/r2r-transfer
borg2: "borg transfer" cmd (and also getting rid of legacy)
2022-06-09 17:56:03 +02:00
Thomas Waldmann
c5540c2dd9 upgrade compressed chunk: fix treatment of ObfuscateSize chunks
the inner payload of ObfuscateSize chunks are compressed chunks and need
the same zlib fix and level patching as non-obfuscated compressed chunks.
2022-06-09 17:49:16 +02:00
Thomas Waldmann
72c68c49d0 obfuscation: fix byte order for size, fixes #6701 2022-06-09 17:49:16 +02:00
Thomas Waldmann
6584a92c81 compression: use the 2 bytes for type and level, fixes #6698
adapt borg transfer, transferred chunks are set to compression level "unknown".
2022-06-09 17:49:16 +02:00
Thomas Waldmann
32a3601e4a compute hlid from inode / device 2022-06-09 17:49:16 +02:00
Thomas Waldmann
8798b0340a use whitelist approach to make sure item._dict is clean 2022-06-09 17:49:16 +02:00
Thomas Waldmann
d3dfa3be30 use version 2 for new archives
but still be able to read v1 archives
for borg transfer.
2022-06-09 17:49:16 +02:00
Thomas Waldmann
e5f1a4fb4d recreate: cachedir_masters not needed any more
now all hardlinked regular file items have chunks.
2022-05-18 14:20:01 +02:00
Thomas Waldmann
6bfdb3f630 refactor hardlink_master processing globally
borg now has the chunks list in every item with content.
due to the symmetric way how borg now deals with hardlinks using
item.hlid, processing gets much simpler.

but some places where borg deals with other "sources" of hardlinks
still need to do some hardlink management:
borg uses the HardLinkManager there now (which is not much more
than a dict, but keeps documentation at one place and avoids some
code duplication we had before).

item.hlid is computed via hardlink_id function.

support hardlinked symlinks, fixes #2379
as we use item.hlid now to group hardlinks together,
there is no conflict with the item.source usage for
symlink targets any more.

2nd+ hardlinks now add to the files count as did the 1st one.
for borg, now all hardlinks are created equal.
so any hardlink item with chunks now adds to the "file" count.

ItemFormatter: support {hlid} instead of {source} for hardlinks
2022-05-18 14:20:01 +02:00
Thomas Waldmann
7903dad183 transfer: convert timestamps int/bigint -> msgpack.Timestamp, see #2323
Timestamp scales to 64 or 96bit serialization formats, that should be enough for everybody.

We use this in archived items and also in the files cache.
2022-05-18 14:20:01 +02:00
Thomas Waldmann
e4a97ea8cc transfer: all hardlinks have chunks, maybe chunks_healty, hlid
Item.hlid: same id, same hardlink (xxh64 digest)
Item.hardlink_master: not used for new archives any more
Item.source: not used for hardlink slaves any more
2022-05-18 14:20:01 +02:00
Thomas Waldmann
01f72d15b4 transfer: remove the zlib type bytes hack
hack: see the docstring of ZLIB_legacy class.

New clean ZLIB class that works as every other compressor.

ZLIB ID 0x0500, ZLIB_legacy ID 0x.8..
2022-05-18 14:20:01 +02:00
Thomas Waldmann
ba1dbe6111 transfer: make sure items with chunks have precomputed size 2022-05-18 14:20:01 +02:00
Thomas Waldmann
98b7dc0bf5 transfer: clean item of attic 0.13 'acl' bug remnants
also: remove attic bug support code from borg check.

borg transfer removes the acl key. we do not run borg check on old repos.
2022-05-18 14:20:00 +02:00
Thomas Waldmann
116f67036f transfer: copy archives from another repo
this is somehow similar to borg recreate,
but with different focus and way simpler:

not changing compression algo
not changing chunking
not excluding files inside an archive by path match
only dealing with complete archives

but:
different src and dst repo
only reading each chunk once
keeping the compressed payload (no decompression/recompression effort)
--dry-run can be used before and afterwards to check
2022-05-18 14:20:00 +02:00
Emil M George
1b4b84dfd8
Remove scp syntax for locations (#6697)
remove scp syntax support from cli and from Location parser, add note about converting scp-style URLs to ssh-style, fixes #6691
2022-05-15 21:55:19 +02:00
Andrea Gelmini
c79fd61b5c
Fix typos (#6688)
fix typos

Co-authored-by: Thomas Waldmann <tw@waldmann-edv.de>
2022-05-15 21:23:48 +02:00
TW
ab4bef0372
Merge pull request #6694 from ThomasWaldmann/versions-mount-1archive-error-master
mount -o versions: give clear error msg instead of crashing
2022-05-15 19:52:32 +02:00
Thomas Waldmann
2bed467e92 mount -o versions: give clear error msg instead of crashing
it does not make sense to request versions view if you only
look at 1 archive, but the code shall not crash in that case
as it did, but give a clear error msg.
2022-05-15 00:37:45 +02:00
Christopher Klooz
594d83aad5
docs: authentication primitives: improved security and performance infos (master) (#6667)
docs: authentication primitives: improved security and performance infos
2022-05-14 22:57:22 +02:00
ReethuVinta
ac4666d7f4
documented workaround for getting help for sub-sub-commands (#6346)
docs: how to get help for sub-sub-commands
2022-05-13 18:29:43 +02:00
ReethuVinta
c85bcfd3ad
documented secret key usage against fingerprinting (#6345)
docs: secret key usage against fingerprinting

Co-authored-by: Thomas Waldmann <tw@waldmann-edv.de>
2022-05-10 21:18:40 +02:00
TW
0e3ff0ab70
Merge pull request #6682 from ThomasWaldmann/fix-archive-progress-json-master
show_progress: add finished=true/false to archive_progress json
2022-05-08 19:45:39 +02:00
TW
09a84fbd24
Merge pull request #6685 from ThomasWaldmann/fix-create-filter-master
fix create_filter_process exception handler, fixes #6681
2022-05-08 19:15:35 +02:00
Thomas Waldmann
18eb696a17 fix create_filter_process exception handler, fixes #6681
if cmd was falsy (e.g. None), there is no proc.
then, if "yield stream" raises an exception, the exception handler crashed at "proc.kill()".
2022-05-08 18:46:13 +02:00
Thomas Waldmann
1c0937958d show_progress: add finished=true/false to archive_progress json, fixes #6570
also:
- remove empty values from final json
- add test
2022-05-08 18:32:07 +02:00
TW
a3e99a2b51
Merge pull request #6659 from ThomasWaldmann/docs-fc-suffix-master
docs: mention BORG_FILES_CACHE_SUFFIX as alternative to BORG_FILES_CACHE_TTL
2022-05-07 14:39:57 +02:00
TW
4acfcf23e9
Merge pull request #6670 from ThomasWaldmann/no-pytest-check-master
check that borg does not require pytest for normal usage, fixes #6563
2022-05-07 10:41:34 +02:00
Thomas Waldmann
2c25123284 check that borg does not require pytest for normal usage, fixes #6563
also: move the note about this to the very top of the affected modules.
2022-05-07 02:24:18 +02:00
TW
dc89798496
Merge pull request #6665 from ThomasWaldmann/fix-key-idhash-compat
fix key id hash compat check
2022-05-04 00:00:21 +02:00
Thomas Waldmann
af776ce7a6 refactor: borg.key.uses_same_id_hash(key_old, key_new) 2022-05-03 21:32:35 +02:00
Thomas Waldmann
3239836dce fix key id hash compat check: also support new->new
the check only considered old key -> new key changes, but
new key to new key is of course also fine.

e.g. repokey-aes-ocb -> repokey-aes-ocb (both use hmac-sha256
as id hash)
2022-05-03 21:25:44 +02:00
TW
b0f7dd0904
Merge pull request #6664 from ThomasWaldmann/api-give-compressed-master
api: enable giving already compressed data
2022-05-03 11:43:47 +02:00
Thomas Waldmann
0e53dc040a api: enable giving already compressed data
the api already offered getting compressed data,
but not giving compressed data.

thus: cache.add_chunk and key.encrypt improved.
2022-05-03 04:15:01 +02:00
TW
19ad926c70
Merge pull request #6662 from ThomasWaldmann/decrypt-fixes
fix key.decrypt calls
2022-05-02 21:25:26 +02:00
Thomas Waldmann
cc0e33da65 fix key.decrypt calls
the id must now always be given correctly because
the AEAD crypto modes authenticate the chunk id.

the special case when id == MANIFEST_ID is now handled
inside assert_id, so we never need to give a None id.
2022-05-02 20:56:50 +02:00
TW
3ba9bab66c
Merge pull request #6660 from ThomasWaldmann/reuse-key
init --other-location=OTHER_REPO: reuse key material from OTHER_REPO
2022-05-02 20:52:13 +02:00
Thomas Waldmann
4b070040d6 init --other-location=OTHER_REPO: reuse key material from OTHER_REPO, fixes #6554
it potentially will ask for the passphrase for the key of OTHERREPO.
for the newly created repo, it will use the same passphrase.

it will copy: enc_key, enc_hmac_key, id_key, chunker_seed.

keeping the id_key (and id algorithm) and the chunker seed (and chunker
algorithm and parameters) is desirable for deduplication.
the id algorithm is usually either HMAC-SHA256 or BLAKE2b.

keeping the enc_key / enc_hmac_key must be implemented carefully:
A) AES-CTR -> AES-CTR is INSECURE due to nonce reuse, thus not allowed.
B) AES-CTR -> AEAD with session keys is secure.
C) AEAD with session keys -> AEAD with session keys is secure.

AEAD modes with session keys: AES-OCB and CHACHA20-POLY1305.
2022-05-02 18:50:27 +02:00
Thomas Waldmann
020e2defaf implement with_other_repository and BORG_OTHER_REPO 2022-05-02 18:48:14 +02:00
Thomas Waldmann
a375335859 make some code from with_repository reusable 2022-05-02 18:45:14 +02:00
Thomas Waldmann
9f09a9e096 docs: mention BORG_FILES_CACHE_SUFFIX as alternative to BORG_FILES_CACHE_TTL, fixes #5602 2022-04-30 20:28:46 +02:00