Browse Source

Fix Issue 60: Protect EE Shared Locations

old-stable
Mitesh Shah 11 years ago
parent
commit
7972ca0a5b
  1. 5
      etc/easyengine/ee.conf
  2. 4
      etc/nginx/common/locations.conf
  3. 22
      usr/local/sbin/easyengine

5
etc/easyengine/ee.conf

@ -5,7 +5,10 @@ apt-get-assume-yes = false
gpg-keys-fix = false
# Password Protection
# Default easyengine/easyengine
htpasswduser =
htpasswdpass =
# WordPress Defaults
# Custom Database Name

4
etc/nginx/common/locations.conf

@ -25,6 +25,10 @@ location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gi
location /ee/ {
autoindex on;
alias /var/www/shared/;
satisfy any;
include common/allowed_ip.conf;
auth_basic "Restricted Area";
auth_basic_user_file htpasswd-ee;
include common/allowed_ip.conf;
index index.php index.html index.htm;

22
usr/local/sbin/easyengine

@ -179,6 +179,28 @@ COMMONNGINX()
EESOURCE="/usr/share/easyengine/nginx/common"
EEDEST="/etc/nginx/common"
EEMD5SUM
# White List IP Address
sed -i "s/deny.*/$(echo "allow $(w | grep $(echo $SSH_TTY| cut -d'/' -f3,4) | awk '{print($3)}');")\ndeny all;/" /etc/nginx/common/allowed_ip.conf
# Protect EE Locations
# Get The htpasswd Details
HTPASSWDUSER=$(grep htpasswduser /etc/easyengine/ee.conf | awk '{print($3)}')
HTPASSWDPASS=$(grep htpasswdpass /etc/easyengine/ee.conf | awk '{print($3)}')
if [[ $HTPASSWDUSER = "" ]]
then
HTPASSWDUSER=easyengine
fi
if [[ $HTPASSWDPASS = "" ]]
then
HTPASSWDPASS=easyengine
fi
# Generate htpasswd-ee file
printf "$HTPASSWDUSER:$(openssl passwd -crypt $HTPASSWDPASS)\n" > /etc/nginx/htpasswd-ee
}
INSTALLPHP()

Loading…
Cancel
Save