The SSL Checker script is a Bash script designed to check the SSL certificate expiration status for a list of domains and send notifications to Slack channels based on the remaining days until expiration. It utilizes WHOIS information and OpenSSL to retrieve SSL certificate details.
- Checks SSL certificate expiration for multiple domains.
- Sends notifications to Slack channels with color-coded information and icons.
- Supports different Slack channels for each domain.
Before using the script, ensure the following prerequisites are met:
- Bash shell environment.
dig
,whois
,openssl
, andcurl
commands installed.- Incoming Webhooks integration enabled in your Slack workspace.
- Visit Incoming Webhooks.
- Click on "Add to Slack" to add the Incoming Webhooks integration to your workspace.
- Choose the channel where you want to receive notifications and click on "Add Incoming WebHooks integration."
- Copy the generated Webhook URL.
git clone https://github.com/alexmeanpug/ssl-checker-slack
cd ssl-checker-slack
- Copy
.env.example
to.env
and update theSLACK_WEBHOOK_URL
variable with your Slack Incoming Webhook URL. - Copy
domains_channels.txt.example
todomains_channels.txt
and update the list of domains to monitor and their channels where the message should be sent.
You can either run the command manually with ./ssl-domains.sh
or you can set up a cronjob to do this automagically for you:
EDITOR=nano crontab -e
The example sets the editor to nano if you aren't comfortable with vi/vim, which is the default in most systems.
Copy and paste this to the end of your crontab file:
0 10 1 * * /usr/env/bash ~/path/to/ssl-domains.sh
Please update the path to your ssl-domains.sh
file or else cron
won't be able to find it.
To exit nano, hit CTRL+x
and answer y
to the question.
Now the script should be scheduled to run at 10:00am 1st day of each Month. To tweak the time and date, you can take a look at crontab.guru.
The script will display information about each domain, including the domain name, expiry date, remaining days until expiration, color-coded status, and the Slack channel it's notifying.
- Ensure proper permissions are set for the script (
chmod +x ssl-domains.sh
). - Use the copied Webhook URL to update the
SLACK_WEBHOOK_URL
variable in the script.
This project is licensed under the MIT License - see the LICENSE file for details.