zrepl/docs
Christian Schwarz 2d8c3692ec rework resume token validation to allow resuming from raw sends of unencrypted datasets
Before this change, resuming from an unencrypted dataset with
send.raw=true specified wouldn't work with zrepl due to overly
restrictive resume token checking.

An initial PR to fix this was made in https://github.com/zrepl/zrepl/pull/503
but it didn't address the core of the problem.
The core of the problem was that zrepl assumed that if a resume token
contained `rawok=true, compressok=true`, the resulting send would be
encrypted. But if the sender dataset was unencrypted, such a resume would
actually result in an unencrypted send.
Which could be totally legitimate but zrepl failed to recognize that.

BACKGROUND
==========

The following snippets of OpenZFS code are insightful regarding how the
various ${X}ok values in the resume token are handled:

- 6c3c5fcfbe/module/zfs/dmu_send.c (L1947-L2012)
- 6c3c5fcfbe/module/zfs/dmu_recv.c (L877-L891)
- https://github.com/openzfs/zfs/blob/6c3c5fc/lib/libzfs/libzfs_sendrecv.c#L1663-L1672

Basically, some zfs send flags make the DMU send code set some DMU send
stream featureflags, although it's not a pure mapping, i.e, which DMU
send stream flags are used depends somewhat on the dataset (e.g., is it
encrypted or not, or, does it use zstd or not).

Then, the receiver looks at some (but not all) feature flags and maps
them to ${X}ok dataset zap attributes.

These are funnelled back to the sender 1:1 through the resume_token.

And the sender turns them into lzc flags.

As an example, let's look at zfs send --raw.
if the sender requests a raw send on an unencrypted dataset, the send
stream (and hence the resume token) will not have the raw stream
featureflag set, and hence the resume token will not have the rawok
field set. Instead, it will have compressok, embedok, and depending
on whether large blocks are present in the dataset, largeblockok set.

WHAT'S ZREPL'S ROLE IN THIS?
============================

zrepl provides a virtual encrypted sendflag that is like `raw`,
but further ensures that we only send encrypted datasets.

For any other resume token stuff, it shoudn't do any checking,
because it's a futile effort to keep up with ZFS send/recv features
that are orthogonal to encryption.

CHANGES MADE IN THIS COMMIT
===========================

- Rip out a bunch of needless checking that zrepl would do during
  planning. These checks were there to give better error messages,
  but actually, the error messages created by the endpoint.Sender.Send
  RPC upon send args validation failure are good enough.
- Add platformtests to validate all combinations of
  (Unencrypted/Encrypted FS) x (send.encrypted = true | false) x (send.raw = true | false)
  for cases both non-resuming and resuming send.

Additional manual testing done:
1. With zrepl 0.5, setup with unencrypted dataset, send.raw=true specified, no send.encrypted specified.
2. Observe that regular non-resuming send works, but resuming doesn't work.
3. Upgrade zrepl to this change.
4. Observe that both regular and resuming send works.

closes https://github.com/zrepl/zrepl/pull/613
2022-09-25 17:32:02 +02:00
..
_static docs: add logo 2017-11-11 23:25:12 +01:00
configuration docs: improve overview 2022-07-31 15:50:53 +02:00
installation docs: add a note that FreeBSD jail zfs userland needs to be kept in sync with kernel module 2021-12-18 16:06:26 +01:00
quickstart docs: fix typo in backup_to_external_disk.rst 2022-01-20 19:25:03 +01:00
sphinxconf docs: bump copyright 2019-03-30 19:01:34 +01:00
usage/runbooks docs: add runbook on how to migrate sending side to new zpool 2021-11-14 17:34:32 +01:00
.gitignore docs: publishing workflow as script 2017-11-11 23:25:12 +01:00
changelog.rst rework resume token validation to allow resuming from raw sends of unencrypted datasets 2022-09-25 17:32:02 +02:00
conf.py docs: sphinx-versioning would not build master 2017-11-18 21:28:10 +01:00
configuration.rst make initial replication policy configurable (most_recent, all, fail) 2022-06-26 14:36:59 +02:00
gen-sphinx-versioning-flags.py docs: gen-sphinx-versioning-flags.py: implement the stable branch logic used for 0.3.0 release 2020-09-12 14:03:45 +02:00
global.rst.inc docs: badges & links to Matrix chat room 2022-01-09 12:05:19 +01:00
index.rst docs: badges & links to Matrix chat room 2022-01-09 12:05:19 +01:00
installation.rst build: rpm + deb targets, build-in-docker targets, CircleCI pipeline rewrite 2020-09-02 21:34:52 +02:00
Makefile build: include docs in release artifacts + use sphinxcontrib-versioning 2017-11-18 16:28:06 +01:00
pr.rst docs: reflect changes in replication_rewrite branch 2018-10-11 18:03:18 +02:00
publish.sh docs / CI: stop creating churn with doc commits & commit as zreplbot@ 2021-07-08 17:07:24 +02:00
quickstart.rst docs: document fan-out replication & add quick-start guide 2022-01-09 12:45:09 +01:00
requirements.txt build: use git+https to fix lazy.sh docdep failures 2022-03-20 20:23:01 +01:00
supporters.rst send/recv: job-level bandwidth limiting 2021-09-12 20:08:43 +02:00
usage.rst docs: update CLI usage to --mode raw & remove outdated "Limitations" section 2022-06-28 00:17:34 +02:00