Skip to content

Commit 1a54bbf

Browse files
committed
Ask Before Whitelist IP Address
1 parent 8e9a7ea commit 1a54bbf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

usr/local/sbin/easyengine

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,14 @@ COMMONNGINX()
219219
EEMD5SUM
220220

221221
# White List IP Address
222-
WHITELISTIP=$(w | grep $(echo $SSH_TTY| cut -d'/' -f3,4) | awk '{print($3)}')
223-
if [ ! -z $WHITELISTIP ]
222+
IPDETECT=$(w | grep $(echo $SSH_TTY| cut -d'/' -f3,4) | awk '{print($3)}' | grep -v "-")
223+
if [ ! -z $IPDETECT ]
224224
then
225+
read -p "Enter The IP Address To Whitelist: [$IPDETECT]: " WHITELISTIP
226+
if [[ $WHITELISTIP = "" ]]
227+
then
228+
WHITELISTIP=$IPDETECT
229+
fi
225230
sed -i "s/deny.*/$(echo "allow $WHITELISTIP;")\ndeny all;/" /etc/nginx/common/acl.conf
226231
fi
227232

0 commit comments

Comments
 (0)