{"id":65,"date":"2025-02-06T08:25:24","date_gmt":"2025-02-06T13:25:24","guid":{"rendered":"https:\/\/fortycreek.org\/?p=65"},"modified":"2025-03-17T11:37:26","modified_gmt":"2025-03-17T16:37:26","slug":"letsencrypt","status":"publish","type":"post","link":"https:\/\/fortycreek.org\/index.php\/2025\/02\/06\/letsencrypt\/","title":{"rendered":"Letsencrypt"},"content":{"rendered":"\n<p>Been using letsencrypt for a while now, and they have announced that they will no longer send expiry emails out.  Need to find a solution to test the certificates to see if they are almost expiring.  This looks promising: <a href=\"https:\/\/nickjanetakis.com\/blog\/using-curl-to-check-an-ssl-certificate-expiration-date-and-details\">https:\/\/nickjanetakis.com\/blog\/using-curl-to-check-an-ssl-certificate-expiration-date-and-details<\/a><\/p>\n\n\n\n<p>Now need to compare the date to current date and send email as appropriate.  This is close: <a href=\"https:\/\/unix.stackexchange.com\/questions\/24626\/quickly-calculate-date-differences\">https:\/\/unix.stackexchange.com\/questions\/24626\/quickly-calculate-date-differences<\/a><\/p>\n\n\n\n<p>Final Solution:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#! \/bin\/bash\n# looks at date of cert expiry on cmd line\n#\n\nuExpire=`\/usr\/bin\/curl $1 -vkI --stderr - | \/bin\/grep \"expire date\" | \/usr\/bin\/cut -b 17-`\ndExpire=$(date -d \"$uExpire\" +%s)\ndNow=$(date -d \"now + 3 weeks\" +%s)\n\nsExpiry=$(( (dExpire - dNow) ))\n\nif &#91; $sExpiry -lt 0 ]\nthen\n        echo \"Cert will expire in less than 3 weeks\"\n        echo \"something wrong with renewal on $1\"\nfi\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Been using letsencrypt for a while now, and they have announced that they will no longer send expiry emails out. Need to find a solution to test the certificates to see if they are almost expiring. This looks promising: https:\/\/nickjanetakis.com\/blog\/using-curl-to-check-an-ssl-certificate-expiration-date-and-details Now need to compare the date to current date and send email as appropriate. This [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-65","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/fortycreek.org\/index.php\/wp-json\/wp\/v2\/posts\/65","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fortycreek.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fortycreek.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fortycreek.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fortycreek.org\/index.php\/wp-json\/wp\/v2\/comments?post=65"}],"version-history":[{"count":3,"href":"https:\/\/fortycreek.org\/index.php\/wp-json\/wp\/v2\/posts\/65\/revisions"}],"predecessor-version":[{"id":70,"href":"https:\/\/fortycreek.org\/index.php\/wp-json\/wp\/v2\/posts\/65\/revisions\/70"}],"wp:attachment":[{"href":"https:\/\/fortycreek.org\/index.php\/wp-json\/wp\/v2\/media?parent=65"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fortycreek.org\/index.php\/wp-json\/wp\/v2\/categories?post=65"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fortycreek.org\/index.php\/wp-json\/wp\/v2\/tags?post=65"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}