add letsencrypt support for --proxy
This commit is contained in:
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
|
|
||||||
- IPv6 support with HTTPS
|
- IPv6 support with HTTPS
|
||||||
- Brotli support in Nginx
|
- Brotli support in Nginx
|
||||||
|
- Let's Encrypt support with --proxy
|
||||||
|
|
||||||
#### Changed
|
#### Changed
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class WOLogShowController(CementBaseController):
|
|||||||
action='store_true')),
|
action='store_true')),
|
||||||
(['site_name'],
|
(['site_name'],
|
||||||
dict(help='Website Name', nargs='?', default=None))
|
dict(help='Website Name', nargs='?', default=None))
|
||||||
]
|
]
|
||||||
usage = "wo log show [<site_name>] [options]"
|
usage = "wo log show [<site_name>] [options]"
|
||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
@@ -68,17 +68,17 @@ class WOLogShowController(CementBaseController):
|
|||||||
if self.app.pargs.php:
|
if self.app.pargs.php:
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) and
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
(not self.app.pargs.mysql) and (not self.app.pargs.access) and
|
||||||
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)):
|
(not self.app.pargs.wp) and (not self.app.pargs.site_name)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.fpm = True
|
self.app.pargs.fpm = True
|
||||||
self.app.pargs.mysql = True
|
self.app.pargs.mysql = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) and
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
(not self.app.pargs.mysql) and (not self.app.pargs.access) and
|
||||||
and (not self.app.pargs.wp) and (self.app.pargs.site_name)):
|
(not self.app.pargs.wp) and (self.app.pargs.site_name)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.wp = True
|
self.app.pargs.wp = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
@@ -185,7 +185,7 @@ class WOLogResetController(CementBaseController):
|
|||||||
action='store_true')),
|
action='store_true')),
|
||||||
(['site_name'],
|
(['site_name'],
|
||||||
dict(help='Website Name', nargs='?', default=None))
|
dict(help='Website Name', nargs='?', default=None))
|
||||||
]
|
]
|
||||||
usage = "wo log reset [<site_name>] [options]"
|
usage = "wo log reset [<site_name>] [options]"
|
||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
@@ -197,9 +197,9 @@ class WOLogResetController(CementBaseController):
|
|||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
||||||
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)
|
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)
|
||||||
and (not self.app.pargs.slow_log_db)):
|
and (not self.app.pargs.slow_log_db)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.fpm = True
|
self.app.pargs.fpm = True
|
||||||
self.app.pargs.mysql = True
|
self.app.pargs.mysql = True
|
||||||
@@ -207,9 +207,9 @@ class WOLogResetController(CementBaseController):
|
|||||||
self.app.pargs.slow_log_db = True
|
self.app.pargs.slow_log_db = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
||||||
and (not self.app.pargs.wp) and (self.app.pargs.site_name)
|
and (not self.app.pargs.wp) and (self.app.pargs.site_name)
|
||||||
and (not self.app.pargs.slow-log-db)):
|
and (not self.app.pargs.slow-log-db)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.wp = True
|
self.app.pargs.wp = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
@@ -324,7 +324,7 @@ class WOLogGzipController(CementBaseController):
|
|||||||
action='store_true')),
|
action='store_true')),
|
||||||
(['site_name'],
|
(['site_name'],
|
||||||
dict(help='Website Name', nargs='?', default=None))
|
dict(help='Website Name', nargs='?', default=None))
|
||||||
]
|
]
|
||||||
usage = "wo log gzip [<site_name>] [options]"
|
usage = "wo log gzip [<site_name>] [options]"
|
||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
@@ -336,16 +336,16 @@ class WOLogGzipController(CementBaseController):
|
|||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
||||||
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)):
|
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.fpm = True
|
self.app.pargs.fpm = True
|
||||||
self.app.pargs.mysql = True
|
self.app.pargs.mysql = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
||||||
and (not self.app.pargs.wp) and (self.app.pargs.site_name)):
|
and (not self.app.pargs.wp) and (self.app.pargs.site_name)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.wp = True
|
self.app.pargs.wp = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
@@ -461,7 +461,7 @@ class WOLogMailController(CementBaseController):
|
|||||||
(['--to'],
|
(['--to'],
|
||||||
dict(help='Email addresses to send log files', action='append',
|
dict(help='Email addresses to send log files', action='append',
|
||||||
dest='to', nargs=1, required=True)),
|
dest='to', nargs=1, required=True)),
|
||||||
]
|
]
|
||||||
usage = "wo log mail [<site_name>] [options]"
|
usage = "wo log mail [<site_name>] [options]"
|
||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
@@ -473,16 +473,16 @@ class WOLogMailController(CementBaseController):
|
|||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
||||||
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)):
|
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.fpm = True
|
self.app.pargs.fpm = True
|
||||||
self.app.pargs.mysql = True
|
self.app.pargs.mysql = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
||||||
and (not self.app.pargs.wp) and (self.app.pargs.site_name)):
|
and (not self.app.pargs.wp) and (self.app.pargs.site_name)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.wp = True
|
self.app.pargs.wp = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
|
|||||||
@@ -38,19 +38,19 @@ class WOSecureController(CementBaseController):
|
|||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def default(self):
|
def default(self):
|
||||||
if self.app.pargs.auth:
|
if self.app.pargs.auth:
|
||||||
self.secure_auth()
|
self.secure_auth()
|
||||||
if self.app.pargs.port:
|
if self.app.pargs.port:
|
||||||
self.secure_port()
|
self.secure_port()
|
||||||
if self.app.pargs.ip:
|
if self.app.pargs.ip:
|
||||||
self.secure_ip()
|
self.secure_ip()
|
||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def secure_auth(self):
|
def secure_auth(self):
|
||||||
"""This function secures authentication"""
|
"""This function secures authentication"""
|
||||||
passwd = ''.join([random.choice
|
passwd = ''.join([random.choice
|
||||||
(string.ascii_letters + string.digits)
|
(string.ascii_letters + string.digits)
|
||||||
for n in range(6)])
|
for n in range(6)])
|
||||||
if not self.app.pargs.user_input:
|
if not self.app.pargs.user_input:
|
||||||
username = input("Provide HTTP authentication user "
|
username = input("Provide HTTP authentication user "
|
||||||
"name [{0}] :".format(WOVariables.wo_user))
|
"name [{0}] :".format(WOVariables.wo_user))
|
||||||
@@ -125,7 +125,7 @@ class WOSecureController(CementBaseController):
|
|||||||
user_ip = ['127.0.0.1']
|
user_ip = ['127.0.0.1']
|
||||||
for ip_addr in user_ip:
|
for ip_addr in user_ip:
|
||||||
if not ("exist_ip_address "+ip_addr in open('/etc/nginx/common/'
|
if not ("exist_ip_address "+ip_addr in open('/etc/nginx/common/'
|
||||||
'acl.conf').read()):
|
'acl.conf').read()):
|
||||||
WOShellExec.cmd_exec(self, "sed -i "
|
WOShellExec.cmd_exec(self, "sed -i "
|
||||||
"\"/deny/i allow {whitelist_address}\;\""
|
"\"/deny/i allow {whitelist_address}\;\""
|
||||||
" /etc/nginx/common/acl.conf"
|
" /etc/nginx/common/acl.conf"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class WOStackMigrateController(CementBaseController):
|
|||||||
(['--mariadb'],
|
(['--mariadb'],
|
||||||
dict(help="Migrate database to MariaDB",
|
dict(help="Migrate database to MariaDB",
|
||||||
action='store_true')),
|
action='store_true')),
|
||||||
]
|
]
|
||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def migrate_mariadb(self):
|
def migrate_mariadb(self):
|
||||||
@@ -97,10 +97,11 @@ class WOStackMigrateController(CementBaseController):
|
|||||||
self.app.args.print_help()
|
self.app.args.print_help()
|
||||||
if self.app.pargs.mariadb:
|
if self.app.pargs.mariadb:
|
||||||
if WOVariables.wo_mysql_host is not "localhost":
|
if WOVariables.wo_mysql_host is not "localhost":
|
||||||
Log.error(self, "Remote MySQL server in use, skipping local install")
|
Log.error(
|
||||||
|
self, "Remote MySQL server in use, skipping local install")
|
||||||
|
|
||||||
if WOShellExec.cmd_exec(self, "mysqladmin ping") and (not
|
if WOShellExec.cmd_exec(self, "mysqladmin ping") and (not
|
||||||
WOAptGet.is_installed(self, 'mariadb-server')):
|
WOAptGet.is_installed(self, 'mariadb-server')):
|
||||||
|
|
||||||
Log.info(self, "If your database size is big, "
|
Log.info(self, "If your database size is big, "
|
||||||
"migration may take some time.")
|
"migration may take some time.")
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
(['--no-prompt'],
|
(['--no-prompt'],
|
||||||
dict(help="Upgrade Packages without any prompt",
|
dict(help="Upgrade Packages without any prompt",
|
||||||
action='store_true')),
|
action='store_true')),
|
||||||
]
|
]
|
||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def upgrade_php56(self):
|
def upgrade_php56(self):
|
||||||
@@ -72,7 +72,8 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
WOAptGet.update(self)
|
WOAptGet.update(self)
|
||||||
Log.info(self, "Installing packages, please wait ...")
|
Log.info(self, "Installing packages, please wait ...")
|
||||||
if (WOVariables.wo_platform_distro == 'ubuntu'):
|
if (WOVariables.wo_platform_distro == 'ubuntu'):
|
||||||
WOAptGet.install(self, WOVariables.wo_php + WOVariables.wo_php_extra)
|
WOAptGet.install(self, WOVariables.wo_php +
|
||||||
|
WOVariables.wo_php_extra)
|
||||||
else:
|
else:
|
||||||
WOAptGet.install(self, WOVariables.wo_php)
|
WOAptGet.install(self, WOVariables.wo_php)
|
||||||
|
|
||||||
@@ -86,9 +87,9 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
packages = []
|
packages = []
|
||||||
|
|
||||||
if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and
|
if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and
|
||||||
(not self.app.pargs.php) and (not self.app.pargs.mysql) and
|
(not self.app.pargs.php) and (not self.app.pargs.mysql) and
|
||||||
(not self.app.pargs.all) and (not self.app.pargs.wpcli) and
|
(not self.app.pargs.all) and (not self.app.pargs.wpcli) and
|
||||||
(not self.app.pargs.redis) and (not self.app.pargs.nginxmainline)):
|
(not self.app.pargs.redis) and (not self.app.pargs.nginxmainline)):
|
||||||
self.app.pargs.web = True
|
self.app.pargs.web = True
|
||||||
|
|
||||||
if self.app.pargs.all:
|
if self.app.pargs.all:
|
||||||
|
|||||||
@@ -44,21 +44,22 @@ class WOSyncController(CementBaseController):
|
|||||||
if site.site_type != 'mysql':
|
if site.site_type != 'mysql':
|
||||||
Log.debug(self, "Searching wp-config.php in {0}/htdocs/ "
|
Log.debug(self, "Searching wp-config.php in {0}/htdocs/ "
|
||||||
.format(wo_site_webroot))
|
.format(wo_site_webroot))
|
||||||
configfiles = glob.glob(wo_site_webroot + '/htdocs/wp-config.php')
|
configfiles = glob.glob(
|
||||||
|
wo_site_webroot + '/htdocs/wp-config.php')
|
||||||
|
|
||||||
if configfiles:
|
if configfiles:
|
||||||
if WOFileUtils.isexist(self, configfiles[0]):
|
if WOFileUtils.isexist(self, configfiles[0]):
|
||||||
wo_db_name = (WOFileUtils.grep(self, configfiles[0],
|
wo_db_name = (WOFileUtils.grep(self, configfiles[0],
|
||||||
'DB_NAME').split(',')[1]
|
'DB_NAME').split(',')[1]
|
||||||
.split(')')[0].strip().replace('\'', ''))
|
.split(')')[0].strip().replace('\'', ''))
|
||||||
wo_db_user = (WOFileUtils.grep(self, configfiles[0],
|
wo_db_user = (WOFileUtils.grep(self, configfiles[0],
|
||||||
'DB_USER').split(',')[1]
|
'DB_USER').split(',')[1]
|
||||||
.split(')')[0].strip().replace('\'', ''))
|
.split(')')[0].strip().replace('\'', ''))
|
||||||
wo_db_pass = (WOFileUtils.grep(self, configfiles[0],
|
wo_db_pass = (WOFileUtils.grep(self, configfiles[0],
|
||||||
'DB_PASSWORD').split(',')[1]
|
'DB_PASSWORD').split(',')[1]
|
||||||
.split(')')[0].strip().replace('\'', ''))
|
.split(')')[0].strip().replace('\'', ''))
|
||||||
wo_db_host = (WOFileUtils.grep(self, configfiles[0],
|
wo_db_host = (WOFileUtils.grep(self, configfiles[0],
|
||||||
'DB_HOST').split(',')[1]
|
'DB_HOST').split(',')[1]
|
||||||
.split(')')[0].strip().replace('\'', ''))
|
.split(')')[0].strip().replace('\'', ''))
|
||||||
|
|
||||||
# Check if database really exist
|
# Check if database really exist
|
||||||
@@ -84,7 +85,7 @@ class WOSyncController(CementBaseController):
|
|||||||
db_host=wo_db_host)
|
db_host=wo_db_host)
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "Config files not found for {0} "
|
Log.debug(self, "Config files not found for {0} "
|
||||||
.format(site.sitename))
|
.format(site.sitename))
|
||||||
|
|
||||||
|
|
||||||
def load(app):
|
def load(app):
|
||||||
|
|||||||
Reference in New Issue
Block a user