Restrict Access to Web GUI Management on LAN?

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Goto page Previous  1, 2
Author Message
e123enitan
DD-WRT Novice


Joined: 13 Mar 2017
Posts: 46

PostPosted: Sun Sep 10, 2017 6:25    Post subject: Re: Ooops Sorry Reply with quote
e123enitan wrote:
sploit wrote:
Oopps Sorry... My brain was somewhere else...
ADMINISTRATION TAB
then COMMAND tab.
Them paste the code into the box and press SAVE FIREWALL.

Then reboot the router



Thanks it works like cham, sincerely appreciate your time/knowledge.

May I bothered you with another issue, similar to the same access restriction.
I have say five devices on my LAN, connected through both wireless and Ethernet, I have all these MAC addresses set in DHCP reservation, is it possible to allow for only these five MAC's only in my LAN/WAN, where any devices with MAC not in the DHCP table will rejected.
My reason for doing this is mainly to prevent people in my house using the Ethernet RJ 45 wall socket to bypass restriction set in the wireless to gain access to my LAN server.

Thanks for your support.


I am, in serious trouble, I can log into my router from the computer which I have the MAC allowed.
Any idea of logging into the router without resetting the router.
Sponsor
e123enitan
DD-WRT Novice


Joined: 13 Mar 2017
Posts: 46

PostPosted: Sun Sep 10, 2017 21:16    Post subject: Re: Ooops Sorry Reply with quote
e123enitan wrote:
e123enitan wrote:
sploit wrote:
Oopps Sorry... My brain was somewhere else...
ADMINISTRATION TAB
then COMMAND tab.
Them paste the code into the box and press SAVE FIREWALL.

Then reboot the router



Thanks it works like cham, sincerely appreciate your time/knowledge.

May I bothered you with another issue, similar to the same access restriction.
I have say five devices on my LAN, connected through both wireless and Ethernet, I have all these MAC addresses set in DHCP reservation, is it possible to allow for only these five MAC's only in my LAN/WAN, where any devices with MAC not in the DHCP table will rejected.
My reason for doing this is mainly to prevent people in my house using the Ethernet RJ 45 wall socket to bypass restriction set in the wireless to gain access to my LAN server.

Thanks for your support.


I am, in serious trouble, I can log into my router from the computer which I have the MAC allowed.
Any idea of logging into the router without resetting the router.


Guys please any idea how to log into my router, after making the change to prevent other MAC which seem to work , but what it does is to also lock me out of the computer which the MAC is set to allow.
My router model is Linksys Router 1900AC and Rom Build is by Kong
Hope someone with come up with solutions to get into the router
Thanks for your supports

Pls don't leave me hanging, someone help i need to get into my router pls, pls !, there must be a way somehow any idea or solution to exploit
e123enitan
DD-WRT Novice


Joined: 13 Mar 2017
Posts: 46

PostPosted: Mon Sep 11, 2017 19:28    Post subject: Re: Ooops Sorry Reply with quote
e123enitan wrote:
e123enitan wrote:
e123enitan wrote:
sploit wrote:
Oopps Sorry... My brain was somewhere else...
ADMINISTRATION TAB
then COMMAND tab.
Them paste the code into the box and press SAVE FIREWALL.

Then reboot the router



Thanks it works like cham, sincerely appreciate your time/knowledge.

May I bothered you with another issue, similar to the same access restriction.
I have say five devices on my LAN, connected through both wireless and Ethernet, I have all these MAC addresses set in DHCP reservation, is it possible to allow for only these five MAC's only in my LAN/WAN, where any devices with MAC not in the DHCP table will rejected.
My reason for doing this is mainly to prevent people in my house using the Ethernet RJ 45 wall socket to bypass restriction set in the wireless to gain access to my LAN server.

Thanks for your support.


I am, in serious trouble, I can log into my router from the computer which I have the MAC allowed.
Any idea of logging into the router without resetting the router.


Guys please any idea how to log into my router, after making the change to prevent other MAC which seem to work , but what it does is to also lock me out of the computer which the MAC is set to allow.
My router model is Linksys Router 1900AC and Rom Build is by Kong
Hope someone with come up with solutions to get into the router
Thanks for your supports

Pls don't leave me hanging, someone help i need to get into my router pls, pls !, there must be a way somehow any idea or solution to exploit



A thought just came to mind to try Putty to SSH or telnet using CLI to access the iptable and delete or purge the command.

Since I don't how what to write getting into the CLI ie root/pass

can someone help to write the command to get to iptable and purge the code.

