diff --git a/apps/evo-dev-session/main.cpp b/apps/evo-dev-session/main.cpp index cbfaae9..f67958d 100644 --- a/apps/evo-dev-session/main.cpp +++ b/apps/evo-dev-session/main.cpp @@ -5,7 +5,7 @@ // already contain them). server.key and grant.key are secrets (owner-only on POSIX): // they belong in the dev namespace Secret, never in images, logs or the repository. // evo-dev-session grants --environment dev --key FILE --world N --frame N --region N -// --subject N --out FILE [--count 1..64] [--lifetime 60..3600] +// --subject N --out FILE [--count 1..64] [--lifetime 60..14400] // Writes COUNT single-use 108-byte grants for one test subject. Clients consume one // per connection; the HMAC key itself never leaves the operator machine. // evo-dev-session probe --connect HOST:PORT --server-name NAME --ca FILE --grants FILE @@ -133,10 +133,10 @@ int grants(const Args& a) { const auto region = number(a.get("--region").value_or("")); const auto subject = number(a.get("--subject").value_or("")); const auto count = number(a.get("--count").value_or("16")); - const auto lifetime = number(a.get("--lifetime").value_or("3600")); + const auto lifetime = number(a.get("--lifetime").value_or("14400")); if (a.get("--environment") != "dev" || !key_path || !out || !world || !frame || !region || !subject || !count || *count == 0 || *count > 64 || !lifetime || *lifetime < 60 || - *lifetime > 3600) + *lifetime > 14400) return 2; std::ifstream file{std::string{*key_path}}; const std::string text{std::istreambuf_iterator{file}, std::istreambuf_iterator{}}; diff --git a/apps/evo-server/m10_bridge.hpp b/apps/evo-server/m10_bridge.hpp index b9bbefd..80f2dba 100644 --- a/apps/evo-server/m10_bridge.hpp +++ b/apps/evo-server/m10_bridge.hpp @@ -53,7 +53,7 @@ namespace evo::server_app { struct M10Options { std::string listen, certificate, key, issuer, environment, session_window; - // M10.5c: dev only, 60..3600 s; 0 keeps the default (300 s, ADR-0091). + // M10.5c: dev only, 60..14400 s; 0 keeps the default (300 s, ADR-0091). std::uint64_t max_grant_lifetime{}; // M10.9 (ADR-0097, dev only): `--m10-load-governor off` keeps measuring and exposing the // work but never refuses or sheds (process tests whose host speed is unknown). diff --git a/apps/evo-server/main.cpp b/apps/evo-server/main.cpp index c5b3043..1661bf0 100644 --- a/apps/evo-server/main.cpp +++ b/apps/evo-server/main.cpp @@ -229,7 +229,7 @@ std::optional parse(int argc, char** argv) { o.m10.environment = value; else if (flag == "--session-window") o.m10.session_window = value; - else if (flag == "--m10-max-grant-lifetime" && n && *n >= 60 && *n <= 3600) + else if (flag == "--m10-max-grant-lifetime" && n && *n >= 60 && *n <= 14400) o.m10.max_grant_lifetime = *n; else if (flag == "--m10-area") o.m10.area = value; @@ -607,10 +607,10 @@ int main(int argc, char** argv) { "--session-grant-ledger F --session-environment dev]] [--m10-listen " "ADDRESS:PORT --m10-cert F --m10-key F --m10-issuer F " "--m10-environment dev|stage|world0 --session-window ACTIVATION:UTC_EXPIRY " - "[--m10-max-grant-lifetime 60..3600] [--m10-area X0,Y0,X1,Y1] " + "[--m10-max-grant-lifetime 60..14400] [--m10-area X0,Y0,X1,Y1] " "[--m10-handoff-key F [--m10-neighbour " "REGION=X0,Y0,X1,Y1=HOST:PORT=NAME=PUBFILE]...] " - "[--m10-load-governor on|off]]\n", + "[--m10-load-governor on|off]]\\n", stderr); return 2; } diff --git a/apps/evo-session-probe/main.cpp b/apps/evo-session-probe/main.cpp index e58eba3..d1eeb47 100644 --- a/apps/evo-session-probe/main.cpp +++ b/apps/evo-session-probe/main.cpp @@ -4,7 +4,7 @@ // Writes a fresh dev issuer key pair: DIR/issuer.key (32-byte P-256 scalar, owner-only) // and DIR/issuer.pub (65-byte public key for evo-server --m10-issuer). // evo-session-probe grants --issuer-key FILE --world N --frame N --region N -// --account HEX32 --out FILE [--serial N] [--count 1..64] [--lifetime 60..3600] +// --account HEX32 --out FILE [--serial N] [--count 1..64] [--lifetime 60..14400] // M10.5c (ADR-0093): writes COUNT 160-byte grants for one account (the engineering // client's grant bundle), serials SERIAL..SERIAL+COUNT-1, all issued now. Without // --serial the first is 64 x the issue time in seconds, so a later bundle for the same @@ -438,7 +438,7 @@ int main(int argc, char** argv) { o.region = *n; else if (n && flag == "--serial") o.serial = *n; - else if (n && flag == "--lifetime" && *n > 0 && *n <= 3600) + else if (n && flag == "--lifetime" && *n > 0 && *n <= 14400) o.lifetime = *n; else if (n && flag == "--intents" && *n <= 1000) o.intents = *n; @@ -467,7 +467,7 @@ int main(int argc, char** argv) { o.serial == 0) { std::fputs("usage: evo-session-probe keys --out DIR | grants --issuer-key FILE " "--world N --frame N --region N --account HEX32 --out FILE [--serial N] " - "[--count 1..64] [--lifetime 60..3600] | run --connect HOST:PORT " + "[--count 1..64] [--lifetime 60..14400] | run --connect HOST:PORT " "--server-name NAME --ca FILE --issuer-key FILE --world N --frame N " "--region N --account HEX32 --serial N [--lifetime S] [--intents N] " "[--actions N --action-base ID] [--query ID]... [--timeout-ms N] " diff --git a/deploy/kubernetes/region/base/deployment.yaml b/deploy/kubernetes/region/base/deployment.yaml index 14ed70f..5b1bab4 100644 --- a/deploy/kubernetes/region/base/deployment.yaml +++ b/deploy/kubernetes/region/base/deployment.yaml @@ -62,7 +62,8 @@ spec: if [ -n "$REGION_SESSION" ]; then m10=(--m10-listen "$REGION_SESSION_LISTEN" --m10-cert /run/session/server.pem --m10-key /run/session/server.key --m10-issuer /run/session/issuer.pub - --m10-environment "$REGION_SESSION" --session-window "$REGION_SESSION_WINDOW") + --m10-environment "$REGION_SESSION" --session-window "$REGION_SESSION_WINDOW" + --m10-max-grant-lifetime "$REGION_M10_MAX_GRANT_LIFETIME") fi exec /usr/local/bin/evo-server --profile lineage "${retained[@]}" "${inputs[@]}" \ "${m10[@]}" \ @@ -88,6 +89,8 @@ spec: - {name: REGION_SESSION_LISTEN, value: "127.0.0.1:7400"} # Absolute UTC expiry; route overlays must provide activation-id:unix-seconds. - {name: REGION_SESSION_WINDOW, value: ""} + # DEV-only grant ceiling; overlays must keep this within the server contract. + - {name: REGION_M10_MAX_GRANT_LIFETIME, value: "300"} ports: - {name: ops, containerPort: 9100, protocol: TCP} readinessProbe: diff --git a/deploy/kubernetes/region/dev-session-route/listener.yaml b/deploy/kubernetes/region/dev-session-route/listener.yaml index 27e5fea..efdf40a 100644 --- a/deploy/kubernetes/region/dev-session-route/listener.yaml +++ b/deploy/kubernetes/region/dev-session-route/listener.yaml @@ -13,6 +13,7 @@ spec: - {name: REGION_SESSION, value: "dev"} - {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"} - {name: REGION_SESSION_WINDOW, value: "dev-20261007T170444-12542:1791393884"} + - {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"} ports: # QUIC (ADR-0090): UDP only; nothing listens on TCP 7400. - {name: session, containerPort: 7400, protocol: UDP} diff --git a/docs/adr/0091-m10-session-identity-and-control.md b/docs/adr/0091-m10-session-identity-and-control.md index 4d72902..780a78a 100644 --- a/docs/adr/0091-m10-session-identity-and-control.md +++ b/docs/adr/0091-m10-session-identity-and-control.md @@ -62,7 +62,7 @@ These limits are engineering defaults, not game rules. **Identity adapter** (`evo_identity`, library): `IdentityProvider`, `AccountDirectory` (bounded in-memory implementation for tests and tools), `GrantIssuer` (credential to -signed grant, lifetime 1..3600 s). Production providers and a running issuer service +signed grant, lifetime 1..14400 s). Production providers and a running issuer service are later work behind these interfaces. ## Alternatives considered @@ -142,7 +142,7 @@ only through `claim_account_control`, `renew_account_control` and with the operator; testers receive only the bundle and the dev CA. Grants cannot be dated ahead (clock skew 30 s), so a bundle expires as a whole. - **Lifetime.** The 300 s maximum would make a bundle unusable after five minutes. The - evo-server flag `--m10-max-grant-lifetime 60..3600` raises the region's maximum, refused + evo-server flag `--m10-max-grant-lifetime 60..14400` raises the region's maximum, refused at startup outside `dev`; without it the 300 s default stands. A session ends when its grant expires; the client then reconnects with the next grant of the bundle, which succeeds only while that grant is still valid. diff --git a/docs/networking/M10_CLIENT_SESSIONS.md b/docs/networking/M10_CLIENT_SESSIONS.md index f3b911e..fc510ea 100644 --- a/docs/networking/M10_CLIENT_SESSIONS.md +++ b/docs/networking/M10_CLIENT_SESSIONS.md @@ -9,7 +9,7 @@ On a machine that holds the dev issuer key (never give the key to testers): ```sh evo-session-probe grants --issuer-key issuer.key --world 100 --frame 9 --region 1 \ - --account <32 hex digits, one per tester> --count 16 --lifetime 3600 --out tester.grants + --account <32 hex digits, one per tester> --count 16 --lifetime 14400 --out tester.grants ``` The file is created new and owner-only; it holds 16 single-use grants, valid together for diff --git a/include/evo/identity/identity.hpp b/include/evo/identity/identity.hpp index 6f296f8..e5cba20 100644 --- a/include/evo/identity/identity.hpp +++ b/include/evo/identity/identity.hpp @@ -106,7 +106,7 @@ class MemoryAccountDirectory final : public AccountDirectory { class GrantIssuer { public: // The provider and signing key must belong to the same environment. Lifetime is - // 1..3600 s; regions refuse lifetimes above their own maximum (300 s by default). + // 1..14400 s; regions refuse lifetimes above their own maximum (300 s by default). [[nodiscard]] static std::expected create(network::GrantSigningKey key, IdentityProvider& provider, AccountDirectory& directory, std::uint64_t lifetime_seconds); diff --git a/include/evo/network/admission.hpp b/include/evo/network/admission.hpp index 1d2404b..5da57a8 100644 --- a/include/evo/network/admission.hpp +++ b/include/evo/network/admission.hpp @@ -44,7 +44,7 @@ struct AdmissionConfig { std::uint32_t intent_window{8}; // Ticks ahead of the server tick. std::uint32_t window_ticks{8}; // Rate window length. std::uint32_t max_intents_per_window{16}; // Counts every attempt by a session. - std::uint64_t max_grant_lifetime{3600}; // Seconds. + std::uint64_t max_grant_lifetime{14400}; // Seconds; four-hour DEV ceiling. std::uint64_t clock_skew{30}; // Seconds tolerated before issued_at. }; enum class AdmissionError : std::uint8_t { diff --git a/src/identity/identity.cpp b/src/identity/identity.cpp index 1c9fd61..817b40f 100644 --- a/src/identity/identity.cpp +++ b/src/identity/identity.cpp @@ -71,7 +71,7 @@ std::expected GrantIssuer::create(network::GrantSign std::uint64_t lifetime_seconds) { if (provider.environment() != key.environment()) return std::unexpected(IdentityError::wrong_environment); - if (lifetime_seconds == 0 || lifetime_seconds > 3600) + if (lifetime_seconds == 0 || lifetime_seconds > 14400) return std::unexpected(IdentityError::invalid_request); return GrantIssuer{std::move(key), provider, directory, lifetime_seconds}; } diff --git a/src/network/protocol/session_control.cpp b/src/network/protocol/session_control.cpp index 193d23d..55effa8 100644 --- a/src/network/protocol/session_control.cpp +++ b/src/network/protocol/session_control.cpp @@ -28,7 +28,7 @@ std::expected SessionControl::create(ControlConfig if (config.world.world == 0 || config.world.frame == 0 || config.region == 0 || config.epoch == 0 || config.max_sessions == 0 || config.max_sessions > 1024 || config.max_accounts < config.max_sessions || config.max_accounts > (std::size_t{1} << 20) || - config.max_grant_lifetime == 0 || config.max_grant_lifetime > 3600 || + config.max_grant_lifetime == 0 || config.max_grant_lifetime > 14400 || config.clock_skew > 300 || config.max_account_attempts == 0 || config.max_region_attempts == 0 || config.attempt_window == 0 || config.attempt_window > 3600) diff --git a/tests/network_control.cpp b/tests/network_control.cpp index fcf4807..e900a8f 100644 --- a/tests/network_control.cpp +++ b/tests/network_control.cpp @@ -209,7 +209,9 @@ void control_rules() { bad.max_accounts = 2; // Fewer than sessions. CHECK(refused(SessionControl::create(bad), ControlError::invalid_config)); bad = config(); - bad.max_grant_lifetime = 3601; + bad.max_grant_lifetime = 14400; + CHECK(SessionControl::create(bad)); + bad.max_grant_lifetime = 14401; CHECK(refused(SessionControl::create(bad), ControlError::invalid_config)); } // Scope and time.