swoiow / blocked

A coredns plugin to block domains/query.
Mozilla Public License 2.0
0 stars 0 forks source link
ad-blocker blocked coredns-plugin dns

blocked

TEST RELEASE (in docker)

A coredns plugin to block domains/query.

Usage

.:1053 {
    errors
    bind 127.0.0.1
    forward . 223.5.5.5:53

    log . {
        class all
    }

    blocked {
        bootstrap_resolvers 223.5.5.5:53 114.114.114.114:53

        intercept/check A AAAA HTTPS CNAME

        # to reload cache_data/black_list/white_list, default: 5days. 
        # Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
        interval/reload 86400s

        # bloom filter capacity & rate. default: 250_000 0.001
        size_rate 250_000 0.001

        # enable log, remove is disable
        log

        # hostname query, default: refused. Options: ignore / refused
        hostname_query refused

        # blocked_query_response, default: soa. Options: soa / zero / hinfo / no-ans / refused
        #  can config some special for qtypes
        resp_type zero {
            refused ANY AAAA HTTPS MX PTR SRV CNAME
            zero AAAA
        }

        # covert domain in wildcard, and compare all to filter
        #  if use it black_list must used `local+` prefix to skip domain valid
        wildcard

        # (the last cache-data will be ues) load cache file from local or remote
        cache_data https://example.com/rules.data
        cache_data <AbsolutePath>/rules.data

        # black list to block query, load rules from local or remote.
        #  use `local+` will skip the domain verify means allow any line exclude comment
        black_list <AbsolutePath>/list.txt
        black_list local+<AbsolutePath>/list.txt
        black_list https://example.com/reject-list.txt

        # white list to disable block
        white_list <AbsolutePath>/white-list.txt
        white_list https://example.com/white-list.txt
    }
}

Feature

TODO

Changelog & Note