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.x - [Unreleased]
|
||||||
|
|
||||||
|
### v3.9.8.5 - 2019-08-29
|
||||||
|
|
||||||
#### Fixed
|
#### Fixed
|
||||||
|
|
||||||
- Fix Netdata install on Raspbian 9/10
|
- 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
|
### v3.9.8.4 - 2019-08-28
|
||||||
|
|
||||||
|
|||||||
@@ -989,8 +989,6 @@ def display_cache_settings(self, data):
|
|||||||
"page=nginx".format(data['site_name']))
|
"page=nginx".format(data['site_name']))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def logwatch(self, logfiles):
|
def logwatch(self, logfiles):
|
||||||
import zlib
|
import zlib
|
||||||
import base64
|
import base64
|
||||||
@@ -1012,8 +1010,8 @@ def logwatch(self, logfiles):
|
|||||||
'caught exception rendering a new log line in %s'
|
'caught exception rendering a new log line in %s'
|
||||||
% filename)
|
% filename)
|
||||||
|
|
||||||
l = logwatch.LogWatcher(logfiles, callback)
|
logl = logwatch.LogWatcher(logfiles, callback)
|
||||||
l.loop()
|
logl.loop()
|
||||||
|
|
||||||
|
|
||||||
def detSitePar(opts):
|
def detSitePar(opts):
|
||||||
@@ -1243,10 +1241,19 @@ def removeAcmeConf(self, domain):
|
|||||||
.format(domain))
|
.format(domain))
|
||||||
WOFileUtils.rm(self, '/etc/nginx/conf.d/force-ssl-{0}.conf.disabled'
|
WOFileUtils.rm(self, '/etc/nginx/conf.d/force-ssl-{0}.conf.disabled'
|
||||||
.format(domain))
|
.format(domain))
|
||||||
|
if WOFileUtils.grepcheck(self, '/var/www/22222/conf/nginx/ssl.conf',
|
||||||
WOGit.add(self, ["/etc/letsencrypt"],
|
'{0}'.format(domain)):
|
||||||
msg="Deleted {0} "
|
Log.info(self, "Setting back default certificate for WordOps backend")
|
||||||
.format(domain))
|
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):
|
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'
|
if not os.path.isfile('{0}22222/conf/nginx/ssl.conf'
|
||||||
.format(ngxroot)):
|
.format(ngxroot)):
|
||||||
|
|
||||||
with open("/var/www/22222/conf/nginx/"
|
with open("/var/www/22222/conf/nginx/"
|
||||||
"ssl.conf", "a") as php_file:
|
"ssl.conf", "w") as php_file:
|
||||||
php_file.write("ssl_certificate "
|
php_file.write("ssl_certificate "
|
||||||
"/var/www/22222/cert/22222.crt;\n"
|
"/var/www/22222/cert/22222.crt;\n"
|
||||||
"ssl_certificate_key "
|
"ssl_certificate_key "
|
||||||
|
|||||||
@@ -244,6 +244,22 @@ class WOFileUtils():
|
|||||||
Log.error(self, "Unable to Search string {0} in {1}"
|
Log.error(self, "Unable to Search string {0} in {1}"
|
||||||
.format(sstr, fnm))
|
.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):
|
def rm(self, path):
|
||||||
"""
|
"""
|
||||||
Remove files
|
Remove files
|
||||||
|
|||||||
Reference in New Issue
Block a user