SSL Certificate Monitor
What This Does
A CLI tool to monitor SSL/TLS certificates for expiration dates, security issues, and basic compliance checks. Check single domains or multiple domains from a list, get detailed certificate information, and receive alerts before certificates expire.
Key features:
- - Check expiration dates for SSL certificates on domains and subdomains
- Detailed certificate info - issuer, subject, serial number, signature algorithm
- Security validation - check certificate chain, basic trust validation
- Batch monitoring - check multiple domains from a file or list
- Alert thresholds - warn when certificates expire within specified days (default 30 days)
- JSON output - machine-readable output for integration with monitoring systems
- Simple CLI interface - easy to use in scripts or cron jobs
- No external API required - uses Python's SSL/TLS libraries
When To Use
- - You need to monitor SSL certificate expiration for your websites
- You want to automate certificate renewal reminders
- You're managing multiple domains and subdomains
- You need to validate certificate chain and basic security
- You want to integrate SSL monitoring into your DevOps pipeline
- You're auditing domains for certificate compliance
- You need to check certificates on internal servers or development environments
Usage
Basic commands:
CODEBLOCK0
Examples
Example 1: Check single domain expiration
CODEBLOCK1
Output:
CODEBLOCK2
Example 2: Check with warning threshold
CODEBLOCK3
Output (if expiring within 30 days):
CODEBLOCK4
Example 3: Batch check from file
CODEBLOCK5
Output:
CODEBLOCK6
Example 4: JSON output for automation
CODEBLOCK7
Output:
CODEBLOCK8
Example 5: Certificate details
CODEBLOCK9
Output:
CODEBLOCK10
Requirements
- - Python 3.x
- INLINECODE0 library for certificate parsing (installed automatically or via pip)
Install missing dependencies:
CODEBLOCK11
Limitations
- - Only checks TLS certificates on standard ports (custom ports supported via --port)
- Requires network connectivity to target domains
- May be blocked by firewalls or network security policies
- Does not perform deep security audits (no revocation checking, weak cipher detection)
- No support for client certificate authentication
- Limited to standard TLS handshake (no SNI customization)
- May not work with self-signed certificates without custom trust stores
- No support for checking certificate transparency logs
- Rate limiting may affect checking many domains quickly
- No built-in notification system (output only)
- Does not check for mixed content or other web security issues
- No support for checking certificates in load balancers or CDNs directly
- Limited error handling for network timeouts or DNS failures
- No support for checking certificates in mobile apps or other non-web contexts
Directory Structure
The tool works with domain lists as text files (one domain per line). No special configuration directories are required.
Error Handling
- - Connection timeouts show helpful error messages with retry suggestions
- DNS resolution failures suggest checking domain spelling
- Certificate validation errors show certificate details and validation issues
- Port connection failures suggest checking firewall rules or service status
- File not found errors suggest checking file paths and permissions
Contributing
This is a skill built by the Skill Factory. Issues and improvements should be reported through the OpenClaw project.
SSL证书监控工具
功能概述
这是一款命令行工具,用于监控SSL/TLS证书的过期日期、安全问题和基本合规性检查。可检查单个域名或列表中的多个域名,获取详细的证书信息,并在证书过期前接收警报。
主要功能:
- - 检查过期日期 - 监控域名和子域名的SSL证书过期时间
- 详细证书信息 - 颁发者、主题、序列号、签名算法
- 安全验证 - 检查证书链、基本信任验证
- 批量监控 - 从文件或列表中检查多个域名
- 警报阈值 - 在证书指定天数内过期时发出警告(默认30天)
- JSON输出 - 机器可读输出,便于集成监控系统
- 简单CLI界面 - 易于在脚本或cron任务中使用
- 无需外部API - 使用Python的SSL/TLS库
适用场景
- - 需要监控网站SSL证书过期情况
- 希望自动化证书续期提醒
- 管理多个域名和子域名
- 需要验证证书链和基本安全性
- 希望将SSL监控集成到DevOps流程中
- 审计域名的证书合规性
- 需要检查内部服务器或开发环境的证书
使用方法
基本命令:
bash
检查单个域名
python3 scripts/main.py check example.com
使用自定义端口检查
python3 scripts/main.py check example.com --port 443
从文件检查多个域名(每行一个域名)
python3 scripts/main.py batch domains.txt
设置自定义警告阈值(过期前天数)
python3 scripts/main.py check example.com --warning-days 14
输出JSON格式供机器处理
python3 scripts/main.py check example.com --json
检查证书详细信息(颁发者、主题、算法等)
python3 scripts/main.py details example.com
验证证书链和基本安全性
python3 scripts/main.py validate example.com
示例
示例1:检查单个域名过期情况
bash
python3 scripts/main.py check example.com
输出:
✅ 域名:example.com:443
状态:有效
过期时间:2026-06-15 23:59:59 UTC
剩余天数:101
颁发者:Lets Encrypt Authority X3
主题:CN=example.com
算法:SHA256-RSA
示例2:带警告阈值的检查
bash
python3 scripts/main.py check example.com --warning-days 30
输出(如果在30天内过期):
⚠️ 域名:example.com:443
状态:即将过期
过期时间:2026-03-10 23:59:59 UTC
剩余天数:4
颁发者:Lets Encrypt Authority X3
主题:CN=example.com
算法:SHA256-RSA
警告:证书将在4天后过期
示例3:从文件批量检查
bash
python3 scripts/main.py batch domains.txt --warning-days 30
输出:
📋 批量检查结果(5个域名):
✅ example.com:有效(剩余101天)
✅ api.example.com:有效(剩余95天)
⚠️ staging.example.com:即将过期(剩余15天)
❌ internal.example.com:无效(证书2天前已过期)
❌ old.example.com:连接失败(超时)
摘要:3个有效,1个即将过期,1个已过期,1个失败
示例4:自动化JSON输出
bash
python3 scripts/main.py check example.com --json
输出:
json
{
domain: example.com,
port: 443,
status: valid,
expires_at: 2026-06-15T23:59:59Z,
days_remaining: 101,
issuer: Lets Encrypt Authority X3,
subject: CN=example.com,
algorithm: SHA256-RSA,
serial_number: 0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6,
valid_from: 2025-06-16T00:00:00Z,
valid_to: 2026-06-15T23:59:59Z,
warning: false,
error: null
}
示例5:证书详细信息
bash
python3 scripts/main.py details example.com
输出:
📋 example.com:443的证书详细信息
主题:CN=example.com
颁发者:Lets Encrypt Authority X3
序列号:0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6
有效期:
生效时间:2025-06-16 00:00:00 UTC
失效时间:2026-06-15 23:59:59 UTC
剩余天数:101
签名:
算法:SHA256-RSA
密钥大小:2048位
扩展:
主题备用名称:example.com, www.example.com
密钥用途:数字签名、密钥加密
扩展密钥用途:TLS Web服务器认证
系统要求
- - Python 3.x
- cryptography库用于证书解析(自动安装或通过pip安装)
安装缺失依赖:
bash
pip3 install cryptography
局限性
- - 仅检查标准端口的TLS证书(自定义端口通过--port支持)
- 需要网络连接到目标域名
- 可能被防火墙或网络安全策略阻止
- 不执行深度安全审计(无吊销检查、弱密码检测)
- 不支持客户端证书认证
- 仅限于标准TLS握手(无SNI自定义)
- 无自定义信任库时可能无法处理自签名证书
- 不支持检查证书透明度日志
- 速率限制可能影响快速检查多个域名
- 无内置通知系统(仅输出)
- 不检查混合内容或其他Web安全问题
- 不支持直接检查负载均衡器或CDN中的证书
- 对网络超时或DNS失败的错误处理有限
- 不支持检查移动应用或其他非Web环境中的证书
目录结构
该工具使用文本文件形式的域名列表(每行一个域名)。无需特殊配置目录。
错误处理
- - 连接超时显示有用的错误信息并建议重试
- DNS解析失败建议检查域名拼写
- 证书验证错误显示证书详细信息和验证问题
- 端口连接失败建议检查防火墙规则或服务状态
- 文件未找到错误建议检查文件路径和权限
贡献指南
这是由Skill Factory构建的技能。问题和改进应通过OpenClaw项目报告。