change hsts settings
This commit is contained in:
@@ -785,9 +785,11 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
action='store' or 'store_const',
|
action='store' or 'store_const',
|
||||||
choices=('on', 'off', 'renew', 'subdomain', 'wildcard'),
|
choices=('on', 'off', 'renew', 'subdomain', 'wildcard'),
|
||||||
const='on', nargs='?')),
|
const='on', nargs='?')),
|
||||||
(['--hsts'],
|
(['-hsts'],
|
||||||
dict(help="configure HSTS on site secured with letsencrypt",
|
dict(help="configure hsts for the site",
|
||||||
action='store_true')),
|
action='store' or 'store_const',
|
||||||
|
choices=('on', 'off'),
|
||||||
|
const='on', nargs='?')),
|
||||||
(['--proxy'],
|
(['--proxy'],
|
||||||
dict(help="update to proxy site", nargs='+')),
|
dict(help="update to proxy site", nargs='+')),
|
||||||
(['--experimental'],
|
(['--experimental'],
|
||||||
@@ -1319,22 +1321,37 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
if pargs.hsts:
|
if pargs.hsts:
|
||||||
if os.path.isfile(("{0}/conf/nginx/ssl.conf")
|
if pargs.hsts == 'on':
|
||||||
.format(wo_site_webroot)):
|
if os.path.isfile(("{0}/conf/nginx/ssl.conf")
|
||||||
if (not os.path.isfile("{0}/conf/nginx/hsts.conf"
|
.format(wo_site_webroot)):
|
||||||
.format(wo_site_webroot))):
|
if (not os.path.isfile("{0}/conf/nginx/hsts.conf"
|
||||||
setupHsts(self, wo_domain, True)
|
.format(wo_site_webroot))):
|
||||||
|
setupHsts(self, wo_domain, True)
|
||||||
|
else:
|
||||||
|
Log.error(self, "HSTS is already configured for given "
|
||||||
|
"site")
|
||||||
|
if not WOService.reload_service(self, 'nginx'):
|
||||||
|
Log.error(self, "service nginx reload failed. "
|
||||||
|
"check issues with `nginx -t` command")
|
||||||
else:
|
else:
|
||||||
Log.error(self, "HSTS is already configured for given "
|
Log.error(self, "HTTPS is not configured for given "
|
||||||
"site")
|
"site")
|
||||||
if not WOService.reload_service(self, 'nginx'):
|
return 0
|
||||||
Log.error(self, "service nginx reload failed. "
|
|
||||||
"check issues with `nginx -t` command")
|
elif pargs.hsts == 'off':
|
||||||
else:
|
if os.path.isfile(("{0}/conf/nginx/hsts.conf")
|
||||||
Log.error(self, "HTTPS is not configured for given "
|
.format(wo_site_webroot)):
|
||||||
"site")
|
WOFileUtils.mvfile(self, "{0}/conf/nginx/hsts.conf"
|
||||||
return 0
|
.format(wo_site_webroot),
|
||||||
|
'{0}/conf/nginx/hsts.conf.disabled'
|
||||||
|
.format(wo_site_webroot))
|
||||||
|
if not WOService.reload_service(self, 'nginx'):
|
||||||
|
Log.error(self, "service nginx reload failed. "
|
||||||
|
"check issues with `nginx -t` command")
|
||||||
|
else:
|
||||||
|
Log.error(self, "HSTS is not configured for given "
|
||||||
|
"site")
|
||||||
|
return 0
|
||||||
|
|
||||||
if stype == oldsitetype and cache == oldcachetype:
|
if stype == oldsitetype and cache == oldcachetype:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user