mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-27 19:04:28 +01:00
fb6a9be954
fixes https://github.com/zrepl/zrepl/issues/504 Problem: plain send + recv with root_fs encrypted + placeholders causes plain recvs whereas user would expect encrypt-on-recv Reason: We create placeholder filesytems with -o encryption=off. Thus, children received below those placeholders won't inherit encryption of root_fs. Fix: We'll have three values for `recv.placeholders.encryption: unspecified (default) | off | inherit`. When we create a placeholder, we will fail the operation if `recv.placeholders.encryption = unspecified`. The exception is if the placeholder filesystem is to encode the client identity ($root_fs/$client_identity) in a pull job. Those are created in `inherit` mode if the config field is `unspecified` so that users who don't need placeholders are not bothered by these details. Future Work: Automatically warn existing users of encrypt-on-recv about the problem if they are affected. The problem that I hit during implementation of this is that the `encryption` prop's `source` doesn't quite behave like other props: `source` is `default` for `encryption=off` and `-` when `encryption=on`. Hence, we can't use `source` to distinguish the following 2x2 cases: (1) placeholder created with explicit -o encryption=off (2) placeholder created without specifying -o encryption with (A) an encrypted parent at creation time (B) an unencrypted parent at creation time
52 lines
2.2 KiB
Go
52 lines
2.2 KiB
Go
// Code generated by "enumer -type=FilesystemPlaceholderCreateEncryptionValue -trimprefix=FilesystemPlaceholderCreateEncryption"; DO NOT EDIT.
|
|
|
|
//
|
|
package zfs
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
const _FilesystemPlaceholderCreateEncryptionValueName = "InheritOff"
|
|
|
|
var _FilesystemPlaceholderCreateEncryptionValueIndex = [...]uint8{0, 7, 10}
|
|
|
|
func (i FilesystemPlaceholderCreateEncryptionValue) String() string {
|
|
i -= 1
|
|
if i < 0 || i >= FilesystemPlaceholderCreateEncryptionValue(len(_FilesystemPlaceholderCreateEncryptionValueIndex)-1) {
|
|
return fmt.Sprintf("FilesystemPlaceholderCreateEncryptionValue(%d)", i+1)
|
|
}
|
|
return _FilesystemPlaceholderCreateEncryptionValueName[_FilesystemPlaceholderCreateEncryptionValueIndex[i]:_FilesystemPlaceholderCreateEncryptionValueIndex[i+1]]
|
|
}
|
|
|
|
var _FilesystemPlaceholderCreateEncryptionValueValues = []FilesystemPlaceholderCreateEncryptionValue{1, 2}
|
|
|
|
var _FilesystemPlaceholderCreateEncryptionValueNameToValueMap = map[string]FilesystemPlaceholderCreateEncryptionValue{
|
|
_FilesystemPlaceholderCreateEncryptionValueName[0:7]: 1,
|
|
_FilesystemPlaceholderCreateEncryptionValueName[7:10]: 2,
|
|
}
|
|
|
|
// FilesystemPlaceholderCreateEncryptionValueString retrieves an enum value from the enum constants string name.
|
|
// Throws an error if the param is not part of the enum.
|
|
func FilesystemPlaceholderCreateEncryptionValueString(s string) (FilesystemPlaceholderCreateEncryptionValue, error) {
|
|
if val, ok := _FilesystemPlaceholderCreateEncryptionValueNameToValueMap[s]; ok {
|
|
return val, nil
|
|
}
|
|
return 0, fmt.Errorf("%s does not belong to FilesystemPlaceholderCreateEncryptionValue values", s)
|
|
}
|
|
|
|
// FilesystemPlaceholderCreateEncryptionValueValues returns all values of the enum
|
|
func FilesystemPlaceholderCreateEncryptionValueValues() []FilesystemPlaceholderCreateEncryptionValue {
|
|
return _FilesystemPlaceholderCreateEncryptionValueValues
|
|
}
|
|
|
|
// IsAFilesystemPlaceholderCreateEncryptionValue returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
func (i FilesystemPlaceholderCreateEncryptionValue) IsAFilesystemPlaceholderCreateEncryptionValue() bool {
|
|
for _, v := range _FilesystemPlaceholderCreateEncryptionValueValues {
|
|
if i == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|