Fix hsts enable disable

This commit is contained in:
VirtuBox
2024-06-03 00:56:23 +02:00
parent d1e50d06b5
commit 6b5e5ecb47

View File

@@ -146,8 +146,7 @@ class SSL:
self, "Adding /var/www/{0}/conf/nginx/hsts.conf" self, "Adding /var/www/{0}/conf/nginx/hsts.conf"
.format(wo_domain_name)) .format(wo_domain_name))
hstsconf = open("/var/www/{0}/conf/nginx/hsts.conf" hstsconf = open(f"/var/www/{wo_domain_name}/conf/nginx/hsts.conf",
.format(wo_domain_name),
encoding='utf-8', mode='w') encoding='utf-8', mode='w')
hstsconf.write("more_set_headers " hstsconf.write("more_set_headers "
"\"Strict-Transport-Security: " "\"Strict-Transport-Security: "
@@ -177,13 +176,11 @@ class SSL:
try: try:
WOShellExec.cmd_exec( WOShellExec.cmd_exec(
self, "openssl genrsa -out " self, "openssl genrsa -out "
"{0}/ssl.key 2048" f"{selfs_tmp}/ssl.key 2048")
.format(selfs_tmp))
WOShellExec.cmd_exec( WOShellExec.cmd_exec(
self, "openssl req -new -batch " self, "openssl req -new -batch "
"-subj /commonName=localhost/ " "-subj /commonName=localhost/ "
"-key {0}/ssl.key -out {0}/ssl.csr" f"-key {selfs_tmp}/ssl.key -out {selfs_tmp}/ssl.csr")
.format(selfs_tmp))
WOFileUtils.mvfile( WOFileUtils.mvfile(
self, "{0}/ssl.key" self, "{0}/ssl.key"