[SOLVED] Access Restrictions don't work

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
Frakko
DD-WRT Guru


Joined: 06 May 2016
Posts: 521

PostPosted: Fri Feb 09, 2018 5:57    Post subject: [SOLVED] Access Restrictions don't work Reply with quote
I blocked the internet access to a device that makes no sense to have access to the network. The blocking rule is regularly active but I noticed that the device accesses the internet, I see it from the LEDs.
I blocked the device both as an IP and as a MAC.
Tips?


Last edited by Frakko on Fri Feb 09, 2018 18:39; edited 1 time in total
Sponsor
Frakko
DD-WRT Guru


Joined: 06 May 2016
Posts: 521

PostPosted: Fri Feb 09, 2018 6:43    Post subject: Reply with quote
eibgrad wrote:
Not sure I'd depend on flashing LEDs to determine if any given device is accessing the internet. It might very well hit the WAN, trigger the LED, but get blocked at that point.

What kind of device? Does it have a UI where you can more easily tell if it's accessing the internet?


Decoder TV, no it haven't.
Frakko
DD-WRT Guru


Joined: 06 May 2016
Posts: 521

PostPosted: Fri Feb 09, 2018 14:07    Post subject: Reply with quote
eibgrad wrote:
AR (Access Restrictions) is known to not be very good. It's grown a bit outdated over the years. For a problem like this, it might just be easier to use some firewall rules and add them to the firewall script.

If we assume the device has the local IP 192.168.1.100 ...

Code:
iptables -I FORWARD -s 192.168.1.100 -j REJECT


Create a static lease on the GUI that maps its MAC address to that IP so it never changes. Make sure the static lease IP is *outside* the scope of the DHCP pool!


Is this problem also due to the impossibility of restricting access to the webgui through a specific MAC?

https://www.dd-wrt.com/phpBB2/viewtopic.php?p=1104065#1104065

If possible can you update these modules that I consider interdependent?
Thank you.
Frakko
DD-WRT Guru


Joined: 06 May 2016
Posts: 521

PostPosted: Fri Feb 09, 2018 18:15    Post subject: Reply with quote
I inserted the modules indicated in "start" and entered the iptables rule in the firewall.
There is something wrong with the rule. In fact I can access from all the devices to the dd-wrt menu while from the pc with the indicated mac I can not navigate.
I removed the rule and the pc surfs regularly.
Can you verify the rule please?
Thank you.
Frakko
DD-WRT Guru


Joined: 06 May 2016
Posts: 521

PostPosted: Fri Feb 09, 2018 18:38    Post subject: Reply with quote
All right, everything seems ok.
For the other question, restrict the access to the GUI of dd-wrt to a single device I open a new question?
Thank you.
Frakko
DD-WRT Guru


Joined: 06 May 2016
Posts: 521

PostPosted: Sat Feb 10, 2018 6:52    Post subject: Reply with quote
eibgrad wrote:
If you want to limit access of the GUI to only *one* device, then you need to use the INPUT chain of the filter table.

Code:
iptables -I INPUT -p tcp --dport 80 -j REJECT
iptables -I INPUT -p tcp --dport 80 -m mac --mac-source 00:11:22:33:44:55:66 -j ACCEPT


Be careful w/ this one. If you get the MAC address wrong, then you'll lock yourself out of the GUI completely, since every other MAC address will be rejected! You might want to test this using a shell (telnet/ssh) first. If you accidentally get locked out, you can simply reboot and start over. Once you know it to be working, only *then* should you install it in the firewall script.

One other precaution. If by chance the client in question happens to be behind a client bridge or repeater bridge, you'll probably have to specify the MAC address of the wireless client on that bridge, NOT the actual client. Whenever you use a wireless bridge, it masks the MAC address of the clients behind it w/ its own MAC address. So it's a bit trickery to configure. If this doesn't apply to you, don't worry about it.


I have done various tests but, my router is a TpLink-1043ND v3, but access continues to be allowed by all devices.
I think it's a bug. Sad

Code:

root@DD-WRT:~# iptables -vnL INPUT

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80 MAC xx:xx:xx:xx:xx:xx
    0     0 REJECT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80 reject-with icmp-port-unreachable
 1722  256K ACCEPT     0    --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
    0     0 ACCEPT     udp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           udp spt:67 dpt:68
    0     0 DROP       udp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           udp dpt:520
    0     0 DROP       udp  --  br0    *       0.0.0.0/0            0.0.0.0/0           udp dpt:520
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:520
  464 33582 ACCEPT     0    --  br0    *       0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       icmp --  eth0   *       0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       2    --  *      *       0.0.0.0/0            0.0.0.0/0           
    3   213 ACCEPT     0    --  lo     *       0.0.0.0/0            0.0.0.0/0           state NEW
    0     0 ACCEPT     0    --  br0    *       0.0.0.0/0            0.0.0.0/0           state NEW
    0     0 ACCEPT     udp  --  ath0   *       0.0.0.0/0            0.0.0.0/0           udp dpt:67
    0     0 ACCEPT     udp  --  ath0   *       0.0.0.0/0            0.0.0.0/0           udp dpt:53
    0     0 ACCEPT     tcp  --  ath0   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:53
    0     0 DROP       0    --  ath0   *       0.0.0.0/0            0.0.0.0/0           state NEW
    0     0 ACCEPT     0    --  ath0   *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     udp  --  ath0.1 *       0.0.0.0/0            0.0.0.0/0           udp dpt:67
    0     0 ACCEPT     udp  --  ath0.1 *       0.0.0.0/0            0.0.0.0/0           udp dpt:53
    0     0 ACCEPT     tcp  --  ath0.1 *       0.0.0.0/0            0.0.0.0/0           tcp dpt:53
    0     0 DROP       0    --  ath0.1 *       0.0.0.0/0            0.0.0.0/0           state NEW
    0     0 ACCEPT     0    --  ath0.1 *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     udp  --  ath0.2 *       0.0.0.0/0            0.0.0.0/0           udp dpt:67
    0     0 ACCEPT     udp  --  ath0.2 *       0.0.0.0/0            0.0.0.0/0           udp dpt:53
    0     0 ACCEPT     tcp  --  ath0.2 *       0.0.0.0/0            0.0.0.0/0           tcp dpt:53
    0     0 DROP       0    --  ath0.2 *       0.0.0.0/0            0.0.0.0/0           state NEW
    0     0 ACCEPT     0    --  ath0.2 *       0.0.0.0/0            0.0.0.0/0           
    9   456 DROP       0    --  *      *       0.0.0.0/0            0.0.0.0/0           
Frakko
DD-WRT Guru


Joined: 06 May 2016
Posts: 521

PostPosted: Sat Feb 10, 2018 7:21    Post subject: Reply with quote
eibgrad wrote:
Seems odd. The REJECT rule is so broad I can't see how it could not be triggered. The GUI is port 80, and tcp.

You're still loading the MAC modules, right?

Is it possible you're accessing the GUI w/ https (port 443) rather than http (port 80)?


Now everything is OK. I had actually not considered that I was connecting on 443 for the management of the router. Thank you!
Display posts from previous:    Page 1 of 1
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