In the name of testing things, im trying out Blocky, whats blocky? Its DNS server, like pihole/adguardhome. As im pretty convenient using pihole, with the great web interface management, this Blocky only using single flat file for configuration. Then im just thinking, lets go yolo wipe pihole and deploy blocky. Then issues comes, my ADLIST and BLOCKLIST how i can import them, or at least had them listed. Here is a snippet blocky config how blocky block things:

blocking:
  blackLists:
    ads:
      - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

Feel familiar with it? Yes, that's the default URL on new Pi-Hole installation, but as usage over time there is many list we added, so how do we export / import them? There is a way, as we know pihole depends on their gravity.db to store things like adlist and blocklist, we can use sqlite3 to query it. In simple terms, we queries the domain list from the gravity:

sqlite3 ./gravity.db "SELECT domain FROM domainlist WHERE enabled=1 AND type=0;
sqlite3 ./gravity.db "SELECT domain FROM domainlist WHERE enabled=1 AND type=1;
sqlite3 ./gravity.db "SELECT domain FROM domainlist WHERE enabled=1 AND type=2;
sqlite3 ./gravity.db "SELECT domain FROM domainlist WHERE enabled=1 AND type=3;

Taking from pihole docs, this is what type means:

0 = exact whitelist
1 = exact blacklist
2 = regex whitelist
3 = regex blacklist

For every queries it will list the URL that we can copy pasted to blocky config.

The last part is deploying blocky, im using docker to deploy blocky.

# Compose
version: "2.1"
services:
  blocky:
    image: spx01/blocky
    container_name: blocky
    restart: unless-stopped
    ports:
      - "53:53/tcp" # DNS port
      - "53:53/udp" # DNS port
      - "4000:4000/tcp" # Prometheus port
    environment:
      - TZ=Asia/Jakarta # Optional to synchronize the log timestamp with host
    volumes:
      # config file
      - ./config.yml:/app/config.yml

So how my config become? This is my config after tinkering few hours.

# Config.yml
bootstrapDns: 8.8.8.8
upstream:
  default:
    - https://dns.nextdns.io/3f43b6
    - 45.90.28.66
    - 45.90.30.66
    - 192.168.0.1

#customDNS:
#  mapping:
#    customhost.localdomain: 192.168.0.2

filtering:
  queryTypes:
    - PTR

# Get your client name from router `mypc.local`
clientLookup:
  upstream: 192.168.0.1

blocking:
  blackLists:
    ads:
      - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
      - https://raw.githubusercontent.com/DRSDavidSoft/additional-hosts/master/domains/blacklist/adservers-and-trackers.txt
      - https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-malware.txt
      - https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt
      - https://raw.githubusercontent.com/notracking/hosts-blocklists/master/hostnames.txt
      - https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
      - https://gitlab.com/my-privacy-dns/matrix/matrix/-/raw/master/source/tracking/domains.list
      - https://raw.githubusercontent.com/r-a-y/mobile-hosts/master/AdguardApps.txt
      - https://raw.githubusercontent.com/r-a-y/mobile-hosts/master/AdguardMobileAds.txt
      - https://raw.githubusercontent.com/FadeMind/hosts.extras/master/StreamingAds/hosts
      - https://raw.githubusercontent.com/w13d/adblockListABP-PiHole/master/Spotify.txt
      - https://raw.githubusercontent.com/DRSDavidSoft/additional-hosts/master/domains/blacklist/adservers-and-trackers.txt
      - https://raw.githubusercontent.com/deathbybandaid/piholeparser/master/Subscribable-Lists/ParsedBlacklists/AdAway-Default-Blocklist.txt
      - https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
      - https://v.firebog.net/hosts/Easyprivacy.txt
      - https://raw.githubusercontent.com/deathbybandaid/piholeparser/master/Subscribable-Lists/ParsedBlacklists/FadeMind-addSpam.txt
      - https://raw.githubusercontent.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites/master/hacked-domains.list
      - https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/AmazonFireTV.txt
      - https://raw.githubusercontent.com/mitchellkrogza/Stop.Google.Analytics.Ghost.Spam.HOWTO/master/output/domains/INACTIVE/list
      - https://raw.githubusercontent.com/nickspaargaren/no-google/master/categories/analytics.txt
      - https://raw.githubusercontent.com/nickspaargaren/no-google/master/categories/analyticsparsed
