From 6299e5e3015fec3dcd07378716927b7209d03af1 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Tue, 23 Sep 2014 16:38:26 +0530 Subject: [PATCH] Removed Default http Auth --- src/modules/secure/ee_mod_secure_auth.sh | 17 ++++++++++------- src/modules/stack/install/ee_mod_setup_nginx.sh | 5 ----- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/modules/secure/ee_mod_secure_auth.sh b/src/modules/secure/ee_mod_secure_auth.sh index b8281793..a76514a8 100644 --- a/src/modules/secure/ee_mod_secure_auth.sh +++ b/src/modules/secure/ee_mod_secure_auth.sh @@ -3,23 +3,26 @@ function ee_mod_secure_auth() { local ee_http_auth_user ee_http_auth_pass + + # Random characters + local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) - read -p "Provide HTTP authentication user name [easyengine]: " ee_http_auth_user - read -sp "Provide HTTP authentication password [easyengine]: " ee_http_auth_pass + read -p "Provide HTTP authentication user name [$(git config user.name)]: " ee_http_auth_user + read -sp "Provide HTTP authentication password [$ee_random]: " ee_http_auth_pass echo - # If enter is pressed, set easyengine + # If enter is pressed, set git config user.name if [[ $ee_http_auth_user = "" ]]; then - ee_http_auth_user=easyengine + ee_http_auth_user=$(git config user.email) fi if [[ $ee_http_auth_pass = "" ]]; then - ee_http_auth_pass=easyengine + ee_http_auth_pass=$ee_random fi # Add HTTP authentication details - ee_lib_echo "HTTP authentication username: $ee_http_auth_user" &>> $EE_COMMAND_LOG - ee_lib_echo "HTTP authentication password: $ee_http_auth_pass" &>> $EE_COMMAND_LOG + ee_lib_echo "HTTP authentication username: $ee_http_auth_user" + ee_lib_echo "HTTP authentication password: $ee_http_auth_pass" # Generate htpasswd-ee file printf "$ee_http_auth_user:$(openssl passwd -crypt $ee_http_auth_pass 2> /dev/null)\n" > /etc/nginx/htpasswd-ee 2> /dev/null diff --git a/src/modules/stack/install/ee_mod_setup_nginx.sh b/src/modules/stack/install/ee_mod_setup_nginx.sh index a439f4ef..75943cde 100644 --- a/src/modules/stack/install/ee_mod_setup_nginx.sh +++ b/src/modules/stack/install/ee_mod_setup_nginx.sh @@ -94,9 +94,4 @@ function ee_mod_setup_nginx() sed -i "/deny/i $(echo allow $ee_whitelist_ip_address\;)" /etc/nginx/common/acl.conf done fi - - # Set easyengine:easyengine as default http authentication - if [ ! -f /etc/nginx/htpasswd-ee ]; then - printf "easyengine:$(openssl passwd -crypt easyengine 2> /dev/null)\n" > /etc/nginx/htpasswd-ee 2> /dev/null - fi }