From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 00D0F1FF15C for ; Fri, 11 Jul 2025 15:39:07 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A1CB3112AE; Fri, 11 Jul 2025 15:39:53 +0200 (CEST) From: Shannon Sterz To: pbs-devel@lists.proxmox.com Date: Fri, 11 Jul 2025 15:39:17 +0200 Message-Id: <20250711133917.251291-1-s.sterz@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.020 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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. [repository.rs, standard.rs, proxmox.com] Subject: [pbs-devel] [RFC PATCH] apt: add keys as option for proxmox repositories 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: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Signed-off-by: Shannon Sterz --- sending this as rfc for now as i could not do any in-depth testing yet, but cargo {check,clippy,test} are all happy (or at least not less happy than before). proxmox-apt/src/repositories/repository.rs | 2 +- proxmox-apt/src/repositories/standard.rs | 24 +++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/proxmox-apt/src/repositories/repository.rs b/proxmox-apt/src/repositories/repository.rs index a1263e89..24e7943b 100644 --- a/proxmox-apt/src/repositories/repository.rs +++ b/proxmox-apt/src/repositories/repository.rs @@ -122,7 +122,7 @@ impl APTRepositoryImpl for APTRepository { product: &str, suite: &str, ) -> bool { - let (package_type, handle_uris, component) = handle.info(product); + let (package_type, handle_uris, component, _key) = handle.info(product); let mut found_uri = false; diff --git a/proxmox-apt/src/repositories/standard.rs b/proxmox-apt/src/repositories/standard.rs index 7eef0502..3dfb917b 100644 --- a/proxmox-apt/src/repositories/standard.rs +++ b/proxmox-apt/src/repositories/standard.rs @@ -1,6 +1,6 @@ use proxmox_apt_api_types::{ - APTRepository, APTRepositoryFileType, APTRepositoryHandle, APTRepositoryPackageType, - APTStandardRepository, + APTRepository, APTRepositoryFileType, APTRepositoryHandle, APTRepositoryOption, + APTRepositoryPackageType, APTStandardRepository, }; use crate::repositories::DebianCodename; @@ -27,10 +27,11 @@ pub trait APTRepositoryHandleImpl { fn name(self) -> String; /// Get the standard file path for the repository referenced by the handle. fn path(self, product: &str, suite: &str) -> String; - /// Get package type, possible URIs and the component associated with the handle. + /// Get package type, possible URIs, the component associated with the handle and the + /// associated signing key. /// /// The first URI is the preferred one. - fn info(self, product: &str) -> (APTRepositoryPackageType, Vec, String); + fn info(self, product: &str) -> (APTRepositoryPackageType, Vec, String, &str); /// Get the standard repository referenced by the handle. /// /// An URI in the result is not '/'-terminated (under the assumption that no valid @@ -111,7 +112,7 @@ impl APTRepositoryHandleImpl for APTRepositoryHandle { } } - fn info(self, product: &str) -> (APTRepositoryPackageType, Vec, String) { + fn info(self, product: &str) -> (APTRepositoryPackageType, Vec, String, &str) { match self { APTRepositoryHandle::Enterprise => ( APTRepositoryPackageType::Deb, @@ -123,6 +124,7 @@ impl APTRepositoryHandleImpl for APTRepositoryHandle { _ => vec![format!("https://enterprise.proxmox.com/debian/{product}")], }, format!("{product}-enterprise"), + "/usr/share/keyrings/proxmox-archive-keyring.gpg", ), APTRepositoryHandle::NoSubscription => ( APTRepositoryPackageType::Deb, @@ -134,6 +136,7 @@ impl APTRepositoryHandleImpl for APTRepositoryHandle { _ => vec![format!("http://download.proxmox.com/debian/{product}")], }, format!("{product}-no-subscription"), + "/usr/share/keyrings/proxmox-archive-keyring.gpg", ), APTRepositoryHandle::Test => ( APTRepositoryPackageType::Deb, @@ -145,27 +148,31 @@ impl APTRepositoryHandleImpl for APTRepositoryHandle { _ => vec![format!("http://download.proxmox.com/debian/{product}")], }, format!("{product}-test"), + "/usr/share/keyrings/proxmox-archive-keyring.gpg", ), APTRepositoryHandle::CephSquidEnterprise => ( APTRepositoryPackageType::Deb, vec!["https://enterprise.proxmox.com/debian/ceph-squid".to_string()], "enterprise".to_string(), + "/usr/share/keyrings/proxmox-archive-keyring.gpg", ), APTRepositoryHandle::CephSquidNoSubscription => ( APTRepositoryPackageType::Deb, vec!["http://download.proxmox.com/debian/ceph-squid".to_string()], "no-subscription".to_string(), + "/usr/share/keyrings/proxmox-archive-keyring.gpg", ), APTRepositoryHandle::CephSquidTest => ( APTRepositoryPackageType::Deb, vec!["http://download.proxmox.com/debian/ceph-squid".to_string()], "test".to_string(), + "/usr/share/keyrings/proxmox-archive-keyring.gpg", ), } } fn to_repository(self, product: &str, suite: &str) -> APTRepository { - let (package_type, uris, component) = self.info(product); + let (package_type, uris, component, key) = self.info(product); let file_type = match DebianCodename::try_from(suite) { Ok(codename) if codename >= DebianCodename::Trixie => APTRepositoryFileType::Sources, @@ -177,7 +184,10 @@ impl APTRepositoryHandleImpl for APTRepositoryHandle { uris: vec![uris.into_iter().next().unwrap()], suites: vec![suite.to_string()], components: vec![component], - options: vec![], + options: vec![APTRepositoryOption { + key: "Signed-By".into(), + values: vec![key.to_string()], + }], comment: String::new(), file_type, enabled: true, -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel