pfsense:pfblockerng:block_ads
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
pfsense:pfblockerng:block_ads [2021/02/07 17:12] – [Configure TLD (Optional)] peter | pfsense:pfblockerng:block_ads [2021/02/07 18:34] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PFSense - pfBlockingNG - Block Ads ====== | ||
- | |||
- | Use the **DNSBL** portion of pfBlockerNG to remove advertising. | ||
- | |||
- | |||
- | |||
- | ===== Configuring DNSBL feeds ===== | ||
- | |||
- | Before we go adding additional feeds, we should at least understand what the wizard provided us. | ||
- | |||
- | Go to **DNSBL -> DNSBL Groups** to see the current (post-wizard) configuration. | ||
- | |||
- | |||
- | if you want to add more, go to **Feeds** (not DNSBL Groups) at the top menu. Here you will see all of the pre-configured feeds for the IPv4, IPv6, and DNSBL categories. | ||
- | |||
- | <WRAP info> | ||
- | **NOTE: | ||
- | |||
- | Another way to check is if you have **Alerts** instead of **Reports** along the top row of pfBlockerNG options… | ||
- | |||
- | You can either follow the walkthrough for the older version of pfBlockerNG or better yet, delete the old pfBlockerNG and install the pfBlockerNG-devel package. | ||
- | </ | ||
- | |||
- | Scroll down to the **DNSBL Category** header, which is *after* all of the IPv4 and IPv6 sections. | ||
- | |||
- | Note that EasyList has a checkbox near the top left. This means the alias/group or category already exists and is being used. | ||
- | |||
- | {{: | ||
- | |||
- | If you look toward the right, you will see another checkbox. | ||
- | |||
- | This subtle distinction is extremely important to understanding how aliases and feeds work. In addition, if a category ever has a problematic feed, you can always disable that feed instead of the entire category, i.e. we do not need to enable every feed for a particular category. | ||
- | |||
- | For example, if you want to add the **EasyList Adware Filter** or one of the language specific feeds, you would click the **+** sign to the far right and that would add the individual feed to the already existing **EasyList** group. | ||
- | |||
- | {{: | ||
- | |||
- | Ensure you switch **OFF** to **ON** and then click **Save** at the bottom of the screen. | ||
- | |||
- | {{: | ||
- | |||
- | <WRAP important> | ||
- | **WARNING: | ||
- | |||
- | It’s quite possible just adding a few categories by themselves is too much for a resource starved firewall! | ||
- | |||
- | This is because feeds are periodically downloaded and likewise, unbound is reloaded regularly. | ||
- | |||
- | If you using a system with limited resources (mainly RAM), you need to be extra careful. | ||
- | |||
- | When in doubt, add feeds slowly and keep an eye on memory, CPU, etc. | ||
- | </ | ||
- | |||
- | |||
- | ---- | ||
- | |||
- | ==== Add Feed hphosts ==== | ||
- | |||
- | If we go back to the Feeds, a category (group) recommend adding is hpHosts. | ||
- | |||
- | After clicking the **+** next to the hpHosts category, you are taken to a DNSBL feeds page with all of the feeds under that category pre-populated. | ||
- | |||
- | {{: | ||
- | |||
- | Make sure you switch the **Action** from Disabled to Unbound (below). | ||
- | |||
- | Click **Save DNSBL Settings** at the bottom of the page and you should receive a message at the top along the lines of **< | ||
- | |||
- | {{: | ||
- | |||
- | |||
- | Click on the **DNSBL Groups** tab and you will be taken to the DNSBL feeds summary. | ||
- | |||
- | |||
- | {{: | ||
- | |||
- | ---- | ||
- | |||
- | ==== Other items worth mentioning ==== | ||
- | |||
- | If you take a look at the **Malicious** category, you will notice that some feeds have selectable options, such as such as the SANS Internet Storm Center feeds (bullet points). | ||
- | |||
- | I addition, I haven’t seen many false positives when using the expanded (low) list. | ||
- | |||
- | Take note of the door-arrow graphic icons next to several feeds. | ||
- | |||
- | {{: | ||
- | |||
- | ---- | ||
- | |||
- | ===== Other recommended feeds ===== | ||
- | |||
- | * hpHosts (all of them) – From MalwareBytes. | ||
- | * BBcan177 – From the creator of pfBlockerNG. | ||
- | * BBC (BBC_DGA_Agr) – From Bambenek Consulting <- This feed is extremely large. | ||
- | * Cryptojackers (all of them) – This blocks cryptojacking software and in-browser miners, but it also blocks various coin exchanges. | ||
- | |||
- | <WRAP alert> | ||
- | **ALERT: | ||
- | |||
- | If you using a system with limited resources (mainly RAM), you need to be extra careful. | ||
- | |||
- | When in doubt, add feeds slowly and keep an eye on memory, CPU, etc | ||
- | </ | ||
- | |||
- | |||
- | ---- | ||
- | |||
- | |||
- | ===== Problem Solving a Feed ===== | ||
- | |||
- | If you ever experience issues with a particular feed, go to **DNSBL -> DNSBL Groups** and then click the pencil/edit icon next to that particular category. | ||
- | |||
- | {{: | ||
- | |||
- | Once in the category edit screen, simply switch those feeds to **OFF** and then click **save** at the bottom. | ||
- | |||
- | {{: | ||
- | |||
- | You could also delete those feeds. | ||
- | |||
- | ---- | ||
- | |||
- | ===== Forcing DNSBL feed updates ===== | ||
- | |||
- | Anytime you make changes, you can either wait for the next update or you can force the changes yourself. | ||
- | |||
- | To force the changes, go over to the **Update** tab within pfBlockerNG. | ||
- | |||
- | Heed the warning and make sure you are not going to run the updates near the time your cron job would automatically run. If the countdown timer is less than 5 minutes, I would not recommend running it and instead just wait for the system to run it automatically. | ||
- | |||
- | {{: | ||
- | |||
- | Assuming you are good on the time, go ahead and click the **Run** button. | ||
- | |||
- | {{: | ||
- | |||
- | |||
- | ---- | ||
- | |||
- | ===== Testing By Browsing ===== | ||
- | |||
- | So what does the finished product look like? | ||
- | |||
- | On many sites, you’ll see gray boxes where an ad normally would have been. | ||
- | |||
- | A browser add-on like uBlock Origin further cleans this up by removing the gray box entirely and it also provides some secondary protections. | ||
- | |||
- | Also keep in mind that some ads are still served such as video ads on YouTube. | ||
- | |||
- | Those ads cannot be blocked via pfBlockerNG since the ad content is served from the same domain names (DNS) as the video content. | ||
- | |||
- | ---- | ||
- | |||
- | ===== Testing from the command line ===== | ||
- | |||
- | Normally, pinging a site will return the sites actual IP address. | ||
- | |||
- | However, with pfBlockerNG properly setup you may instead see a reply of **10.10.10.1**, | ||
- | |||
- | {{: | ||
- | |||
- | ---- | ||
- | |||
- | ===== Statistics and graphs ===== | ||
- | |||
- | pfBlockerNG has some really fantastic graphs built-in as shown below. | ||
- | |||
- | You can even see the top blocked domains, source IPs with the most blocks, blocked user agent strings, TLDs, and much more. | ||
- | |||
- | Also helpful is you need to whittle down the number of feeds you are using, i.e. this feed accounts for 50% of your blocks and it’s a third the size of these other two feeds combined. | ||
- | |||
- | {{: | ||
- | |||
- | ---- | ||
- | |||
- | ===== Troubleshooting - Whitelisting ===== | ||
- | |||
- | You can remove the offending list entirely (**DNSBL -> DNSBL Groups -> Edit the list in question**) or more preferably, you can just whitelist the domain. | ||
- | |||
- | The absolute easiest way to do this is by going to the **Reports** tab and scrolling down to the DNSBL section. | ||
- | |||
- | Clicking on the **red** lock will temporarily unlock the domain so you can verify if it is indeed the domain that needs to be whitelisted. | ||
- | |||
- | Clicking the **+** will add the domain to the DNSBL whitelist. | ||
- | |||
- | |||
- | {{: | ||
- | |||
- | When clicking the **+** you will then receive a prompt about whether you want to perform a wildcard whitelist or just a whitelist. | ||
- | |||
- | Read the explanation, | ||
- | |||
- | <WRAP tip> | ||
- | Adding a description so you know what was broken and/or why you fixed it, i.e. today it makes perfect sense, but it might not 6 months from now. | ||
- | </ | ||
- | |||
- | |||
- | If you go back to the main DNSBL tab and expand the DNSBL Whitelist section toward the bottom, you should now see the domain you whitelisted. | ||
- | |||
- | You might also notice that if the domain you are whitelisting has CNAME records, pfBlockerNG is smart enough to add those too. | ||
- | |||
- | |||
- | Simply type each domain in on a separate line and then click **Save** if you know which domains to whitelist. | ||
- | |||
- | It's also worth mentioning that if a system already resolved the domain name on your system and it is previously resolved to 10.10.10.1, then you may need to clear your local DNS cache, your browser cache, or both. To clear your machine’s cache, from a command line on Windows, type in **ipconfig /flushdns** and that should take care of it. You can run a similar command on a Linux system, although the commands can vary from one installation to the next. More often than not, simply restarting your network interface will work; on most distributions, | ||
- | |||
- | If ads are not getting blocked and the ping commands above don’t return the virtual IP address, it’s also possible your local machine is not using pfSense for its DNS settings. If you are using Windows, check your network settings and make sure it is set to your pfSense IP address. On Linux/*nix, check your / | ||
- | |||
- | Browsers can also get in the way especially with the advent of DNS over HTTPS. | ||
- | |||
- | ---- | ||
- | |||
- | ===== Whitelist Recommendations ===== | ||
- | |||
- | These are a few domains that cause issues if they end up on the various DNSBLs. | ||
- | |||
- | You can easily copy and paste them into the " | ||
- | |||
- | < | ||
- | s3.amazonaws.com | ||
- | s3-1.amazonaws.com # CNAME for (s3.amazonaws.com) | ||
- | .github.com | ||
- | .githubusercontent.com | ||
- | github.map.fastly.net # CNAME for (raw.githubusercontent.com) | ||
- | .apple.com | ||
- | .sourceforge.net | ||
- | .fls-na.amazon.com # alexa | ||
- | .control.kochava.com # alexa 2 | ||
- | .device-metrics-us-2.amazon.com # alexa 3 | ||
- | .amazon-adsystem.com # amazon app ads | ||
- | .px.moatads.com # amazon app 2 | ||
- | .wildcard.moatads.com.edgekey.net # CNAME for (px.moatads.com) | ||
- | .e13136.g.akamaiedge.net # CNAME for (px.moatads.com) | ||
- | .secure-gl.imrworldwide.com # amazon app 3 | ||
- | .pixel.adsafeprotected.com # amazon app 4 | ||
- | .anycast.pixel.adsafeprotected.com # CNAME for (pixel.adsafeprotected.com) | ||
- | .bs.serving-sys.com # amazon app 5 | ||
- | .bs.eyeblaster.akadns.net # CNAME for (bs.serving-sys.com) | ||
- | .bsla.eyeblaster.akadns.net # CNAME for (bs.serving-sys.com) | ||
- | .adsafeprotected.com # amazon app 6 | ||
- | .anycast.static.adsafeprotected.com # CNAME for (static.adsafeprotected.com) | ||
- | google.com | ||
- | www.google.com | ||
- | youtube.com | ||
- | www.youtube.com | ||
- | youtube-ui.l.google.com # CNAME for (youtube.com) | ||
- | stackoverflow.com | ||
- | www.stackoverflow.com | ||
- | dropbox.com | ||
- | www.dropbox.com | ||
- | www.dropbox-dns.com # CNAME for (dropbox.com) | ||
- | .adsafeprotected.com | ||
- | control.kochava.com | ||
- | secure-gl.imrworldwide.com | ||
- | pbs.twimg.com # twitter images | ||
- | www.pbs.twimg.com # twitter images | ||
- | cs196.wac.edgecastcdn.net # CNAME for (pbs.twimg.com) | ||
- | cs2-wac.apr-8315.edgecastdns.net # CNAME for (pbs.twimg.com) | ||
- | cs2-wac-us.8315.ecdns.net # CNAME for (pbs.twimg.com) | ||
- | cs45.wac.edgecastcdn.net # CNAME for (pbs.twimg.com) | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== TLD Blacklisting ===== | ||
- | |||
- | TLD (top-level domain) blacklisting is another option in DNSBL. | ||
- | |||
- | Don’t forget you need to **Enable** the TLD option at the top of the DNSBL configuration page to use the features discussed here. | ||
- | |||
- | Static blacklisting is not normally advocated because the bad guys will simply move around it, TLD blacklisting is a rare instance where you can eliminate some potential attack vectors although its usefulness depends entirely on your situation. | ||
- | |||
- | Some TLDs are used extensively for typosquatting — Omitting the " | ||
- | |||
- | If you’re looking for a little more guidance of what is ‘bad’ then look no further than Spamhaus and the website link below. | ||
- | |||
- | https:// | ||
- | |||
- | Suggest adding the top 3 TLDs, as they are used often for | ||
- | |||
- | < | ||
- | cm | ||
- | party | ||
- | click | ||
- | link | ||
- | </ | ||
- | |||
- | Adding these others would likely not cause too many issues, although keep in mind that you will see false positives: | ||
- | |||
- | < | ||
- | technology | ||
- | gdn | ||
- | study | ||
- | men | ||
- | biz | ||
- | reise | ||
- | stream | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | |||
- | ===== References ===== | ||
- | |||
- | https:// | ||
- | |||
- | https:// | ||
- | |||
pfsense/pfblockerng/block_ads.1612717924.txt.gz · Last modified: 2021/02/07 17:12 by peter