Skip to main content

agentmux_common/
system_certs.rs

1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! What is said when a Linux machine has no system certificates, in one place so that `agentmux doctor`, the server's
5//! log and the error a failed https request carries all use the same words.
6
7/// What is wrong: every https request the server makes fails, because there is nothing to check a server's certificate against.
8pub const NO_SYSTEM_CERTS: &str = "no system certificates found: every https request the server makes (models, updates, connected accounts) would fail";
9
10/// What to do about it.
11pub const NO_SYSTEM_CERTS_FIX: &str = "install the ca-certificates package (Debian and Ubuntu: `apt install ca-certificates`; Fedora: `dnf install ca-certificates`; Alpine: `apk add ca-certificates`), or point SSL_CERT_FILE at a bundle, then restart AgentMux (the server reads the certificates once, when it starts)";
12
13/// The two together, as one sentence for a log line or an error.
14pub fn no_system_certs_message() -> String {
15    format!("{NO_SYSTEM_CERTS}. To fix it, {NO_SYSTEM_CERTS_FIX}")
16}
17
18#[cfg(test)]
19mod tests {
20    use super::*;
21
22    #[test]
23    fn the_message_names_the_problem_and_the_package() {
24        let m = no_system_certs_message();
25        assert!(m.starts_with("no system certificates found"));
26        assert!(m.contains("ca-certificates") && m.contains("SSL_CERT_FILE"));
27    }
28}