-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfull_reference_config.yaml
More file actions
executable file
·1157 lines (1024 loc) · 54.8 KB
/
full_reference_config.yaml
File metadata and controls
executable file
·1157 lines (1024 loc) · 54.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# File: full_reference_config.yaml
# Version: 1.80.0
# Updated: 21-Apr-2026 18:35 CEST
#
# Description:
# Complete reference configuration for sdproxy. Every supported option is
# documented here with its type, default, and guidance notes. Copy this file,
# strip what you don't need, and adjust to taste. The comments are the manual.
#
# Changes:
# 1.80.0 - [DOCS] Updated `secure` upstream strategy documentation to reflect
# the new fault-tolerant behavior of `loose` mode filtering.
# 1.79.0 - [DOCS] Updated budget terminology to accurately reflect the interactions
# of `FREE`, `ALLOW`, and `unlimited` limits with umbrella budgets.
# 1.78.0 - [FEAT] Added `support_ip_version` to selectively filter resource
# loading for IPv4 and IPv6 globally.
# =============================================================================
# SERVER
# =============================================================================
server:
# Listener addresses. Multiple addresses supported per protocol.
# Omit any section to disable that protocol entirely.
listen_udp: ["0.0.0.0:53", "127.0.0.1:5353"]
listen_tcp: ["0.0.0.0:53"]
listen_dot: ["0.0.0.0:853"]
listen_doh: ["0.0.0.0:443"] # HTTP/1.1, HTTP/2, and HTTP/3 (QUIC)
listen_doq: ["0.0.0.0:853"] # DNS over QUIC — RFC 9250
# Select which IP versions to support globally in resource loaders.
# This affects Category lists, ASN databases, Hosts files, and DHCP Leases.
# Any IP or subnet found in these sources that does not match this setting
# will be discarded during the loading phase to save memory and CPU.
#
# Options: "both" (default), "ipv4", "ipv6".
#
# Note: This setting can be overridden at runtime via command-line flags
# (-4 or -ipv4 for IPv4-only, -6 or -ipv6 for IPv6-only). If both IPv4
# and IPv6 flags are passed, it resolves to "both".
support_ip_version: "both"
# Number of goroutines in the UDP worker pool.
# On Linux each worker gets its own SO_REUSEPORT socket — no shared channel.
# Default: 10. Tune to number of CPU cores on fast hardware.
udp_workers: 10
# TLS certificate and private key for DoT / DoH / DoQ.
# When absent and any encrypted listener is configured, a self-signed
# certificate is generated automatically at startup.
tls_cert: "/etc/sdproxy/cert.pem"
tls_key: "/etc/sdproxy/key.pem"
# Hard memory ceiling in MiB, applied via runtime/debug.SetMemoryLimit.
# Triggers aggressive GC before the process hits the limit.
# 0 = disabled (Go runtime default). Recommended for routers: 64–128.
memory_limit_mb: 64
# ---------------------------------------------------------------------------
# DNS ACCESS CONTROL LISTS (Public Resolver Hardening)
# ---------------------------------------------------------------------------
# Limit which IPs are allowed to query this DNS server. Crucial for limiting
# exposure if bound to public interfaces. Accepts IPs or CIDRs.
# Queries from denied/unauthorized IPs are silently dropped.
acl:
# Explicitly denied IPs or Subnets (e.g. ["1.2.3.4", "10.10.10.0/24"]).
# Overrides allow list.
deny: []
# Explicitly allowed IPs or Subnets. If left empty, ALL IPs are allowed
# (provided they are not in the deny list).
# e.g., ["192.168.0.0/16", "10.0.0.0/8", "127.0.0.1"]
allow: []
# ---------------------------------------------------------------------------
# PER-CLIENT RATE LIMITING (Public Resolver Hardening)
# ---------------------------------------------------------------------------
# Essential when exposing sdproxy to the public internet. Prevents malicious
# actors from exhausting global query slots, participating in amplification
# attacks, or causing Denial of Service. Violators are silently dropped.
rate_limit:
enabled: false
# Sustained queries per second allowed per client.
qps: 20
# Maximum burst size allowed before the limit is enforced.
burst: 100
# Subnet grouping for rate limiting. Attackers often rotate IPs within a /64
# or /24. These masks group traffic by prefix.
# Default: 32 (IPv4) and 128 (IPv6) - tracks individual IPs.
ipv4_prefix_length: 32
ipv6_prefix_length: 128
# Cap the absolute maximum number of tracked IPs/subnets to prevent
# out-of-memory (OOM) situations during intense spoofed source-IP floods.
# Default: 1000.
max_tracked_ips: 1000
# IPs or Subnets that explicitly bypass rate limiting and the penalty box entirely.
# These entries will have unlimited access and will never be blackholed.
# E.g., ["127.0.0.1", "192.168.1.50", "10.0.0.0/8"]
exempt: []
# ── PENALTY BOX ────────────────────────────────────────────────────────
# Automatically blackholes clients who repeatedly violate rate limits or
# transmit malformed/exploitative payloads. While in the penalty box, ALL
# traffic from that IP/Subnet is silently dropped to preserve I/O capacity.
penalty_box:
enabled: true
# How many consecutive dropped queries trigger a blackhole event.
# Sending malformed payloads incurs an instant ban regardless of threshold.
strike_threshold: 100
# Duration (in minutes) to keep the client completely blackholed.
ban_duration_min: 15
# ---------------------------------------------------------------------------
# DNS REBINDING PROTECTION (Public Resolver Hardening)
# ---------------------------------------------------------------------------
# Protects users and internal networks from DNS Rebinding and SSRF attacks.
# When true, sdproxy drops any upstream response containing private/bogon IPs
# (RFC1918, loopback, ULAs) returning NXDOMAIN. Default: false.
rebinding_protection: false
# Drop all AAAA (IPv6) query responses, returning NOERROR with an empty
# answer section. Useful on IPv4-only networks to avoid IPv6 resolution
# delays on clients that still try. Default: false.
filter_aaaa: false
# When true, IP addresses in A/AAAA responses from upstream are checked
# against parental category allow/blocklists. If an IP matches a category
# blocked for the client, it is filtered out of the response. If all IPs are
# filtered, the query is blocked completely. Default: false.
filter_ips: false
# When true, PTR queries for IPs that do not appear in any identity source
# (hosts files / leases) return NXDOMAIN instead of being forwarded.
# Prevents upstream PTR leakage of LAN addresses. Default: false.
strict_ptr: false
# When true, CNAME chains in upstream responses are collapsed into a single
# A/AAAA record (the final resolved IP only). Reduces response size and
# prevents CNAME-based tracking. Default: false.
flatten_cname: false
# When true, sdproxy checks the target domain-names of CNAME, MX, NS, PTR,
# SRV, SOA, SVCB, and HTTPS records in responses against domain_policy and
# parental block rules. If a target is blocked, the query is treated as blocked.
# This check is performed before cname-flattening. Default: false.
target_name: false
# When true, responses are trimmed to include only the records that directly
# answer the query — no additional or authority records are forwarded to the
# client. Default: false.
minimize_answer: false
# When true, all IANA-obsolete / withdrawn / experimental query types (e.g.
# MD, WKS, A6) are automatically blocked with NOTIMP. Individual types can
# still be overridden via rtype_policy:. Default: false.
block_obsolete_qtypes: false
# DDR — Discovery of Designated Resolvers (RFC 9462).
# Advertises encrypted resolver endpoints to clients that support DDR.
ddr:
enabled: true
hostnames: ["dns.home.arpa"]
ipv4: ["192.168.1.1"] # When left empty, the IP of the incomimg
ipv6: [] # interface is used in the response/spoof.
# ---------------------------------------------------------------------------
# UPSTREAM EXECUTION
# ---------------------------------------------------------------------------
# Global Upstream Selection Strategy. When an upstream group has multiple unique
# IP addresses, this specifies how sdproxy uses them to resolve queries.
# "stagger" — Default. Launch query 1. If no response is received within
# `upstream_stagger_ms`, fire query 2. Fastest to respond wins.
# "round-robin" — Cycles sequentially through all available upstreams.
# "random" — Randomly selects an upstream from the group.
# "fastest" — Tracks Exponential Moving Averages (EMA) of RTT per upstream.
# Sticks to the fastest one with a 5% Epsilon-Greedy exploration
# rate to test other endpoints.
# "secure" — Queries ALL upstreams simultaneously to enforce consensus validation.
# The specific behavior is controlled by the group's `mode` setting:
# `loose` (Default): Dynamically filters out connection timeouts,
# execution errors, and any RCODE other than NOERROR
# or NXDOMAIN. Consensus is built purely from the
# healthy, valid responses that successfully arrive.
# `strict`: Demands 100% participation. All dialed upstreams MUST respond
# flawlessly. Any timeout or failure instantly aborts the query.
# Additionally, it deep-inspects the end-answers (e.g., IPs
# behind CNAMEs) to ensure they are mathematically identical
# across all upstreams.
# In both modes, NOERROR answers cannot be mixed with empty answers, and
# NULL-IPs (0.0.0.0 / ::) immediately void the consensus.
upstream_selection: "stagger"
# Upstream stagger — delay (ms) between the first upstream probe and
# subsequently spawned parallel probes. 0 = sequential (first upstream wins
# or fails before the next is tried). >0 = racing: all probes fire within
# stagger_ms of each other; fastest response wins. Default: 0.
# NOTE: Only applies when using the "stagger" strategy.
upstream_stagger_ms: 0
# Hard per-exchange deadline for upstream DNS calls, in milliseconds.
# When set, each call to an upstream receives a context.WithTimeout so a slow
# or unreachable upstream cannot hold a goroutine indefinitely.
#
# Without this setting the upstream's own TCP/TLS connect timeout governs
# (typically 3–30 s depending on OS and transport). That is safe for stable
# connections but can cause goroutine pile-up when a DoH server is slow or
# a QUIC path has high packet loss.
#
# Guidelines:
# 0 — no deadline (default; keep for stable single-upstream setups)
# 3000–5000 — recommended for home routers with WAN upstreams
# 1000–2000 — aggressive; only useful with stagger racing so a fast
# upstream wins before the timeout fires on slower ones
upstream_timeout_ms: 0
# Global bootstrap DNS servers for resolving upstream hostnames that have no
# per-URL bootstrap IPs appended with #. Accepts "ip" or "ip:port" format.
# Entries without a port default to :53. Per-URL bootstrap IPs always win.
bootstrap_servers:
- "1.1.1.1"
- "9.9.9.9"
# TTL (seconds) placed on every DNS record that sdproxy synthesises locally.
# Applies to:
# • DDR responses — SVCB, A, AAAA, and HTTPS records for _dns.resolver.arpa
# and resolver hostnames (RFC 9462 / RFC 9461).
# • Local identity — A, AAAA, and PTR answers served from hosts/lease files.
# • NXDOMAIN policy SOA — the fake SOA authority record injected into
# domain_policy NXDOMAIN replies so stub resolvers cache
# the negative response for this long (RFC 2308 §3).
# rtype_policy REFUSED/NOTIMP replies carry no RRs and
# are unaffected — those codes have no caching semantics.
#
# 0 = use built-in default of 60 s.
# Low values (e.g. 10) help during testing; 300–600 suits stable production
# setups. Parental-block TTL is controlled separately by the parental: section.
synthetic_ttl: 60
# =============================================================================
# LOGGING
# =============================================================================
logging:
# Per-query log lines (e.g. "[DNS] [udp] 192.168.1.5 -> example.com A | UPSTREAM").
# Set false to suppress per-query lines entirely — only init/error/parental
# lines remain. Handy on busy home routers to reduce log volume. Default: true.
log_queries: true
# Strip the date/time prefix from all log lines (log.SetFlags(0)).
# Useful when the process supervisor (systemd, procd) already timestamps logs.
# Default: false.
strip_time: false
# Include Autonomous System Number (ASN), Owner Name, and Country of the client
# IP address in the logs (when identity.ipinfo_asn is configured).
# Default: false.
log_asn_details: false
# =============================================================================
# CACHE
# =============================================================================
cache:
enabled: true
# Maximum number of DNS responses to cache. Each entry is ~300–600 bytes.
# 5000 entries ≈ 2–3 MB. Tune to available RAM. Default: 5000.
size: 5000
# Minimum TTL (seconds) to enforce on cached responses, overriding shorter
# upstream TTLs. 0 = honour upstream TTL as-is. Default: 0.
min_ttl: 0
# Maximum TTL (seconds) to cap on cached responses. 0 = no cap. Default: 0.
# Useful to force periodic re-resolution of high-TTL records.
max_ttl: 0
# TTL (seconds) to apply to NXDOMAIN and NODATA (empty answer) responses.
# 0 = use the TTL from the SOA record in the upstream response.
# When no SOA is present, falls back to min_ttl. Default: 0.
negative_ttl: 0
# Extra seconds beyond TTL expiry during which a stale entry may still be
# served (RFC 8767 serve-stale). A background revalidation fires immediately.
# 0 = disabled (default). Recommended: 30–300 for resilience on flaky WANs.
stale_ttl: 0
# Background prefetch: seconds before TTL expiry to trigger a refresh for
# popular entries. 0 = disabled. Pair with prefetch_min_hits. Default: 0.
# Recommended pairing: prefetch_before: 10, prefetch_min_hits: 2
prefetch_before: 0
# Minimum number of cache hits an entry must accumulate before it qualifies
# for prefetch. Prevents pre-fetching one-off queries. Default: 0.
# Recommended pairing: prefetch_before: 10, prefetch_min_hits: 2
prefetch_min_hits: 0
# How often (seconds) the background sweeper scans all cache shards for
# entries whose stale window has passed and reclaims their memory.
# 0 = default 60 s.
#
# The sweeper does NOT affect query correctness — CacheGet rejects expired
# entries on read regardless. The sweeper only frees memory.
#
# Lower values reclaim RAM faster but add background CPU:
# 15–30 s — low-RAM routers (32–64 MB) or large cache sizes
# 60 s — default, suitable for most home routers
# 120 s+ — quiet environments where memory is not a concern
sweep_interval_s: 60
# NXDOMAIN, rtype_policy blocks, filter_aaaa, strict_ptr, obsolete qtypes.
# On repeat queries the cache hit at step 3 skips domain walks, policy
# map lookups, and qtype checks entirely. Default: false.
cache_synthetic: false
# Cache local A/AAAA/PTR responses from hosts_files / *_leases sources.
# WARNING: only safe when synthetic_ttl ≤ identity.poll_interval.
# If synthetic_ttl > poll_interval, stale local addresses may be served
# in the gap between a file change and the next poll. Default: false.
cache_local_identity: false
# Cache upstream NXDOMAIN and NODATA (NOERROR + empty answer) responses.
# Set false to always forward negative lookups upstream — useful when
# upstream blocklists change frequently. Default: true (RFC 2308).
cache_upstream_negative: true
# Sort A/AAAA IP addresses in the Answer section before sending them to the client.
# Because the cache is updated with the new order, this allows true round-robin
# or random rotation of IP lists per DNS request.
# Only affects record sets that contain 2 or more A/AAAA responses.
# Valid options: "none", "round-robin", "random", "ip-sort". Default: "none".
answer_sort: "none"
# =============================================================================
# IDENTITY
# =============================================================================
# Maps IP addresses and MAC addresses to hostnames using local files.
# Enables:
# • Local A/AAAA/PTR responses without upstream forwarding.
# • Client name resolution for log lines and {client-name} URL substitution.
# • MAC-to-name mapping for ARP-identified clients.
#
# All file formats are parsed incrementally — only changed files are re-read.
identity:
# Standard hosts file(s) — one IP per line followed by one or more
# space-separated hostnames. Inline comments (#) are stripped.
hosts_files:
- "/etc/hosts"
# hosts_files:
# - "/etc/hosts"
# - "/tmp/hosts/odhcpd" # OpenWrt dnsmasq+odhcpd
# dnsmasq flat-file lease database.
# Format: <expiry> <mac> <ip> <hostname> <client-id> (one per line).
# Hostname '*' means the client didn't supply one — entry is skipped.
dnsmasq_leases: []
# dnsmasq_leases:
# - "/tmp/dhcp.leases"
# ISC DHCP block-structured lease files.
# Only active/static bindings are imported; last active block for a given
# IP wins (ISC append semantics).
isc_leases: []
# isc_leases:
# - "/var/lib/dhcp/dhcpd.leases"
# Kea DHCP4 CSV lease files.
# Only state=0 (active) rows are imported. Header row is skipped.
kea_leases: []
# kea_leases:
# - "/var/lib/kea/kea-leases4.csv"
# odhcpd internal state files.
# Used when running odhcpd standalone (no dnsmasq).
# Hostname '-' means no name was supplied — entry is skipped.
odhcpd_leases: []
# odhcpd_leases:
# - "/var/lib/odhcpd/dhcp.leases"
# IPinfo ASN Databases (JSON or GZ)
# Allows routing clients dynamically based on their Autonomous System.
# Supports both the Free tier (IP-Ranges) and Lite tier (CIDR networks).
# Get free databases from:
# Free: https://ipinfo.io/data/free/asn.json.gz?token=YOUR_TOKEN
# Lite: https://ipinfo.io/data/ipinfo_lite.json.gz?token=YOUR_TOKEN
# Supports both remote URLs and local files. GZIP is auto-detected natively.
ipinfo_asn: []
# ipinfo_asn:
# - "https://ipinfo.io/data/ipinfo_lite.json.gz?&token=YOUR_TOKEN"
# - "/etc/sdproxy/asn.json"
# Directory where downloaded and processed IPinfo ASN databases are cached.
# This makes the databases persistent across reboots and speeds up startup.
# If empty, remote databases are kept only in memory.
# Default: "/var/lib/sdproxy/asn"
asn_cache_dir: "/var/lib/sdproxy/asn"
# How often to check for newer versions of the IPinfo ASN databases.
# Accepts Go duration strings (e.g., "6h", "24h").
# Default: "6h". Set to "0s" or empty to load once at startup and never poll.
asn_poll_interval: "6h"
# FastStart: when true, sdproxy will immediately start answering queries at boot
# even if ASN databases have not finished downloading/parsing. This makes
# startup non-interruptive, but some traffic might lack ASN routing initially.
# When false, sdproxy waits for the ASN DB to load before starting.
# Default: false.
asn_fast_start: false
# How often (seconds) to re-check all local identity files (leases/hosts) for changes.
# mtime is checked first — unchanged files are never re-read or re-parsed.
# 0 = load once at startup and never poll again.
poll_interval: 60
# =============================================================================
# QUERY-TYPE POLICY
# =============================================================================
# Maps specific DNS RR query types to an immediate action or RCODE.
# Fired before cache, identity, DDR, and upstream on every query.
#
# Valid actions: "BLOCK" (null-ip/NXDOMAIN), "DROP" (silently ignore), or any standard DNS RCODE (e.g., "REFUSED", "NXDOMAIN").
#
# Note: You can group multiple QTypes by separating them with commas.
rtype_policy:
"ANY, AXFR, IXFR": "DROP"
"HINFO, RESINFO": "NOTIMP"
# You can also supply an external file with a list of RTypes for a specific action.
# The file should contain one RType per line. Empty lines and inline comments (#) are ignored.
# rtype_policy_files:
# "/etc/sdproxy/drop_rtypes.txt": "DROP"
# "/etc/sdproxy/block_rtypes.txt": "BLOCK"
# =============================================================================
# DOMAIN POLICY
# =============================================================================
# Maps domain suffixes to an immediate action or RCODE — no upstream forwarding.
# A single entry covers the apex AND all subdomains.
# Valid actions: "BLOCK" (null-ip/NXDOMAIN), "DROP" (silently ignore), or any standard DNS RCODE.
#
# Fired before DDR, identity, and routing.
#
# IMPORTANT: domain_policy fires BEFORE domain_routes. Don't add zones here
# that are also in domain_routes — the block wins and routing never fires.
#
# IMPORTANT: most-specific-wins semantics apply. "sub.example.com" takes
# precedence over "example.com" when both are present.
#
# Note: You can group multiple Domains by separating them with commas.
domain_policy:
# =================================================================================================
# DOCUMENTATION, EXAMPLES & TESTING
# Domains reserved strictly for use in documentation, sample code, and local testing.
# =================================================================================================
"example, example.com, example.net, example.org": "NXDOMAIN" # RFC 2606 | Reserved for documentation and examples
"invalid, test": "NXDOMAIN" # RFC 6761 | Reserved for obviously invalid names and testing
# =================================================================================================
# LOCAL & PRIVATE NETWORK SUFFIXES
# Domains commonly used (formally or informally) for local routing, home networks, and LANs.
# =================================================================================================
"belkin, router, modem, gw": "NXDOMAIN" # Common gateway/captive portal administration sinkholes
"corp, domain, internal, intranet, priv, private, main": "NXDOMAIN" # Common internal network suffixes
"lan, localdomain, workgroup": "NXDOMAIN" # Informally used for local area networks and Windows
"home.arpa, localhost, local": "NXDOMAIN" # RFC 8375/6761/6762 | Special-use and loopback routing
# =================================================================================================
# IPv4 REVERSE MAPPING & SPECIAL BLOCKS (in-addr.arpa)
# Reverse DNS zones for reserved, private, multicast, and special-purpose IPv4 ranges.
# =================================================================================================
"0.in-addr.arpa, 127.in-addr.arpa": "NXDOMAIN" # RFC 1122 | IPv4 "This host on this network" and Loopback
"10.in-addr.arpa": "NXDOMAIN" # RFC 6761 | Private IPv4 reverse mapping (10.0.0.0/8)
"254.169.in-addr.arps": "NXDOMAIN" # RFC 3927 | IPv4 Link-Local (169.254.0.0/16) reverse mapping
# Grouped 172.16.0.0/12 block - RFC 6761 | Private IPv4 reverse mapping (172.16.0.0/12)
"16.172.in-addr.arpa, 17.172.in-addr.arpa, 18.172.in-addr.arpa, 19.172.in-addr.arpa, 20.172.in-addr.arpa, 21.172.in-addr.arpa, 22.172.in-addr.arpa, 23.172.in-addr.arpa, 24.172.in-addr.arpa, 25.172.in-addr.arpa, 26.172.in-addr.arpa, 27.172.in-addr.arpa, 28.172.in-addr.arpa, 29.172.in-addr.arpa, 30.172.in-addr.arpa, 31.172.in-addr.arpa": "NXDOMAIN"
"170.0.0.192.in-addr.arpa, 171.0.0.192.in-addr.arpa": "NXDOMAIN" # RFC 8880 | Special-purpose IPv4 reserved for NAT64/DNS64
"168.192.in-addr.arpa": "NXDOMAIN" # RFC 6761 | Private IPv4 reverse mapping (192.168.0.0/16)
"100.51.198.in-addr.arpa, 113.0.203.in-addr.arpa": "NXDOMAIN" # RFC 5737 | Reverse mapping for TEST-NET-2/3
# Grouped IPv4 Multicast (224-239) - RFC 5771
"224.in-addr.arpa, 225.in-addr.arpa, 226.in-addr.arpa, 227.in-addr.arpa, 228.in-addr.arpa, 229.in-addr.arpa, 230.in-addr.arpa, 231.in-addr.arpa, 232.in-addr.arpa, 233.in-addr.arpa, 234.in-addr.arpa, 235.in-addr.arpa, 236.in-addr.arpa, 237.in-addr.arpa, 238.in-addr.arpa, 239.in-addr.arpa": "NXDOMAIN"
# Grouped IPv4 Reserved/Class E (240-254) - RFC 3330
"240.in-addr.arpa, 241.in-addr.arpa, 242.in-addr.arpa, 243.in-addr.arpa, 244.in-addr.arpa, 245.in-addr.arpa, 246.in-addr.arpa, 247.in-addr.arpa, 248.in-addr.arpa, 249.in-addr.arpa, 250.in-addr.arpa, 251.in-addr.arpa, 252.in-addr.arpa, 253.in-addr.arpa, 254.in-addr.arpa": "NXDOMAIN"
"255.in-addr.arpa": "NXDOMAIN" # RFC 919 | IPv4 Limited Broadcast address reverse mapping (255.0.0.0/8)
# =================================================================================================
# IPv6 REVERSE MAPPING (ip6.arpa)
# Reverse DNS zones for IPv6 addresses and Link-Local blocks.
# =================================================================================================
"c.f.ip6.arpa, d.f.ip6.arpa": "NXDOMAIN" # RFC 4193 | IPv6 Unique Local Address (ULA) reverse mapping
"8.e.f.ip6.arpa, 9.e.f.ip6.arpa, a.e.f.ip6.arpa, b.e.f.ip6.arpa": "NXDOMAIN" # RFC 6762 | IPv6 Link-Local (fe80::/10) reverse mapping, mDNS restricted
# =================================================================================================
# INFRASTRUCTURE, PROTOCOL & SERVICE DISCOVERY
# Reserved namespaces used for DNS routing, protocol discovery, and server identification.
# =================================================================================================
"bind, server": "DROP" # RFC 4892 | Identifying a server instance
"as112.arpa": "NXDOMAIN" # RFC 7535 | Sinking DNS traffic for reverse IP lookups
"in-addr-servers.arpa, ip6-servers.arpa": "NXDOMAIN" # RFC 5855 | Nameservers for the reverse domains
"eap-noob.arpa, eap.arpa": "NXDOMAIN" # Out-Of-Band authentication and EAP framework
"resolver.arpa, service.arpa": "NXDOMAIN" # RFC 9462/9665 | Discovery of Designated Resolvers (DDR) / SRP
"uri.arpa, urn.arpa": "NXDOMAIN" # RFC 3405 | Resolving URIs/URNs via DDDS
"6tisch.arpa, ipv4only.arpa, iris.arpa, wpad": "NXDOMAIN" # Miscellanous Infrastructure / Discovery
# =================================================================================================
# ALTERNATIVE NAMESPACES, WEB3 & DARKNETS
# Pseudo-TLDs intended for resolution outside the standard global DNS hierarchy.
# =================================================================================================
"alt, exit, i2p, onion": "NXDOMAIN" # Alt networks, Tor, and I2P routing
"ape, basenji, bitcoin, crypto, dao, eth, nft, onchain, polygon, sol, wallet, x": "NXDOMAIN" # Web3 and Crypto Onchain Namespaces
# =================================================================================================
# OBSOLETE HISTORICAL PSEUDO-TLDS & DELETED TLDs
# Legacy network namespaces and early internet domains that are no longer in active use.
# =================================================================================================
"bitnet, csnet, decnet, fidonet, mailnet, nato, uucp": "NXDOMAIN"
# =================================================================================================
# OBSOLETE & ANOMALOUS COUNTRY CODE TLDs (ccTLDs)
# Retired domains for dissolved nations, plus anomalous legacy ccTLDs (like .su) often sinkholed.
# =================================================================================================
"an, cs, dd, su, tp, um, yu, zr": "NXDOMAIN"
# =================================================================================================
# EXCEPTIONALLY RESERVED COUNTRY CODES (Not Delegated)
# ISO 3166-1 codes that are active/reserved but strictly prohibited from global DNS delegation.
# =================================================================================================
"cp, dg, ea, ez, fx, ic, ta, un": "NXDOMAIN"
# You can also supply an external file with a list of Domains for a specific action.
# The file should contain one domain/suffix per line. Empty lines and inline comments (#) are ignored.
# domain_policy_files:
# "/etc/sdproxy/adservers.txt": "NXDOMAIN"
# =============================================================================
# UPSTREAM GROUPS
# =============================================================================
# The "default" group is required — all other groups are optional.
#
# TWO YAML FORMS — both are valid:
#
# Traditional (List of Strings):
# default:
# - "udp://1.1.1.1:53"
#
# Advanced (Mapped with Strategy override per-group):
# default:
# strategy: "fastest"
# servers:
# - "udp://1.1.1.1:53"
#
# PROTOCOL SCHEMES
# udp://host:port Plain DNS over UDP (RFC 1035). Default port: 53.
# tcp://host:port Plain DNS over TCP (RFC 1035). Default port: 53.
# dot://host:port DNS over TLS — RFC 7858. Default port: 853.
# doh://host/path DNS over HTTPS/2 with HTTP/1.1 fallback — RFC 8484.
# doh3://host/path DNS over HTTP/3 / QUIC.
# doq://host:port DNS over QUIC — RFC 9250. Default port: 853.
#
# OUTBOUND HTTP METHOD (DoH / DoH3 only)
# Append +get or +post to the URL path (before #) to control the HTTP method.
# Default is POST. +get uses RFC 8484 §4.1 GET with base64url-encoded query.
# Example: "doh://cloudflare-dns.com/dns-query+get#1.1.1.1,1.0.0.1"
#
# PER-URL BOOTSTRAP IPs (appended after #, comma-separated)
# Bypasses DNS for the upstream hostname. Always takes precedence over
# bootstrap_servers. Required for {client-name} in hostnames.
# Syntax: "scheme://host/path[+get|+post]#ip1,ip2"
#
# {client-name} SUBSTITUTION
# The literal string {client-name} in a URL is replaced at query time with
# the DHCP hostname of the querying device (resolved via identity tables).
# Useful for upstream resolvers that support per-client filtering profiles.
#
# PRIVACY NOTE
# All outgoing queries have EDNS0 options stripped (removes ECS, cookies, etc.).
# Encrypted upstreams additionally get RFC 7830/8467 padding applied.
# UDP payload size is always normalised to 4096 bytes before forwarding.
upstreams:
default:
- "udp://1.1.1.1:53"
- "doh://cloudflare-dns.com/dns-query#1.1.1.1,1.0.0.1"
kids:
- "tcp://1.1.1.3:53"
- "doh://doh.controld.com/{client-name}#76.76.2.0,76.76.10.0"
secure:
strategy: "secure"
preference: "ordered" # Valid options: "fastest" (default) or "ordered" (primary server wins)
mode: "strict" # Valid options: "loose" (default) or "strict" (deep inspection of end-answers)
servers:
- "dot://dns.quad9.net:853#9.9.9.9,149.112.112.112"
- "doh3://security.cloudflare-dns.com/dns-query+get#1.1.1.2,1.0.0.2"
local_network:
- "udp://192.168.1.1:53"
# =============================================================================
# CLIENT-BASED ROUTES (MAC, MAC glob, IP, CIDR, ASN, Name, SNI, Path)
# =============================================================================
# Maps a client identifier to a specific upstream group and/or a parental
# control group.
#
# PRECEDENCE (when multiple keys match the same client):
# MAC exact > MAC glob > IP > CIDR > ASN > Client-Name > SNI > Path
#
# Note: You can group multiple identifiers by separating them with commas.
#
# FIELDS:
# upstream — upstream group for this client. When absent and group: is
# set, the group's upstream is used as the default.
# Effective precedence: route upstream: > group upstream: > "default".
# client_name — overrides the DHCP/hosts-derived name for logs and
# {client-name} URL substitutions (optional).
# bypass_local — when true, local A/AAAA/PTR answers from hosts/leases are
# skipped; every query goes upstream. Client naming for logs
# and {client-name} still works. Default: false.
# group — links this device to a parental control profile.
#
# ── KEY FORMATS ──────────────────────────────────────────────────────────────
#
# MAC ADDRESS (exact)
# Standard colon-separated form: "aa:bb:cc:dd:ee:ff"
# Case-insensitive — normalised to lowercase at startup.
#
# PRIVATE / RANDOMIZED MAC ADDRESSES
# Modern OSes (iOS, Android, Windows 11) randomize MAC addresses by default
# to prevent tracking. This breaks static MAC-based routing and budget profiles.
# To reliably track specific devices (e.g. for kids), you must DISABLE
# "Private Wi-Fi Address" / "MAC Randomization" in the device's Wi-Fi settings
# specifically for your home network.
# Alternatively, you can catch ALL randomized MAC addresses globally using a glob.
# Randomized (Locally Administered) MACs always have the second character as
# "2", "6", "a" or "e". See the 'private/privacy macs' example below.
#
# MAC ADDRESS (glob)
# Same six-octet colon structure but with '?' and/or '*' wildcards.
#
# IP ADDRESS / CIDR SUBNET
# IPv4 or IPv6: "192.168.1.50", "2001:db8::/32"
#
# AUTONOMOUS SYSTEM NUMBER (ASN)
# Dynamically routes clients based on their ASN.
# Requires identity.ipinfo_asn to be populated with an IPinfo database.
# Case-insensitive format: "AS1136"
#
# SNI / HOSTNAME (DoT, DoH, DoQ)
# Matches the TLS Server Name Indication the client used to connect to sdproxy.
# Must be prefixed with "sni:". Example: "sni:doh.example.com"
#
# URL PATH (DoH, DoH3)
# Matches the HTTP request path.
# Must start with "/" or be prefixed with "path:". Example: "/dns-query-kids"
#
# CLIENT NAME
# The DHCP/hosts hostname of the device. Catch-all for any other string.
# Requires identity: to be configured with at least one hosts or lease file.
routes:
# ── Exact MAC & Grouped mixed properties ──────────────────────────────────
"cc:dd:ee:ff:00:11, 10.0.0.0/24, AS1136, sni:doh.secure.com":
upstream: "secure"
# ── MAC glob & URL Path ──────────────────────────────────────────────────
"aa:bb:cc:??:??:??, /dns-query-kids":
upstream: "kids"
# ── Client name — matched against DHCP lease / hosts hostname ─────────────
"alice-iphone, bob-ipad, charlie-mac":
group: "kids"
# ── private/privacy macs ──────────────────────────────────────────────────
"?2:*:*:*:*:*, ?6:*:*:*:*:*, ?a:*:*:*:*:*, ?e:*:*:*:*:*":
group: "private"
bypass_local: true
# You can also supply external files containing lists of identifiers.
# One identifier per line. Empty lines and inline comments (#) are ignored.
# routes_files:
# "/etc/sdproxy/kids_devices.txt":
# group: "kids"
# "/etc/sdproxy/guest_subnets.txt":
# upstream: "default"
# bypass_local: true
# =============================================================================
# DOMAIN-BASED ROUTES
# =============================================================================
# Suffix matching checked before cache and upstream selection.
# NOTE: domain_policy is checked BEFORE domain_routes.
#
# TWO YAML FORMS — both are valid and can be mixed freely:
#
# Compact (original form — unchanged, fully supported):
# "domain": "upstream_group"
#
# Expanded (required when setting bypass_local: true):
# "domain":
# upstream: "upstream_group"
# bypass_local: true
#
# PRECEDENCE: when both a MAC route and a domain route match the same query,
# the domain route's upstream and bypass_local values win.
#
# Note: You can group multiple Domains by separating them with commas.
domain_routes:
# Compact form — local identity answers enabled (bypass_local defaults false).
"lan, home.arpa, corp.internal": "local_network"
# Expanded form — always go to upstream, never answer from local hosts/leases.
"youtube.com, netflix.com, hulu.com":
upstream: "kids"
bypass_local: true
# You can also supply external files containing lists of domains for routing.
# One domain per line. Empty lines and inline comments (#) are ignored.
# domain_routes_files:
# "/etc/sdproxy/work_domains.txt":
# upstream: "secure"
# bypass_local: true
# =============================================================================
# GROUPS
# =============================================================================
# Parental control profiles. Devices are linked via routes[mac].group above.
# The entire groups: section can be omitted — zero overhead when absent.
#
# Fields:
# upstream — upstream group for all MACs in this group.
# bypass_local — default bypass_local for all MACs in this group.
#
# schedule — restrict DNS access to one or more time windows.
#
# SINGLE STRING (old form — fully backward-compatible):
# schedule: "HH:MM-HH:MM"
# Access is allowed inside this window every day.
# Midnight-spanning ranges work: "22:00-07:00".
#
# LIST OF ENTRIES (new form — multiple windows):
# schedule:
# - "[<days>] HH:MM-HH:MM"
# - "[<days>] HH:MM-HH:MM"
# Access is open when ANY entry matches (union semantics).
#
# DAY SPEC SYNTAX (placed before the time range):
# weekdays — Monday through Friday
# weekend — Saturday and Sunday
# mon-fri — inclusive range (wraps week boundary)
# mon,wed,fri — explicit comma-separated list
# mon / tuesday — single day (3-letter abbrev or full)
#
# block_ttl — TTL (seconds) on blocked responses for this group.
# 0 = use the global parental.block_ttl (default 20s).
#
# budget_tracking — "group" (default) or "device".
#
# budget — daily accumulative time limits. Keys:
# "total" — overall daily screen time, OR the baseline
# default action for the entire group. If set
# to ALLOW, BLOCK, FREE, or LOG, it applies to
# everything *unless* a specific category overrides it.
# <category> — any category key under categories:. Explicitly
# configured categories strictly bypass the "total" default.
# Values (case-insensitive):
# "<duration>" — Go duration string: "2h", "90m".
# "unlimited" — no specific limit for this category, but visiting it still drains the "total" budget.
# "BLOCK" — permanently blocks all queries. No reset.
# "ALLOW" — bypasses ALL restrictions (schedule, BLOCK, budget exhaustion).
# "FREE" — bypasses ALL schedule and budget restrictions, preserves explicit BLOCK/ALLOW. Does not drain the budget.
# "LOG" — acts identically to ALLOW (bypasses budget), but emits an explicit PARENTAL LOG.
#
# PRECEDENCE & DEFAULTS:
# Explicitly configured categories strictly take precedence over
# the "total" fallback. For example, if "total" is "BLOCK"
# but "educational" is "FREE", all allowance will be blocked
# except educational sites.
#
# Evaluation Order:
# 1. WebUI Runtime Overrides (Gate Wide Open / Internet Cut)
# 2. Explicit Category Action (LOG -> FREE -> ALLOW -> BLOCK)
# 3. "total" Default Action (LOG -> FREE -> ALLOW -> BLOCK)
# 4. WebUI Runtime Overrides (Suspension/Bypass - FREE / LOG)
# 5. Schedule Window
# 6. Category Time Budget
# 7. "total" Time Budget
groups:
# ── alice ─────────────────────────────────────────────────────────────────
# Different time windows for school days vs weekends.
alice:
upstream: "kids"
schedule:
- "mon-fri 07:00-21:00"
- "sat-sun 09:00-22:00"
budget_tracking: "group"
budget:
total: "2h"
bad_ip: "BLOCK"
games: "1h"
streaming: "1h30m"
social: "BLOCK"
educational: "FREE"
# ── bob ───────────────────────────────────────────────────────────────────
bob:
upstream: "kids"
schedule: "08:00-20:00"
budget_tracking: "device"
budget:
total: "3h"
bad_ip: "BLOCK"
games: "1h30m"
streaming: "LOG" # Never block, but actively track streaming habits
# ── charlie ───────────────────────────────────────────────────────────────
# Example of using "total" as a default baseline action:
# If you wanted to block EVERYTHING by default and only allow educational,
# you would set `total: "BLOCK"` and `educational: "FREE"`.
kids:
upstream: "kids"
schedule:
- "mon-fri 15:30-21:00"
- "weekend 09:00-22:00"
budget_tracking: "group"
budget:
total: "3h"
bad_ip: "BLOCK"
games: "1h"
social: "30m"
# ── bob ───────────────────────────────────────────────────────────────────
# Log private-mac-address clients
private:
upstream: "secure"
budget_tracking: "device"
budget:
total: "LOG"
# =============================================================================
# PARENTAL CONTROL
# =============================================================================
# Global settings for the parental control subsystem. Ignored when groups: is
# empty — zero overhead when parental control is off.
parental:
# FastStart: when true, sdproxy will immediately start answering queries at boot
# even if parental category lists have not finished downloading. This may allow
# some unfiltered traffic through initially. When false, sdproxy postpones
# answering until lists are ready. Default: false.
fast_start: false
# TTL (seconds) sdproxy substitutes in responses for categorised domains.
# Turns DNS into a periodic heartbeat on TTL-compliant clients. Default: 60.
forced_ttl: 60
# TTL (seconds) on blocked responses (0.0.0.0 for A, NXDOMAIN for others).
# Can be overridden per group via groups.<n>.block_ttl. Default: 20.
block_ttl: 20
# How often (seconds) the background debit goroutine fires.
# Minimum granularity of time accounting. Default: 10.
ticker_interval: 10
# How long after the last DNS query for a category before its timer pauses.
# Makes time tracking accumulative. Can be overridden per category.
# Default: "2m"
default_idle_pause: "2m"
# Deprecated alias for default_idle_pause — accepted for backward
# compatibility. When both are present, default_idle_pause takes precedence.
# default_session_window: "5m"
# Directory where daily usage snapshots are written (one JSON file per
# state key per day). Use persistent storage to survive reboots.
# Default: /tmp/sdproxy
snapshot_dir: "/var/lib/sdproxy"
# ---------------------------------------------------------------------------
# LIST PROCESSING / CONSOLIDATION
# ---------------------------------------------------------------------------
# Enable post-processing of loaded domain lists. When false, the options
# below are skipped entirely. Default: true.
# CAUTION: Please stick to the defaults for everything running smooth, if
# not, the bloom-filter my start categorizing/blocking less
# reliably.
consolidation: true
# Auto-synthesise missing parent domains when enough children share the
# same category. Replaces the old negative-threshold hack. Default: false.
synthesise_parents: false
# Strip sub-domain entries whose parent is already in the same category list.
# Reduces memory footprint. Default: true.
remove_redundant_subdomains: true
# Strip well-known service prefixes (www, cdn, api, etc.) from loaded
# domain list entries. Default: false.
strip_service_labels: false
# Minimum number of direct children in the same category that must exist
# before the parent is synthesised (only applies if synthesise_parents is true).
# Default: 10.
parent_consolidation_threshold: 10
# Minimum percentage of children that must agree on the winning category
# before a parent domain is synthesised. Default: 90. Range: 1–100.
consolidation_homogeneity_pct: 90
# ---------------------------------------------------------------------------
# CATEGORIES
# ---------------------------------------------------------------------------
# Domain categories for time budgeting. Only categories referenced in a
# group budget are loaded — unused ones cost nothing.
#
# Fields:
# source: — URL(s) or local file path(s) to load the domain list from.
# Scalar (single) and sequence (multiple) forms both accepted.
# http:// and https:// values are fetched over the network;
# anything else is read from the local filesystem.
# Fetched at startup; automatically refreshed weekly (Sun 03:00).
# Local files are re-read from disk on every reload cycle.
# Supported formats (auto-detected per line — files may mix):
# DOMAIN — one bare domain per line: example.com
# HOSTS — hosts file format: 0.0.0.0 host1.com host2.com
# ADBLOCK — uBlock/AdBlock rules: ||example.com^
# idle_pause — per-category override for default_idle_pause.
# (replaces deprecated "session_window").
# add — domains/patterns to include regardless of the source.
# remove — domains/patterns to exclude even if in the source.
#
# ADD / REMOVE ENTRY TYPES
# Plain (no '*' or '?'): apex domain — matches itself and all subdomains.
# Wildcard ('*' or '?'): glob pattern — matched against the full queried
# domain only (no suffix walk). Case-insensitive.
categories:
games:
source:
- "https://raw.githubusercontent.com/cbuijs/ut1/master/games/domains"
- "https://raw.githubusercontent.com/cbuijs/ut1/master/gambling/domains"
idle_pause: "2m"
add:
- "bet"
- "bingo"
- "crazygames.com"
- "casino"
- "epicgames.com"
- "fortnite.com"
- "fun"
- "game"
- "games"
- "gg"
- "itch.io"
- "juegos"
- "minecraft.net"
- "ninja"
- "play"
- "poker"
- "poki.com"
- "roblox.com"
- "toys"
- "win"
- "*game.*"
- "*games.*"
remove:
- "about.com"
- "chess.com"
streaming:
# Multiple sources combined into one category — sequence form.
source:
- "https://raw.githubusercontent.com/cbuijs/ut1/master/audio-video/domains"
- "https://raw.githubusercontent.com/cbuijs/ut1/master/manga/domains"
- "https://raw.githubusercontent.com/cbuijs/ut1/master/radio/domains"
idle_pause: "5m" # streaming apps buffer — use a wider idle window
add:
- "deezer.com"
- "netflix.com"
- "spotify.com"
- "youtube.com"
- "audio"
- "cam"
- "hbomax.com"
- "disneyplus.com"
- "live"
- "media"
- "now"
- "netflix.com"