Skip to content

Email notification for cert expiry#204

Open
garaimanoj wants to merge 8 commits into
stfc:masterfrom
garaimanoj:GT-1437-email-notification-for-cert-expiry
Open

Email notification for cert expiry#204
garaimanoj wants to merge 8 commits into
stfc:masterfrom
garaimanoj:GT-1437-email-notification-for-cert-expiry

Conversation

@garaimanoj
Copy link
Copy Markdown
Contributor

@garaimanoj garaimanoj commented Apr 24, 2026

2026-04-27T09:57:00.193+01:00  INFO 423739 --- [iry-scheduler-1] uk.ac.ngs.TaskConfig                     : Starting daily certificate expiry reminder job
2026-04-27T09:57:00.461+01:00  INFO 423739 --- [iry-scheduler-1] uk.ac.ngs.service.CertificateService     : 1 certificate(s) are going to expire after 7 days.
2026-04-27T09:57:00.463+01:00  INFO 423739 --- [iry-scheduler-1] uk.ac.ngs.service.CertificateService     : Sending 7-days expiry reminder for cert [103] to bob13@xyzc.com
2026-04-27T09:57:02.053+01:00  INFO 423739 --- [iry-scheduler-1] u.a.n.s.email.FreemarkerEmailSender      : body=<!doctype html>

<html>

<body>
    Dear Owner of UK e-Science Certificate number: 103,
    <br />
    <br />
    You have a certificate which will expire in <b>7 days</b>. If you do not wish to renew this
    certificates or if you have
    done so already then please ignore this message.
    <br />
    <br />
    Your certificate was issued for "User3" and has the subject:
    <br />
    <br />
    [CN=User1,OU=xyz_c,O=stfc.com,L=OX,ST=OX,C=UK]
    <br />
    <br />
    If you prefer a browser interface for your certificate management and you have your current certificate in your
    browser then please go to the CA Portal <a href="https://portal.ca.grid-support.ac.uk/">https://portal.ca.grid-support.ac.uk/</a> and follow the instructions
    for renewal.
    <br />
    <br />
    Other tools are available at <a href="https://ca.grid-support.ac.uk">https://ca.grid-support.ac.uk</a>
    <br />
    <br />
    The server will then queue your renewal request for your RA to approve.
    There is NO need to visit your RA. You will receive an e-mail when the certificate is available.
    <br />
    <br />
    If you have any questions, concerns or comments, then we shall be pleased to hear them. We are always aiming to
    improve our service, and so your feedback will be appreciated.
    <br />
    <br />
    Regards,
    <br />
    <br />
    The UK eScience CA Support Centre
</body>

</html>
2026-04-27T09:57:02.637+01:00 ERROR 423739 --- [iry-scheduler-1] uk.ac.ngs.service.email.EmailService     : MailSender Failed messages: org.eclipse.angus.mail.smtp.SMTPSendFailedException: 530-5.7.0 Must issue a STARTTLS command first. For more information, go to
530-5.7.0  https://support.google.com/a/answer/3221692 and review RFC 3207
530 5.7.0 specifications. 5b1f17b1804b1-488fb74c789sm233860095e9.5 - gsmtp

2026-04-27T09:57:02.642+01:00  INFO 423739 --- [iry-scheduler-1] uk.ac.ngs.service.CertificateService     : No certificates are going to expire after 30 days.
2026-04-27T09:57:02.643+01:00  INFO 423739 --- [iry-scheduler-1] uk.ac.ngs.TaskConfig                     : Completed daily certificate expiry reminder job successfully in 2448 ms

Sample email in html

image

@garaimanoj garaimanoj self-assigned this Apr 24, 2026
Comment thread src/main/java/uk/ac/ngs/dao/JdbcCertificateDao.java Fixed
Comment on lines +487 to +489
long endOfDay = Long.parseLong(
formatter.format(targetDate.plusDays(1)
.atStartOfDay(ZoneOffset.UTC)));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yyyyMMddHHmmss produces only digits → safe to parse as long

Comment on lines +485 to +486
long startOfDay = Long.parseLong(
formatter.format(targetDate.atStartOfDay(ZoneOffset.UTC)));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yyyyMMddHHmmss produces only digits → safe to parse as long

Comment thread src/main/java/uk/ac/ngs/service/email/EmailService.java Fixed
Comment thread src/main/java/uk/ac/ngs/service/email/EmailService.java Fixed
Comment thread src/main/java/uk/ac/ngs/service/email/EmailService.java Fixed
Comment thread src/main/java/uk/ac/ngs/service/email/EmailService.java Fixed
@garaimanoj garaimanoj requested a review from DonaldChung-HK May 13, 2026 07:37
@garaimanoj garaimanoj marked this pull request as ready for review May 13, 2026 07:37
Comment thread src/main/webapp/WEB-INF/freemarker/email/emailUserCertExpiryReminderTemplate.html Outdated
Comment thread src/main/webapp/WEB-INF/freemarker/email/emailUserCertExpiryReminderTemplate.html Outdated
garaimanoj and others added 2 commits May 13, 2026 16:32
…minderTemplate.html

Co-authored-by: rowan04 <rowanmoss04@gmail.com>
…minderTemplate.html

Co-authored-by: rowan04 <rowanmoss04@gmail.com>
@garaimanoj garaimanoj requested a review from rowan04 May 13, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants