This commit is contained in:
2019-07-08 18:32:00 +00:00
parent 9499b50f26
commit 58a87676a9

View File

@@ -41,15 +41,16 @@ namespace rockfishCore.Util
/// <summary>
/// check if an ssl cert is within 10 days of expiry
/// check if an ssl cert is within 30 days of expiry
/// (30 days is the minimum threshold for LetsEncrypt to allow re-up)
/// </summary>
/// <param name="url"></param>
/// <returns>null if more than 10 days before expiry or the expiry date for display</returns>
/// <returns>null if more than 30 days before expiry or the expiry date for display</returns>
public static DateTime? SSLCertExpiryDate(string url)
{
var expires = GetServerCertificateExpiryAsync(url).Result;
//In 10 days will we be past the expiry date
var deadline = DateTime.Now.AddDays(100);
//In 30 days will we be past the expiry date?
var deadline = DateTime.Now.AddDays(30);
if (expires < deadline)
{
return expires;