swarm-controller: move the secrets concern into its own module
Refs #6897
This commit is contained in:
parent
7c7c94d184
commit
6d0c0dc391
21 changed files with 35 additions and 25 deletions
|
|
@ -35,7 +35,7 @@ The role signs for every agent:
|
|||
|
||||
The entity name is the agent's name: `swarm-controller` names the entity of
|
||||
each agent's cert login after the agent
|
||||
(`swarm-controller/src/agent_entity.rs`). A request for any other principal,
|
||||
(`swarm-controller/src/secrets/agent_entity.rs`). A request for any other principal,
|
||||
a glob, host certificates, other key types or another extension is a refusal
|
||||
from the store.
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#
|
||||
# Each agent backs up under the credentials swarm-controller wrote for it at
|
||||
# `swarm/hives/<this hive>/archive/<agent>`
|
||||
# (../../swarm-controller/src/archive_access.rs), read with the hive's own
|
||||
# (../../swarm-controller/src/secrets/archive_access.rs), read with the hive's own
|
||||
# store identity: the agent's login to the archive, and its restic password,
|
||||
# which restic reads through `RESTIC_PASSWORD_COMMAND` and nothing writes to
|
||||
# disk. An agent the controller has not granted this hive is skipped. The
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
# the index, so a compromised hive cannot erase history. Dropping history is
|
||||
# the prune unit's job, on this host, by retention.
|
||||
# - `--private-repos`: a login reaches `/<its own name>/` only. There is one
|
||||
# login per agent, created by swarm-controller (../../swarm-controller/src/archive_access.rs)
|
||||
# login per agent, created by swarm-controller (../../swarm-controller/src/secrets/archive_access.rs)
|
||||
# when it places the agent, replaced when it moves and removed when it is
|
||||
# destroyed. An agent's hive can write that agent's repository and no other.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ let
|
|||
|
||||
# What the role pins. `{{identity.entity.name}}` is the name of the entity the
|
||||
# agent's cert login lands on, which swarm-controller sets to the agent's name
|
||||
# (`swarm-controller/src/agent_entity.rs`); with `allowed_users_template` the
|
||||
# (`swarm-controller/src/secrets/agent_entity.rs`); with `allowed_users_template` the
|
||||
# engine checks every requested principal against it, and with
|
||||
# `default_user_template` an unrequested one defaults to it, so a certificate
|
||||
# names its holder's own agent and no other. `allowed_user_key_lengths` limits
|
||||
|
|
|
|||
|
|
@ -1092,7 +1092,7 @@ in
|
|||
SWARM_CONTROLLER_GRAFANA_URL = "https://${swarmCfg.grafana.domain}";
|
||||
# The names squid allows every authenticated agent by default. The
|
||||
# allow-list route refuses them as entries
|
||||
# (swarm-controller/src/egress_allow.rs). A hive that overrides
|
||||
# (swarm-controller/src/secrets/egress_allow.rs). A hive that overrides
|
||||
# `deploy.hive-controller.squid.baseAllowedDomains` is not reflected
|
||||
# here; its hive-c0re skips the entries its own list covers.
|
||||
SWARM_CONTROLLER_SQUID_BASE_DOMAINS = lib.concatStringsSep " " (
|
||||
|
|
|
|||
|
|
@ -29,16 +29,11 @@ mod agent_commands;
|
|||
mod agent_config_repo;
|
||||
mod agent_control;
|
||||
mod agent_custom;
|
||||
mod agent_cutoff;
|
||||
mod agent_entity;
|
||||
mod agent_icon;
|
||||
mod agent_identity;
|
||||
mod agent_input;
|
||||
mod agent_limits;
|
||||
mod agent_login;
|
||||
mod agent_permissions;
|
||||
mod agent_renewal;
|
||||
mod agent_role_ttl;
|
||||
mod agent_ssh;
|
||||
mod agent_state_stream;
|
||||
mod agent_status;
|
||||
|
|
@ -46,19 +41,12 @@ mod agent_todos;
|
|||
mod agents_md;
|
||||
mod agents_md_initial;
|
||||
mod archetypes;
|
||||
mod archive_access;
|
||||
mod attic_copy;
|
||||
mod auth;
|
||||
mod backend_egress;
|
||||
mod backend_env;
|
||||
mod backend_secrets;
|
||||
mod bash_task;
|
||||
mod builder;
|
||||
mod cache_miss;
|
||||
mod claude_login;
|
||||
mod config_drift;
|
||||
mod egress_allow;
|
||||
mod egress_deny;
|
||||
mod git_forge;
|
||||
mod inference;
|
||||
mod jobq;
|
||||
|
|
@ -69,12 +57,11 @@ mod meta_flake;
|
|||
mod observability;
|
||||
mod observability_grant;
|
||||
mod pause_hold;
|
||||
mod proxy_credential;
|
||||
mod queue_identity;
|
||||
mod read_policy;
|
||||
mod review;
|
||||
mod routes;
|
||||
mod schedules;
|
||||
mod secrets;
|
||||
mod ssh_connections;
|
||||
mod startup;
|
||||
mod status;
|
||||
|
|
@ -86,7 +73,7 @@ mod term_stream;
|
|||
mod test_nats;
|
||||
mod wanted;
|
||||
|
||||
// The accounts, forge, observability and review modules keep their crate-root paths (`crate::matrix_account::…`).
|
||||
// The accounts, forge, secrets, observability and review modules keep their crate-root paths (`crate::matrix_account::…`).
|
||||
use accounts::{
|
||||
forge_account, github_account, gitlab_account, link_egress, linked_accounts, matrix_account,
|
||||
};
|
||||
|
|
@ -97,6 +84,11 @@ use jobq::{Late, WorkerDeps, spawn_jobq_worker};
|
|||
use observability::{alerts, held_deploys, otel_http_client, vcs_metrics};
|
||||
use review::{notify_flows, notify_router_api, request_reviewer, review_classifier};
|
||||
use routes::AppState;
|
||||
use secrets::{
|
||||
agent_cutoff, agent_entity, agent_identity, agent_renewal, agent_role_ttl, archive_access,
|
||||
backend_egress, backend_env, backend_secrets, claude_login, egress_allow, egress_deny,
|
||||
proxy_credential, read_policy,
|
||||
};
|
||||
use startup::{
|
||||
agent_icon_reader, agent_status_reader, agents_md_reader, build_app,
|
||||
configured_matrix_homeserver, connect_status_reader, load_hives, load_links, load_swarm_name,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use serde::{Deserialize, Serialize};
|
|||
use swarm_secret_client::backend_env::{self, BackendEnv};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use super::linked_accounts::AccountStore;
|
||||
use crate::linked_accounts::AccountStore;
|
||||
use crate::routes::agents::swarm_hive;
|
||||
use crate::routes::{AppState, error_problem};
|
||||
|
||||
|
|
@ -194,8 +194,8 @@ pub(crate) mod tests {
|
|||
use serde_json::json;
|
||||
use swarm_secret_client::backend_env::BackendEnv;
|
||||
|
||||
use super::super::linked_accounts::{AccountStore, Accounts, tests::FakeStore};
|
||||
use super::{MAX_BYTES, PutBackendEnvRequest, validated};
|
||||
use crate::linked_accounts::{AccountStore, Accounts, tests::FakeStore};
|
||||
|
||||
const SECRET: &str = "sk-live-0123";
|
||||
|
||||
|
|
@ -226,7 +226,7 @@ pub(crate) mod tests {
|
|||
forge: std::sync::Arc::default(),
|
||||
create_gate: std::sync::Arc::default(),
|
||||
accounts: Accounts::Fake(Arc::clone(store)),
|
||||
try_outs: super::super::review_classifier::TryOuts::default(),
|
||||
try_outs: crate::review_classifier::TryOuts::default(),
|
||||
reviews: std::sync::Arc::default(),
|
||||
runs: crate::review_classifier::runs::Runs::Live(None),
|
||||
builds: crate::builder::runs::Builds::Live(None),
|
||||
|
|
@ -17,8 +17,8 @@ use serde::{Deserialize, Serialize};
|
|||
use swarm_secret_client::backend_secrets::{self, BackendSecrets};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use super::linked_accounts::AccountStore;
|
||||
use crate::backend_env::validated;
|
||||
use crate::linked_accounts::AccountStore;
|
||||
use crate::routes::agents::swarm_hive;
|
||||
use crate::routes::{AppState, error_problem};
|
||||
|
||||
|
|
@ -132,8 +132,8 @@ mod tests {
|
|||
use swarm_secret_client::backend_secrets::BackendSecrets;
|
||||
|
||||
use super::super::backend_env::tests::state;
|
||||
use super::super::linked_accounts::{AccountStore, tests::FakeStore};
|
||||
use super::PutBackendSecretsRequest;
|
||||
use crate::linked_accounts::{AccountStore, tests::FakeStore};
|
||||
|
||||
const SECRET: &str = "sk-ant-live-0123";
|
||||
|
||||
18
swarm-controller/src/secrets/mod.rs
Normal file
18
swarm-controller/src/secrets/mod.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
//! The secrets concern: agent identities and their renewal and cutoff, the
|
||||
//! credentials the controller hands out (archive, proxy, backend) and the
|
||||
//! egress and read policies written to the store.
|
||||
|
||||
pub(crate) mod agent_cutoff;
|
||||
pub(crate) mod agent_entity;
|
||||
pub(crate) mod agent_identity;
|
||||
pub(crate) mod agent_renewal;
|
||||
pub(crate) mod agent_role_ttl;
|
||||
pub(crate) mod archive_access;
|
||||
pub(crate) mod backend_egress;
|
||||
pub(crate) mod backend_env;
|
||||
pub(crate) mod backend_secrets;
|
||||
pub(crate) mod claude_login;
|
||||
pub(crate) mod egress_allow;
|
||||
pub(crate) mod egress_deny;
|
||||
pub(crate) mod proxy_credential;
|
||||
pub(crate) mod read_policy;
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue