FIX: AutoTLS via RustTLS
This commit is contained in:
@@ -36,10 +36,6 @@ struct Args {
|
||||
/// Disable TLS encryption (not recommended, use only for debugging)
|
||||
#[arg(long, default_value_t = false)]
|
||||
no_tls: bool,
|
||||
|
||||
/// Save the auto-generated TLS certificate to this file (for client --tls-ca)
|
||||
#[arg(long, env = "FURUMI_TLS_CERT_OUT")]
|
||||
tls_cert_out: Option<PathBuf>,
|
||||
}
|
||||
|
||||
async fn metrics_handler() -> String {
|
||||
@@ -118,16 +114,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let cert_pem = cert_pair.cert.pem();
|
||||
let key_pem = cert_pair.signing_key.serialize_pem();
|
||||
|
||||
// Optionally save the certificate PEM for the client
|
||||
if let Some(ref cert_path) = args.tls_cert_out {
|
||||
std::fs::write(cert_path, &cert_pem)
|
||||
.unwrap_or_else(|e| {
|
||||
eprintln!("Error: Failed to write TLS cert to {:?}: {}", cert_path, e);
|
||||
std::process::exit(1);
|
||||
});
|
||||
println!("TLS certificate saved to {:?} (use with client --tls-ca)", cert_path);
|
||||
}
|
||||
|
||||
let identity = Identity::from_pem(cert_pem, key_pem);
|
||||
let tls_config = ServerTlsConfig::new().identity(identity);
|
||||
builder = builder.tls_config(tls_config)?;
|
||||
|
||||
Reference in New Issue
Block a user