(void)cfg_map_get(options, "listen-on", &clistenon);
}
if (clistenon != NULL) {
- /* check return code? */
- (void)listenlist_fromconfig(
+ CHECK(listenlist_fromconfig(
clistenon, config, named_g_aclconfctx,
- named_g_mctx, AF_INET, &listenon);
+ named_g_mctx, AF_INET, &listenon));
} else {
/*
* Not specified, use default.
(void)cfg_map_get(options, "listen-on-v6", &clistenon);
}
if (clistenon != NULL) {
- /* check return code? */
- (void)listenlist_fromconfig(
+ CHECK(listenlist_fromconfig(
clistenon, config, named_g_aclconfctx,
- named_g_mctx, AF_INET6, &listenon);
+ named_g_mctx, AF_INET6, &listenon));
} else {
/*
* Not specified, use default.
in_port_t port = 0;
isc_dscp_t dscp = -1;
const char *key = NULL, *cert = NULL;
- bool do_tls = false, http = false;
+ bool do_tls = false, no_tls = false, http = false;
ns_listenelt_t *delt = NULL;
REQUIRE(target != NULL && *target == NULL);
- /* XXXWPK TODO be more verbose on failures. */
tlsobj = cfg_tuple_get(listener, "tls");
if (tlsobj != NULL && cfg_obj_isstring(tlsobj)) {
const char *tlsname = cfg_obj_asstring(tlsobj);
- if (strcmp(tlsname, "ephemeral") != 0) {
+ if (strcasecmp(tlsname, "none") == 0) {
+ no_tls = true;
+ } else if (strcasecmp(tlsname, "ephemeral") == 0) {
+ do_tls = true;
+ } else {
const cfg_obj_t *keyobj = NULL, *certobj = NULL;
const cfg_obj_t *tlsmap = NULL;
+ do_tls = true;
+
tlsmap = find_maplist(config, "tls", tlsname);
if (tlsmap == NULL) {
return (ISC_R_FAILURE);
CHECK(cfg_map_get(tlsmap, "cert-file", &certobj));
cert = cfg_obj_asstring(certobj);
}
-
- do_tls = true;
}
httpobj = cfg_tuple_get(listener, "http");
if (httpobj != NULL && cfg_obj_isstring(httpobj)) {
const char *httpname = cfg_obj_asstring(httpobj);
+ if (!do_tls && !no_tls) {
+ cfg_obj_log(httpobj, named_g_lctx, ISC_LOG_ERROR,
+ "http must specify a 'tls' "
+ "statement, 'tls ephemeral', or "
+ "'tls none'");
+ return (ISC_R_FAILURE);
+ }
+
http_server = find_maplist(config, "http", httpname);
if (http_server == NULL) {
cfg_obj_log(httpobj, named_g_lctx, ISC_LOG_ERROR,
--- /dev/null
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+tls local-tls {
+ key-file "key.pem";
+ cert-file "cert.pem";
+};
+
+http local-http-server {
+ endpoints { "/dns-query"; };
+};
+
+options {
+ listen-on { 10.53.0.1; };
+ http-port 80;
+ https-port 443;
+ listen-on port 443 tls local-tls http local-http-server { 10.53.0.1; };
+ listen-on port 8080 tls none http local-http-server { 10.53.0.1; };
+};
If an HTTP configuration is specified, ``named`` will listen for
DNS-over-HTTPS (DoH) connections using the HTTP endpoint specified in the
-referenced ``http`` statement. Normally, ``http`` and ``tls``
-configurations will be used together, but ``tls`` may be omitted if
-encryption is being handled by external software.
+referenced ``http`` statement. ``http`` and ``tls`` configurations must be
+used together. If an unencrypted connection is desired (for example, when
+load-sharing servers behind a reverse proxy), ``tls none`` may be
+used.
If a port number is not specified, the default is 53 for standard DNS, 853
for DNS-over-TLS, and 443 for DNS-over-HTTPS.
listen-on-v6 port 1234 { !2001:db8::/32; any; };
listen-on port 8853 tls example-tls { 2001:db8::100; };
listen-on port 8453 tls example-tls http myserver { 2001:db8::100; };
- listen-on port 8000 http myserver { 2001:db8::100; };
+ listen-on port 8000 tls none http myserver { 2001:db8::100; };
The first two lines instruct the name server to listen for standard DNS
queries on port 53 of any IPv6 addresses, and on port 1234 of IPv6
in the a ``tls`` statement with the name ``example-tls``. The fourth
instructs the server to listen for DNS-over-HTTPS connections, again using
``example-tls``, on the HTTP endpoint specified in ``http myserver``. The
-fifth line, in which the ``tls`` parameter is omitted, instructs the server
-to listen for *unencrypted* DNS queries over HTTP.
+fifth line, in which the ``tls`` parameter is set to ``none``, instructs
+the server to listen for *unencrypted* DNS queries over HTTP.
To instruct the server not to listen on any IPv6 addresses, use:
``hostname``
The hostname associated with the certificate.
-The built-in ``ephemeral`` TLS connection object represents a temporary
-key and certificate created for the current ``named`` session only.
+There are two built-in TLS connection configurations: ``ephemeral``,
+uses a temporary key and certificate created for the current ``named``
+session only, and ``none``, which can be used when setting up an HTTP
+listener with no encryption.
.. _http: