0

本身不是编程问题,但对从事商业 Web 开发的人来说很有趣。

您如何跟踪所有客户的托管、域注册和 SSL 证书到期日期?

你只是保留一个电子表格还是有一些有用的软件呢?

我进行了广泛的搜索,找不到可用的软件,很想写点东西。由于要管理 100 多个客户,并且托管和域名分布在多家托管公司和注册商中,我的临时手段失败了。

4

5 回答 5

2

我们把它变成一个编程问题怎么样!您可以使用此代码(C#),但我建议对其稍作修改(例如,将 url 放入文件中)并将其放入服务中。

此代码设置证书验证回调,HttpWebRequest 将在遇到证书时调用该回调。这让我们可以查看证书,通常这用于验证证书,但我们将查看到期时间,如果在 3 个月内,我们将向自己发送电子邮件。设置了一个计时器以每天运行一次检查。

using System.Net;
using System.Diagnostics;
using System.Net.Mail;
using System.Threading;

static void Main(string[] args)
{
    // List of URL's to check
    string[] urls = new string[]{
        "https://www.6bit.com/",
        "https://www.google.com/"
    };

    HttpWebRequest req = null;

    // Certificate check callback
    ServicePointManager.ServerCertificateValidationCallback = (state, cert, certChain, sslerr) =>
    {
        DateTime expiration = DateTime.Parse(cert.GetExpirationDateString());
        if (expiration < DateTime.Now.AddMonths(3))
        {
            Debug.WriteLine("Cert expiring on " + expiration.ToShortDateString());
            MailMessage msg = new MailMessage("SSLCheck@example.com", "josh@example.com", "SSL Certificate Expiring", "The ssl certificate for" + req.RequestUri.ToString() + " will expire on " + expiration.ToShortDateString());
            SmtpClient sc = new SmtpClient();
            sc.Send(msg);
        }

        return true;
    };

    // Request each url once a day so that the validation callback runs for each
    Timer t = new Timer(s =>
    {
        Array.ForEach(urls, url =>
        {
            try
            {
                req = (HttpWebRequest)HttpWebRequest.Create(url);
                HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
                resp.Close();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error checking site: " + ex.ToString());
            }
        });
    }, null, TimeSpan.FromSeconds(0), TimeSpan.FromDays(1));  // Run the timer now and schedule to run once a day
}
于 2008-12-12T02:56:53.947 回答
1

使用通常用于管理时间/日程的任何工具可能比使用一些专门的工具更好。无论是 Outlook、Sunbird、Lightning、PDA、手机、纸质日历等。只需使用您通常用于跟踪日期的任何工具。

[添加]

详细地说,您希望将其与其他重要日期放在同一个地方的原因是它确保(至少一点)您注意列表。如果您使用的是其他类型的程序,那么很容易忙几个星期,忘记查看您的特殊工具,最终让一些不应该过期的东西过期。

于 2008-12-12T02:06:57.153 回答
1

关于管理 SSL 证书,您可以编写一个调用 OpenSSL 的脚本,或者如果您想要一些现成的东西,您可以试试这个:

SSL 证书发现和监控工具

它会在您的网络上查找和编目证书,并在证书即将到期时发送电子邮件警报。结果可以导入一个名为 Cert Centre 的基于网络的工具。

于 2011-07-25T15:26:29.217 回答
0

尝试使用epazote基本上您可以在 yaml 文件上创建站点(服务)列表,并在证书到期之前收到电子邮件/警报/hipchat 通知,例如:

services:
    google:
        url: https://www.google.com
        seconds: 60
        expect:
            status: 302
            ssl:
                hours: 72

在这种情况下,可以在证书到期前 72 小时发送电子邮件。

更多详细信息:https ://epazote.io/post/how-to-use-it/

于 2016-09-22T10:15:23.527 回答
0

You can use a service like https://IsItWorking.info to track domain registration, and SSL certificate expiry.

You can set when you want to get notifications (e.g. 60 days before expiry) and it can notify you by email, slack or pushover.

(full disclosure: I wrote it!)

于 2017-03-30T17:53:09.227 回答