]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/letsencrypt/files/default/bin/check-certificate
Start reminding about expiry at 21 days
[chef.git] / cookbooks / letsencrypt / files / default / bin / check-certificate
index 608d9e7af2b7a4a4e55fcba1119866f56ef637b1..303314fcab2af17abd12359433ba6465a9094e5c 100755 (executable)
@@ -10,7 +10,7 @@ begin
 
   if Time.now < certificate.not_before
     puts "Certificate #{domain} not valid until #{certificate.not_before}"
-  elsif certificate.not_after - Time.now < 14 * 86400
+  elsif certificate.not_after - Time.now < 21 * 86400
     puts "Certificate #{domain} expires at #{certificate.not_after}"
   else
     subject_alt_name = certificate.extensions.find { |e| e.oid == "subjectAltName" }
@@ -31,6 +31,6 @@ begin
   end
 
   connection.finish
-rescue OpenSSL::SSL::SSLError => error
+rescue StandardError => error
   puts "Error connecting to #{domain}: #{error.message}"
 end