Access restrictions not working

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2
Author Message
bjornbai
DD-WRT Novice


Joined: 08 Jan 2014
Posts: 14

PostPosted: Thu Jul 17, 2014 11:18    Post subject: Reply with quote
I have also had problems getting Access restrictions to work properly; I have been using various KONG builds and static IP.

However the method described by Raph321 at:
http://www.dd-wrt.com/phpBB2/viewtopic.php?p=894477#894477
works just perfect for me.

You might want to give it a try.
Sponsor
Diverge
DD-WRT Novice


Joined: 25 Sep 2008
Posts: 48

PostPosted: Wed Aug 20, 2014 16:28    Post subject: Reply with quote
I'm also having an issue with this. I'm using Kongs build on my R7000 (24710M) and already had some working urls being filtered out. But when I went to add another url it keeps letting the page load (prior ones still working).

Seems pretty odd to me. I've rebooted the router. Same issue. I'm gonna try a power cycle now...

edit: Something odd I just released. The link I am blocking is an Google OTA firmware update link, and it seems the link switches to HTTPS (maybe because HTTP is blocked?). Anyway, I added the HTTPS url to the block list, but it still loads..
henningdalgaard
DD-WRT Novice


Joined: 04 Nov 2010
Posts: 9

PostPosted: Wed Apr 15, 2015 7:10    Post subject: Reply with quote
any new on this? I am also on a R7000 and I have added one domain that works and added yet anoter that doesn't work.
sinewave
DD-WRT Novice


Joined: 11 Sep 2016
Posts: 2

PostPosted: Sat Sep 24, 2016 0:11    Post subject: access restrictions working correctly Reply with quote
Hi Guys, for all of you who has problem configuring access restrictions I figured it on my router and if still interested i can share my way.

TP-LINK C9 Firmware: DD-WRT v3.0-r28598 std (12/24/15)
henningdalgaard
DD-WRT Novice


Joined: 04 Nov 2010
Posts: 9

PostPosted: Sat Sep 24, 2016 6:35    Post subject: Reply with quote
Yes, please share! Very Happy
<Kong>
DD-WRT Guru


Joined: 15 Dec 2010
Posts: 4339
Location: Germany

PostPosted: Sat Sep 24, 2016 8:43    Post subject: Reply with quote
Diverge wrote:
I'm also having an issue with this. I'm using Kongs build on my R7000 (24710M) and already had some working urls being filtered out. But when I went to add another url it keeps letting the page load (prior ones still working).

Seems pretty odd to me. I've rebooted the router. Same issue. I'm gonna try a power cycle now...

edit: Something odd I just released. The link I am blocking is an Google OTA firmware update link, and it seems the link switches to HTTPS (maybe because HTTP is blocked?). Anyway, I added the HTTPS url to the block list, but it still loads..


Because access restriction does not work with https ad will never do.

_________________
KONG PB's: http://www.desipro.de/ddwrt/
KONG Info: http://tips.desipro.de/
Aliby
DD-WRT Novice


Joined: 08 Jul 2014
Posts: 2

PostPosted: Sat Oct 01, 2016 5:17    Post subject: Re: access restrictions working correctly Reply with quote
sinewave wrote:
Hi Guys, for all of you who has problem configuring access restrictions I figured it on my router and if still interested i can share my way.

TP-LINK C9 Firmware: DD-WRT v3.0-r28598 std (12/24/15)


Hey Sinewave, really want to hear what your solution was.
Xentrk
DD-WRT Novice


Joined: 03 Jun 2016
Posts: 45

PostPosted: Wed Oct 05, 2016 0:24    Post subject: Reply with quote
Router: D-Link 880L

Build: DD-WRT v3.0-r29837 std (06/06/16)

I do volunteer IT work at a childrens home and school in Chiang Mai Thailand. I was asked to block certain websites and restrict access to the WAN at certain times of the day. I ended up using OpenDNS combined with DNSOMATIC for website blocking and it works great.

At the childrens home, I used the Access Restrictions tab to restrict access to the WAN at certain times of the day. There is a computer lab with a static ip assigned. I created a rule that blocks WAN access to this IP from 00:00 to 07::00 Monday to Friday. I then created another rule that blocks access from 20:30 to 23:59 Monday to Friday. I have gone over in the morning and validated that I can access the WAN in the computer lab after 7:00 AM and I can. But around 5:30 each night, one of the children comes and tells me they can’t get on the internet. To fix, I sign onto the DD-WRT Access Restrictions tab and hit apply. They can then access the WAN again. So the rule is correct. It just does not seem to stick.

I have done some searching on the forums and web and can’t seem to find an answer. I did see a post where another DD-WRT had an issue and said the last build that worked for them for Access Restrictions was Build 27506 July 2015. I am tempted to flash with this build if I can’t get this to work.

I have nine rules and there is room for ten. This morning, I deleted the first rule so it is empty. I then placed it in rule 10. I will see if that works as I see where this worked for another user back in 2007. In pfSense, the order of the rules are very important. But not in DD-WRT. At least that is what I have read.

Mikimik posted a fix here for Access Restrictions when running a OpenVPN client:

http://www.dd-wrt.com/phpBB2/viewtopic.php?t=277911