#      - https://raw.githubusercontent.com/kowith337/PersonalFilterListCollection/master/hosts/hosts_facebook0.txt
      - https://raw.githubusercontent.com/anudeepND/blacklist/master/facebook.txt
      - https://raw.githubusercontent.com/r-a-y/mobile-hosts/master/AdguardMobileSpyware.txt
      - https://raw.githubusercontent.com/XionKzn/PiHole-Lists/master/PiHole_HOSTS_Spyware.txt
      - https://raw.githubusercontent.com/deathbybandaid/piholeparser/master/Subscribable-Lists/ParsedBlacklists/WindowsSpyBlocker81.txt
      - https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt
      - https://gitlab.com/ZeroDot1/CoinBlockerLists/raw/master/list.txt
      - https://gitlab.com/ZeroDot1/CoinBlockerLists/raw/master/list_browser.txt
      - https://gitlab.com/ZeroDot1/CoinBlockerLists/raw/master/hosts
      - https://gitlab.com/ZeroDot1/CoinBlockerLists/raw/master/hosts_optional
      - https://raw.githubusercontent.com/anudeepND/blacklist/master/CoinMiner.txt
      - https://raw.githubusercontent.com/austinheap/sophos-xg-block-lists/master/nocoin.txt
      - https://raw.githubusercontent.com/pirat28/IHateTracker/master/iHateTracker.txt
      - https://raw.githubusercontent.com/deathbybandaid/piholeparser/master/Subscribable-Lists/ParsedBlacklists/CryptoWall-Ransomware-C2-Domain-blocklist.txt
      - https://raw.githubusercontent.com/deathbybandaid/piholeparser/master/Subscribable-Lists/ParsedBlacklists/Locky-Ransomware-C2-Domain-Blocklist.txt
      - https://raw.githubusercontent.com/XionKzn/PiHole-Lists/master/Cerber_Ransomware.txt
      - https://raw.githubusercontent.com/deathbybandaid/piholeparser/master/Subscribable-Lists/ParsedBlacklists/Ransomware-Domain-Blocklist.txt
      - https://raw.githubusercontent.com/deathbybandaid/piholeparser/master/Subscribable-Lists/ParsedBlacklists/TeslaCrypt-Ransomware-C2-Domain-Blocklist.txt
      - https://raw.githubusercontent.com/deathbybandaid/piholeparser/master/Subscribable-Lists/ParsedBlacklists/TeslaCrypt-Ransomware-Payment-Sites-Domain-Blocklist.txt
      - https://raw.githubusercontent.com/deathbybandaid/piholeparser/master/Subscribable-Lists/ParsedBlacklists/TorrentLocker-Ransomware-C2-Domain-Blocklist.txt
      - https://raw.githubusercontent.com/deathbybandaid/piholeparser/master/Subscribable-Lists/ParsedBlacklists/TorrentLocker-Ransomware-Payment-Sites-Domain-Blocklist.txt
      - https://gitlab.com/Kurobeats/phishing_hosts/raw/master/hosts
      - https://raw.githubusercontent.com/MetaMask/eth-phishing-detect/master/src/hosts.txt
      - |
        slb-p2p.vcloud.ks-live.com
        api.ad.xiaomi.com
        badgen.net
        sdkconfig.ad.xiaomi.com
        example.org
        xtrapath2.izatcloud.net
        (\.|^)unityads$
        rawxgnuwolda.com
        found.io
        usamin.cc
        addresseepaper.com
        sheschemetraitor.com
        ku2d3a7pa8mdi.com
        creepingbrings.com
        dwightadjoining.com
        banquetunarmedgrater.com
        limurol.com
        notifyoutspoken.com
        unseenreport.com
  whiteLists:
    ads:
      - whitelist.txt
      - |
        wl.spotify.com
        t.co
        dc.services.visualstudio.com
        c.microsoft.com
        js.monitor.azure.com
        assets.adobedtm.com
        pbs.twimg.com
        video.twimg.com
        pastebin.com
        m.youtube.com
        disqus.com
        twitter.com
        yt3.ggpht.com
        stackoverflow.com
        outlook.live.com
        youtube.com
        google.com
        picsum.photos
        imgur.com
        (\.|^)micloud\.xiaomi\.net$
        (\.|^)microsoft\.com$
        (\.|^)xiaomi\.com$
        (\.|^)miui\.com$
        /facebook/
        /fbcn/
        /instagram/
        /sendgrid/
        cdn.jsdelivr.net
        fonts.gstatic.com
        alive.github.com
        /github/
        /matomo/
        /stripe/

  clientGroupsBlock:
    default:
      - ads
  refreshPeriod: 60m

port: 53
#httpPort: 4000

caching:
  prefetching: true

# Monitoring part 
#prometheus:
#  enable: true
#  path: /metrics

#queryLog:
#  type: mysql
#  target: blockyuser:blockypass@tcp(192.168.0.2:3310)/blocky?charset=utf8mb4&parseTime=True&loc=Local
#  logRetentionDays: 30

sources:

Previous Post Next Post

Add a comment