all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup v3 2/6] config: inline NodeConfig::validate() to its only call side
Date: Thu, 12 Mar 2026 12:42:04 +0100	[thread overview]
Message-ID: <20260312114208.514373-5-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260312114208.514373-1-c.ebner@proxmox.com>

Helps to avoid any dependency on the openssl crate when moving the
NodeConfig to the pbs-api-types crate, which is itself done in order
to move the node config implementation to pbs-config.

Having the implementation in pbs-config will allow to easily access
the node config from pbs-datastore, in order to read the node proxy
config.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 src/config/node.rs | 35 ++++++++++++++---------------------
 1 file changed, 14 insertions(+), 21 deletions(-)

diff --git a/src/config/node.rs b/src/config/node.rs
index c01c6aa7a..93173e66f 100644
--- a/src/config/node.rs
+++ b/src/config/node.rs
@@ -34,7 +34,20 @@ pub fn config() -> Result<(NodeConfig, [u8; 32]), Error> {
 
 /// Write the Node Config, requires the write lock to be held.
 pub fn save_config(config: &NodeConfig) -> Result<(), Error> {
-    config.validate()?;
+    let mut domains = HashSet::new();
+    for domain in config.acme_domains() {
+        let domain = domain?;
+        if !domains.insert(domain.domain.to_lowercase()) {
+            bail!("duplicate domain '{}' in ACME config", domain.domain);
+        }
+    }
+    let mut dummy_acceptor = SslAcceptor::mozilla_intermediate_v5(SslMethod::tls()).unwrap();
+    if let Some(ciphers) = config.ciphers_tls_1_3.as_deref() {
+        dummy_acceptor.set_ciphersuites(ciphers)?;
+    }
+    if let Some(ciphers) = config.ciphers_tls_1_2.as_deref() {
+        dummy_acceptor.set_cipher_list(ciphers)?;
+    }
 
     let raw = crate::tools::config::to_bytes(config, &NodeConfig::API_SCHEMA)?;
     pbs_config::replace_backup_config(CONF_FILE, &raw)
@@ -246,26 +259,6 @@ impl NodeConfig {
     pub fn set_http_proxy(&mut self, http_proxy: Option<String>) {
         self.http_proxy = http_proxy;
     }
-
-    /// Validate the configuration.
-    pub fn validate(&self) -> Result<(), Error> {
-        let mut domains = HashSet::new();
-        for domain in self.acme_domains() {
-            let domain = domain?;
-            if !domains.insert(domain.domain.to_lowercase()) {
-                bail!("duplicate domain '{}' in ACME config", domain.domain);
-            }
-        }
-        let mut dummy_acceptor = SslAcceptor::mozilla_intermediate_v5(SslMethod::tls()).unwrap();
-        if let Some(ciphers) = self.ciphers_tls_1_3.as_deref() {
-            dummy_acceptor.set_ciphersuites(ciphers)?;
-        }
-        if let Some(ciphers) = self.ciphers_tls_1_2.as_deref() {
-            dummy_acceptor.set_cipher_list(ciphers)?;
-        }
-
-        Ok(())
-    }
 }
 
 pub struct AcmeDomainIter<'a> {
-- 
2.47.3





  parent reply	other threads:[~2026-03-12 11:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 11:42 [PATCH proxmox{,-backup} v3 0/8] fix #6716: Add support for http proxy configuration for S3 endpoints Christian Ebner
2026-03-12 11:42 ` [PATCH proxmox v3 1/2] http: move http proxy schema from PBS to crate's api types Christian Ebner
2026-03-12 11:42 ` [PATCH proxmox v3 2/2] pbs-api-types: move over NodeConfig and related api type from PBS Christian Ebner
2026-03-12 11:42 ` [PATCH proxmox-backup v3 1/6] pbs-config: use http proxy schema moved to proxmox-http crate Christian Ebner
2026-03-12 11:42 ` Christian Ebner [this message]
2026-03-12 11:42 ` [PATCH proxmox-backup v3 3/6] config: use moved NodeConfig definitions in pbs-api-types Christian Ebner
2026-03-12 11:42 ` [PATCH proxmox-backup v3 4/6] tools: drop unused from_property_string() helper Christian Ebner
2026-03-12 11:42 ` [PATCH proxmox-backup v3 5/6] config: move node config into pbs-config, including helper tools Christian Ebner
2026-03-12 11:42 ` [PATCH proxmox-backup v3 6/6] fix #6716: pass node http proxy config to s3 backend Christian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260312114208.514373-5-c.ebner@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal