[auto-rotation feature] PR 4 - Notification system (SMTP email)#971
Open
Manuthor wants to merge 5 commits into
Open
[auto-rotation feature] PR 4 - Notification system (SMTP email)#971Manuthor wants to merge 5 commits into
Manuthor wants to merge 5 commits into
Conversation
Add comprehensive specification for scheduled key rotation covering: - 6 rotation scenarios (plain, wrapping, wrapped, asymmetric, CoverCrypt, KEK) - Rotation policy vendor attributes (x-rotate-interval, etc.) - Server-side cron scheduler - KMIP attribute tables (auto vs manual rotation semantics) - Implementation roadmap (5 stacked PRs) Ref: #900
…s + test vectors (#969) * feat(rekey): implement symmetric key ReKey with wrapping key re-wrap - Implement KMIP ReKey for symmetric keys with name transfer per §4.4 - Support re-wrapping dependent keys when a wrapping key is rekeyed - Add find_wrapped_by() to ObjectsStore trait (SQLite, PostgreSQL, MySQL) - Fix: transfer Name attribute from old to new key during ReKey - Fix: error on self-wrap when wrapping_key_id is user-supplied - Fix: bypass ownership check for server-configured KEK Tested with 37 vector tests (9 symmetric + 27 keypair + 1 security) * fix: consolidate rekey operations using trait * feat: consolidate Recertify operation
…4 (merge spec+manual into PR1)
Add a background thread that periodically checks which keys are due for rotation and automatically rotates them. The scheduler supports: - Symmetric keys via KMIP ReKey - Asymmetric keys (RSA/EC/PQC) via new CreateKeyPair + cross-links - CoverCrypt keys via ReKeyKeyPair (in-place rotation) - Certificates via Certify (re-issuance) New components: - find_due_for_rotation() in ObjectsStore trait + SQLite/PostgreSQL/MySQL impls - is_due_for_rotation() helper in locate_query.rs - auto_rotate.rs: rotation logic per object type - spawn_auto_rotation_cron() in cron.rs - --auto-rotation-check-interval-secs CLI flag (default: 0 = disabled) The rotation policy (rotate_interval, rotate_name, rotate_offset) is transferred to the new key so the cycle continues. Old keys get rotate_interval=0 and ReplacementObjectLink to the new key.
4e3e03c to
f27b7e5
Compare
- NotificationsStore trait + implementations (SQLite, PostgreSQL, MySQL)
- SMTP email notifier (lettre) for renewal warnings and rotation events
- SmtpConfig + RenewalNotificationStrategy configuration
- dispatch_renewal_warnings() background scanner with threshold-based dedup
- rotate_last_warning_days attribute to prevent duplicate warnings
- HTTP API: GET /notifications, GET /notifications/unread/count,
POST /notifications/{id}/read, POST /notifications/read-all
- NoopNotificationsStore for Redis-findex backend
- Allow 0BSD license (quoted_printable, transitive dep of lettre)
5f074fa to
4b5820b
Compare
f27b7e5 to
43b5cdb
Compare
cf711aa to
bea7e61
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the notification subsystem for key rotation events: a
NotificationsStoretrait backed by SQL, an SMTP email notifier (via
lettre), threshold-based dedupfor renewal warnings, and a REST API for reading notifications from the UI.
This is PR 4 of 4 in the key auto-rotation feature stack (depends on PR 3: #970):
What's included
NotificationsStoretrait —crate/interfaces/src/stores/notifications_store.rsPersistent notification log with four methods:
insert()list(owner)unread_count(owner)mark_read(id)/mark_all_read(owner)Implemented for SQLite, PostgreSQL, and MySQL (
crate/server_database/).NoopNotificationsStoreprovided for the Redis-findex backend (#[cfg(feature = "non-fips")]).SMTP email notifier —
crate/server/src/notifications/email.rsrotation_success,rotation_failure, andapproaching_deadlineeventslettre0.11 (async SMTP with TLS)warn!level and never block the rotation operationSmtpConfig—crate/server/src/config/command_line/smtp_config.rsRenewalNotificationStrategyConfigures the threshold days (default:
[30, 7, 1]) at which renewal warningsare emitted before a key's next scheduled rotation.
dispatch_renewal_warnings()— wired intoauto_rotate.rs(
rotate_last_warning_daysattribute for dedup)HTTP API —
crate/server/src/routes/notifications.rsGET /notificationsGET /notifications/unread/countPOST /notifications/{id}/readPOST /notifications/read-allDependencies added
lettre = "0.11"(async SMTP)"0BSD"added todeny.tomlallow list (required byquoted_printable,a transitive dep of
lettre)Breaking changes
None. Notifications are off by default (no SMTP config → no emails sent;
HTTP API always available).
Reviewer notes
NotificationsStoreis injected intoKmsServeralongside theexisting
ObjectsStore— no global state.non-fipsfeature) usesNoopNotificationsStorebecause Redis-findex has no relational schema.
0BSDlicense addition todeny.tomlis intentional and safe — it is themost permissive OSI license (no attribution required).
NotificationsBellUI component (from PR 2: [auto-rotation feature] PR 2 - ckms and Web UI updates #988) is wired to theGET /notifications/unread/countendpoint introduced here.