Skip to content

a very silly, very shitty little DNS cache warmup tool born of sleep deprivation, far too much coffee, and a poor moral compass

License

Notifications You must be signed in to change notification settings

saint-lascivious/haha_cache_go_brrr

Repository files navigation

haha_cache_go_brrr

a very silly, very shitty little DNS cache warmup tool born of sleep deprivation, far too much coffee, and a poor moral compass

Description

haha_cache_go_brrr is a cache preloading tool designed for populating the initial and prefetch caches of a recursive resolver such as Unbound DNS which backs a DNS filter or proxy such as dnsproxy or Pi-hole

Under no circumstances should haha_cache_go_brrr be run against Pi-hole (Pi-hole deliberately maintains a very short min-ttl and performs no cache prefetching), nor should it be run against any resolver endpoint that does not cache, any ISP/third party upstream DNS providers, or in fact any DNS endpoint that you do not control. This tool has been designed to support the Unbound DNS resolver by supplying cache pressure and prefetch rules when unbound is functioning as a caching recursive resolver with large buffers, cache slabs, a high cache-min-ttl, multiple threads, multi-threaded udp and libevent if the server is expected to process very large amounts of queries.

Note: If you intend to receive a recursive reply from an Unbound DNS server located anywhere other than localhost you may need to adjust your access-control definitions.

Features

  • Set the total domains queried

Users have the ability to set the total number of domains parsed out from the top domains CSV.

default: 500
  • Set the resolver address and port

Set a custom resolver address (if not running on this machine) and custom port. Uses localhost and Unbound DNS default port by default.

PLEASE ENSURE YOU CONTROL THESE ENDPOINTS

default: resolver_address="127.0.0.1"
default: resolver_port="5335"
  • Set the flags used to form the dig queries

More information on the dig command structure can be found here.

default: dig_flags="+short +time=20 +tries=3"
  • Set your own top domains CSV URL and choose a domain column within it

Provide your own top domains CSV with the ability to set which column is used as each top domain list isn't guaranteed to have the domain in the same CSV column. Uses the Majestic Million top domain list.

default: domain_list_url="https://downloads.majestic.com/majestic_million.csv"
default: csv_column="3"
  • Query an additional custom domain list

Users can provide an addition list of domains, one per line, in the user created /etc/haha_cache_go_brrr/custom_domains file. If present this list is parsed and queried after the top N domains.

  • Parallel queries

Ability to optionally split the master dig command list into four and run using gnu parallel. Set use_parallel="yes" to enable.

default: use_parallel=""
  • Runs as a service with service timer

The systemd service timer approach ensures that haha_cache_go_brrr runs ten minutes after boot to give the system plenty of time to come up before applying cache pressure.

Usage

sudo apt-get install dns-utils parallel
  • Download haha_cache_go_brrr
cd /usr/local/bin/
sudo wget https://raw.githubusercontent.com/saint-lascivious/haha_cache_go_brrr/main/haha_cache_go_brrr
chmod +x /usr/local/bin/haha_cache_go_brrr
  • Run
haha_cache_go_brrr

Optional (not recommended)

  • Download haha_cache_go_brrr service files:
cd /etc/systemd/system/
sudo wget https://raw.githubusercontent.com/saint-lascivious/haha_cache_go_brrr/main/haha_cache_go_brrr.service
sudo wget https://raw.githubusercontent.com/saint-lascivious/haha_cache_go_brrr/main/haha_cache_go_brrr.timer
  • Start The haha_cache_go_brrr Service
sudo systemctl enable haha_cache_go_brrr.timer
sudo systemctl start haha_cache_go_brrr.timer

To-Do

  • Commandline Entensions

Pass custom arguments to haha_cache_go_brrr directly from the command line

  • External Variables File

Source variables from an external file in /etc/haha_cache_go_brrr perhaps

  • Suggestions?

Reasonable suggestions within the scope of the project are welcomed. Contact details are available below.

Related Projects

  • unbound Unbound is a validating, recursive, and caching DNS resolver.

  • unbound-config configuration file for unbound recursive dns resolver

  • unbound-get-root-hints simple systemd timer to periodically update root.hints for unbound recursive resolver

  • pi-hole A black hole for Internet advertisements

  • dnsproxy Simple DNS proxy with DoH, DoT, DoQ and DNSCrypt support

Uninstall

sudo systemctl stop haha_cache_go_brr.timer
sudo systemctl disable haha_cache_go_brr.timer
sudo rm /etc/systemd/system/haha_cache_go_brrr.service
sudo rm /etc/systemd/system/haha_cache_go_brrr.timer
sudo rm -rf /etc/haha_cache_go_brr
sudo rm /usr/local/bin/haha_cache_go_brrr

Contact

alt text

About

a very silly, very shitty little DNS cache warmup tool born of sleep deprivation, far too much coffee, and a poor moral compass

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages