From 19da5429308412c19176733d2b32ccbf2c08df1c Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 8 Jul 2014 21:34:04 -0700 Subject: create client certificates with generous not_before (fixes #5884) --- app/models/client_certificate.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/models') diff --git a/app/models/client_certificate.rb b/app/models/client_certificate.rb index 63de9e1..d5bb1e0 100644 --- a/app/models/client_certificate.rb +++ b/app/models/client_certificate.rb @@ -24,7 +24,7 @@ class ClientCertificate cert.subject.common_name = common_name(options[:prefix]) # set expiration - cert.not_before = yesterday + cert.not_before = last_month cert.not_after = months_from_yesterday(APP_CONFIG[:client_cert_lifespan]) # generate key @@ -111,6 +111,11 @@ class ClientCertificate Time.utc t.year, t.month, t.day end + def last_month + t = Time.now - 24*60*60*30 + Time.utc t.year, t.month, t.day + end + def months_from_yesterday(num) t = yesterday date = Date.new t.year, t.month, t.day -- cgit v1.2.3