gateway: serve the hive dashboard on <hive>.hives.<swarm> behind authelia, drop htpasswd
The dashboard, its API, the swagger UI and the agent routes move to their own vhost, `swarm.dashboardDomain` = `<hive>.hives.<swarm.domain>`, under the swarm domain so authelia's session cookie reaches it. `/`, `/api/` and `/api/docs/` ask authelia through `auth_request`, and authelia's `operatorsOnly` rule for each hive's dashboard name lets only the admins group in. The hive domain keeps matrix discovery and redirects every other path to the new name. The name rides as a SAN on the hive's own gateway leaf: the per-hive bao role allows it, and hive-tls asks for it and checks coverage. HTTP Basic auth is gone: the htpasswd writer and its test, the `hivectl gateway` verbs and host-socket requests, the `gateway.auth` options (now a removed-option error), the unauthorized page and the bcrypt dependency. tmpfiles deletes a leftover gateway.htpasswd, which held bcrypt hashes at 0644. c0re hands out dashboard and agent URLs on the new name (HYPERHIVE_DASHBOARD_DOMAIN), and the swarm controller's hive roster carries each hive's dashboard name for the swarm UI's hive list. Closes #3469
This commit is contained in:
parent
09ad7386b2
commit
92559af8e7
47 changed files with 351 additions and 623 deletions
|
|
@ -860,13 +860,15 @@ async fn health() -> &'static str {
|
|||
|
||||
/// One hive in the swarm's directory — the same `name`/`domain` pair
|
||||
/// `services.hyperhive.swarm.hives` (nix/host-modules/swarm.nix) declares,
|
||||
/// carried across unchanged rather than reshaped, so this stays a direct
|
||||
/// mirror of the nix source of truth instead of a second vocabulary for
|
||||
/// the same two fields.
|
||||
/// plus that hive's `swarm.dashboardDomains` entry, carried across
|
||||
/// unchanged rather than reshaped, so this stays a direct mirror of the
|
||||
/// nix source of truth instead of a second vocabulary for the same fields.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
|
||||
struct HiveEntry {
|
||||
name: String,
|
||||
domain: String,
|
||||
/// The host the hive's dashboard answers on.
|
||||
dashboard: String,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
|
@ -3706,6 +3708,7 @@ mod tests {
|
|||
hives: std::sync::Arc::new(vec![HiveEntry {
|
||||
name: "pr1ma".to_owned(),
|
||||
domain: "pr1ma.example".to_owned(),
|
||||
dashboard: "pr1ma.hives.example".to_owned(),
|
||||
}]),
|
||||
links: std::sync::Arc::new(Vec::new()),
|
||||
status: None,
|
||||
|
|
@ -4139,6 +4142,7 @@ mod tests {
|
|||
hives.push(HiveEntry {
|
||||
name: "sec0nd".to_owned(),
|
||||
domain: "sec0nd.example".to_owned(),
|
||||
dashboard: "sec0nd.hives.example".to_owned(),
|
||||
});
|
||||
let state = super::AppState {
|
||||
hives: std::sync::Arc::new(hives),
|
||||
|
|
@ -5908,7 +5912,7 @@ mod tests {
|
|||
unsafe {
|
||||
std::env::set_var(
|
||||
HIVES_ENV,
|
||||
r#"[{"name":"pr1ma","domain":"pr1ma.example.com"},{"name":"umbra","domain":"umbra.example.com"}]"#,
|
||||
r#"[{"name":"pr1ma","domain":"pr1ma.example.com","dashboard":"pr1ma.hives.example"},{"name":"umbra","domain":"umbra.example.com","dashboard":"umbra.hives.example"}]"#,
|
||||
);
|
||||
}
|
||||
assert_eq!(
|
||||
|
|
@ -5917,10 +5921,12 @@ mod tests {
|
|||
HiveEntry {
|
||||
name: "pr1ma".to_string(),
|
||||
domain: "pr1ma.example.com".to_string(),
|
||||
dashboard: "pr1ma.hives.example".to_string(),
|
||||
},
|
||||
HiveEntry {
|
||||
name: "umbra".to_string(),
|
||||
domain: "umbra.example.com".to_string(),
|
||||
dashboard: "umbra.hives.example".to_string(),
|
||||
},
|
||||
]
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue