From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 11EB868D3D for ; Wed, 11 Nov 2020 16:34:10 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0630024FD8 for ; Wed, 11 Nov 2020 16:33:40 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id A18F724FC5 for ; Wed, 11 Nov 2020 16:33:38 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 67B6546034 for ; Wed, 11 Nov 2020 16:33:38 +0100 (CET) From: Stoiko Ivanov To: pbs-devel@lists.proxmox.com Date: Wed, 11 Nov 2020 15:33:22 +0000 Message-Id: <20201111153322.28641-3-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201111153322.28641-1-s.ivanov@proxmox.com> References: <20201111153322.28641-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.092 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox-backup-client.rs] Subject: [pbs-devel] [PATCH proxmox-backup 2/2] log source of encryption key X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 15:34:10 -0000 This patch prints the source of the encryption key when running operations with proxmox-backup-client. Signed-off-by: Stoiko Ivanov --- 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>, 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>, 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>, 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