diff --git a/bin/easyengine b/bin/easyengine index 03299a56..e8913d5a 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -17,7 +17,7 @@ EE_FOURTH=$4 EE_FIFTH=$5 # Let's capture the EasyEngine arguments -ee_lib_echo "EasyEngine (ee) execution started [$(date)]" &>> $EE_COMMAND_LOG +ee_lib_echo "EasyEngine (ee) $EE_VERSION execution started [$(date)]" &>> $EE_COMMAND_LOG ee_lib_echo "EasyEngine (ee) command: $0 $@" &>> $EE_COMMAND_LOG diff --git a/src/lib/ee_lib_variables.sh b/src/lib/ee_lib_variables.sh index 3376cd5f..ef6220eb 100644 --- a/src/lib/ee_lib_variables.sh +++ b/src/lib/ee_lib_variables.sh @@ -17,7 +17,6 @@ readonly EE_CONFIG_GET=$(echo "git config --file /etc/easyengine/ee.conf") readonly EE_CONFIG_SET=$(echo "git config --file /etc/easyengine/ee.conf" --replace-all) readonly EE_IP_ADDRESS=$($EE_CONFIG_GET system.ip-address | cut -d'=' -f2 | sed 's/ //g' | tr ',' '\n') readonly EE_APT_GET=$($EE_CONFIG_GET system.apt-get-assume-yes | grep -i true &> /dev/null && echo apt-get -y || echo apt-get) -readonly EE_RANDOM=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) # Distribution specific variable if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then diff --git a/src/modules/site/create/ee_mod_setup_database.sh b/src/modules/site/create/ee_mod_setup_database.sh index 20da4895..30d7d339 100644 --- a/src/modules/site/create/ee_mod_setup_database.sh +++ b/src/modules/site/create/ee_mod_setup_database.sh @@ -2,8 +2,11 @@ function ee_mod_setup_database() { + # Random characters + local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) + # Replace dot(.) with underscore(_) in EE_DOMAIN Name - ee_replace_dot=$(echo $EE_DOMAIN | tr '.' '_') + local ee_replace_dot=$(echo $EE_DOMAIN | tr '.' '_') # Default database or custom database if [ $($EE_CONFIG_GET mysql.db-name) == "true" ];then @@ -23,7 +26,7 @@ function ee_mod_setup_database() # Default database user or custom user if [ $($EE_CONFIG_GET mysql.db-user) == "true" ]; then read -p "Enter the MySQL database username [$ee_replace_dot]: " EE_DB_USER - read -sp "Enter the MySQL database password [$EE_RANDOM]: " EE_DB_PASS + read -sp "Enter the MySQL database password [$ee_random]: " EE_DB_PASS fi # If mysql.db-user = false @@ -37,7 +40,7 @@ function ee_mod_setup_database() fi if [[ $EE_DB_PASS = "" ]]; then - EE_DB_PASS=$EE_RANDOM + EE_DB_PASS=$ee_random fi # Fix MySQL username ERROR 1470 (HY000) diff --git a/src/modules/site/create/ee_mod_setup_wordpress.sh b/src/modules/site/create/ee_mod_setup_wordpress.sh index ff743368..106cbb78 100644 --- a/src/modules/site/create/ee_mod_setup_wordpress.sh +++ b/src/modules/site/create/ee_mod_setup_wordpress.sh @@ -2,6 +2,9 @@ function ee_mod_setup_wordpress() { + # Random characters + local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) + # Download latest WordPress ee_lib_echo "Downloading WordPress, please wait..." wget --no-check-certificate -cqO /var/www/$EE_DOMAIN/htdocs/latest.tar.gz \ @@ -69,7 +72,7 @@ function ee_mod_setup_wordpress() # WordPress default user: admin EE_WP_PASS=$($EE_CONFIG_GET wordpress.password) if [[ $EE_WP_PASS = "" ]]; then - EE_WP_PASS=$EE_RANDOM + EE_WP_PASS=$ee_random fi # WordPress default email: `git config user.email` diff --git a/src/modules/system/install/ee_mod_install_mysql.sh b/src/modules/system/install/ee_mod_install_mysql.sh index dfbfae3b..ba16f87e 100644 --- a/src/modules/system/install/ee_mod_install_mysql.sh +++ b/src/modules/system/install/ee_mod_install_mysql.sh @@ -2,6 +2,9 @@ ee_mod_install_mysql() { + # Random characters + local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) + # Check MySQL is installed or not ee_lib_package_check mysql-server @@ -10,11 +13,11 @@ ee_mod_install_mysql() if [ -n "$EE_PACKAGE_NAME" ]; then # Setting up MySQL password - debconf-set-selections <<< "mysql-server mysql-server/root_password password $EE_RANDOM" - debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $EE_RANDOM" + debconf-set-selections <<< "mysql-server mysql-server/root_password password $ee_random" + debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $ee_random" # Generate ~/.my.cnf - echo -e "[client]\nuser=root\npassword=$EE_RANDOM" > ~/.my.cnf + echo -e "[client]\nuser=root\npassword=$ee_random" > ~/.my.cnf fi