fix(enroll): skip TLS validation during enrollment bootstrap to allow certificate acquisition
Some checks failed
CI/CD Pipeline / Code Format (push) Successful in 3s
CI/CD Pipeline / Clippy Lints (push) Failing after 43s
CI/CD Pipeline / Enrollment Tests (push) Has been skipped
CI/CD Pipeline / Verify Enrollment CLI Flag (push) Has been skipped
CI/CD Pipeline / All Unit Tests (push) Failing after 56s
CI/CD Pipeline / Build Debian Package (push) Has been skipped
CI/CD Pipeline / Build Debian Package (Ubuntu 22.04) (push) Has been skipped
CI/CD Pipeline / Build RPM Package (push) Has been skipped
CI/CD Pipeline / Build Alpine Package (push) Has been skipped
CI/CD Pipeline / Build Arch Package (push) Has been skipped
CI/CD Pipeline / Security Audit (push) Successful in 4s
Some checks failed
CI/CD Pipeline / Code Format (push) Successful in 3s
CI/CD Pipeline / Clippy Lints (push) Failing after 43s
CI/CD Pipeline / Enrollment Tests (push) Has been skipped
CI/CD Pipeline / Verify Enrollment CLI Flag (push) Has been skipped
CI/CD Pipeline / All Unit Tests (push) Failing after 56s
CI/CD Pipeline / Build Debian Package (push) Has been skipped
CI/CD Pipeline / Build Debian Package (Ubuntu 22.04) (push) Has been skipped
CI/CD Pipeline / Build RPM Package (push) Has been skipped
CI/CD Pipeline / Build Alpine Package (push) Has been skipped
CI/CD Pipeline / Build Arch Package (push) Has been skipped
CI/CD Pipeline / Security Audit (push) Successful in 4s
This commit is contained in:
@ -142,16 +142,16 @@ pub struct AppConfig {
|
||||
|
||||
impl AppConfig {
|
||||
/// Load configuration from a YAML file
|
||||
pub fn load(path: &str) -> Result<Self> {
|
||||
pub fn load(path: &str, skip_tls_validation: bool) -> Result<Self> {
|
||||
let content = std::fs::read_to_string(path)
|
||||
.with_context(|| format!("Failed to read config file: {}", path))?;
|
||||
|
||||
let config: AppConfig = serde_yaml::from_str(&content)
|
||||
.with_context(|| format!("Failed to parse config file: {}", path))?;
|
||||
|
||||
// Validate TLS configuration if enabled
|
||||
// Validate TLS configuration if enabled (skip during enrollment bootstrap)
|
||||
if let Some(ref tls) = config.tls {
|
||||
if tls.enabled {
|
||||
if tls.enabled && !skip_tls_validation {
|
||||
if !std::path::Path::new(&tls.ca_cert).exists() {
|
||||
anyhow::bail!("TLS CA certificate not found: {}", tls.ca_cert);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ async fn main() -> Result<()> {
|
||||
);
|
||||
|
||||
// Load configuration
|
||||
let config = match AppConfig::load(&args.config) {
|
||||
let config = match AppConfig::load(&args.config, args.enroll.is_some()) {
|
||||
Ok(cfg) => {
|
||||
info!(
|
||||
port = cfg.server.port,
|
||||
|
||||
Reference in New Issue
Block a user