[PR #227] [MERGED] Add support for LE expiration notification e-mails on API cert #351

Closed
opened 2026-03-13 16:19:02 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/acme-dns/acme-dns/pull/227
Author: @blkeller
Created: 4/29/2020
Status: Merged
Merged: 1/11/2021
Merged by: @joohoi

Base: masterHead: notification-email


📝 Commits (1)

  • f89224a Add support for LE expiration notification e-mails on API cert

📊 Changes

4 files changed (+6 additions, -0 deletions)

View changed files

📝 README.md (+2 -0)
📝 config.cfg (+2 -0)
📝 main.go (+1 -0)
📝 types.go (+1 -0)

📄 Description

Summary:

This PR adds support for setting an e-mail address in the config file that Let's Encrypt can use to send notification e-mails if the API's certificate is expiring soon. When an account at LE is registered and an e-mail address is provided, LE will use this address for this purpose:
https://letsencrypt.org/docs/expiration-emails/

This is a helpful, optional service that LE offers for free, and the e-mails can be useful for an admin to be alerted to potential certificate renewal issues that might otherwise go unnoticed.

The new config option notification_email is an empty string by default, preserving the previous behavior of not registering any address with LE upon account creation. If the user fills in an e-mail address, this value will be used during account creation with LE.

The value of notification_email is passed through to CertMagic and leverages their existing support for this feature.

Example:

Where the config file includes these entries:

[api]
# possible values: "letsencrypt", "letsencryptstaging", "cert", "none"
tls = "letsencryptstaging"
# only used if tls = "letsencrypt"
acme_cache_dir = "api-certs"
# optional e-mail address to which Let's Encrypt will send expiration notices for the API's cert
notification_email = "myuser@mydomain.com"

This patch yields the following results:

$ sudo rm -Rf /var/lib/acme-dns/api-certs
$ sudo systemctl start acme-dns
$ journalctl -u acme-dns --no-pager | grep -A2 'certificate maintenance'
Apr 28 18:25:38 ns1 acme-dns[13286]: time="2020-04-28T18:25:38-05:00" level=info msg="2020/04/28 18:25:38 [INFO][cache:0xc00008e5f0] Started certificate maintenance routine"
Apr 28 18:25:38 ns1 acme-dns[13286]: time="2020-04-28T18:25:38-05:00" level=info msg="[INFO] acme: Registering account for myuser@mydomain.com"
Apr 28 18:25:38 ns1 acme-dns[13286]: time="2020-04-28T18:25:38-05:00" level=info msg="2020/04/28 18:25:38 [INFO][ns1.certs.mydomain.com] Obtain certificate"

$ sudo ls /var/lib/acme-dns/api-certs/acme/acme-staging-v02.api.letsencrypt.org/users
myuser@mydomain.com

$ sudo cat /var/lib/acme-dns/api-certs/acme/acme-staging-v02.api.letsencrypt.org/users/myuser@mydomain.com/myuser.json
{
        "Email": "myuser@mydomain.com",
        "Registration": {
                "body": {
                        "status": "valid",
                        "contact": [
                                "mailto:myuser@mydomain.com"
                        ]
                },
                "uri": "https://acme-staging-v02.api.letsencrypt.org/acme/acct/12345678"
        }
}

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/acme-dns/acme-dns/pull/227 **Author:** [@blkeller](https://github.com/blkeller) **Created:** 4/29/2020 **Status:** ✅ Merged **Merged:** 1/11/2021 **Merged by:** [@joohoi](https://github.com/joohoi) **Base:** `master` ← **Head:** `notification-email` --- ### 📝 Commits (1) - [`f89224a`](https://github.com/acme-dns/acme-dns/commit/f89224a53761b89f48cdfd225c9f3429d8e67053) Add support for LE expiration notification e-mails on API cert ### 📊 Changes **4 files changed** (+6 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+2 -0) 📝 `config.cfg` (+2 -0) 📝 `main.go` (+1 -0) 📝 `types.go` (+1 -0) </details> ### 📄 Description ### Summary: This PR adds support for setting an e-mail address in the config file that Let's Encrypt can use to send notification e-mails if the API's certificate is expiring soon. When an account at LE is registered and an e-mail address is provided, LE will use this address for this purpose: https://letsencrypt.org/docs/expiration-emails/ This is a helpful, optional service that LE offers for free, and the e-mails can be useful for an admin to be alerted to potential certificate renewal issues that might otherwise go unnoticed. The new config option `notification_email` is an empty string by default, preserving the previous behavior of not registering any address with LE upon account creation. If the user fills in an e-mail address, this value will be used during account creation with LE. The value of `notification_email` is passed through to CertMagic and leverages their existing support for this feature. ### Example: Where the config file includes these entries: ```ini [api] # possible values: "letsencrypt", "letsencryptstaging", "cert", "none" tls = "letsencryptstaging" # only used if tls = "letsencrypt" acme_cache_dir = "api-certs" # optional e-mail address to which Let's Encrypt will send expiration notices for the API's cert notification_email = "myuser@mydomain.com" ``` This patch yields the following results: ```console $ sudo rm -Rf /var/lib/acme-dns/api-certs $ sudo systemctl start acme-dns $ journalctl -u acme-dns --no-pager | grep -A2 'certificate maintenance' Apr 28 18:25:38 ns1 acme-dns[13286]: time="2020-04-28T18:25:38-05:00" level=info msg="2020/04/28 18:25:38 [INFO][cache:0xc00008e5f0] Started certificate maintenance routine" Apr 28 18:25:38 ns1 acme-dns[13286]: time="2020-04-28T18:25:38-05:00" level=info msg="[INFO] acme: Registering account for myuser@mydomain.com" Apr 28 18:25:38 ns1 acme-dns[13286]: time="2020-04-28T18:25:38-05:00" level=info msg="2020/04/28 18:25:38 [INFO][ns1.certs.mydomain.com] Obtain certificate" $ sudo ls /var/lib/acme-dns/api-certs/acme/acme-staging-v02.api.letsencrypt.org/users myuser@mydomain.com $ sudo cat /var/lib/acme-dns/api-certs/acme/acme-staging-v02.api.letsencrypt.org/users/myuser@mydomain.com/myuser.json { "Email": "myuser@mydomain.com", "Registration": { "body": { "status": "valid", "contact": [ "mailto:myuser@mydomain.com" ] }, "uri": "https://acme-staging-v02.api.letsencrypt.org/acme/acct/12345678" } } ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-13 16:19:02 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/acme-dns#351
No description provided.