Fix SSL certificate removal with WordOps backend
This commit is contained in:
@@ -8,9 +8,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
|
||||
### v3.9.x - [Unreleased]
|
||||
|
||||
### v3.9.8.5 - 2019-08-29
|
||||
|
||||
#### Fixed
|
||||
|
||||
- Fix Netdata install on Raspbian 9/10
|
||||
- `wo stack remove/purge` confirmation
|
||||
- Nginx error after removing a SSL certificate used to secure WordOps backend
|
||||
|
||||
### v3.9.8.4 - 2019-08-28
|
||||
|
||||
|
||||
@@ -989,8 +989,6 @@ def display_cache_settings(self, data):
|
||||
"page=nginx".format(data['site_name']))
|
||||
|
||||
|
||||
|
||||
|
||||
def logwatch(self, logfiles):
|
||||
import zlib
|
||||
import base64
|
||||
@@ -1012,8 +1010,8 @@ def logwatch(self, logfiles):
|
||||
'caught exception rendering a new log line in %s'
|
||||
% filename)
|
||||
|
||||
l = logwatch.LogWatcher(logfiles, callback)
|
||||
l.loop()
|
||||
logl = logwatch.LogWatcher(logfiles, callback)
|
||||
logl.loop()
|
||||
|
||||
|
||||
def detSitePar(opts):
|
||||
@@ -1243,10 +1241,19 @@ def removeAcmeConf(self, domain):
|
||||
.format(domain))
|
||||
WOFileUtils.rm(self, '/etc/nginx/conf.d/force-ssl-{0}.conf.disabled'
|
||||
.format(domain))
|
||||
|
||||
WOGit.add(self, ["/etc/letsencrypt"],
|
||||
msg="Deleted {0} "
|
||||
.format(domain))
|
||||
if WOFileUtils.grepcheck(self, '/var/www/22222/conf/nginx/ssl.conf',
|
||||
'{0}'.format(domain)):
|
||||
Log.info(self, "Setting back default certificate for WordOps backend")
|
||||
with open("/var/www/22222/conf/nginx/"
|
||||
"ssl.conf", "w") as ssl_conf_file:
|
||||
ssl_conf_file.write("ssl_certificate "
|
||||
"/var/www/22222/cert/22222.crt;\n"
|
||||
"ssl_certificate_key "
|
||||
"/var/www/22222/cert/22222.key;\n")
|
||||
WOGit.add(self, ["/etc/letsencrypt"],
|
||||
msg="Deleted {0} "
|
||||
.format(domain))
|
||||
WOService.restart_service(self, "nginx")
|
||||
|
||||
|
||||
def site_url_https(self, domain):
|
||||
|
||||
@@ -460,9 +460,8 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
|
||||
if not os.path.isfile('{0}22222/conf/nginx/ssl.conf'
|
||||
.format(ngxroot)):
|
||||
|
||||
with open("/var/www/22222/conf/nginx/"
|
||||
"ssl.conf", "a") as php_file:
|
||||
"ssl.conf", "w") as php_file:
|
||||
php_file.write("ssl_certificate "
|
||||
"/var/www/22222/cert/22222.crt;\n"
|
||||
"ssl_certificate_key "
|
||||
|
||||
@@ -244,6 +244,22 @@ class WOFileUtils():
|
||||
Log.error(self, "Unable to Search string {0} in {1}"
|
||||
.format(sstr, fnm))
|
||||
|
||||
def grepcheck(self, fnm, sstr):
|
||||
"""
|
||||
Searches for string in file and returns True or False.
|
||||
"""
|
||||
try:
|
||||
Log.debug(self, "Finding string {0} to file {1}"
|
||||
.format(sstr, fnm))
|
||||
for line in open(fnm, encoding='utf-8'):
|
||||
if sstr in line:
|
||||
return True
|
||||
return False
|
||||
except OSError as e:
|
||||
Log.debug(self, "{0}".format(e.strerror))
|
||||
Log.error(self, "Unable to Search string {0} in {1}"
|
||||
.format(sstr, fnm))
|
||||
|
||||
def rm(self, path):
|
||||
"""
|
||||
Remove files
|
||||
|
||||
Reference in New Issue
Block a user