Or itsn't as simple as I thought?
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Mon Apr 24, 2023 7:24    Post subject: Reply with quote
e123enitan wrote:

iptables -I INPUT -i br0 -p tcp --dport 80 -j REJECT
iptables -I INPUT -i br0 -p tcp --dport 80 -m mac --mac-source
B8:AC:6F:39:6F:0E -j ACCEPT

You can also set up DD-WRT's DHCP Server (DNSmasq Additional Option "dhcp-host") to always hand out the same IP address to the device with that MAC addresss, then you can use IP address in the ACCEPT rule.

A more secured option is to use SSH tunneling. With this setup, the only ACCEPT rule is for 127.0.0.1! Wink

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw


Last edited by mwchang on Mon Apr 24, 2023 7:43; edited 1 time in total
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Mon Apr 24, 2023 7:28    Post subject: Re: Ooops Sorry Reply with quote
e123enitan wrote:
A thought just came to mind to try Putty to SSH or telnet using CLI to access the iptable and delete or purge the command.

Since I don't how what to write getting into the CLI ie root/pass

can someone help to write the command to get to iptable and purge the code.

Or itsn't as simple as I thought?

The following command lists iptables entries with line numbers:
Code:
iptables -nvL --line-number | more

Then you can delete rule by line number of the chain, as for example, line 3 in INPUT chain:
Code:
iptables -D INPUT 3


After deleting the rule, restart firwall by "service firewall stop" and "service firewall start" so that the change could be saved. Make sure that you didn't add the rule via the firewall script. In that case, just delete the rule in the Firewall script.

DD-WRT :: View topic - [How To] Delete a nat iptables rule
https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=694052

How To List and Delete Iptables Firewall Rules | DigitalOcean
https://www.digitalocean.com/community/tutorials/how-to-list-and-delete-iptables-firewall-rules

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6436
Location: UK, London, just across the river..

PostPosted: Mon Apr 24, 2023 8:24    Post subject: Reply with quote
On the new builds, there is an option to restrict GUI access for WiFi (via LAN ports is accessible)

Otherwise my practice is:

via CLI

nvram set https_lanport=48443 <---- Or whatever port you want (away from the first 1024)
nvram commit
reboot


Then access your router via
https://routeripaddress:48443

Im using only https GUI access

Than, in firewall i have rule that bans https port for any access, until i log in via SSh and manually allow it..

iptables -I INPUT -i br0 -p tcp --dport 48443 -j REJECT

iptables -I INPUT -i br0 -p tcp --dport 48443 -m mac --mac-source xx:xx:xx:xx:xx:xx -j ACCEPT
xx.xx.xx.. is the mac address of this device you want to permit access

My ssh is also with changed port via GUI 49022 and has disabled password access.
Log in via SSh only with secure KEY that is even password protected..

you can manually delete the rule via CLI (ssh) and no need to restart firewall

iptables -D INPUT -i br0 -p tcp --dport 48443 -m mac --mac-source xx:xx:xx:xx:xx:xx -j ACCEPT

Also on my router reset via button is disabled too..

My R7800 is the main router(edge router)in a student accommodation, where kids are very crafty animals... Laughing

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Wed Apr 26, 2023 10:40    Post subject: Reply with quote
Alozaros wrote:

nvram set https_lanport=48443 <---- Or whatever port you want (away from the first 1024)
nvram commit
reboot
iptables -I INPUT -i br0 -p tcp --dport 48443 -j REJECT

Instead of using hard-coded value "48443", you might wanna use output of shell command (shell variable):
Code:
iptables -I INPUT -i br0 -p tcp --dport `nvram get https_lanport` -j REJECT

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6436
Location: UK, London, just across the river..

PostPosted: Thu Apr 27, 2023 17:17    Post subject: Reply with quote
mwchang wrote:
Alozaros wrote:

nvram set https_lanport=48443 <---- Or whatever port you want (away from the first 1024)
nvram commit
reboot
iptables -I INPUT -i br0 -p tcp --dport 48443 -j REJECT

Instead of using hard-coded value "48443", you might wanna use output of shell command (shell variable):
Code:
iptables -I INPUT -i br0 -p tcp --dport `nvram get https_lanport` -j REJECT


well...both commands will cut off the same port... Rolling Eyes

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1931

PostPosted: Thu Apr 27, 2023 17:53    Post subject: Reply with quote
This should also work:

Code:
iptables -I INPUT -i br0 -p tcp --dport $(nvram get https_lanport) -j REJECT

_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
Goto page Previous  1, 2 Display posts from previous:    Page 2 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum