Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pdns/dnsdistdist/dnsdist-configuration-yaml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ static void loadWebServer(const Context& context, const dnsdist::rust::settings:
dnsdist::webserver::setMaxConcurrentConnections(webConfig.max_concurrent_connections);
config.d_apiConfigDirectory = std::string(webConfig.api_configuration_directory);
config.d_apiReadWrite = webConfig.api_read_write;
config.d_webserverBindFatal = webConfig.bind_fatal;
});
}

Expand Down Expand Up @@ -1062,6 +1063,7 @@ static void handleConsoleConfiguration(const dnsdist::rust::settings::ConsoleCon
config.d_consoleACL.addMask(std::string(aclEntry));
}
B64Decode(std::string(consoleConf.key), config.d_consoleKey);
config.d_consoleBindFatal = consoleConf.bind_fatal;
});
}
}
Expand Down
2 changes: 2 additions & 0 deletions pdns/dnsdistdist/dnsdist-configuration.hh
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ struct RuntimeConfiguration
bool d_allowEmptyResponse{false};
bool d_dropEmptyQueries{false};
bool d_consoleEnabled{false};
bool d_consoleBindFatal{false};
bool d_webserverBindFatal{false};
bool d_logConsoleConnections{true};
bool d_addEDNSToSelfGeneratedResponses{true};
bool d_applyACLToProxiedClients{false};
Expand Down
2 changes: 2 additions & 0 deletions pdns/dnsdistdist/dnsdist-console-completion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ static std::vector<dnsdist::console::completion::ConsoleKeyword> s_consoleKeywor
{"setCacheCleaningPercentage", true, "num", "Set the percentage of the cache that the cache cleaning algorithm will try to free by removing expired entries. By default (100), all expired entries are remove"},
{"setConsistentHashingBalancingFactor", true, "factor", "Set the balancing factor for bounded-load consistent hashing"},
{"setConsoleACL", true, "{netmask, netmask}", "replace the console ACL set with these netmasks"},
{"setConsoleBindFatal", true, "enable", "whether a failure to bind the console control socket is fatal"},
{"setConsoleConnectionsLogging", true, "enabled", "whether to log the opening and closing of console connections"},
{"setConsoleMaximumConcurrentConnections", true, "max", "Set the maximum number of concurrent console connections"},
{"setConsoleOutputMaxMsgSize", true, "messageSize", "set console message maximum size in bytes, default is 10 MB"},
Expand Down Expand Up @@ -309,6 +310,7 @@ static std::vector<dnsdist::console::completion::ConsoleKeyword> s_consoleKeywor
{"setVerbose", true, "bool", "set whether log messages at the verbose level will be logged"},
{"setVerboseHealthChecks", true, "bool", "set whether health check errors will be logged"},
{"setVerboseLogDestination", true, "destination file", "Set a destination file to write the 'verbose' log messages to, instead of sending them to syslog and/or the standard output"},
{"setWebserverBindFatal", true, "enable", "whether a failure to bind a web server socket is fatal"},
{"setWebserverConfig", true, "[{password=string, apiKey=string, customHeaders, statsRequireAuthentication, prometheusAddInstanceLabel=bool}]", "Updates webserver configuration"},
{"setWeightedBalancingFactor", true, "factor", "Set the balancing factor for bounded-load weighted policies (whashed, wrandom)"},
{"setWHashedPerturbation", true, "value", "Set the hash perturbation value to be used in the whashed policy instead of a random one, allowing to have consistent whashed results on different instance"},
Expand Down
2 changes: 2 additions & 0 deletions pdns/dnsdistdist/dnsdist-lua-configuration-items.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ static const std::map<std::string, BooleanConfigurationItems> s_booleanConfigIte
{"setRoundRobinFailOnNoServer", {[](dnsdist::configuration::RuntimeConfiguration& config, bool newValue) { config.d_roundrobinFailOnNoServer = newValue; }}},
{"setDropEmptyQueries", {[](dnsdist::configuration::RuntimeConfiguration& config, bool newValue) { config.d_dropEmptyQueries = newValue; }}},
{"setAllowEmptyResponse", {[](dnsdist::configuration::RuntimeConfiguration& config, bool newValue) { config.d_allowEmptyResponse = newValue; }}},
{"setConsoleBindFatal", {[](dnsdist::configuration::RuntimeConfiguration& config, bool newValue) { config.d_consoleBindFatal = newValue; }}},
{"setConsoleConnectionsLogging", {[](dnsdist::configuration::RuntimeConfiguration& config, bool newValue) { config.d_logConsoleConnections = newValue; }}},
{"setWebserverBindFatal", {[](dnsdist::configuration::RuntimeConfiguration& config, bool newValue) { config.d_webserverBindFatal = newValue; }}},
{"setProxyProtocolApplyACLToProxiedClients", {[](dnsdist::configuration::RuntimeConfiguration& config, bool newValue) { config.d_applyACLToProxiedClients = newValue; }}},
{"setAddEDNSToSelfGeneratedResponses", {[](dnsdist::configuration::RuntimeConfiguration& config, bool newValue) { config.d_addEDNSToSelfGeneratedResponses = newValue; }}},
};
Expand Down
6 changes: 6 additions & 0 deletions pdns/dnsdistdist/dnsdist-lua.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,9 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
g_outputBuffer = "Unable to bind to webserver socket on " + local.toStringWithPort() + ": " + e.what();
SLOG(errlog("Unable to bind to webserver socket on %s: %s", local.toStringWithPort(), e.what()),
getLogger("webserver")->error(Logr::Error, e.what(), "Error while trying to bind the web server socket", "network.local.address", Logging::Loggable(local)));
if (dnsdist::configuration::getCurrentRuntimeConfiguration().d_webserverBindFatal) {
_exit(EXIT_FAILURE);
}
}
}
});
Expand Down Expand Up @@ -1248,6 +1251,9 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
g_outputBuffer = "Unable to bind to control socket on " + local.toStringWithPort() + ": " + exp.what();
SLOG(errlog("Unable to bind to control socket on %s: %s", local.toStringWithPort(), exp.what()),
getLogger("controlSocket")->error(Logr::Error, exp.what(), "Unable to bind to console's control socket", "network.local.address", Logging::Loggable(local)));
if (dnsdist::configuration::getCurrentRuntimeConfiguration().d_consoleBindFatal) {
_exit(EXIT_FAILURE);
}
}
}
});
Expand Down
16 changes: 16 additions & 0 deletions pdns/dnsdistdist/dnsdist-settings-definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,14 @@ webserver:
type: "bool"
default: "false"
description: "Allow modifications of the configuration via the API. Optionally saving these changes to disk. Modifications done via the API will not be written to the configuration by default and will not persist after a reload. Note that flushing the content of the packet cache via DELETE requests is still allowed even if the API is read-only"
- name: "bind_fatal"
version_added: "2.2.0"
type: "bool"
Comment thread
Annih marked this conversation as resolved.
default: "false"
lua-name: "setWebserverBindFatal"
internal-field-name: "d_webserverBindFatal"
runtime-configurable: true
description: "Whether a failure to bind a web server socket should be fatal"

console:
description: "Console-related settings"
Expand Down Expand Up @@ -507,6 +515,14 @@ console:
internal-field-name: "d_consoleMaxConcurrentConnections"
runtime-configurable: false
description: "Set the maximum number of concurrent console connection"
- name: "bind_fatal"
version_added: "2.2.0"
type: "bool"
Comment thread
Annih marked this conversation as resolved.
default: "false"
lua-name: "setConsoleBindFatal"
internal-field-name: "d_consoleBindFatal"
runtime-configurable: true
description: "Whether a failure to bind the console control socket should be fatal"

ebpf_map:
description: "An ``eBPF`` map that is used to share data with kernel-land ``AF_XDP``/``XSK``, ``socket filter`` or ``XDP`` programs. Maps can be pinned to a filesystem path, which makes their content persistent across restarts and allows external programs to read their content and to add new entries. :program:`dnsdist` will try to load maps that are pinned to a filesystem path on startups, inheriting any existing entries, and fall back to creating them if they do not exist yet. Note that the user :program`dnsdist` is running under must have the right privileges to read and write to the given file, and to go through all the directories in the path leading to that file. The pinned path must be on a filesystem of type ``BPF``, usually below ``/sys/fs/bpf/``"
Expand Down
6 changes: 6 additions & 0 deletions pdns/dnsdistdist/dnsdist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3531,6 +3531,9 @@ static ListeningSockets initListeningSockets()
catch (const std::exception& exp) {
SLOG(errlog("Unable to bind to control socket on %s: %s", local.toStringWithPort(), exp.what()),
dnsdist::logging::getTopLogger("setup")->error(Logr::Error, exp.what(), "Unable to bind to console control socket", "network.local.address", Logging::Loggable(local)));
if (currentConfig.d_consoleBindFatal) {
_exit(EXIT_FAILURE);
}
}
}

Expand All @@ -3544,6 +3547,9 @@ static ListeningSockets initListeningSockets()
catch (const std::exception& exp) {
SLOG(errlog("Unable to bind to web server socket on %s: %s", local.toStringWithPort(), exp.what()),
dnsdist::logging::getTopLogger("setup")->error(Logr::Error, exp.what(), "Unable to bind to web server socket", "network.local.address", Logging::Loggable(local)));
if (currentConfig.d_webserverBindFatal) {
_exit(EXIT_FAILURE);
}
}
}

Expand Down
16 changes: 16 additions & 0 deletions pdns/dnsdistdist/docs/reference/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,14 @@ Control Socket, Console and Webserver

Generate and print an encryption key.

.. function:: setConsoleBindFatal(enable)

.. versionadded:: 2.2.0

Whether a failure to bind a console control socket is fatal.

:param bool enabled: Default to false.

.. function:: setConsoleConnectionsLogging(enabled)

Whether to log the opening and closing of console connections.
Expand Down Expand Up @@ -412,6 +420,14 @@ Webserver configuration
:param bool allow: Set to true to allow modification of the configuration through the API
:param str dir: A valid directory where the configuration files will be written by the API.

.. function:: setWebserverBindFatal(enable)

.. versionadded:: 2.2.0

Whether a failure to bind a web server socket is fatal.

:param bool enabled: Default to false.

.. function:: setWebserverConfig(options)

.. versionchanged:: 2.1.0
Expand Down
Loading
Loading