82 字
1 分钟

一个查看域名ssl认证有效期的脚本

Terminal window
server_name=$1
# 获取网站的证书有效期
ssl_time=$(echo | openssl s_client -servername ${server_name} -connect ${server_name}:443 2>/dev/null | openssl x509 -noout -dates|awk -F '=' '/notAfter/{print $2}')
# 转换时间戳
ssl_unix_time=$(date +%s -d "${ssl_time}")
# 获取今天时间戳
today=$(date +%s)
# 计算剩余时间
let expr_time=($ssl_unix_time-$today)/24/3600
echo "${server_name} : SSL Certification Expired in $expr_time days. "

使用#

Terminal window
[root@wordpress-187 ~]#./ssl_expire.sh blog.freelytomorrow.com
blog.freelytomorrow.com : SSL Certification Expired in 247 days.

支持与分享

如果这篇文章对你有帮助,欢迎分享给更多人或赞助支持!

赞助
一个查看域名ssl认证有效期的脚本
https://white-festa.net/posts/ssl-cert-expire/
作者
常世常暗
发布于
2023-08-14
许可协议
CC BY-NC-SA 4.0
最后更新于 2023-08-14,距今已过 920 天

部分内容可能已过时

评论区

Profile Image of the Author
常世常暗
If you shout loud enough, you'll be the one.
公告 - 2025/12/21
本站框架已由Ghost迁移到Astro!
音乐
封面

音乐

暂未播放

0:00 0:00
暂无歌词
分类
标签
站点统计
文章
60
分类
11
标签
36
总字数
115,331
运行时长
0
最后活动
0 天前

目录