Browse Source

Display HTTP AUTH details

bugfixes
harshadyeola 10 years ago
parent
commit
8f140f4dd3
  1. 20
      src/modules/secure/ee_mod_secure_auth.sh

20
src/modules/secure/ee_mod_secure_auth.sh

@ -2,29 +2,27 @@
function ee_mod_secure_auth() function ee_mod_secure_auth()
{ {
local ee_http_auth_user ee_http_auth_pass
# Random characters # Random characters
local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1)
read -p "Provide HTTP authentication user name [$(git config user.name)]: " ee_http_auth_user 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 read -sp "Provide HTTP authentication password [$ee_random]: " EE_HTTP_AUTH_PASS
echo echo
# If enter is pressed, set git config user.name # If enter is pressed, set git config user.name
if [[ $ee_http_auth_user = "" ]]; then if [[ $EE_HTTP_AUTH_USER = "" ]]; then
ee_http_auth_user=$(git config user.name) EE_HTTP_AUTH_USER=$(git config user.name)
fi fi
if [[ $ee_http_auth_pass = "" ]]; then if [[ $EE_HTTP_AUTH_PASS = "" ]]; then
ee_http_auth_pass=$ee_random EE_HTTP_AUTH_PASS=$ee_random
fi fi
# Add HTTP authentication details # Add HTTP authentication details
echo echo
ee_lib_echo "HTTP authentication username: $ee_http_auth_user" &>> $EE_COMMAND_LOG 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 password: $EE_HTTP_AUTH_PASS" &>> $EE_COMMAND_LOG
# Generate htpasswd-ee file # 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 printf "$EE_HTTP_AUTH_USER:$(openssl passwd -crypt $EE_HTTP_AUTH_PASS 2> /dev/null)\n" > /etc/nginx/htpasswd-ee 2> /dev/null
} }

Loading…
Cancel
Save