mirror of
https://github.com/google/nomulus.git
synced 2025-08-12 04:29:39 +02:00
Log registrar and certificate info before sending an email (#1308)
* Log registrar and certificate info before sending an email
This commit is contained in:
parent
447bfa162b
commit
d6127e4c0c
1 changed files with 7 additions and 6 deletions
|
@ -151,6 +151,12 @@ public class SendExpiringCertificateNotificationEmailAction implements Runnable
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ImmutableSet<InternetAddress> recipients = getEmailAddresses(registrar, Type.TECH);
|
ImmutableSet<InternetAddress> recipients = getEmailAddresses(registrar, Type.TECH);
|
||||||
|
Date expirationDate = certificateChecker.getCertificate(certificate.get()).getNotAfter();
|
||||||
|
logger.atInfo().log(
|
||||||
|
"Registrar %s should receive an email that its %s SSL certificate will expire on %s.",
|
||||||
|
registrar.getRegistrarName(),
|
||||||
|
certificateType.getDisplayName(),
|
||||||
|
expirationDate.toString());
|
||||||
if (recipients.isEmpty()) {
|
if (recipients.isEmpty()) {
|
||||||
logger.atWarning().log(
|
logger.atWarning().log(
|
||||||
"Registrar %s contains no email addresses to receive notification email.",
|
"Registrar %s contains no email addresses to receive notification email.",
|
||||||
|
@ -165,16 +171,11 @@ public class SendExpiringCertificateNotificationEmailAction implements Runnable
|
||||||
getEmailBody(
|
getEmailBody(
|
||||||
registrar.getRegistrarName(),
|
registrar.getRegistrarName(),
|
||||||
certificateType,
|
certificateType,
|
||||||
certificateChecker.getCertificate(certificate.get()).getNotAfter(),
|
expirationDate,
|
||||||
registrar.getClientId()))
|
registrar.getClientId()))
|
||||||
.setRecipients(recipients)
|
.setRecipients(recipients)
|
||||||
.setCcs(getEmailAddresses(registrar, Type.ADMIN))
|
.setCcs(getEmailAddresses(registrar, Type.ADMIN))
|
||||||
.build());
|
.build());
|
||||||
logger.atInfo().log(
|
|
||||||
"Sent an email to inform registrar %s that its %s SSL certificate will expire on %s.",
|
|
||||||
registrar.getRegistrarName(),
|
|
||||||
certificateType.getDisplayName(),
|
|
||||||
DATE_FORMATTER.print(lastExpiringCertNotificationSentDate));
|
|
||||||
/*
|
/*
|
||||||
* A duration time offset is used here to ensure that date comparison between two
|
* A duration time offset is used here to ensure that date comparison between two
|
||||||
* successive dates is always greater than 1 day. This date is set as last updated date,
|
* successive dates is always greater than 1 day. This date is set as last updated date,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue