]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
etc/config: use net.listen() syntax for configs
authorTomas Krizek <tomas.krizek@nic.cz>
Tue, 14 Jan 2020 13:08:11 +0000 (14:08 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 21 Jan 2020 16:20:37 +0000 (17:20 +0100)
- meson templating no longer needed
- commented out DoH/webmgmt configuration removed
- added explicit port 53 and kind=dns

etc/config/config.cluster [moved from etc/config/config.cluster.in with 84% similarity]
etc/config/config.docker [moved from etc/config/config.docker.in with 96% similarity]
etc/config/config.internal [moved from etc/config/config.internal.in with 64% similarity]
etc/config/config.isp [moved from etc/config/config.isp.in with 90% similarity]
etc/config/config.personal [moved from etc/config/config.personal.in with 66% similarity]
etc/config/config.privacy [moved from etc/config/config.privacy.in with 82% similarity]
etc/config/config.splitview [moved from etc/config/config.splitview.in with 81% similarity]
etc/config/meson.build

similarity index 84%
rename from etc/config/config.cluster.in
rename to etc/config/config.cluster
index f5869d6ee4c464c552e6a6c1e7c8c02d2e40f89a..33e0fe3cfe0dda4625341049d1bae2852be7f3bc 100644 (file)
@@ -4,15 +4,12 @@
 -- as the resolver is busy most of the time.
 -- Alternative is using `etcd` as a configuration backend.
 -- Refer to manual: https://knot-resolver.readthedocs.io/en/stable/
-@config_defaults@
 
--- For DNS-over-HTTPS and web management when using http module
--- modules.load('http')
--- http.config({
---     cert = '/etc/knot-resolver/mycert.crt',
---     key = '/etc/knot-resolver/mykey.key',
---     tls = true,
--- })
+-- Network interface configuration
+net.listen('127.0.0.1', 53, { kind = 'dns' })
+net.listen('::1', 53, { kind = 'dns'})
+net.listen('127.0.0.1', 853, { kind = 'tls' })
+net.listen('::1', 853, { kind = 'tls' })
 
 -- To disable DNSSEC validation, uncomment the following line (not recommended)
 -- trust_anchors.remove('.')
similarity index 96%
rename from etc/config/config.docker.in
rename to etc/config/config.docker
index d543a0977cc3ebd8880d77c6923cfea5326c3163..9199880fc03a79dcfe2f5a905d5b3a270ab62ba0 100644 (file)
@@ -2,7 +2,7 @@
 -- Refer to manual: https://knot-resolver.readthedocs.io/en/stable/
 
 -- Listen on all interfaces (localhost would not work in Docker)
-net.listen('0.0.0.0')
+net.listen('0.0.0.0', 53, { kind = 'dns' })
 net.listen('0.0.0.0', 853, { kind = 'tls' })
 net.listen('0.0.0.0', 443, { kind = 'doh' })
 net.listen('0.0.0.0', 8453, { kind = 'webmgmt' })
similarity index 64%
rename from etc/config/config.internal.in
rename to etc/config/config.internal
index 6407339788f0e5bdb80aa860e90d3cd24e112ed9..ed8b2f1e1cacda2bc720e0c54d1ec2f537219fe2 100644 (file)
@@ -1,10 +1,15 @@
 -- vim:syntax=lua:set ts=4 sw=4:
 -- Config file example usable for multi-user ISP resolver
 -- Refer to manual: https://knot-resolver.readthedocs.io/en/stable/
-@config_defaults@
+
+-- Network interface configuration
+net.listen('127.0.0.1', 53, { kind = 'dns' })
+net.listen('::1', 53, { kind = 'dns'})
+net.listen('127.0.0.1', 853, { kind = 'tls' })
+net.listen('::1', 853, { kind = 'tls' })
 
 -- define list of internal-only domains
 internalDomains = policy.todnames({'company.example', 'internal.example'})
 
 -- forward all queries below 'internalDomains' to '192.168.1.2'
-policy.add(policy.suffix(policy.FORWARD({'192.168.1.2'}), internalDomains))
\ No newline at end of file
+policy.add(policy.suffix(policy.FORWARD({'192.168.1.2'}), internalDomains))
similarity index 90%
rename from etc/config/config.isp.in
rename to etc/config/config.isp
index 44272f969b8af8721ed396671c1d34005ba1bb18..bf9d65c847c72527fde29404acae3472aacaad69 100644 (file)
@@ -1,7 +1,12 @@
 -- vim:syntax=lua:set ts=4 sw=4:
 -- Config file example usable for ISP resolver
 -- Refer to manual: https://knot-resolver.readthedocs.io/en/stable/
-@config_defaults@
+
+-- Network interface configuration
+net.listen('127.0.0.1', 53, { kind = 'dns' })
+net.listen('::1', 53, { kind = 'dns'})
+net.listen('127.0.0.1', 853, { kind = 'tls' })
+net.listen('::1', 853, { kind = 'tls' })
 
 -- Large cache size, so we don't need to flush often
 -- This can be larger than available RAM, least frequently accessed
similarity index 66%
rename from etc/config/config.personal.in
rename to etc/config/config.personal
index 619691330bd7dc15d041f721f923977fa6547dbd..31d58d246a166cfe3875af29693aad94685bafe2 100644 (file)
@@ -1,14 +1,11 @@
 -- vim:syntax=lua:set ts=4 sw=4:
 -- Refer to manual: https://knot-resolver.readthedocs.org/en/stable/
-@config_defaults@
 
--- For DNS-over-HTTPS and web management when using http module
--- modules.load('http')
--- http.config({
---     cert = '/etc/knot-resolver/mycert.crt',
---     key = '/etc/knot-resolver/mykey.key',
---     tls = true,
--- })
+-- Network interface configuration
+net.listen('127.0.0.1', 53, { kind = 'dns' })
+net.listen('::1', 53, { kind = 'dns'})
+net.listen('127.0.0.1', 853, { kind = 'tls' })
+net.listen('::1', 853, { kind = 'tls' })
 
 -- To disable DNSSEC validation, uncomment the following line (not recommended)
 -- trust_anchors.remove('.')
similarity index 82%
rename from etc/config/config.privacy.in
rename to etc/config/config.privacy
index 824aa23ce0722d15966428b84b1444f64a3a1671..29ee4169a4619a3e2e65fc17ee1879c9f8581437 100644 (file)
@@ -1,7 +1,12 @@
 -- vim:syntax=lua:set ts=4 sw=4:
 -- Config file example usable for privacy-preserving resolver
 -- Refer to manual: https://knot-resolver.readthedocs.io/en/stable/
-@config_defaults@
+
+-- Network interface configuration
+net.listen('127.0.0.1', 53, { kind = 'dns' })
+net.listen('::1', 53, { kind = 'dns'})
+net.listen('127.0.0.1', 853, { kind = 'tls' })
+net.listen('::1', 853, { kind = 'tls' })
 
 -- TLS server configuration
 -- use this to configure your TLS certificates
@@ -26,4 +31,4 @@ policy.add(policy.slice(
       {'193.17.47.1', hostname='odvr.nic.cz'},
       {'185.43.135.1', hostname='odvr.nic.cz'},
    })
-))
\ No newline at end of file
+))
similarity index 81%
rename from etc/config/config.splitview.in
rename to etc/config/config.splitview
index 7051efa843946ff06e784e910fc9d23adc736525..2fd2415b4fb5f571742f8827dbd68516565da3cb 100644 (file)
@@ -1,15 +1,12 @@
 -- vim:syntax=lua:set ts=4 sw=4:
 -- Config file with split-view for internal zone
 -- Refer to manual: https://knot-resolver.readthedocs.io/en/stable/