I’m not running an OpenVPN client but am thinking about placing the script in the start-up commands if the above does not work.
Xentrk
DD-WRT Novice


Joined: 03 Jun 2016
Posts: 45

PostPosted: Fri Oct 07, 2016 0:48    Post subject: Reply with quote
Quote:
Mikimik posted a fix here for Access Restrictions when running a OpenVPN client:

http://www.dd-wrt.com/phpBB2/viewtopic.php?t=277911


The above script/solution appears to have fixed the problem even though I am not running a VPN client! Thank you Mikimik! I added the script to the start-up commands section, rebooted the router then went to the Access Restrictions GUI and Applied Settings. WAN access worked on the computer lab per the rules.

I will continue to monitor over the weekend with the other rules I have in place and report back.
Xentrk
DD-WRT Novice


Joined: 03 Jun 2016
Posts: 45

PostPosted: Tue Nov 01, 2016 14:49    Post subject: Reply with quote
The script appeared to be the fix. However, the WAN interface is not working per rules when it should at times. The fix is to go into the web GUI access restrictions tab and select the "Apply" button. They then works as they should, at least for awhile.
benCorpo
DD-WRT Novice


Joined: 21 Feb 2017
Posts: 1

PostPosted: Wed Feb 22, 2017 0:17    Post subject: Solution for simple rules Reply with quote
Xentrk wrote:
The script appeared to be the fix. However, the WAN interface is not working per rules when it should at times. The fix is to go into the web GUI access restrictions tab and select the "Apply" button. They then works as they should, at least for awhile.

After a few hours trying to figure it out, I found that there are no cron jobs defined that would read the configurations and rebuild the iptable rules. The "Apply" button does that job, so unless you want to click on this button on every necessary changes, this feature is useless.

I did find a decent solution if your rules are simple (no overlapping rules). In my case, I wanted to deny or grant internet access to a list of MAC addresses. I created a single policy (it has to be #1) in the "Access restrictions" tab and listed all my MAC addresses, selected the "DENY" policy and as long as it is enabled, the rest is not important to set.

DD-WRT will then add a new iptable chain called "lan2web" with a "grp_1" target. That is all we need, now the second step is to manually add cron jobs in the "Administration -> Management" tab.

When you want to have your rule active, you need to call "/usr/sbin/iptables -A lan2wan -j grp_1" which will enable the policy, and use "/usr/sbin/iptables -D lan2wan 1" when you want to disable it.

As an example of a complete cron job, I want to enable internet access at 3:30pm from monday-friday and at 9am saturday and sunday (i.e. remove policy) :
30 15 * * 1-5 root /usr/sbin/iptables -D lan2wan 1
0 9 * * 6,7 root /usr/sbin/iptables -D lan2wan 1

Then block access at 6pm (sunday to thursday) and 9pm friday+saturday (i.e. add policy)
0 18 * * 0-4 root /usr/sbin/iptables -A lan2wan -j grp_1
0 21 * * 5,6 root /usr/sbin/iptables -A lan2wan -j grp_1

The only thing to maintain is the list of denied devices in the access restriction tab and maybe cron time. Very Happy

Hope this helps other users, I spent too many hours reverse engineering this part to discover it does not have any cron to update the iptable rules.

Bare in mind, because the cron always delete target #1 from the lan2wan chain, YOU CANNOT HAVE MORE THAN ONE POLICY ACTIVE or this cron job might not work.
Xentrk
DD-WRT Novice


Joined: 03 Jun 2016
Posts: 45

PostPosted: Wed Feb 22, 2017 4:50    Post subject: Reply with quote
I did some more googling. I ended up writing ssh scripts that contain iptables command to drop and allow wan connections based on day and time of day. I am away from home on holiday and unable to access router remotely via ssh with iPad. I will post my solution when I return last week of February.

This logs the start and end time to a log file called cronlog. Because guess what, cron is another issue with my build. Ugh. It seems if I manually do the stopservice cron and starservice cron after reboot it works. I then issue the iptables -L command to make sure the command ran okay.

Code:

#!/bin/sh
echo "********************PC-Lab_Naomi_off script run START at `date`" >> /var/log/cronlog
# Block an incoming connection from PC Lab
iptables -I FORWARD -s 192.168.2.218 -j DROP
# Block an incoming connection from Naomi Laptop
iptables -I FORWARD -s 192.168.2.232 -j DROP
iptables -L FORWARD | grep DROP >> /var/log/cronlog
echo "********************PC-Lab_Naomi_off script END run at `date`" >> /var/log/cronlog



Code:
#!/bin/sh
echo "********************PC-Lab_Naomi_on script run START at `date`" >> /var/log/cronlog
# drop rule that blocked an incoming connection from PC Lab
iptables -D FORWARD -s 192.168.2.218 -j DROP
# drop rule that blocked an incoming connection from Naomi Laptop
iptables -D FORWARD -s 192.168.2.232 -j DROP
iptables -L FORWARD >> /var/log/cronlog
echo "********************PC-Lab_Naomi_on script END run at `date`" >> /var/log/cronlog
Goto page Previous  1, 2 Display posts from previous:    Page 2 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware 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 can attach files in this forum
You can download files in this forum