|
NAMEdns2blackhole —
Malware Prevention through Domain Blocking (Black Hole).
DESCRIPTIONdns2blackhole is a set of Bourne Shell csh scripts that fetch host files from public host file providers that contain the FQDN [ Fully Qualified Domain Names ] of sites that fall into the following categories, adware, malware, exploit, hijackers, harvesters, tracking, phishing, fake news, fraud, spam, sex, porn, gambling, advertisements, misleading marketing, illegal pharmacy, warez/piracy and others. The output of the dns2blackhole scripts may be fed directly into the ports/package versions of unbound, named, or dnsmask DNS servers to block those FQDN thus protecting user devices from being compromised or bothered seeing things of no interest. The base built-in version of unbound titled "local_unbound" can also be configured to work using the dns2blackhole method. This black hole method is another layer of protection that you can customize to your needs.These public host file providers in general have staffs that collect, analyze and create FQDN lists which are available to the general public. The collection of data may utilize software that rolls through ranges of IP addresses world wide simulating a browser behavior allowing itself to be compromised. The data acquired is then analyzed and placed in the hosts file if it's determined to be detrimental to a normal browser. These are the things people want to protect their computers from. Host files first started to be created in the past when harmful sites were less than 100. These host files were used to feed into Unix flavored operating systems /etc/host files and Microsoft Windows host files. This is how they got their name which continues in use to today even though the hosts files are now too large to function in the operating system host file without causing severe slow downs. How does blocking work.Most DNS server software have their own record syntax for passing a list of FQDN to the server telling the server to return a NOT found reply without doing a public internet DNS request lookup. This not only speeds up the loading of browser pages but also protects other applications from accessing those sites.Memory limits.There is a relationship between the memory size of the computer and how large of a FQDN list can be loaded into the dns server your using.The dns2blackhole-update1 script creates a FQDN list of 130,100 entries that has been tested loading into a computer with 2 GB of memory. The dns2blackhole-update2 script creates a FQDN list of 1.6 million entries that has been tested loading into a computer with 16 GB of memory. You may try commenting out some file fetches in dns2blackhole-update2 to make the resulting FQDN list smaller to see if it will load on your computer's memory size. dns2blackhole and unbound server.The dns2blackhole Bourne Shell csh scripts are customized for use with the unbound server as installed from the ports or package system. The update1 and update2 scripts have alternate commented out code to work with named and dnsmask DNS servers. Just follow the comments in those scripts for instructions. A unbound.conf file is included to simplify unbound setup.
dns2blackhole and local_unbound server.1. Edit the /usr/local/bin/dns2blackhole-update1 and update2 scripts and follow the comments to enable local_unbound use. All it takes is un-commiting two lines near the front of the script.
Host file providers.As of 09/11/2017 every public host file provider identifiable on the internet is fetched by the dns2blackhole update1 and update2 scripts. The only difference between them is update1 fetches providers that provide text host files and update2 fetches providers that provide compressed host files. Many really bad FQDN sites are contained in many of the individual provider hosts files. Rest assured that these duplicates are removed before being fed to the DNS server software being used.All host file providers are not as diligent at removing FQDN that are no longer registered in the public DSN system as some of the other providers. Adding these unknown dead FQDN to the DNS server being used causes no harm. If in the future you identify additional host files it's very easy to add them to either of the 2 update scripts. The output of update1 and update2 combined together yield 1.6 million blocked FQDN, and that size will continue to grow for sure. WhiteListing or BlackListing your own FQDN.BlackListing is the way you add your own FQDN of sites you want blocked. WhiteListing is the way you remove some FQDN that are contained in the downloaded provider host files that you don't want blocked any longer.You edit whitelist.txt or the blacklist.txt files in /usr/local/etc/unbound directory adding your FQDN starting in position one of each line. Do not leave a blank line at the end of the file. You then run the update1 and or update2 to get your whitelist.txt and/or blacklist.txt files applied. These two files are the permanent way to apply your customized configuration across host file updates. Be careful to not delete them or you will have to start from scratch to re-build their content. The quick and dirty method is to edit the fqdn-list file deleteing the FQDN you don't want blocked IE: WhiteListed. Or adding FQDN you want blocked IE: BlackListed. Then enable the new content by issuing the "service unbound restart" command. dns2blackhole files.dns2blackhole.8 This man page your reading now dns2blackhole-unbound.conf Pre-configured unbound.conf file dns2blackhole-update1 updates all host text files dns2blackhole-update2 updates all host compressed files dns2blackhole-sanitize sub-routine used by update1 & update2 dns2blackhole-sort-fqdn sub-routine used by update1 & update2 dns2blackhole-whitelist sub-routine used by update1 & update2 dns2blackhole usage.At your choice, update1 can be run without update2. Note that update2 has option to auto install the 7zip package and use it to un-compress the downloaded files or default to using tar to un-compress the downloaded files. Read the comments in update2 for details. The host file providers do not update their downloadable files on a dependable cycle. Somewhere between 2 to 12 times a year. If you decide to run the update scripts as a crom job more often that monthly, it would just be a waste of process time.Unbound setup instructions.1. unbound comes with a built-in "root zone" which negates the need for a "forward-zone: section" all together. This built-in "root zone" sends DNS requests to the up-stream public DSN servers. Verify that your host firewall doesn't have rules restricting port 53 to using only your ISP's DNS IP addresses.
AUTHORJoe Barbish ⟨dns2blackhole@a1poweruser.com⟩
Visit the GSP FreeBSD Man Page Interface. |