Skip to content

Instantly share code, notes, and snippets.

@vcunat
Created January 11, 2022 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vcunat/41ab2f9e713af1e2d36b928ac7580e80 to your computer and use it in GitHub Desktop.
Save vcunat/41ab2f9e713af1e2d36b928ac7580e80 to your computer and use it in GitHub Desktop.
knot-resolver schema for YAML/JSON config [experimental]
{"$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": {"server": {"type": "object", "properties": {"hostname": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "groupid": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "nsid": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "workers": {"anyOf": [{"enum": ["auto"]}, {"type": "integer"}], "default": 1}, "use_cache_gc": {"type": "boolean", "default": true}, "backend": {"enum": ["auto", "systemd", "supervisord"], "default": "auto"}, "watchdog": {"anyOf": [{"enum": [false]}, {"type": "object", "properties": {"qname": {"type": "string"}, "qtype": {"enum": ["A", "A6", "AAAA", "AFSDB", "ANY", "APL", "ATMA", "AVC", "AXFR", "CAA", "CDNSKEY", "CDS", "CERT", "CNAME", "CSYNC", "DHCID", "DLV", "DNAME", "DNSKEY", "DOA", "DS", "EID", "EUI48", "EUI64", "GID", "GPOS", "HINFO", "HIP", "HTTPS", "IPSECKEY", "ISDN", "IXFR", "KEY", "KX", "L32", "L64", "LOC", "LP", "MAILA", "MAILB", "MB", "MD", "MF", "MG", "MINFO", "MR", "MX", "NAPTR", "NID", "NIMLOC", "NINFO", "NS", "NSAP", "NSAP-PTR", "NSEC", "NSEC3", "NSEC3PARAM", "NULL", "NXT", "OPENPGPKEY", "OPT", "PTR", "PX", "RKEY", "RP", "RRSIG", "RT", "SIG", "SINK", "SMIMEA", "SOA", "SPF", "SRV", "SSHFP", "SVCB", "TA", "TALINK", "TKEY", "TLSA", "TSIG", "TXT", "UID", "UINFO", "UNSPEC", "URI", "WKS", "X25", "ZONEMD"]}}}], "default": false}, "rundir": {"type": "string", "default": "."}, "management": {"description": "Management API configuration.", "type": "object", "properties": {"listen": {"type": "object", "properties": {"ip": {"anyOf": [{"type": "string"}, {"type": "string"}, {"type": "null"}], "default": null}, "port": {"anyOf": [{"type": "integer"}, {"type": "null"}], "default": null}, "unix_socket": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "interface": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}}, "description": "Specifies where does the manager listen with its API. Can't be changed in runtime!", "default": {"unix_socket": "/home/vasek/Work/knot-resolver-manager/manager.sock"}}}, "default": {"listen": {"unix_socket": "/home/vasek/Work/knot-resolver-manager/manager.sock"}}}, "webmgmt": {"anyOf": [{"type": "object", "properties": {"listen": {"type": "object", "properties": {"ip": {"anyOf": [{"type": "string"}, {"type": "string"}, {"type": "null"}], "default": null}, "port": {"anyOf": [{"type": "integer"}, {"type": "null"}], "default": null}, "unix_socket": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "interface": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}}}, "tls": {"type": "boolean", "default": false}, "cert_file": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "key_file": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}}}, {"type": "null"}], "default": null}}, "default": {"hostname": "dingo", "groupid": null, "nsid": null, "workers": 1, "use_cache_gc": true, "backend": "auto", "watchdog": false, "rundir": ".", "management": {"listen": {"unix_socket": "/home/vasek/Work/knot-resolver-manager/manager.sock"}}, "webmgmt": null}}, "options": {"type": "object", "properties": {"glue_checking": {"enum": ["normal", "strict", "permissive"], "default": "normal"}, "qname_minimisation": {"type": "boolean", "default": true}, "query_loopback": {"type": "boolean", "default": false}, "reorder_rrset": {"type": "boolean", "default": true}, "query_case_randomization": {"type": "boolean", "default": true}, "query_priming": {"type": "boolean", "default": true}, "rebinding_protection": {"type": "boolean", "default": false}, "refuse_no_rd": {"type": "boolean", "default": true}, "time_jump_detection": {"type": "boolean", "default": true}, "violators_workarounds": {"type": "boolean", "default": false}, "serve_stale": {"type": "boolean", "default": false}, "prediction": {"anyOf": [{"type": "boolean"}, {"type": "object", "properties": {"window": {"type": "string", "pattern": "\\d+(ms|s|m|h|d)", "default": "15m"}, "period": {"type": "integer", "default": 24}}}], "default": false}}, "default": {"glue_checking": "normal", "qname_minimisation": true, "query_loopback": false, "reorder_rrset": true, "query_case_randomization": true, "query_priming": true, "rebinding_protection": false, "refuse_no_rd": true, "time_jump_detection": true, "violators_workarounds": false, "serve_stale": false, "prediction": false}}, "network": {"type": "object", "properties": {"do_ipv4": {"type": "boolean", "default": true}, "do_ipv6": {"type": "boolean", "default": true}, "out_interface_v4": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "out_interface_v6": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "tcp_pipeline": {"type": "integer", "default": 100}, "edns_keep_alive": {"type": "boolean", "default": true}, "edns_buffer_size": {"type": "object", "properties": {"upstream": {"type": "string", "pattern": "\\d+(B|K|M|G)", "default": "1232B"}, "downstream": {"type": "string", "pattern": "\\d+(B|K|M|G)", "default": "1232B"}}, "default": {"upstream": "1232B", "downstream": "1232B"}}, "address_renumbering": {"anyOf": [{"type": "array", "items": {"type": "object", "properties": {"source": {"type": "string"}, "destination": {"anyOf": [{"type": "string"}, {"type": "string"}]}}}}, {"type": "null"}], "default": null}, "tls": {"type": "object", "properties": {"cert_file": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "key_file": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "sticket_secret": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "sticket_secret_file": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "auto_discovery": {"type": "boolean", "default": false}, "padding": {"type": "integer", "default": 1}}, "default": {"cert_file": null, "key_file": null, "sticket_secret": null, "sticket_secret_file": null, "auto_discovery": false, "padding": 1}}, "interfaces": {"type": "array", "items": {"type": "object", "properties": {"listen": {"type": "object", "properties": {"ip": {"anyOf": [{"type": "string"}, {"type": "string"}, {"type": "null"}], "default": null}, "port": {"anyOf": [{"type": "integer"}, {"type": "null"}], "default": null}, "unix_socket": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "interface": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}}}, "kind": {"enum": ["dns", "xdp", "dot", "doh"], "default": "dns"}, "freebind": {"type": "boolean", "default": false}}}, "default": [{"listen": {"port": 53, "ip": "127.0.0.1"}, "kind": "dns", "freebind": false}, {"listen": {"port": 53, "ip": "::1"}, "kind": "dns", "freebind": true}]}}, "default": {"do_ipv4": true, "do_ipv6": true, "out_interface_v4": null, "out_interface_v6": null, "tcp_pipeline": 100, "edns_keep_alive": true, "edns_buffer_size": {"upstream": "1232B", "downstream": "1232B"}, "address_renumbering": null, "tls": {"cert_file": null, "key_file": null, "sticket_secret": null, "sticket_secret_file": null, "auto_discovery": false, "padding": 1}, "interfaces": [{"listen": {"port": 53, "ip": "127.0.0.1"}, "kind": "dns", "freebind": false}, {"listen": {"port": 53, "ip": "::1"}, "kind": "dns", "freebind": true}]}}, "static_hints": {"type": "object", "properties": {"ttl": {"anyOf": [{"type": "string", "pattern": "\\d+(ms|s|m|h|d)"}, {"type": "null"}], "default": null}, "no_data": {"type": "boolean", "default": true}, "etc_hosts": {"type": "boolean", "default": false}, "root_hints_file": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "hints_files": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "default": null}, "root_hints": {"anyOf": [{"type": "object", "additionalProperties": {"type": "array", "items": {"anyOf": [{"type": "string"}, {"type": "string"}]}}}, {"type": "null"}], "default": null}, "hints": {"anyOf": [{"type": "object", "additionalProperties": {"type": "array", "items": {"anyOf": [{"type": "string"}, {"type": "string"}]}}}, {"type": "null"}], "default": null}}, "default": {"ttl": null, "no_data": true, "etc_hosts": false, "root_hints_file": null, "hints_files": null, "root_hints": null, "hints": null}}, "views": {"anyOf": [{"type": "object", "additionalProperties": {"type": "object", "properties": {"subnets": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "default": null}, "tsig": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "default": null}, "options": {"anyOf": [{"type": "array", "items": {"enum": ["no-minimize", "no-ipv4", "no-ipv6", "tcp", "resolved", "await-ipv4", "await-ipv6", "await-cut", "no-edns", "cached", "no-cache", "expiring", "allow_local", "dnssec-want", "dnssec-bogus", "dnssec-insecure", "dnssec-cd", "stub", "always-cut", "dnssec-wexpand", "permissive", "strict", "badcookie-again", "cname", "reorder-rr", "trace", "no-0x20", "dnssec-nods", "dnssec-optout", "nonauth", "forward", "dns64-mark", "cache-tried", "no-ns-found", "pkt-is-sane", "dns64-disable"]}}, {"type": "null"}], "default": null}}}}, {"type": "null"}], "default": null}, "policy": {"anyOf": [{"type": "object", "additionalProperties": {"type": "object", "properties": {"action": {"enum": ["pass", "deny", "drop", "refuse", "tc", "reroute", "answer", "mirror", "debug-always", "debug-cache-miss", "qtrace", "reqtrace"]}, "order": {"anyOf": [{"type": "integer"}, {"type": "null"}], "default": null}, "filter": {"anyOf": [{"type": "object", "properties": {"suffix": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "pattern": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "qtype": {"anyOf": [{"enum": ["A", "A6", "AAAA", "AFSDB", "ANY", "APL", "ATMA", "AVC", "AXFR", "CAA", "CDNSKEY", "CDS", "CERT", "CNAME", "CSYNC", "DHCID", "DLV", "DNAME", "DNSKEY", "DOA", "DS", "EID", "EUI48", "EUI64", "GID", "GPOS", "HINFO", "HIP", "HTTPS", "IPSECKEY", "ISDN", "IXFR", "KEY", "KX", "L32", "L64", "LOC", "LP", "MAILA", "MAILB", "MB", "MD", "MF", "MG", "MINFO", "MR", "MX", "NAPTR", "NID", "NIMLOC", "NINFO", "NS", "NSAP", "NSAP-PTR", "NSEC", "NSEC3", "NSEC3PARAM", "NULL", "NXT", "OPENPGPKEY", "OPT", "PTR", "PX", "RKEY", "RP", "RRSIG", "RT", "SIG", "SINK", "SMIMEA", "SOA", "SPF", "SRV", "SSHFP", "SVCB", "TA", "TALINK", "TKEY", "TLSA", "TSIG", "TXT", "UID", "UINFO", "UNSPEC", "URI", "WKS", "X25", "ZONEMD"]}, {"type": "null"}], "default": null}}}, {"type": "null"}], "default": null}, "views": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "default": null}, "options": {"anyOf": [{"type": "array", "items": {"enum": ["no-minimize", "no-ipv4", "no-ipv6", "tcp", "resolved", "await-ipv4", "await-ipv6", "await-cut", "no-edns", "cached", "no-cache", "expiring", "allow_local", "dnssec-want", "dnssec-bogus", "dnssec-insecure", "dnssec-cd", "stub", "always-cut", "dnssec-wexpand", "permissive", "strict", "badcookie-again", "cname", "reorder-rr", "trace", "no-0x20", "dnssec-nods", "dnssec-optout", "nonauth", "forward", "dns64-mark", "cache-tried", "no-ns-found", "pkt-is-sane", "dns64-disable"]}}, {"type": "null"}], "default": null}, "message": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "reroute": {"anyOf": [{"type": "array", "items": {"type": "object", "properties": {"source": {"type": "string"}, "destination": {"anyOf": [{"type": "string"}, {"type": "string"}]}}}}, {"type": "null"}], "default": null}, "answer": {"anyOf": [{"type": "object", "properties": {"qtype": {"enum": ["A", "A6", "AAAA", "AFSDB", "ANY", "APL", "ATMA", "AVC", "AXFR", "CAA", "CDNSKEY", "CDS", "CERT", "CNAME", "CSYNC", "DHCID", "DLV", "DNAME", "DNSKEY", "DOA", "DS", "EID", "EUI48", "EUI64", "GID", "GPOS", "HINFO", "HIP", "HTTPS", "IPSECKEY", "ISDN", "IXFR", "KEY", "KX", "L32", "L64", "LOC", "LP", "MAILA", "MAILB", "MB", "MD", "MF", "MG", "MINFO", "MR", "MX", "NAPTR", "NID", "NIMLOC", "NINFO", "NS", "NSAP", "NSAP-PTR", "NSEC", "NSEC3", "NSEC3PARAM", "NULL", "NXT", "OPENPGPKEY", "OPT", "PTR", "PX", "RKEY", "RP", "RRSIG", "RT", "SIG", "SINK", "SMIMEA", "SOA", "SPF", "SRV", "SSHFP", "SVCB", "TA", "TALINK", "TKEY", "TLSA", "TSIG", "TXT", "UID", "UINFO", "UNSPEC", "URI", "WKS", "X25", "ZONEMD"]}, "rdata": {"type": "string"}, "ttl": {"type": "string", "pattern": "\\d+(ms|s|m|h|d)", "default": "1s"}, "nodata": {"type": "boolean", "default": false}}}, {"type": "null"}], "default": null}, "mirror": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "default": null}}}}, {"type": "null"}], "default": null}, "rpz": {"anyOf": [{"type": "object", "additionalProperties": {"type": "object", "properties": {"action": {"enum": ["pass", "deny", "drop", "refuse", "tc", "reroute", "answer", "mirror", "debug-always", "debug-cache-miss", "qtrace", "reqtrace"]}, "file": {"type": "string"}, "watch": {"type": "boolean", "default": true}, "views": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "default": null}, "options": {"anyOf": [{"type": "array", "items": {"enum": ["no-minimize", "no-ipv4", "no-ipv6", "tcp", "resolved", "await-ipv4", "await-ipv6", "await-cut", "no-edns", "cached", "no-cache", "expiring", "allow_local", "dnssec-want", "dnssec-bogus", "dnssec-insecure", "dnssec-cd", "stub", "always-cut", "dnssec-wexpand", "permissive", "strict", "badcookie-again", "cname", "reorder-rr", "trace", "no-0x20", "dnssec-nods", "dnssec-optout", "nonauth", "forward", "dns64-mark", "cache-tried", "no-ns-found", "pkt-is-sane", "dns64-disable"]}}, {"type": "null"}], "default": null}, "message": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}}}}, {"type": "null"}], "default": null}, "stub_zones": {"anyOf": [{"type": "object", "additionalProperties": {"type": "object", "properties": {"servers": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "array", "items": {"type": "object", "properties": {"address": {"type": "string"}}}}]}, "views": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "default": null}, "options": {"anyOf": [{"type": "array", "items": {"enum": ["no-minimize", "no-ipv4", "no-ipv6", "tcp", "resolved", "await-ipv4", "await-ipv6", "await-cut", "no-edns", "cached", "no-cache", "expiring", "allow_local", "dnssec-want", "dnssec-bogus", "dnssec-insecure", "dnssec-cd", "stub", "always-cut", "dnssec-wexpand", "permissive", "strict", "badcookie-again", "cname", "reorder-rr", "trace", "no-0x20", "dnssec-nods", "dnssec-optout", "nonauth", "forward", "dns64-mark", "cache-tried", "no-ns-found", "pkt-is-sane", "dns64-disable"]}}, {"type": "null"}], "default": null}}}}, {"type": "null"}], "default": null}, "forward_zones": {"anyOf": [{"type": "object", "additionalProperties": {"type": "object", "properties": {"tls": {"type": "boolean", "default": false}, "servers": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "array", "items": {"type": "object", "properties": {"address": {"type": "string"}, "pin_sha256": {"anyOf": [{"type": "string"}, {"type": "array", "items": {"type": "string"}}, {"type": "null"}], "default": null}, "hostname": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "ca_file": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}}}}]}, "views": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "default": null}, "options": {"anyOf": [{"type": "array", "items": {"enum": ["no-minimize", "no-ipv4", "no-ipv6", "tcp", "resolved", "await-ipv4", "await-ipv6", "await-cut", "no-edns", "cached", "no-cache", "expiring", "allow_local", "dnssec-want", "dnssec-bogus", "dnssec-insecure", "dnssec-cd", "stub", "always-cut", "dnssec-wexpand", "permissive", "strict", "badcookie-again", "cname", "reorder-rr", "trace", "no-0x20", "dnssec-nods", "dnssec-optout", "nonauth", "forward", "dns64-mark", "cache-tried", "no-ns-found", "pkt-is-sane", "dns64-disable"]}}, {"type": "null"}], "default": null}}}}, {"type": "null"}], "default": null}, "cache": {"type": "object", "properties": {"storage": {"type": "string", "default": "/var/cache/knot-resolver"}, "size_max": {"type": "string", "pattern": "\\d+(B|K|M|G)", "default": "100M"}, "ttl_min": {"type": "string", "pattern": "\\d+(ms|s|m|h|d)", "default": "5s"}, "ttl_max": {"type": "string", "pattern": "\\d+(ms|s|m|h|d)", "default": "6d"}, "ns_timeout": {"type": "string", "pattern": "\\d+(ms|s|m|h|d)", "default": "1000ms"}, "prefill": {"anyOf": [{"type": "array", "items": {"type": "object", "properties": {"domain": {"type": "string"}, "url": {"type": "string"}, "refresh_interval": {"type": "string", "pattern": "\\d+(ms|s|m|h|d)", "default": "1d"}, "ca_file": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}}}}, {"type": "null"}], "default": null}}, "default": {"storage": "/var/cache/knot-resolver", "size_max": "100M", "ttl_min": "5s", "ttl_max": "6d", "ns_timeout": "1000ms", "prefill": null}}, "dnssec": {"anyOf": [{"type": "boolean"}, {"type": "object", "properties": {"trust_anchor_sentinel": {"type": "boolean", "default": true}, "trust_anchor_signal_query": {"type": "boolean", "default": true}, "time_skew_detection": {"type": "boolean", "default": true}, "keep_removed": {"type": "integer", "default": 0}, "refresh_time": {"anyOf": [{"type": "string", "pattern": "\\d+(ms|s|m|h|d)"}, {"type": "null"}], "default": null}, "hold_down_time": {"type": "string", "pattern": "\\d+(ms|s|m|h|d)", "default": "30d"}, "trust_anchors": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "default": null}, "negative_trust_anchors": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "default": null}, "trust_anchors_files": {"anyOf": [{"type": "array", "items": {"type": "object", "properties": {"file": {"type": "string"}, "read_only": {"type": "boolean", "default": false}}}}, {"type": "null"}], "default": null}}}], "default": true}, "dns64": {"anyOf": [{"type": "boolean"}, {"type": "object", "properties": {"prefix": {"type": "string", "default": "64:ff9b::/96"}}}], "default": false}, "logging": {"type": "object", "properties": {"level": {"enum": ["crit", "err", "warning", "notice", "info", "debug"], "default": "notice"}, "target": {"anyOf": [{"enum": ["syslog", "stderr", "stdout"]}, {"type": "null"}], "default": null}, "groups": {"anyOf": [{"type": "array", "items": {"enum": ["manager", "system", "cache", "io", "net", "ta", "tasent", "tasign", "taupd", "tls", "gnutls", "tls_cl", "xdp", "zimprt", "zscann", "doh", "dnssec", "hint", "plan", "iterat", "valdtr", "resolv", "select", "zonecut", "cookie", "statis", "rebind", "worker", "policy", "daf", "timejm", "timesk", "graphi", "prefil", "primin", "srvstl", "wtchdg", "nsid", "dnstap", "tests", "dotaut", "http", "contrl", "module", "devel", "reqdbg"]}}, {"type": "null"}], "default": null}}, "default": {"level": "notice", "target": null, "groups": null}}, "lua": {"type": "object", "properties": {"script_only": {"type": "boolean", "default": false}, "script": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}, "script_file": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null}}, "default": {"script_only": false, "script": null, "script_file": null}}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment