mirror of
https://github.com/zrepl/zrepl.git
synced 2024-12-22 23:20:51 +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
63 lines
2.3 KiB
Go
63 lines
2.3 KiB
Go
// Code generated by "enumer -type=PlaceholderCreationEncryptionProperty -transform=kebab -trimprefix=PlaceholderCreationEncryptionProperty"; DO NOT EDIT.
|
|
|
|
//
|
|
package endpoint
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
const (
|
|
_PlaceholderCreationEncryptionPropertyName_0 = "unspecifiedinherit"
|
|
_PlaceholderCreationEncryptionPropertyName_1 = "off"
|
|
)
|
|
|
|
var (
|
|
_PlaceholderCreationEncryptionPropertyIndex_0 = [...]uint8{0, 11, 18}
|
|
_PlaceholderCreationEncryptionPropertyIndex_1 = [...]uint8{0, 3}
|
|
)
|
|
|
|
func (i PlaceholderCreationEncryptionProperty) String() string {
|
|
switch {
|
|
case 1 <= i && i <= 2:
|
|
i -= 1
|
|
return _PlaceholderCreationEncryptionPropertyName_0[_PlaceholderCreationEncryptionPropertyIndex_0[i]:_PlaceholderCreationEncryptionPropertyIndex_0[i+1]]
|
|
case i == 4:
|
|
return _PlaceholderCreationEncryptionPropertyName_1
|
|
default:
|
|
return fmt.Sprintf("PlaceholderCreationEncryptionProperty(%d)", i)
|
|
}
|
|
}
|
|
|
|
var _PlaceholderCreationEncryptionPropertyValues = []PlaceholderCreationEncryptionProperty{1, 2, 4}
|
|
|
|
var _PlaceholderCreationEncryptionPropertyNameToValueMap = map[string]PlaceholderCreationEncryptionProperty{
|
|
_PlaceholderCreationEncryptionPropertyName_0[0:11]: 1,
|
|
_PlaceholderCreationEncryptionPropertyName_0[11:18]: 2,
|
|
_PlaceholderCreationEncryptionPropertyName_1[0:3]: 4,
|
|
}
|
|
|
|
// PlaceholderCreationEncryptionPropertyString retrieves an enum value from the enum constants string name.
|
|
// Throws an error if the param is not part of the enum.
|
|
func PlaceholderCreationEncryptionPropertyString(s string) (PlaceholderCreationEncryptionProperty, error) {
|
|
if val, ok := _PlaceholderCreationEncryptionPropertyNameToValueMap[s]; ok {
|
|
return val, nil
|
|
}
|
|
return 0, fmt.Errorf("%s does not belong to PlaceholderCreationEncryptionProperty values", s)
|
|
}
|
|
|
|
// PlaceholderCreationEncryptionPropertyValues returns all values of the enum
|
|
func PlaceholderCreationEncryptionPropertyValues() []PlaceholderCreationEncryptionProperty {
|
|
return _PlaceholderCreationEncryptionPropertyValues
|
|
}
|
|
|
|
// IsAPlaceholderCreationEncryptionProperty returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
func (i PlaceholderCreationEncryptionProperty) IsAPlaceholderCreationEncryptionProperty() bool {
|
|
for _, v := range _PlaceholderCreationEncryptionPropertyValues {
|
|
if i == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|