Opkg install iptables-mod-iprange > /dev/null If opkg list-installed | grep -q iptables-mod-iprangeĮcho 'Installing iptables-mod-iprange. Opkg install iptables-mod-nat-extra > /dev/null If opkg list-installed | grep -q iptables-mod-nat-extraĮcho 'iptables-mod-nat-extra is installed! 'Įcho 'Installing iptables-mod-nat-extra. #Delete files used to build list to free up the limited space #Change the cron command to what is comfortable, or leave as is # If enabled, understand the consequences and mechanics of this setup # Try to transparently serve pixel response? CRON: The cron line to put in the crontab.ENDPOINT_IP4/IP6*: Define the IP to return for blocked hostnames (IPv4 and IPv6).TRANS#: (Y/N): Modify router web server to server transparent pixel responses for blocked websites.SSL# (Y/N): Install wget with ssl support (only needed for ssl websites). EXEMPT# (Y/N): Exempt ip range from filtering (between START_ RANGE and END_RANGE).ONLY_WIRELESS (Y/N): Only filter on wireless interface.Other variables require a full restart because they must install or verify dependencies. However, if you change certain variables, you must re-update the blocklist because the redirection values will have changed. That is, # sh /etc/adblock.sh -t # turn off To change the configuration of an already active installation, I would toggle the adblocking off first, change the script, then toggle it back on. Then only the wireless interface of the router will filter the blocklist. The config section of the script has some variables that alter the behaviour of the script.įor example, if you change: ONLY_WIRELESS="N" To reinstall the current implementation: # sh /etc/adblock.sh -r To manually update the blocklist, run the script without switches: # sh /etc/adblock.sh Note: This does not delete the blocklist, whitelist, or blacklist. To toggle the blocking on and off, run the script with the -t switch: # sh /etc/adblock.sh -t I've found it tedious, but worthwhile, to find the offending url in /etc/block.hosts and copy it to /etc/white.list. NOTE: The whitelist support is pretty stupid, so don't expect smart filtering (e.g., domain extrapolation). To blacklist urls, place them (one per line) in /etc/black.list. Similarly, the script supports defining blacklisted urls - urls that will be added to the downloaded blocklists. To whitelist urls, place them (one per line) in /etc/white.list. That is, urls that will be filtered out of the downloaded blocklists. The script supports defining whitelisted urls. You can test it by looking up, say, google analytics. If these commands complete without errors, the adblocking is active. There should be status updates in the output, but there should be no errors. If you are running the script for the first time: # sh /etc/adblock.sh -f The script must be copied to an OpenWRT router (gargoyle firmware works fine, too).įor example, if the router is located at 192.168.1.1: # scp adblock.sh the script executable: # chmod +x /etc/adblock.sh However, the blocking is leaky, so do not expect everything to be blocked. In addition, the router will update the blocklist weekly. Since the address blocklist is full of advertising, malware, and tracking servers, this setup is generally a good thing. Gargoyle package by package by its basic usage, this script will modify the router such that blocked addresses are null routed and unreachable. Others have recently developed packages for this same functionality, and done it better than anything I could do.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |