Start to implement devices enrollment

This commit is contained in:
2024-07-01 21:10:45 +02:00
parent 378c296e71
commit 9ba4aa5194
21 changed files with 267 additions and 16 deletions

View File

@ -1,3 +1,4 @@
use crate::devices::device::DeviceId;
use clap::{Parser, Subcommand};
use std::path::{Path, PathBuf};
@ -154,7 +155,7 @@ impl AppConfig {
/// Get PKI root CA cert path
pub fn root_ca_cert_path(&self) -> PathBuf {
self.pki_path().join("root_ca.pem")
self.pki_path().join("root_ca.crt")
}
/// Get PKI root CA CRL path
@ -169,7 +170,7 @@ impl AppConfig {
/// Get PKI web CA cert path
pub fn web_ca_cert_path(&self) -> PathBuf {
self.pki_path().join("web_ca.pem")
self.pki_path().join("web_ca.crt")
}
/// Get PKI web CA CRL path
@ -184,7 +185,7 @@ impl AppConfig {
/// Get PKI devices CA cert path
pub fn devices_ca_cert_path(&self) -> PathBuf {
self.pki_path().join("devices_ca.pem")
self.pki_path().join("devices_ca.crt")
}
/// Get PKI devices CA CRL path
@ -199,13 +200,33 @@ impl AppConfig {
/// Get PKI server cert path
pub fn server_cert_path(&self) -> PathBuf {
self.pki_path().join("server.pem")
self.pki_path().join("server.crt")
}
/// Get PKI server private key path
pub fn server_priv_key_path(&self) -> PathBuf {
self.pki_path().join("server.key")
}
/// Get devices configuration storage path
pub fn devices_config_path(&self) -> PathBuf {
self.storage_path().join("devices")
}
/// Get device configuration path
pub fn device_config_path(&self, id: &DeviceId) -> PathBuf {
self.devices_config_path().join(format!("{}.conf", id.0))
}
/// Get device certificate path
pub fn device_cert_path(&self, id: &DeviceId) -> PathBuf {
self.devices_config_path().join(format!("{}.crt", id.0))
}
/// Get device CSR path
pub fn device_csr_path(&self, id: &DeviceId) -> PathBuf {
self.devices_config_path().join(format!("{}.csr", id.0))
}
}
#[cfg(test)]