notifications needs to pull them (instead of the notifications be pushed
to it), an external message bus (e.g. rabbitmq, Kafka) should be used for
that purpose.
-
+* RBD: Trailing newline in passphrase files (`<passphrase-file>` argument in
+ `rbd encryption format` command and `--encryption-passphrase-file` option
+ in other commands) is no longer stripped.
>=17.2.1
`passphrase-file`.
.. note::
- If the content of `passphrase-file` ends with a newline character, it will
- be stripped off.
+ In older versions, if the content of `passphrase-file` ended with a newline
+ character, it was stripped off.
By default, AES-256 in xts-plain64 mode (which is the current recommended mode,
and the usual default for other tools) will be used. The format operation
dd if=/dev/urandom of=/tmp/testdata2 bs=4M count=4
# create passphrase files
-echo -n "password" > /tmp/passphrase
-echo -n "password2" > /tmp/passphrase2
+printf "pass\0word\n" > /tmp/passphrase
+printf "\t password2 " > /tmp/passphrase2
# create an image
rbd create testimg --size=32M
auto& specs = opts->specs;
specs.resize(spec_count);
for (size_t i = 0; i < spec_count; ++i) {
- std::ifstream file(passphrase_files[i].c_str());
+ std::ifstream file(passphrase_files[i], std::ios::in | std::ios::binary);
auto sg = make_scope_guard([&] { file.close(); });
specs[i].format = formats[i];
<< std::endl;
return -errno;
}
-
- if (!passphrase->empty() &&
- (*passphrase)[passphrase->length() - 1] == '\n') {
- passphrase->erase(passphrase->length() - 1);
- }
}
return 0;
return -EINVAL;
}
- std::ifstream file(passphrase_file.c_str());
+ std::ifstream file(passphrase_file, std::ios::in | std::ios::binary);
if (file.fail()) {
std::cerr << "rbd: unable to open passphrase file " << passphrase_file
<< ": " << cpp_strerror(errno) << std::endl;
auto sg = make_scope_guard([&] {
ceph_memzero_s(&passphrase[0], passphrase.size(), passphrase.size()); });
file.close();
- if (!passphrase.empty() && passphrase[passphrase.length() - 1] == '\n') {
- passphrase.erase(passphrase.length() - 1);
- }
auto alg = RBD_ENCRYPTION_ALGORITHM_AES256;
if (vm.count("cipher-alg")) {
});
for (size_t i = 0; i < encryption_format_count; ++i) {
- std::ifstream file(cfg->encryption_passphrase_file[i].c_str());
+ std::ifstream file(cfg->encryption_passphrase_file[i],
+ std::ios::in | std::ios::binary);
auto sg2 = make_scope_guard([&] { file.close(); });
specs[i].format = cfg->encryption_format[i];
<< cpp_strerror(errno) << std::endl;
goto close_fd;
}
-
- if (!passphrase->empty() &&
- (*passphrase)[passphrase->length() - 1] == '\n') {
- passphrase->erase(passphrase->length() - 1);
- }
}
r = image.encryption_load2(&specs[0], encryption_format_count);