|
@@ -147,6 +147,15 @@ class SiteGen:
|
147
|
147
|
for domain in domains:
|
148
|
148
|
self.cert_check(domain, logger)
|
149
|
149
|
|
|
150
|
+ def cert_enddate(self, domain, logger):
|
|
151
|
+ if not self.is_cert_present(domain):
|
|
152
|
+ raise SiteGenException("Certificate not present: %s" % domain, 1)
|
|
153
|
+ logger("%s: %s" % (domain, self.get_cert_end_date(domain)))
|
|
154
|
+
|
|
155
|
+ def certs_enddate(self, domains, logger):
|
|
156
|
+ for domain in domains:
|
|
157
|
+ self.cert_enddate(domain, logger)
|
|
158
|
+
|
150
|
159
|
def cert_renew(self, domain, logger):
|
151
|
160
|
if self.cert_check(domain, logger):
|
152
|
161
|
self.cert_request(domain, logger)
|
|
@@ -195,6 +204,8 @@ def main():
|
195
|
204
|
help='Check if certificate needs to be renewed. Check all if no domain is specified')
|
196
|
205
|
parser.add_argument('--cert-renew', metavar='cert_renew', const='', nargs='?',
|
197
|
206
|
help='Renew certificate if it needs to be. Renew all that needs to be if no domain is specified')
|
|
207
|
+ parser.add_argument('--cert-enddate', metavar='cert_enddate', const='', nargs='?',
|
|
208
|
+ help='Print certificate enddate. Print all certificates enddate if no domain is specified')
|
198
|
209
|
|
199
|
210
|
parser.add_argument('--site-create', help='Create a site configuration', metavar='site_create')
|
200
|
211
|
parser.add_argument('--site-remove', help='Remove a site configuration', metavar='site_remove')
|
|
@@ -235,6 +246,12 @@ def main():
|
235
|
246
|
else:
|
236
|
247
|
site_gen.cert_renew(args.cert_renew, logger)
|
237
|
248
|
|
|
249
|
+ elif args.cert_enddate is not None:
|
|
250
|
+ if args.cert_enddate == "":
|
|
251
|
+ site_gen.certs_enddate(site_gen.get_all_domains(), logger)
|
|
252
|
+ else:
|
|
253
|
+ site_gen.cert_enddate(args.cert_enddate, logger)
|
|
254
|
+
|
238
|
255
|
elif args.site_create is not None:
|
239
|
256
|
site_gen.site_create(args.site_create, logger)
|
240
|
257
|
|