迎接清晨
痛苦中自省

搭建一个提醒SSL证书过期预警提醒网站

开源于Github的项目  英文版 | 中文版

我们提供的免费的SSL安全证书过期预警提醒服务的地址是 https://ssl.qing.su

教程开始

假设我们对应的网站是ssl.qing.su, 网站安装目录是/srv/www/ssl.qing.su/public_html/,首先,我们获取所有的文件

cd /srv/www/ssl.qing.su/
git clone https://github.com/Har-Kuun/certificate-expiry-monitor_zh-CN.git
mv certificate-expiry-monitor public_html

接着我们新建数据库文件。注意不要把数据库文件放在网站目录内,否则将被所有人可见。我们这里放在/srv/www/ssl.qing.su/db/目录下。注意,请用您服务器的用户名代替www-data, 比如CentOS下的Apache2可能使用的用户名是www, 而LiteSpeed的用户名可能是nobody.

touch /srv/www/ssl.qing.su/db/pre_checks.json
touch /srv/www/ssl.qing.su/db/checks.json
touch /srv/www/ssl.qing.su/db/deleted_checks.json
chown -R www-data /srv/www/ssl.qing.su/db/*.json

并在/functions/variables.php文件中更改数据库的位置。

$pre_check_file = '/srv/www/ssl.qing.su/db/pre_checks.json';
$check_file = '/srv/www/ssl.qing.su/db/checks.json';
$deleted_check_file = '/srv/www/ssl.qing.su/db/deleted_checks.json';

我们还需要更改$current_domain$current_link参数为您网站的网址。

$current_domain = "ssl.qing.su";
$current_link = "ssl.qing.su";

接着设置cronjob. 新建/etc/cron.d/certificate-exipry-monitor

1 1 * * * www-data /path/to/php /srv/www/ssl.qing.su/public_html/cron.php >> /var/log/certificate-expiry-monitor.log 2>&1

 

最后设置邮件。为了避免被主机商屏蔽,我们将使用SMTP发送邮件。安装php-pear和对应的Mail package:

apt-get install php-pear
pear install Mail
pear install Net_SMTP

然后我们更改/functions/文件夹下面的email.php, add_check.php, remove_check.php, pre_check.php这四个文件夹,将对应的SMTP用户名和密码填入文件对应语段中。


教程到此完毕。

赞(0) 赞赏博主
未经允许不得转载:牧野狂歌 » 搭建一个提醒SSL证书过期预警提醒网站

相关推荐

  • 暂无文章

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用,打赏一下下吧。

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

微信扫一扫打赏