[PATCH proxmox-backup v4 4/8] config: inline NodeConfig::validate() to its only call side

Christian Ebner
2026-03-27T12:13:44Z

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>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@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