[control] UI socket: with [ui] socket control also serves the API on a 0660 Unix socket and trusts the proof only there; a socket upstream is refused unless it is the admin host on control's own socket; probes under Caddy reach it too

This commit is contained in:
2026-11-10 21:06:56 +01:00
parent 1f5e4a59a0
commit d249bcf9f2
7 changed files with 160 additions and 8 deletions
+15
View File
@@ -315,6 +315,21 @@ pub async fn probe_upstream(
"GET {path} HTTP/1.1\r\nHost: {host_header}\r\nUser-Agent: ianitor-health\r\nConnection: close\r\n\r\n"
);
let run = async {
if let Some(path) = u.unix_path() {
// A socket upstream (the admin host on control's own UI socket): plain HTTP.
#[cfg(unix)]
{
let s = tokio::net::UnixStream::connect(path)
.await
.map_err(|e| io_kind(&e))?;
return ask(s, req.as_bytes()).await.map_err(|e| io_kind(&e));
}
#[cfg(not(unix))]
{
let _ = path;
return Err("refused");
}
}
let tcp = match tokio::net::TcpStream::connect(u.authority()).await {
Ok(t) => t,
Err(e) => return Err(io_kind(&e)),