hotfix for issue with socktop agent not creating ssl certificate on first launch after upgrade of axum server version.
Some checks failed
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled

This commit is contained in:
jasonwitty 2025-11-21 00:21:05 -08:00
parent 1d7bc42d59
commit 3024816525
4 changed files with 10 additions and 6 deletions

2
Cargo.lock generated
View File

@ -2060,7 +2060,7 @@ dependencies = [
[[package]] [[package]]
name = "socktop_agent" name = "socktop_agent"
version = "1.50.1" version = "1.50.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"assert_cmd", "assert_cmd",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "socktop_agent" name = "socktop_agent"
version = "1.50.1" version = "1.50.2"
authors = ["Jason Witty <jasonpwitty+socktop@proton.me>"] authors = ["Jason Witty <jasonpwitty+socktop@proton.me>"]
description = "Socktop agent daemon. Serves host metrics over WebSocket." description = "Socktop agent daemon. Serves host metrics over WebSocket."
edition = "2024" edition = "2024"
@ -24,7 +24,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"], optional = tr
gfxinfo = "0.1.2" gfxinfo = "0.1.2"
once_cell = "1.19" once_cell = "1.19"
axum-server = { version = "0.7", features = ["tls-rustls"] } axum-server = { version = "0.7", features = ["tls-rustls"] }
rustls = "0.23" rustls = { version = "0.23", features = ["aws-lc-rs"] }
rustls-pemfile = "2.1" rustls-pemfile = "2.1"
rcgen = "0.13" rcgen = "0.13"
anyhow = "1" anyhow = "1"

View File

@ -30,6 +30,12 @@ fn arg_value(name: &str) -> Option<String> {
} }
fn main() -> anyhow::Result<()> { fn main() -> anyhow::Result<()> {
// Install rustls crypto provider before any TLS operations
// This is required when using axum-server's tls-rustls feature
rustls::crypto::aws_lc_rs::default_provider()
.install_default()
.ok(); // Ignore error if already installed
#[cfg(feature = "logging")] #[cfg(feature = "logging")]
tracing_subscriber::fmt::init(); tracing_subscriber::fmt::init();

View File

@ -1,5 +1,3 @@
use assert_cmd::cargo::cargo_bin;
use assert_cmd::prelude::*;
use std::fs; use std::fs;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::Command; use std::process::Command;
@ -18,7 +16,7 @@ fn generates_self_signed_cert_and_key_in_xdg_path() {
let xdg = tmpdir.path().to_path_buf(); let xdg = tmpdir.path().to_path_buf();
// Run the agent once with --enableSSL, short timeout so it exits quickly when killed // Run the agent once with --enableSSL, short timeout so it exits quickly when killed
let mut cmd = Command::new(cargo_bin!("socktop_agent")); let mut cmd = Command::new(assert_cmd::cargo::cargo_bin!("socktop_agent"));
// Bind to an ephemeral port (-p 0) to avoid conflicts/flakes // Bind to an ephemeral port (-p 0) to avoid conflicts/flakes
cmd.env("XDG_CONFIG_HOME", &xdg) cmd.env("XDG_CONFIG_HOME", &xdg)
.arg("--enableSSL") .arg("--enableSSL")