* [pbs-devel] [PATCH proxmox-backup 0/2] log encryption key source
@ 2020-11-11 15:33 Stoiko Ivanov
2020-11-11 15:33 ` [pbs-devel] [PATCH proxmox-backup 1/2] inform user when using default encryption key Stoiko Ivanov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2020-11-11 15:33 UTC (permalink / raw)
To: pbs-devel
The patchset adds println statements to `proxmox-backup-client`
notifying users which encryption key is used for a backup.
Split into 2 patches because I consider the first one quite important,
since it can lead to data-loss (playing around with
`proxmox-backup-client key` , forgetting about it - at some point later
needing to restore a backup, without having access to the user homedir
on the system anymore).
If both get accepted I'll gladly send a v2 (else feel free to squash
them).
tested on my pmg-instance.
Stoiko Ivanov (2):
inform user when using default encryption key
log source of encryption key
src/bin/proxmox-backup-client.rs | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 1/2] inform user when using default encryption key
2020-11-11 15:33 [pbs-devel] [PATCH proxmox-backup 0/2] log encryption key source Stoiko Ivanov
@ 2020-11-11 15:33 ` Stoiko Ivanov
2020-11-11 15:33 ` [pbs-devel] [PATCH proxmox-backup 2/2] log source of " Stoiko Ivanov
2020-11-11 15:36 ` [pbs-devel] applied-series: [PATCH proxmox-backup 0/2] log encryption key source Thomas Lamprecht
2 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2020-11-11 15:33 UTC (permalink / raw)
To: pbs-devel
Currently if you generate a default encryption key:
`proxmox-backup-client key create --kdf none`
all backup operations which don't explicitly disable encryption will be
encrypted with this key.
I found it quite surprising, that my backups were all encrypted without
me explicitly specfying neither key nor encryption mode
This patch informs the user when the default key is used (and no
crypt-mode is provided explicitly)
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
src/bin/proxmox-backup-client.rs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs
index 2d05f622..79031d72 100644
--- a/src/bin/proxmox-backup-client.rs
+++ b/src/bin/proxmox-backup-client.rs
@@ -817,7 +817,10 @@ fn keyfile_parameters(param: &Value) -> Result<(Option<Vec<u8>>, CryptMode), Err
Ok(match (keydata, crypt_mode) {
// no parameters:
(None, None) => match key::read_optional_default_encryption_key()? {
- Some(key) => (Some(key), CryptMode::Encrypt),
+ Some(key) => {
+ println!("Encrypting with default encryption key!");
+ (Some(key), CryptMode::Encrypt)
+ },
None => (None, CryptMode::None),
},
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 2/2] log source of encryption key
2020-11-11 15:33 [pbs-devel] [PATCH proxmox-backup 0/2] log encryption key source Stoiko Ivanov
2020-11-11 15:33 ` [pbs-devel] [PATCH proxmox-backup 1/2] inform user when using default encryption key Stoiko Ivanov
@ 2020-11-11 15:33 ` Stoiko Ivanov
2020-11-11 15:36 ` [pbs-devel] applied-series: [PATCH proxmox-backup 0/2] log encryption key source Thomas Lamprecht
2 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2020-11-11 15:33 UTC (permalink / raw)
To: pbs-devel
This patch prints the source of the encryption key when running
operations with proxmox-backup-client.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
src/bin/proxmox-backup-client.rs | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs
index 79031d72..54e11f08 100644
--- a/src/bin/proxmox-backup-client.rs
+++ b/src/bin/proxmox-backup-client.rs
@@ -802,7 +802,10 @@ fn keyfile_parameters(param: &Value) -> Result<(Option<Vec<u8>>, CryptMode), Err
let keydata = match (keyfile, key_fd) {
(None, None) => None,
(Some(_), Some(_)) => bail!("--keyfile and --keyfd are mutually exclusive"),
- (Some(keyfile), None) => Some(file_get_contents(keyfile)?),
+ (Some(keyfile), None) => {
+ println!("Using encryption key file: {}", keyfile);
+ Some(file_get_contents(keyfile)?)
+ },
(None, Some(fd)) => {
let input = unsafe { std::fs::File::from_raw_fd(fd) };
let mut data = Vec::new();
@@ -810,6 +813,7 @@ fn keyfile_parameters(param: &Value) -> Result<(Option<Vec<u8>>, CryptMode), Err
.map_err(|err| {
format_err!("error reading encryption key from fd {}: {}", fd, err)
})?;
+ println!("Using encryption key from file descriptor");
Some(data)
}
};
@@ -830,7 +834,10 @@ fn keyfile_parameters(param: &Value) -> Result<(Option<Vec<u8>>, CryptMode), Err
// just --crypt-mode other than none
(None, Some(crypt_mode)) => match key::read_optional_default_encryption_key()? {
None => bail!("--crypt-mode without --keyfile and no default key file available"),
- Some(key) => (Some(key), crypt_mode),
+ Some(key) => {
+ println!("Encrypting with default encryption key!");
+ (Some(key), crypt_mode)
+ },
}
// just --keyfile
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pbs-devel] applied-series: [PATCH proxmox-backup 0/2] log encryption key source
2020-11-11 15:33 [pbs-devel] [PATCH proxmox-backup 0/2] log encryption key source Stoiko Ivanov
2020-11-11 15:33 ` [pbs-devel] [PATCH proxmox-backup 1/2] inform user when using default encryption key Stoiko Ivanov
2020-11-11 15:33 ` [pbs-devel] [PATCH proxmox-backup 2/2] log source of " Stoiko Ivanov
@ 2020-11-11 15:36 ` Thomas Lamprecht
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2020-11-11 15:36 UTC (permalink / raw)
To: Proxmox Backup Server development discussion, Stoiko Ivanov
On 11.11.20 16:33, Stoiko Ivanov wrote:
> The patchset adds println statements to `proxmox-backup-client`
> notifying users which encryption key is used for a backup.
>
> Split into 2 patches because I consider the first one quite important,
> since it can lead to data-loss (playing around with
> `proxmox-backup-client key` , forgetting about it - at some point later
> needing to restore a backup, without having access to the user homedir
> on the system anymore).
>
> If both get accepted I'll gladly send a v2 (else feel free to squash
> them).
>
> tested on my pmg-instance.
>
> Stoiko Ivanov (2):
> inform user when using default encryption key
> log source of encryption key
>
> src/bin/proxmox-backup-client.rs | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
applied series, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-11 15:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11 15:33 [pbs-devel] [PATCH proxmox-backup 0/2] log encryption key source Stoiko Ivanov
2020-11-11 15:33 ` [pbs-devel] [PATCH proxmox-backup 1/2] inform user when using default encryption key Stoiko Ivanov
2020-11-11 15:33 ` [pbs-devel] [PATCH proxmox-backup 2/2] log source of " Stoiko Ivanov
2020-11-11 15:36 ` [pbs-devel] applied-series: [PATCH proxmox-backup 0/2] log encryption key source Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox