Add new configuration for summary email intervals
This commit is contained in:
parent
eab5532397
commit
065e4d3964
@ -363,7 +363,7 @@ disabled by default; to enable it, you must set the option ``--notify`` (when us
|
||||
|
||||
If you enable the Celery or cron task to send this notification type, Lemur will send a summary of all
|
||||
certificates with upcoming expiration date that matches one of the intervals configured in the
|
||||
``LEMUR_SECURITY_TEAM_EMAIL_INTERVALS`` configuration parameter (with the same fallbacks as noted above).
|
||||
``LEMUR_EXPIRATION_SUMMARY_EMAIL_INTERVALS`` configuration parameter (with a fallback of 14 days).
|
||||
Note that certificates will be included in this summary even if they do not have any associated notifications.
|
||||
|
||||
This notification type also supports the same ``--exclude`` and ``EXCLUDE_CN_FROM_NOTIFICATION`` options as expiration emails.
|
||||
|
@ -70,12 +70,7 @@ def get_certificates_for_security_summary_email(exclude=None):
|
||||
:return:
|
||||
"""
|
||||
now = arrow.utcnow()
|
||||
expiration_summary_intervals = current_app.config.get("LEMUR_SECURITY_TEAM_EMAIL_INTERVALS", # first priority
|
||||
current_app.config.get( # second priority
|
||||
"LEMUR_DEFAULT_EXPIRATION_NOTIFICATION_INTERVALS",
|
||||
[30, 15, 2] # third priority
|
||||
)
|
||||
)
|
||||
expiration_summary_intervals = current_app.config.get("LEMUR_EXPIRATION_SUMMARY_EMAIL_INTERVALS", [14])
|
||||
max_not_after = now + timedelta(days=max(expiration_summary_intervals) + 1)
|
||||
|
||||
q = (
|
||||
|
@ -119,10 +119,9 @@ def test_send_expiration_summary_notification(certificate, notification, notific
|
||||
|
||||
# we don't actually test the email contents, but adding an assortment of certs here is useful for step debugging
|
||||
# to confirm the produced email body looks like we expect
|
||||
for i in range(1, 6):
|
||||
create_cert_that_expires_in_days(14)
|
||||
create_cert_that_expires_in_days(2)
|
||||
create_cert_that_expires_in_days(2)
|
||||
create_cert_that_expires_in_days(2)
|
||||
create_cert_that_expires_in_days(30)
|
||||
create_cert_that_expires_in_days(30)
|
||||
create_cert_that_expires_in_days(15)
|
||||
create_cert_that_expires_in_days(20)
|
||||
|
Loading…
Reference in New Issue
Block a user