mirror of
https://github.com/mailscope/kumomta.git
synced 2026-08-21 20:08:18 +00:00
tsa: ensure that we have the status endpoint in the default ACL
This commit is contained in:
@@ -84,6 +84,12 @@ allow = true
|
||||
privileges = ["POST"]
|
||||
identity.Group = "kumomta:http-listener-trusted-ip"
|
||||
|
||||
# Explicitly allow blanket unauthenticated access to the health status endpoint
|
||||
[[acl."http_listener/*/tsa/status"]]
|
||||
allow = true
|
||||
privileges = ["GET"]
|
||||
identity.Any = {}
|
||||
|
||||
### TSA config access -----------------------------
|
||||
[[acl."http_listener/*/get_config_v1"]]
|
||||
allow = true
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
use crate::kumod::{DaemonWithMaildir, DaemonWithTsa};
|
||||
use anyhow::Context;
|
||||
|
||||
#[tokio::test]
|
||||
async fn http_liveness_kumod() -> anyhow::Result<()> {
|
||||
let mut daemon = DaemonWithMaildir::start().await?;
|
||||
|
||||
let client = reqwest::Client::new();
|
||||
let response = client
|
||||
.get(&format!(
|
||||
"http://{}/api/check-liveness/v1",
|
||||
daemon.sink.listener("http")
|
||||
))
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
let status = response.status();
|
||||
|
||||
let body_bytes = response
|
||||
.text()
|
||||
.await
|
||||
.context("failed to read error response body")?;
|
||||
|
||||
k9::assert_equal!(format!("{status} {body_bytes}"), "200 OK OK");
|
||||
|
||||
daemon.stop_both().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn http_liveness_tsa() -> anyhow::Result<()> {
|
||||
let mut daemon = DaemonWithTsa::start().await?;
|
||||
|
||||
let client = reqwest::Client::new();
|
||||
let response = client
|
||||
.get(&format!(
|
||||
"http://{}/tsa/status",
|
||||
daemon.tsa.listener("http")
|
||||
))
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
let status = response.status();
|
||||
|
||||
let body_bytes = response
|
||||
.text()
|
||||
.await
|
||||
.context("failed to read error response body")?;
|
||||
|
||||
k9::assert_equal!(format!("{status} {body_bytes}"), "200 OK TSA Daemon OK");
|
||||
|
||||
daemon.stop().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -20,6 +20,7 @@ mod http_inject_compression;
|
||||
mod http_inject_deferred;
|
||||
mod http_inject_size_limit;
|
||||
mod http_inject_template_syntax_error;
|
||||
mod http_liveness;
|
||||
mod log_oob_arf;
|
||||
mod maildir_batch;
|
||||
mod maildir_batch_452;
|
||||
|
||||
Reference in New Issue
Block a user