This project is a command-line tool written in Go that checks the validity and expiration of an SSL/TLS certificate for a given host and port. It is a lightweight utility that can be used to monitor the SSL status of your services and ensure timely renewal of certificates.
## Overview
The tool connects to a specified host and port using TLS, verifies the provided hostname against the certificate, and checks the expiration date of the certificate. It provides warnings or critical alerts based on configurable thresholds for days remaining until expiration.
## Features
- **Hostname Verification**: Verifies that the hostname matches the certificate.
- **Certificate Expiration Check**: Checks how many days are left until the SSL/TLS certificate expires.
- **Configurable Alerts**:
- **Warning**: Triggered when the remaining validity is below a specified number of days.
- **Critical**: Triggered when the certificate is on the brink of expiration or has already expired.
- **Customizable Parameters**: Command-line arguments let you tailor the behavior to specific needs (e.g., host, port, thresholds, timeouts).
## Usage
Run the program using the command line with the following syntax:
| Certificate is valid and not expiring soon. | `OK: Certificate for <host> is valid, expires in <days> days.` | `0` |
| Certificate is nearing expiration. | `WARNING: Certificate for <host> expires in <days> days.` | `1` |
| Certificate is expired or critically close to expiration. | `CRITICAL: Certificate for <host> expired <days> days ago.` or `CRITICAL: Certificate for <host> expires in <days> days.` | `2` |