Implement dns validation on site create

This commit is contained in:
VirtuBox
2019-07-15 12:36:29 +02:00
parent be2e94327b
commit 90e3ebb88c
5 changed files with 36 additions and 17 deletions

View File

@@ -59,6 +59,7 @@
- Ubuntu 19.04 (Disco) - Ubuntu 19.04 (Disco)
- Debian 8 (Jessie) - Debian 8 (Jessie)
- Debian 9 (Stretch) - Debian 9 (Stretch)
- Debian 10 (Buster)
- Raspbian 9 (Stretch) - Raspbian 9 (Stretch)
### Ports requirements ### Ports requirements

View File

@@ -144,9 +144,9 @@ if [ -z "$wo_force_install" ]; then
wo_lib_echo_fail "other Linux distributions and perhaps even Unix deratives." wo_lib_echo_fail "other Linux distributions and perhaps even Unix deratives."
exit 100 exit 100
else else
check_wo_linux_distro=$(lsb_release -sc | grep -E "trusty|xenial|bionic|disco|jessie|stretch") check_wo_linux_distro=$(lsb_release -sc | grep -E "trusty|xenial|bionic|disco|jessie|stretch|buster")
if [ -z "$check_wo_linux_distro" ]; then if [ -z "$check_wo_linux_distro" ]; then
wo_lib_echo_fail "WordOps (wo) only supports Ubuntu 14.04/16.04/18.04/19.04 LTS, Debian 8.x, Debian 9.x and Raspbian 9.x" wo_lib_echo_fail "WordOps (wo) only supports Ubuntu 14.04/16.04/18.04/19.04 LTS, Debian 8.x/9.x/10.x and Raspbian 9.x"
exit 100 exit 100
fi fi
fi fi
@@ -633,7 +633,7 @@ wo_tweak_kernel() {
if [ "$WO_ARCH" = "x86_64" ]; then if [ "$WO_ARCH" = "x86_64" ]; then
rm -f /etc/sysctl.d/60-ubuntu-nginx-web-server.conf rm -f /etc/sysctl.d/60-ubuntu-nginx-web-server.conf
wget -qO /etc/sysctl.d/60-wo-tweaks.conf https://raw.githubusercontent.com/WordOps/WordOps/updating-configuration/wo/cli/templates/sysctl.mustache wget -qO /etc/sysctl.d/60-wo-tweaks.conf https://raw.githubusercontent.com/WordOps/WordOps/updating-configuration/wo/cli/templates/sysctl.mustache
if [ "$wo_distro_version" = "bionic" ] || [ "$wo_distro_version" = "disco" ]; then if [ "$wo_distro_version" = "bionic" ] || [ "$wo_distro_version" = "disco" ] || [ "$wo_distro_version" = "buster" ]; then
modprobe tcp_bbr && echo 'tcp_bbr' >> /etc/modules-load.d/bbr.conf modprobe tcp_bbr && echo 'tcp_bbr' >> /etc/modules-load.d/bbr.conf
echo -e '\nnet.ipv4.tcp_congestion_control = bbr\nnet.ipv4.tcp_notsent_lowat = 16384' >> /etc/sysctl.d/60-wo-tweaks.conf echo -e '\nnet.ipv4.tcp_congestion_control = bbr\nnet.ipv4.tcp_notsent_lowat = 16384' >> /etc/sysctl.d/60-wo-tweaks.conf
else else

View File

@@ -319,7 +319,8 @@ class WOSiteCreateController(CementBaseController):
dict(help="create WordPress multisite with subdomain setup", dict(help="create WordPress multisite with subdomain setup",
action='store_true')), action='store_true')),
(['--wpfc'], (['--wpfc'],
dict(help="create WordPress single/multi site with wpfc cache", dict(help="create WordPress single/multi site with "
"Nginx fastcgi_cache",
action='store_true')), action='store_true')),
(['--wpsc'], (['--wpsc'],
dict(help="create WordPress single/multi site with wpsc cache", dict(help="create WordPress single/multi site with wpsc cache",
@@ -328,7 +329,7 @@ class WOSiteCreateController(CementBaseController):
dict(help="create WordPress single/multi site " dict(help="create WordPress single/multi site "
"with redis cache", "with redis cache",
action='store_true')), action='store_true')),
(['-le', '--letsencrypt'], (['--le', '--letsencrypt'],
dict(help="configure letsencrypt ssl for the site", dict(help="configure letsencrypt ssl for the site",
action='store' or 'store_const', action='store' or 'store_const',
choices=('on', 'subdomain', 'wildcard'), choices=('on', 'subdomain', 'wildcard'),
@@ -336,8 +337,7 @@ class WOSiteCreateController(CementBaseController):
(['--dns'], (['--dns'],
dict(help="choose dns provider api for letsencrypt", dict(help="choose dns provider api for letsencrypt",
action='store' or 'store_const', action='store' or 'store_const',
choices=('cf', 'do'), const='dns_cf', nargs='?')),
const='cf', nargs='?')),
(['--hsts'], (['--hsts'],
dict(help="enable HSTS for site secured with letsencrypt", dict(help="enable HSTS for site secured with letsencrypt",
action='store_true')), action='store_true')),
@@ -731,18 +731,30 @@ class WOSiteCreateController(CementBaseController):
Log.error(self, "Check the log for details: " Log.error(self, "Check the log for details: "
"`tail /var/log/wo/wordops.log` and please try again") "`tail /var/log/wo/wordops.log` and please try again")
if self.app.pargs.dns:
wo_acme_dns = pargs.dns
if self.app.pargs.letsencrypt: if self.app.pargs.letsencrypt:
data['letsencrypt'] = True data['letsencrypt'] = True
letsencrypt = True letsencrypt = True
if data['letsencrypt'] is True: if data['letsencrypt'] is True:
if self.app.pargs.letsencrypt == "on": if self.app.pargs.letsencrypt == "on":
setupLetsEncrypt(self, wo_domain) if self.app.pargs.dns:
setupLetsEncrypt(self, wo_domain, False,
False, True, wo_acme_dns)
else:
setupLetsEncrypt(self, wo_domain)
httpsRedirect(self, wo_domain) httpsRedirect(self, wo_domain)
elif self.app.pargs.letsencrypt == "subodmain": elif self.app.pargs.letsencrypt == "subdomain":
setupLetsEncryptSubdomain(self, wo_domain) if self.app.pargs.dns:
setupLetsEncrypt(self, wo_domain, True, False,
True, wo_acme_dns)
else:
setupLetsEncrypt(self, wo_domain, True)
httpsRedirect(self, wo_domain) httpsRedirect(self, wo_domain)
elif self.app.pargs.letsencrypt == "wildcard": elif self.app.pargs.letsencrypt == "wildcard":
setupLetsEncryptWildcard(self, wo_domain) setupLetsEncrypt(self, wo_domain, False, True,
True, wo_acme_dns)
httpsRedirect(self, wo_domain, True, True) httpsRedirect(self, wo_domain, True, True)
if self.app.pargs.hsts: if self.app.pargs.hsts:
@@ -804,7 +816,7 @@ class WOSiteUpdateController(CementBaseController):
dict(help="update to wpsc cache", action='store_true')), dict(help="update to wpsc cache", action='store_true')),
(['--wpredis'], (['--wpredis'],
dict(help="update to redis cache", action='store_true')), dict(help="update to redis cache", action='store_true')),
(['-le', '--letsencrypt'], (['--le', '--letsencrypt'],
dict(help="configure letsencrypt ssl for the site", dict(help="configure letsencrypt ssl for the site",
action='store' or 'store_const', action='store' or 'store_const',
choices=('on', 'off', 'renew', 'subdomain', 'wildcard'), choices=('on', 'off', 'renew', 'subdomain', 'wildcard'),
@@ -844,7 +856,8 @@ class WOSiteUpdateController(CementBaseController):
if not (pargs.php or pargs.php73 or if not (pargs.php or pargs.php73 or
pargs.mysql or pargs.wp or pargs.wpsubdir or pargs.mysql or pargs.wp or pargs.wpsubdir or
pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or pargs.wpsubdomain or pargs.wpfc or pargs.wpsc or
pargs.wpredis or pargs.letsencrypt or pargs.hsts): pargs.wpredis or pargs.letsencrypt or pargs.hsts or
pargs.dns):
Log.error(self, "Please provide options to update sites.") Log.error(self, "Please provide options to update sites.")
if pargs.all: if pargs.all:
@@ -1264,10 +1277,10 @@ class WOSiteUpdateController(CementBaseController):
" http://{0}".format(wo_domain)) " http://{0}".format(wo_domain))
return 0 return 0
if self.app.pargs.dns:
wo_acme_dns = pargs.dns
if pargs.letsencrypt: if pargs.letsencrypt:
if self.app.pargs.dns:
wo_acme_dns = pargs.dns
if data['letsencrypt'] is True: if data['letsencrypt'] is True:
if not os.path.isfile("{0}/conf/nginx/ssl.conf.disabled" if not os.path.isfile("{0}/conf/nginx/ssl.conf.disabled"
.format(wo_site_webroot)): .format(wo_site_webroot)):

View File

@@ -94,7 +94,8 @@ class WOStackController(CementBaseController):
if set(WOVariables.wo_mysql).issubset(set(apt_packages)): if set(WOVariables.wo_mysql).issubset(set(apt_packages)):
# add mariadb repository excepted on raspbian and ubuntu 19.04 # add mariadb repository excepted on raspbian and ubuntu 19.04
if ((not WOVariables.wo_platform_codename == 'disco') and if ((not WOVariables.wo_platform_codename == 'disco') and
(not WOVariables.wo_platform_distro == 'raspbian')): (not WOVariables.wo_platform_distro == 'raspbian') and
(not WOVariables.wo_platform_codename == 'buster')):
Log.info(self, "Adding repository for MySQL, please wait...") Log.info(self, "Adding repository for MySQL, please wait...")
mysql_pref = ("Package: *\nPin: origin " mysql_pref = ("Package: *\nPin: origin "
"sfo1.mirrors.digitalocean.com" "sfo1.mirrors.digitalocean.com"

View File

@@ -108,6 +108,10 @@ class WOVariables():
wo_nginx_repo = ("deb http://download.opensuse.org" wo_nginx_repo = ("deb http://download.opensuse.org"
"/repositories/home:" "/repositories/home:"
"/virtubox:/WordOps/Debian_9.0/ /") "/virtubox:/WordOps/Debian_9.0/ /")
elif wo_platform_codename == 'buster':
wo_nginx_repo = ("deb http://download.opensuse.org"
"/repositories/home:"
"/virtubox:/WordOps/Debian_10/ /")
else: else:
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:" wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
"/virtubox:/WordOps/Raspbian_9.0/ /") "/virtubox:/WordOps/Raspbian_9.0/ /")