Set --force required to renew > 30 days

This commit is contained in:
VirtuBox
2019-10-29 22:20:36 +01:00
parent 61a2201e17
commit 5cb8ab6268
2 changed files with 11 additions and 6 deletions

View File

@@ -27,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Refactored WordOps download function with python3-requests - Refactored WordOps download function with python3-requests
- MySQL backup path changed to `/var/lib/wo-backup/mysql` - MySQL backup path changed to `/var/lib/wo-backup/mysql`
- Do not check anymore if stack are installed with apt in `wo service` but only if there is a systemd service - Do not check anymore if stack are installed with apt in `wo service` but only if there is a systemd service
- Refactored `--letsencrypt=renew`. Require the flag `--force` if certificate expiration is more than 45 days
#### Fixed #### Fixed

View File

@@ -1091,11 +1091,12 @@ class WOSiteUpdateController(CementBaseController):
if WOAcme.cert_check(self, wo_domain): if WOAcme.cert_check(self, wo_domain):
if not pargs.force: if not pargs.force:
if (SSL.getexpirationdays(self, wo_domain) > 45): if (SSL.getexpirationdays(self, wo_domain) > 30):
Log.error( Log.error(
self, self, "Your cert will expire in more "
'Your certificate expire in more than 45 days.\n' "than 30 days ( " +
'Add \'--force\' to force to renew') str(SSL.getexpirationdays(self, wo_domain)) +
" days).\nAdd \'--force\' to force to renew")
Log.wait(self, "Renewing SSL certificate") Log.wait(self, "Renewing SSL certificate")
if WOAcme.renew(self, wo_domain): if WOAcme.renew(self, wo_domain):
Log.valide(self, "Renewing SSL certificate") Log.valide(self, "Renewing SSL certificate")
@@ -1943,7 +1944,7 @@ class WOSiteDeleteController(CementBaseController):
dict(help="forcefully delete site and configuration", dict(help="forcefully delete site and configuration",
action='store_true')), action='store_true')),
(['--all'], (['--all'],
dict(help="delete all", action='store_true')), dict(help="delete files & db", action='store_true')),
(['--db'], (['--db'],
dict(help="delete db only", action='store_true')), dict(help="delete db only", action='store_true')),
(['--files'], (['--files'],
@@ -1954,7 +1955,7 @@ class WOSiteDeleteController(CementBaseController):
@expose(hide=True) @expose(hide=True)
def default(self): def default(self):
pargs = self.app.pargs pargs = self.app.pargs
if not pargs.site_name: if not pargs.site_name and not pargs.all:
try: try:
while not pargs.site_name: while not pargs.site_name:
pargs.site_name = (input('Enter site name : ') pargs.site_name = (input('Enter site name : ')
@@ -1980,6 +1981,9 @@ class WOSiteDeleteController(CementBaseController):
(not pargs.all)): (not pargs.all)):
pargs.all = True pargs.all = True
if pargs.force:
pargs.no_prompt = True
# Gather information from wo-db for wo_domain # Gather information from wo-db for wo_domain
check_site = getSiteInfo(self, wo_domain) check_site = getSiteInfo(self, wo_domain)
wo_site_type = check_site.site_type wo_site_type = check_site.site_type