jimsalterjrs / sanoid

These are policy-driven snapshot management and replication tools which use OpenZFS for underlying next-gen storage. (Btrfs support plans are shelved unless and until btrfs becomes reliable.)
http://www.openoid.net/products/
GNU General Public License v3.0
3.15k stars 309 forks source link

--insecure-direct-connection is undocumented #963

Open jjakob opened 4 days ago

jjakob commented 4 days ago

The documentation that does exists is very sparse and incomplete. I had to read the source to figure out how it works.

The usage text only says: --insecure-direct-connection=IP:PORT[,IP:PORT] WARNING: DATA IS NOT ENCRYPTED. First address pair is for connecting to the target and the second for listening at the target

README.md has more, but still incomplete:

--insecure-direct-connection=IP:PORT[,IP:PORT,[TIMEOUT,[mbuffer]]]

    WARNING: This is an insecure option as the data is not encrypted while being sent over the network. Only use if you trust the complete network path.
    Use a direct tcp connection (with socat and busybox nc/mbuffer) for the actual zfs send/recv stream. All control commands are still executed via the ssh connection. The first address pair is used for connecting to the target host from the source host and the second pair is for listening on the target host. If the later isn't provided the same as the former is used. This can be used for saturating high throughput connection like >= 10GBe network which isn't easy with the overhead off ssh. It can also be useful for encrypted datasets to lower the cpu usage needed for replication but be aware that metadata is NOT ENCRYPTED in this case. The default timeout is 60 seconds and can be overridden by providing it as third argument. By default busybox nc is used for the listeing tcp socket, if mbuffer is preferred specify its name as fourth argument
but be aware that mbuffer listens on all interfaces and uses an optionally provided ip address for access restriction (This option can't be used for relaying between two remote hosts)

How it actualy works is:

When the switch is enabled:

Additionally, each command is checked for existence on the local and remote host. syncoid will die with an error if any of the following is true:

Some examples:

Any hostname can be a DNS or IP name, as preferred.

I hope this accurately describes how it works.