Milestone 9a: classical session rekey (~120s rotation) + epoch handling (#9) #90
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
femboy/yip!90
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/rekey-9a-session-rotation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Milestone 9a — classical session rekey (~120s) + epoch handling
Closes the rekey half of #9 (session rekey + PQ-hybrid handshake). This is 9a (classical rekey); 9b (PQ-hybrid, McEliece + ML-KEM → PSK) is the sequel, built on this machinery.
Each peer's Noise-IK session now rotates ~every 120s for forward secrecy, with an old→new epoch overlap so in-flight packets keep decrypting across the switch. No wire-format change;
yip-cryptoandyip-wireare untouched.What's here (
bin/yipd)EpochSet(epoch.rs) — a pure state machine holdingcurrent(outbound),next(the responder's derived-but-unconfirmed new epoch, keyed by the initiator's Noise ephemeral), andprevious(receive-only grace).inbound_opentries current→next→previous and promotesnext→current on the first frame that decrypts under it (the responder's confirmed-switch). Steady state is a single decrypt attempt — behaviorally identical to before.PeerState::Established(Box<EpochSet>)— inbound routes throughinbound_open, outbound throughcurrent.PeerManager::tick) — the glare-winner (existinglocal_pub < peer.pubkeytiebreak) starts a fresh handshake atREKEY_INTERVAL_MS(120_000; override viaYIP_REKEY_INTERVAL_MS), one-in-flight, loser-fallback at 2×interval, retransmit/give-up. The live session keeps flowing throughout — rekey failure is a no-op.nextand switches only when it receives a frame under it. Survives a lost msg2 with no black-hole.conn_tagrotates per epoch (derived from each session's keys) — the linkability rotation, for free.Scope & fixes worth calling out
EpochInbound::Sendpath carries fullEgressDatagrams (preservingdst+fate) — a fix for a relay-peer misdirection found in review.Testing
EpochSetswitch state machine (promote/retire/lost-msg2-no-blackhole/guards), rekey scheduling (winner/one-in-flight/loser-fallback/retransmit/abandon), completion (initiator promote / responder install-next / idempotent retransmit / cold-start dedup), all with real Noise-IK crypto + AEAD, not stubs.run-netns-rekey.sh, ran live under sudo on both the poll andYIP_USE_URING=1drivers): 0% packet loss across ~10 fast rotations, and arekey_epoch_witnesstool proves 10/10 distinct rekey rounds on the wire (via distinct cleartext Noise ephemerals — the naiveconn_tag-byte check is vacuous under per-packet header masking). Wired into CI.-D warningsclean.Follow-ups (non-blocking)
relayed_handshake_init/resp→install_next/promote_from_rekeyso relay-only sessions also rotate (deferred to avoid the churn above).[HandshakeResp]can abandon an in-flight rekey (delaying rotation, not breaking the tunnel); rides with #34 (authenticated endpoint).Final whole-branch review (opus): the one Critical (rotation black-hole under Init-retransmit/Resp-reorder) was fixed and re-reviewed Approved; fail-closed throughout (a rekey never disturbs a live session), no wire/crypto change,
forbid-unsafe/ noas/ no bare#[allow].