increase password size

This commit is contained in:
VirtuBox
2019-03-25 12:22:25 +01:00
parent 419c6caa03
commit 79994a1262
4 changed files with 37 additions and 34 deletions

View File

@@ -32,6 +32,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- "--letsencrypt=subdomain" option - "--letsencrypt=subdomain" option
- hardened nginx ssl_ecdh_curve - hardened nginx ssl_ecdh_curve
- Update phpredisadmin - Update phpredisadmin
- Increase MySQL root password size to 16 characters
- Increase MySQL users password size to 16 characters
#### Fixed #### Fixed

View File

@@ -50,7 +50,7 @@ class WOSecureController(CementBaseController):
"""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(16)])
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))

View File

@@ -306,9 +306,9 @@ def setupwordpress(self, data):
"\n\ndefine(\'WP_DEBUG\', false);")) "\n\ndefine(\'WP_DEBUG\', false);"))
try: try:
if WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root" if WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root"
.format(WOVariables.wo_wpcli_path) .format(WOVariables.wo_wpcli_path) +
+ " core config " " core config " +
+ "--dbname=\'{0}\' --dbprefix=\'{1}\' " "--dbname=\'{0}\' --dbprefix=\'{1}\' "
"--dbuser=\'{2}\' --dbhost=\'{3}\' " "--dbuser=\'{2}\' --dbhost=\'{3}\' "
.format(data['wo_db_name'], wo_wp_prefix, .format(data['wo_db_name'], wo_wp_prefix,
data['wo_db_user'], data['wo_db_host'] data['wo_db_user'], data['wo_db_host']
@@ -330,11 +330,11 @@ def setupwordpress(self, data):
else: else:
Log.debug(self, "Generating wp-config for WordPress multisite") Log.debug(self, "Generating wp-config for WordPress multisite")
Log.debug(self, "bash -c \"php {0} --allow-root " Log.debug(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) .format(WOVariables.wo_wpcli_path) +
+ "core config " "core config " +
+ "--dbname=\'{0}\' --dbprefix=\'{1}\' --dbhost=\'{2}\' " "--dbname=\'{0}\' --dbprefix=\'{1}\' --dbhost=\'{2}\' "
.format(data['wo_db_name'], wo_wp_prefix, data['wo_db_host']) .format(data['wo_db_name'], wo_wp_prefix, data['wo_db_host']) +
+ "--dbuser=\'{0}\' --dbpass=\'{1}\' " "--dbuser=\'{0}\' --dbpass=\'{1}\' "
"--extra-php<<PHP \n {2} {3} {4} \nPHP\"" "--extra-php<<PHP \n {2} {3} {4} \nPHP\""
.format(data['wo_db_user'], data['wo_db_pass'], .format(data['wo_db_user'], data['wo_db_pass'],
"\ndefine(\'WPMU_ACCEL_REDIRECT\'," "\ndefine(\'WPMU_ACCEL_REDIRECT\',"
@@ -380,7 +380,8 @@ def setupwordpress(self, data):
os.path.abspath(os.path.join(os.getcwd(), os.pardir))) os.path.abspath(os.path.join(os.getcwd(), os.pardir)))
except Exception as e: except Exception as e:
Log.error(self, 'Unable to move file from {0} to {1}' Log.error(self, 'Unable to move file from {0} to {1}'
.format(os.getcwd()+'/wp-config.php', os.path.abspath(os.path.join(os.getcwd(), os.pardir))), False) .format(os.getcwd()+'/wp-config.php',
os.path.abspath(os.path.join(os.getcwd(), os.pardir))), False)
raise SiteError("Unable to move wp-config.php") raise SiteError("Unable to move wp-config.php")
if not wo_wp_user: if not wo_wp_user:
@@ -421,18 +422,18 @@ def setupwordpress(self, data):
if not data['multisite']: if not data['multisite']:
Log.debug(self, "Creating tables for WordPress Single site") Log.debug(self, "Creating tables for WordPress Single site")
Log.debug(self, "php {0} --allow-root core install " Log.debug(self, "php {0} --allow-root core install "
.format(WOVariables.wo_wpcli_path) .format(WOVariables.wo_wpcli_path) +
+ "--url=\'{0}\' --title=\'{0}\' --admin_name=\'{1}\' " "--url=\'{0}\' --title=\'{0}\' --admin_name=\'{1}\' "
.format(data['www_domain'], wo_wp_user) .format(data['www_domain'], wo_wp_user) +
+ "--admin_password= --admin_email=\'{1}\'" "--admin_password= --admin_email=\'{1}\'"
.format(wo_wp_pass, wo_wp_email)) .format(wo_wp_pass, wo_wp_email))
try: try:
if WOShellExec.cmd_exec(self, "php {0} --allow-root core " if WOShellExec.cmd_exec(self, "php {0} --allow-root core "
.format(WOVariables.wo_wpcli_path) .format(WOVariables.wo_wpcli_path) +
+ "install --url=\'{0}\' --title=\'{0}\' " "install --url=\'{0}\' --title=\'{0}\' "
"--admin_name=\'{1}\' " "--admin_name=\'{1}\' "
.format(data['www_domain'], wo_wp_user) .format(data['www_domain'], wo_wp_user) +
+ "--admin_password=\'{0}\' " "--admin_password=\'{0}\' "
"--admin_email=\'{1}\'" "--admin_email=\'{1}\'"
.format(wo_wp_pass, wo_wp_email), .format(wo_wp_pass, wo_wp_email),
log=False): log=False):
@@ -445,23 +446,23 @@ def setupwordpress(self, data):
else: else:
Log.debug(self, "Creating tables for WordPress multisite") Log.debug(self, "Creating tables for WordPress multisite")
Log.debug(self, "php {0} --allow-root " Log.debug(self, "php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) .format(WOVariables.wo_wpcli_path) +
+ "core multisite-install " "core multisite-install "
"--url=\'{0}\' --title=\'{0}\' --admin_name=\'{1}\' " "--url=\'{0}\' --title=\'{0}\' --admin_name=\'{1}\' "
.format(data['www_domain'], wo_wp_user) .format(data['www_domain'], wo_wp_user) +
+ "--admin_password= --admin_email=\'{1}\' " "--admin_password= --admin_email=\'{1}\' "
"{subdomains}" "{subdomains}"
.format(wo_wp_pass, wo_wp_email, .format(wo_wp_pass, wo_wp_email,
subdomains='--subdomains' subdomains='--subdomains'
if not data['wpsubdir'] else '')) if not data['wpsubdir'] else ''))
try: try:
if WOShellExec.cmd_exec(self, "php {0} --allow-root " if WOShellExec.cmd_exec(self, "php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) .format(WOVariables.wo_wpcli_path) +
+ "core multisite-install " "core multisite-install "
"--url=\'{0}\' --title=\'{0}\' " "--url=\'{0}\' --title=\'{0}\' "
"--admin_name=\'{1}\' " "--admin_name=\'{1}\' "
.format(data['www_domain'], wo_wp_user) .format(data['www_domain'], wo_wp_user) +
+ "--admin_password=\'{0}\' " "--admin_password=\'{0}\' "
"--admin_email=\'{1}\' " "--admin_email=\'{1}\' "
"{subdomains}" "{subdomains}"
.format(wo_wp_pass, wo_wp_email, .format(wo_wp_pass, wo_wp_email,
@@ -478,8 +479,8 @@ def setupwordpress(self, data):
Log.debug(self, "Updating WordPress permalink") Log.debug(self, "Updating WordPress permalink")
try: try:
WOShellExec.cmd_exec(self, " php {0} --allow-root " WOShellExec.cmd_exec(self, " php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) .format(WOVariables.wo_wpcli_path) +
+ "rewrite structure " "rewrite structure "
"/%year%/%monthnum%/%day%/%postname%/") "/%year%/%monthnum%/%day%/%postname%/")
except CommandExecutionError as e: except CommandExecutionError as e:
raise SiteError("Update wordpress permalinks failed") raise SiteError("Update wordpress permalinks failed")
@@ -538,16 +539,16 @@ def installwp_plugin(self, plugin_name, data):
WOFileUtils.chdir(self, '{0}/htdocs/'.format(wo_site_webroot)) WOFileUtils.chdir(self, '{0}/htdocs/'.format(wo_site_webroot))
try: try:
WOShellExec.cmd_exec(self, "php {0} plugin " WOShellExec.cmd_exec(self, "php {0} plugin "
.format(WOVariables.wo_wpcli_path) .format(WOVariables.wo_wpcli_path) +
+ "--allow-root install " "--allow-root install "
"{0}".format(plugin_name)) "{0}".format(plugin_name))
except CommandExecutionError as e: except CommandExecutionError as e:
raise SiteError("plugin installation failed") raise SiteError("plugin installation failed")
try: try:
WOShellExec.cmd_exec(self, "php {0} plugin " WOShellExec.cmd_exec(self, "php {0} plugin "
.format(WOVariables.wo_wpcli_path) .format(WOVariables.wo_wpcli_path) +
+ "--allow-root activate " "--allow-root activate "
"{0} {na}" "{0} {na}"
.format(plugin_name, .format(plugin_name,
na='--network' if data['multisite'] na='--network' if data['multisite']
@@ -1099,7 +1100,7 @@ def detSitePar(opts):
def generate_random(): def generate_random():
wo_random10 = (''.join(random.sample(string.ascii_uppercase + wo_random10 = (''.join(random.sample(string.ascii_uppercase +
string.ascii_lowercase + string.digits, 10))) string.ascii_lowercase + string.digits, 16)))
return wo_random10 return wo_random10

View File

@@ -97,7 +97,7 @@ class WOStackController(CementBaseController):
keyserver="keyserver.ubuntu.com") keyserver="keyserver.ubuntu.com")
WORepo.add_key(self, '0xF1656F24C74CD1D8', WORepo.add_key(self, '0xF1656F24C74CD1D8',
keyserver="keyserver.ubuntu.com") keyserver="keyserver.ubuntu.com")
chars = ''.join(random.sample(string.ascii_letters, 8)) chars = ''.join(random.sample(string.ascii_letters, 16))
Log.debug(self, "Pre-seeding MySQL") Log.debug(self, "Pre-seeding MySQL")
Log.debug(self, "echo \"mariadb-server-10.3 " Log.debug(self, "echo \"mariadb-server-10.3 "
"mysql-server/root_password " "mysql-server/root_password "