Add semi-randomly generated database name & user
This commit is contained in:
@@ -47,10 +47,9 @@ script:
|
||||
- sudo wo site create 1.com --html && sudo wo site create 2.com --php && sudo wo site create 3.com --mysql
|
||||
- sudo wo site update 1.com --wp && sudo wo site update 2.com --php73 && sudo wo site update 3.com --php73 && sudo wo site update 1.com --wpfc && sudo wo site update 1.com --wpsc && sudo wo site update 1.com --wpredis
|
||||
- sudo wp --allow-root --info
|
||||
- sudo wo info
|
||||
- sudo wo info wp1.com
|
||||
- sudo cat /etc/nginx/nginx.conf
|
||||
- sudo tree -L 2 /etc/nginx
|
||||
- sudo tree -L 2 /var/www
|
||||
- sudo wo site info
|
||||
- sudo cat /etc/mysql/my.cnf
|
||||
- sudo wo stack upgrade --nginx --force
|
||||
- sudo wo stack upgrade --php --force
|
||||
|
||||
@@ -15,10 +15,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
- Nginx package OpenSSL configuration improvements (TLS v1.3 now available on all operating systems supported by WordOps)
|
||||
- remove user prompt for confirmation with `wo update`
|
||||
- Nginx stack will not be upgraded with `wo update` anymore. This can be done at anytime with `wo upgrade --nginx`
|
||||
- Databases name and user are now semi-randomly generated (0-8 letters from the domain + 8 random caracters)
|
||||
|
||||
#### Fixed
|
||||
|
||||
- `wo upgrade` output
|
||||
- Database name or database user length
|
||||
|
||||
### v3.9.8.2 - 2019-08-20
|
||||
|
||||
|
||||
@@ -142,10 +142,7 @@ def setupdatabase(self, data):
|
||||
wo_random_pass = (''.join(random.sample(string.ascii_uppercase +
|
||||
string.ascii_lowercase +
|
||||
string.digits, 24)))
|
||||
wo_random = (''.join(random.sample(string.ascii_uppercase +
|
||||
string.ascii_lowercase +
|
||||
string.digits, 8)))
|
||||
wo_replace_dot = wo_domain_name.replace('.', '_')
|
||||
wo_replace_dot = wo_domain_name.replace('.', '')
|
||||
prompt_dbname = self.app.config.get('mysql', 'db-name')
|
||||
prompt_dbuser = self.app.config.get('mysql', 'db-user')
|
||||
wo_mysql_grant_host = self.app.config.get('mysql', 'grant-host')
|
||||
@@ -161,7 +158,7 @@ def setupdatabase(self, data):
|
||||
raise SiteError("Unable to input database name")
|
||||
|
||||
if not wo_db_name:
|
||||
wo_db_name = wo_replace_dot[]
|
||||
wo_db_name = wo_replace_dot
|
||||
|
||||
if prompt_dbuser == 'True' or prompt_dbuser == 'true':
|
||||
try:
|
||||
@@ -178,10 +175,8 @@ def setupdatabase(self, data):
|
||||
if not wo_db_password:
|
||||
wo_db_password = wo_random_pass
|
||||
|
||||
if len(wo_db_username) > 16:
|
||||
Log.debug(self, 'Autofix MySQL username (ERROR 1470 (HY000)),'
|
||||
' please wait')
|
||||
wo_db_username = (wo_db_name[0:6] + generate_random())
|
||||
wo_db_username = (wo_db_name[0:8] + generate_random())
|
||||
wo_db_name = (wo_db_name[0:8] + generate_random())
|
||||
|
||||
# create MySQL database
|
||||
Log.info(self, "Setting up database\t\t", end='')
|
||||
@@ -189,8 +184,8 @@ def setupdatabase(self, data):
|
||||
try:
|
||||
if WOMysql.check_db_exists(self, wo_db_name):
|
||||
Log.debug(self, "Database already exists, Updating DB_NAME .. ")
|
||||
wo_db_name = (wo_db_name[0:6] + generate_random())
|
||||
wo_db_username = (wo_db_name[0:6] + generate_random())
|
||||
wo_db_name = (wo_db_name[0:8] + generate_random())
|
||||
wo_db_username = (wo_db_name[0:8] + generate_random())
|
||||
except MySQLConnectionError:
|
||||
raise SiteError("MySQL Connectivity problem occured")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user