diff options
| author | tv <tv@krebsco.de> | 2026-11-15 16:43:53 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-15 16:43:53 +0000 |
| commit | af120b87c42ca56f69bbe6f8d27c023919742430 (patch) | |
| tree | 60b493edf48aad388ddc9682498f1ad8c5527b53 /src/main.rs | |
| parent | 2d1c64a6e7134f4d6942d4539b27d45f14e7538c (diff) | |
swarm: a new swarm's policy recorded in its genesis change
A swarm strict from its start had its policy written by its first user
in a later change. A change is judged by the policy at its history, so
any member could always add a change whose history is from before the
policy: judged by none, needing no signature, taken whenever it comes.
Since signed values are read by `seq`, an envelope planted there with
the highest `seq` there is can never be followed: a ban, a user, a
declaration, for good.
`--bootstrap-policy JSON`, with `--genesis`, records the policy in the
genesis change, with the first users: then no change of the swarm is
from before it. It must be a policy this node knows, and a strict one
needs `--bootstrap-keys`, or nobody could sign what decides who may do
what.
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index d8704a0..5f2403e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -105,6 +105,12 @@ async fn main() -> Result<()> { } else { Default::default() }; + let first_policy = if args.genesis { + access::policy::first(args.bootstrap_policy.as_deref(), &args.bootstrap_keys) + .map_err(anyhow::Error::msg)? + } else { + None + }; if !first_users.is_empty() && let Some(path) = args.htpasswd.as_deref() { @@ -283,6 +289,7 @@ async fn main() -> Result<()> { swarm_key, protocol_writers: args.protocol_writers.iter().cloned().collect(), first_users, + first_policy, node_key: Some(Arc::clone(&node_key)), sign_every: args.sign_every, token_lifetime: args.token_lifetime, |