-@config_defaults@
 
--- For DNS-over-HTTPS and web management when using http module
--- modules.load('http')
--- http.config({
---     cert = '/etc/knot-resolver/mycert.crt',
---     key = '/etc/knot-resolver/mykey.key',
---     tls = true,
--- })
+-- Network interface configuration
+net.listen('127.0.0.1', 53, { kind = 'dns' })
+net.listen('::1', 53, { kind = 'dns'})
+net.listen('127.0.0.1', 853, { kind = 'tls' })
+net.listen('::1', 853, { kind = 'tls' })
 
 -- To disable DNSSEC validation, uncomment the following line (not recommended)
 -- trust_anchors.remove('.')
index 85f7a379c43b6d19f3c728d43017e5a2dbddff40..e1623b4b65f13d32f9dfcb200c85a6b1cd847153 100644 (file)
@@ -1,26 +1,6 @@
 # etc: config examples
 
-# Config snippets (build-dependant)
-if systemd_files == 'enabled'
-  config_defaults = '''
--- Network interface configuration: see kresd.systemd(7)'''
-else
-  config_defaults = '''
--- Listen on localhost
-net.listen('127.0.0.1')
-net.listen('::1')
-net.listen('127.0.0.1', 853, { kind = 'tls' })
-net.listen('::1', 853, { kind = 'tls' })
-
--- Extra interfaces for http module
--- net.listen('127.0.0.1', 44353, { kind = 'doh' })
--- net.listen('::1', 44353, { kind = 'doh' })
--- net.listen('127.0.0.1', 8453, { kind = 'webmgmt' })
--- net.listen('::1', 8453, { kind = 'webmgmt' })'''
-endif
-
-
-# Configure and install config examples
+# Install config examples
 example_configs = [
   'config.cluster',
   'config.docker',
@@ -31,17 +11,10 @@ example_configs = [
   'config.splitview',
 ]
 
-conf_config = configuration_data()
-conf_config.set('config_defaults', config_defaults)
-
-foreach config_filename : example_configs
-  configure_file(
-    input: config_filename + '.in',
-    output: config_filename,
-    configuration: conf_config,
-    install_dir: examples_dir,
-  )
-endforeach
+install_data(
+  sources: example_configs,
+  install_dir: examples_dir,
+)
 
 
 # kresd.conf
@@ -53,10 +26,9 @@ if get_option('install_kresd_conf') == 'auto'
 endif
 
 if install_kresd_conf
-  configure_file(
-    input: 'config.personal.in',
-    output: 'kresd.conf',
-    configuration: conf_config,
+  install_data(
+    sources: 'config.personal',
+    rename: 'kresd.conf',
     install_dir: etc_dir,
   )
 endif