All projects
OpsOngoing

SSL expiry monitor bot

A Telegram bot that watches certificate expiry across my domains and warns me before anything lapses.

Duration
Ongoing
Arrangement
Personal project
Status
Ongoing
My role
Built and run by me
Team
Personal project
Timeline
2025

01Overview

A small Python service that checks the SSL certificates on my domains and warns me on Telegram well before any of them expire.

02The business problem

An expired certificate takes a site down behind a browser warning. With several domains to look after, it is easy to miss one renewal.

03Requirements

  • Check each domain's certificate on a schedule
  • Calculate days left until expiry
  • Alert on Telegram before it becomes urgent
  • Check on demand with a command
  • Report errors such as timeouts or DNS failures clearly

04Architecture

   schedule (cron, Ubuntu on WSL)
            |
      Python checker
            |
   TLS handshake to each domain:443
   read certificate -> notAfter date
            |
   days left < threshold ?
            |
   Telegram Bot API --> my phone
            ^
      /check command (on demand)

05Implementation

The checker opens a TLS connection to each domain, reads the certificate's expiry date and works out how many days are left. Results go out through the Telegram Bot API, and a /check command runs the same check on demand. The bot token and settings live in an environment file outside the code. Timeouts, DNS failures and handshake errors are caught and reported as their own alerts, so a problem never fails silently.

06Challenges

  • A failed check must not look like a healthy one
  • Keeping the bot token out of the code

07Solutions

  • Separate alert messages for errors and for expiry warnings
  • Configuration in an environment file outside the repository

08Results

Renewals are something I see coming days ahead, instead of something visitors discover.

  • Domains checked automatically
  • Alerts on Telegram
  • On-demand checks with /check

09Screenshots

Screenshots coming soon