Skip to content

Commit 9624d7d

Browse files
Merge pull request #292 from ExtremeFiretop/ExtremeFiretop-AccessRestrictions
Detect Access Restrictions
2 parents 7536558 + 3c5b7d6 commit 9624d7d

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

MerlinAU.sh

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66
# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7-
# Last Modified: 2024-Aug-15
7+
# Last Modified: 2024-Aug-16
88
###################################################################
99
set -u
1010

@@ -147,7 +147,7 @@ theLGExitStr="${GRNct}e${NOct}=Exit to Log Options Menu"
147147
routerLoginFailureMsg="Please try the following:
148148
1. Confirm that you are *not* already logged into the router webGUI using a web browser.
149149
2. Check that the \"Enable Access Restrictions\" option from the webGUI is *not* set up
150-
to restrict access to the router webGUI from the current network client you're using.
150+
to restrict access to the router webGUI from the router's IP address.
151151
3. Confirm your password via the \"Set Router Login Credentials\" option from the Main Menu."
152152

153153
[ -t 0 ] && ! tty | grep -qwi "NOT" && isInteractive=true
@@ -619,6 +619,7 @@ readonly PRODUCT_ID="$(_GetRouterProductID_)"
619619

620620
##FOR TESTING/DEBUG ONLY##
621621
##readonly PRODUCT_ID="TUF-AX3000_V2"
622+
##readonly MODEL_ID="$PRODUCT_ID"
622623
##FOR TESTING/DEBUG ONLY##
623624

624625
readonly FW_FileName="${PRODUCT_ID}_firmware"
@@ -2595,6 +2596,27 @@ _GetLoginCredentials_()
25952596
local oldPWSDstring thePWSDstring
25962597
local loginCredsENC loginCredsDEC
25972598

2599+
# Check if Access Restrictions are enabled #
2600+
local accRestriction restrictRuleList routerIP ruleMatch
2601+
accRestriction="$(nvram get enable_acc_restriction)"
2602+
2603+
if [ "$accRestriction" = "1" ]; then
2604+
# Get the restrict_rulelist and the router IP address #
2605+
restrictRuleList="$(nvram get restrict_rulelist)"
2606+
routerIP="$(nvram get lan_ipaddr)"
2607+
2608+
# Check if the router IP is followed by >1 or >3
2609+
ruleMatch="$(echo "$restrictRuleList" | grep -oE "${routerIP}>[13]")"
2610+
2611+
if [ -z "$ruleMatch" ] || echo "$restrictRuleList" | grep -qE "${routerIP}>2"; then
2612+
printf "${REDct}WARNING: Access Restrictions are enabled!${NOct}\n"
2613+
printf "${REDct}Please add the routers IP with 'Web UI' access under 'Administration -> System -> Access restriction list' to permit login to the WebUI.${NOct}\n"
2614+
printf "${REDct}The alternative option is to disable 'Access restrictions' if unrequired.${NOct}\n"
2615+
_WaitForEnterKey_
2616+
return 1
2617+
fi
2618+
fi
2619+
25982620
# Get the Username from NVRAM #
25992621
userName="$(nvram get http_username)"
26002622

0 commit comments

Comments
 (0)