{"id":24903569,"url":"https://github.com/macsteini/ssl-expiry-reminder-service","last_synced_at":"2025-07-23T06:05:01.791Z","repository":{"id":275074910,"uuid":"924992973","full_name":"MacSteini/SSL-Expiry-Reminder-Service","owner":"MacSteini","description":"A Bash script that monitors SSL certificate expiry dates and sends email notifications to designated recipients, ensuring timely renewals and uninterrupted secure connections.","archived":false,"fork":false,"pushed_at":"2025-01-31T02:30:19.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-09T15:52:11.558Z","etag":null,"topics":["lets-encrypt","letsencrypt","letsencrypt-certificates","reminder","reminder-message","reminder-service","reminders","ssl","ssl-cert","ssl-certificate","ssl-certificates","ssl-expiry","ssl-expiry-reminder","ssl-termination"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MacSteini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-31T02:30:07.000Z","updated_at":"2025-03-19T17:22:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"8e8c4923-3112-452b-84f2-7269c36a38a4","html_url":"https://github.com/MacSteini/SSL-Expiry-Reminder-Service","commit_stats":null,"previous_names":["macsteini/ssl-expiry-reminder-service"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MacSteini/SSL-Expiry-Reminder-Service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacSteini%2FSSL-Expiry-Reminder-Service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacSteini%2FSSL-Expiry-Reminder-Service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacSteini%2FSSL-Expiry-Reminder-Service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacSteini%2FSSL-Expiry-Reminder-Service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MacSteini","download_url":"https://codeload.github.com/MacSteini/SSL-Expiry-Reminder-Service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacSteini%2FSSL-Expiry-Reminder-Service/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266626115,"owners_count":23958344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lets-encrypt","letsencrypt","letsencrypt-certificates","reminder","reminder-message","reminder-service","reminders","ssl","ssl-cert","ssl-certificate","ssl-certificates","ssl-expiry","ssl-expiry-reminder","ssl-termination"],"created_at":"2025-02-01T22:29:34.553Z","updated_at":"2025-07-23T06:05:01.781Z","avatar_url":"https://github.com/MacSteini.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Let’s Encrypt SSL Certificate Expiry Reminder Service\nA Bash script that monitors SSL certificate expiry dates and sends email notifications to designated recipients, ensuring timely renewals and uninterrupted secure connections.\n## Table of Contents\n- [Overview](#overview)\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage](#usage)\n- [Troubleshooting](#troubleshooting)\n- [Contributing](#contributing)\n- [Licence](#licence)\n\n## Overview\nMy main motivation for publishing these few lines of code was the recent [announcement by Let’s Encrypt](https://letsencrypt.org/2025/01/22/ending-expiration-emails/ \"Ending Support for Expiration Notification Emails (Let’s Encrypt)\") about ending notification emails for domain expiry.\n\nI don’t expect an uproar, but if there is one – this repo is here to ease your pain… ;-)\n\nThis script automates the monitoring of SSL certificates by checking their expiry dates and sending email alerts to specified recipients when certificates are nearing expiry. It supports both global and per-domain configurations, allowing for flexible management across multiple domains.\n## Features\n- **Automated Monitoring**: Periodically checks SSL certificate expiry dates for all domains managed by Let’s Encrypt on the server.\n- **Email Notifications**: Sends alerts to a master email address and optional domain-specific recipients when certificates are approaching expiry.\n- **Customisable Settings**: Allows global and per-domain configurations for warning thresholds and follow-up intervals.\n- **`Systemd` Integration**: Utilises `systemd` timers to schedule regular checks and follow-up reminders.\n## Requirements\n- Operating System: Linux-based system with `systemd` support.\n- Dependencies:\n\t- `bash`\n\t- `openssl`\n\t- `sendmail`\n\t- `systemd`\n## Installation\n1. Download the Script:\n\t- Save the script as `/usr/local/bin/SSL_Expiry_Reminder.sh`\n1. Make the Script Executable:\n\t```bash\n\tsudo chmod +x /usr/local/bin/SSL_Expiry_Reminder.sh\n\t```\n1. Create `Systemd` Service File:\n\t- Path: `/usr/lib/systemd/system/SSL-Expiry.service`\n\t- Content:\n\t\t```ini\n\t\t[Unit]\n\t\tDescription=SSL Expiry Reminder Service\n\t\tAfter=network.target\n\n\t\t[Service]\n\t\tType=oneshot\n\t\tExecStart=/usr/local/bin/SSL_Expiry_Reminder.sh\n\t\t```\n1. Create Systemd Timer File:\n\t- Path: `/usr/lib/systemd/system/SSL-Expiry.timer`\n\t- Content:\n\t\t```bash\n\t\t[Unit]\n\t\tDescription=Runs the SSL Expiry Reminder Script Daily\n\n\t\t[Timer]\n\t\tOnCalendar=*-*-* 00:00:00 # Runs daily at midnight\n\t\tPersistent=true\n\n\t\t[Install]\n\t\tWantedBy=timers.target\n\t\t```\n1. Enable and Start the Timer:\n\t```bash\n\tsudo systemctl daemon-reload \u0026\u0026 sudo systemctl enable SSL-Expiry.timer \u0026\u0026 sudo systemctl start SSL-Expiry.timer\n\t```\n## Configuration\nEdit the `/usr/local/bin/SSL_Expiry_Reminder.sh` script to customise the following settings:\n- Global Settings:\n\t- `MASTER_EMAIL`: Primary email to receive all expiry reminders.\n\t- `MASTER_WARNING_DAYS`: Default number of days before expiry to trigger a reminder.\n\t- `MASTER_FOLLOW_UP_INTERVAL`: Default interval for follow-up reminders (e. g., “24h” for daily).\n\t- `SENDER_EMAIL`: Sender email address for reminders.\n- Per-Domain Custom Settings (Optional):\n\t- `EMAILS[\"yourdomain.com\"]`: Additional email recipients for specific domains.\n\t- `WARNING_DAYS[\"yourdomain.com\"]`: Custom warning thresholds for specific domains.\n\t- `FOLLOW_UP_INTERVALS[\"yourdomain.com\"]`: Custom follow-up intervals for specific domains.\n\n\u003e Ensure that the `sendmail` service is correctly configured to send emails from your server.\n\n## Usage\nOnce installed and configured, the script will automatically run daily (as scheduled by the `systemd` timer) to check SSL certificate expiry dates and send notifications as configured. Follow-up reminders will be sent based on the defined intervals until the certificates are renewed.\n\nTo manually run the script:\n```bash\nsudo /usr/local/bin/SSL_Expiry_Reminder.sh\n```\nTo check the status of the `systemd` timer:\n```bash\nsystemctl status SSL-Expiry.timer\n```\n## Troubleshooting\nIf you encounter issues with the script not executing properly, or `systemd` indicates that the follow-up service is already running, follow these steps to resolve them.\n### How to Completely Stop the Running Script \u0026 Follow-Ups\n#### Cancel Any Running Instances\nRun the following command to stop any active instances of the script:\n```bash\nsudo systemctl stop ssl-expiry-followup.service\n```\nThen, check if it is still running:\n```bash\nsystemctl list-units --type=service | grep ssl-expiry\n```\n#### Reset `Systemd` Failed States\nSometimes, `systemd` marks a service as “failed” even if it is not actively running. Reset this status with:\n```bash\nsudo systemctl reset-failed ssl-expiry-followup.service\n```\n#### Remove Any Stuck Timer Units\nIf the error persists, remove the fragment file that may be stuck in `/run/systemd/transient/`:\n```bash\nsudo systemctl reset-failed \u0026\u0026 sudo systemctl daemon-reexec\n```\nThis clears any transient `systemd` jobs, including orphaned ones that might be blocking execution.\n#### Check for Other Running Instances\nIf you are still seeing errors, check if the `systemd` timer (`SSL-Expiry.timer`) is active:\n```bash\nsystemctl list-timers --all | grep ssl-expiry\n```\nIf it is, disable it:\n```bash\nsudo systemctl stop ssl-expiry.timer \u0026\u0026 sudo systemctl disable ssl-expiry.timer\n```\n#### (Optional) Completely Remove the Follow-Up Service\nIf you no longer require follow-ups, you can delete the transient follow-up unit:\n```bash\nsudo rm -f /run/systemd/transient/ssl-expiry-followup.service \u0026\u0026 sudo systemctl daemon-reload\n```\n### What Happens Next?\nAfter these steps, your system will no longer have any running instances of the script or follow-ups. You can now safely run the script again manually using:\n```bash\nsudo /usr/local/bin/SSL_Expiry_Reminder.sh\n```\nIf you want to re-enable scheduled checks, restart the timer:\n```bash\nsudo systemctl enable --now SSL-Expiry.timer\n```\n## Contributing\nContributions are welcome! Please follow these steps:\n1. Fork this repository\n2. Create a feature branch: `git checkout -b feature-branch`\n3. Commit your changes: `git commit -m \"Add feature\"`\n4. Push the branch: `git push origin feature-branch`\n5. Submit a pull request\n\nPlease ensure all changes are well-documented and tested.\n\n**Suggestions for improvements are highly encouraged!** Please ensure that your contributions adhere to the project’s coding standards and include appropriate documentation.\n## Licence\nThis project is licenced under the [MIT Licence](https://opensource.org/license/mit \"MIT Licence\"). You are free to use, modify, and distribute this project in compliance with the licence terms.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacsteini%2Fssl-expiry-reminder-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacsteini%2Fssl-expiry-reminder-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacsteini%2Fssl-expiry-reminder-service/lists"}