[auto-rotation feature] feat: add notifications infrastructure for key auto-rotation events#971
Open
Manuthor wants to merge 1 commit into
Open
Conversation
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
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 3 of 4 in the key auto-rotation feature stack (depends on PR 2: #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).