Add DNS alias mode

This commit is contained in:
VirtuBox
2019-09-24 02:36:46 +02:00
parent 1d8164e583
commit 0170366ce4
5 changed files with 28 additions and 9 deletions

View File

@@ -8,11 +8,15 @@ 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.9 - 2019-09-24
#### Added #### Added
- [STACK] UFW now available as a stack with flag `--ufw` - [STACK] UFW now available as a stack with flag `--ufw`
- [SECURE] `wo stack secure --ssh` to harden ssh security - [SECURE] `wo stack secure --ssh` to harden ssh security
- [SECURE] `wo stack secure --sshport` to change ssh port - [SECURE] `wo stack secure --sshport` to change ssh port
- [SITE] check domain DNS records before issuing a new certificate without DNS API
- [STACK] Acme challenge with DNS Alias mode [acme.sh wiki](https://github.com/Neilpang/acme.sh/wiki/DNS-alias-mode)
#### Changed #### Changed
@@ -26,10 +30,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
#### Fixed #### Fixed
- `wo stack purge --all` failure if mysql isn't installed - [STACK] `wo stack purge --all` failure if mysql isn't installed
- Fix EEv3 files cleanup - [INSTALL] Fix EEv3 files cleanup
- Incorrect variable usage in `wo secure --port` - [SECURE] Incorrect variable usage in `wo secure --port`
- Fix backup_ee function in install script - [INSTALL] Fix backup_ee function in install script
### v3.9.8.12 - 2019-09-20 ### v3.9.8.12 - 2019-09-20

View File

@@ -25,7 +25,7 @@ if not os.path.exists('/var/lib/wo/'):
os.makedirs('/var/lib/wo/') os.makedirs('/var/lib/wo/')
setup(name='wo', setup(name='wo',
version='3.9.8.12', version='3.9.9',
description=long_description, description=long_description,
long_description=long_description, long_description=long_description,
classifiers=[], classifiers=[],

View File

@@ -372,6 +372,9 @@ class WOSiteCreateController(CementBaseController):
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',
const='dns_cf', nargs='?')), const='dns_cf', nargs='?')),
(['--dnsalias'],
dict(help="set domain used for acme dns alias validation",
action='store', 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')),
@@ -730,13 +733,18 @@ class WOSiteCreateController(CementBaseController):
letsencrypt = True letsencrypt = True
if data['letsencrypt'] is True: if data['letsencrypt'] is True:
Log.debug(self, "Going to issue Let's Encrypt certificate") Log.debug(self, "Going to issue Let's Encrypt certificate")
acmedata = dict(acme_domains, dns=False, acme_dns='dns_cf') acmedata = dict(acme_domains, dns=False, acme_dns='dns_cf',
dnsalias=False, acme_alias='')
if pargs.dns: if pargs.dns:
Log.debug(self, "DNS validation enabled") Log.debug(self, "DNS validation enabled")
acmedata['dns'] = True acmedata['dns'] = True
if not pargs.dns == 'dns_cf': if not pargs.dns == 'dns_cf':
Log.debug(self, "DNS API : {0}".format(pargs.dns)) Log.debug(self, "DNS API : {0}".format(pargs.dns))
acmedata['acme_dns'] = pargs.dns acmedata['acme_dns'] = pargs.dns
if pargs.dnsalias:
Log.debug(self, "DNS Alias enabled")
acmedata['dnsalias'] = True
acmedata['acme_alias'] = pargs.dnsalias
# detect subdomain and set subdomain variable # detect subdomain and set subdomain variable
if pargs.letsencrypt == "subdomain": if pargs.letsencrypt == "subdomain":
@@ -793,7 +801,6 @@ class WOSiteCreateController(CementBaseController):
"Aborting SSL certificate issuance") "Aborting SSL certificate issuance")
Log.debug(self, "Setup Cert with acme.sh for {0}" Log.debug(self, "Setup Cert with acme.sh for {0}"
.format(wo_domain)) .format(wo_domain))
Log.info(self, "Certificate type: Subdomain")
if WOAcme.setupletsencrypt( if WOAcme.setupletsencrypt(
self, acme_domains, acmedata): self, acme_domains, acmedata):
WOAcme.deploycert(self, wo_domain) WOAcme.deploycert(self, wo_domain)
@@ -1171,7 +1178,8 @@ class WOSiteUpdateController(CementBaseController):
if pargs.letsencrypt: if pargs.letsencrypt:
acme_domains = [] acme_domains = []
acmedata = dict(acme_domains, dns=False, acme_dns='dns_cf') acmedata = dict(acme_domains, dns=False, acme_dns='dns_cf',
dnsalias=False, acme_alias='')
(wo_domain_type, (wo_domain_type,
wo_root_domain) = WODomain.getdomainlevel(self, wo_domain) wo_root_domain) = WODomain.getdomainlevel(self, wo_domain)
@@ -1398,6 +1406,10 @@ class WOSiteUpdateController(CementBaseController):
if not pargs.dns == 'dns_cf': if not pargs.dns == 'dns_cf':
Log.debug(self, "DNS API : {0}".format(pargs.dns)) Log.debug(self, "DNS API : {0}".format(pargs.dns))
acmedata['acme_dns'] = pargs.dns acmedata['acme_dns'] = pargs.dns
if pargs.dnsalias:
Log.debug(self, "DNS Alias enabled")
acmedata['dnsalias'] = True
acmedata['acme_alias'] = pargs.dnsalias
# Set list of domains to secure # Set list of domains to secure
if acme_subdomain is True: if acme_subdomain is True:
Log.info(self, "Certificate type : subdomain") Log.info(self, "Certificate type : subdomain")

View File

@@ -23,6 +23,9 @@ class WOAcme:
if acmedata['dns'] is True: if acmedata['dns'] is True:
acme_mode = "--dns {0}".format(wo_acme_dns) acme_mode = "--dns {0}".format(wo_acme_dns)
validation_mode = "DNS mode with {0}".format(wo_acme_dns) validation_mode = "DNS mode with {0}".format(wo_acme_dns)
if acmedata['dnsalias'] is True:
acme_mode = acme_mode + \
" --challenge-alias {0}".format(acmedata['acme_alias'])
else: else:
acme_mode = "-w /var/www/html" acme_mode = "-w /var/www/html"
validation_mode = "Webroot challenge" validation_mode = "Webroot challenge"

View File

@@ -11,7 +11,7 @@ class WOVariables():
"""Intialization of core variables""" """Intialization of core variables"""
# WordOps version # WordOps version
wo_version = "3.9.8.12" wo_version = "3.9.9"
# WordOps packages versions # WordOps packages versions
wo_wp_cli = "2.3.0" wo_wp_cli = "2.3.0"
wo_adminer = "4.7.2" wo_adminer = "4.7.2"