From: Otto Moerbeek Date: Mon, 28 Oct 2024 16:02:07 +0000 (+0100) Subject: rec: disable parsing of old-style settings by default X-Git-Tag: rec-5.2.0-alpha1~13^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a331c0127aacf274c3d7c7318be0de5ac34a865f;p=thirdparty%2Fpdns.git rec: disable parsing of old-style settings by default --- diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 55564926b6..1a06447ee3 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -3223,6 +3223,12 @@ int main(int argc, char** argv) SLOG(g_log << Logger::Warning << "Unable to open configuration file '" << configname << "'" << endl, startupLog->error("No such file", "Unable to open configuration file", "config_file", Logging::Loggable(configname))); } + else { + if (!::arg().mustDo("enable-old-settings")) { + startupLog->info(Logr::Error, "Old-style settings syntax not enabled by default anymore. Use YAML or enable with --enable-old-settings on the command line", "configname", Logging::Loggable(configname)); + return EXIT_FAILURE; + } + } } // Reparse, now with config file as well, both for old-style as for YAML settings diff --git a/pdns/recursordist/settings/table.py b/pdns/recursordist/settings/table.py index 8f0733ac47..c7ff798d4a 100644 --- a/pdns/recursordist/settings/table.py +++ b/pdns/recursordist/settings/table.py @@ -939,6 +939,19 @@ By default, this option is empty, meaning no EDNS Client Subnet information is s ''', 'versionadded': '4.5.0' }, + { + 'name' : 'enable_old_settings', + 'section' : 'recursor', + 'type' : LType.Bool, + 'default' : 'false', + 'help' : 'Enable (deprecated) parsing of old-style settings', + 'doc' : ''' +Enable the deprecated parsing of old-style settings. +Only makes sense to set on the command line. + ''', + 'skip-yaml': True, + 'versionadded': '5.2.0', + }, { 'name' : 'entropy_source', 'section' : 'recursor', diff --git a/regression-tests.recursor-dnssec/recursortests.py b/regression-tests.recursor-dnssec/recursortests.py index bb97883624..284b942552 100644 --- a/regression-tests.recursor-dnssec/recursortests.py +++ b/regression-tests.recursor-dnssec/recursortests.py @@ -699,7 +699,8 @@ distributor-threads={threads}""".format(confdir=confdir, recursorcmd = [os.environ['PDNSRECURSOR'], '--config-dir=%s' % confdir, '--local-port=%s' % port, - '--security-poll-suffix='] + '--security-poll-suffix=', + '--enable-old-settings'] print(' '.join(recursorcmd)) logFile = os.path.join(confdir, 'recursor.log') diff --git a/regression-tests.recursor/vars.sample b/regression-tests.recursor/vars.sample index 2d25723318..9c5756210b 100644 --- a/regression-tests.recursor/vars.sample +++ b/regression-tests.recursor/vars.sample @@ -1,5 +1,5 @@ PREFIX=10.0.3 # PDNSRECURSOR= # set to override default location -# PDNS= # set to override default location +# PDNS= # set to override default location AUTHRUN="exec authbind ${PDNS} --config-dir=. > logfile 2>&1" -RECRUN="exec authbind ${PDNSRECURSOR} --config-dir=. --daemon=no --trace=yes --dont-query= --local-address=$PREFIX.9 --hint-file=hintfile --packetcache-ttl=0 --max-cache-ttl=15 --threads=1 > logfile 2>&1" +RECRUN="exec authbind ${PDNSRECURSOR} --config-dir=. --daemon=no --trace=yes --dont-query= --local-address=$PREFIX.9 --hint-file=hintfile --packetcache-ttl=0 --max-cache-ttl=15 --threads=1 --enable-old-settings > logfile 2>&1" diff --git a/regression-tests/recursor-test b/regression-tests/recursor-test index ec58cfe90b..2a6a704b7f 100755 --- a/regression-tests/recursor-test +++ b/regression-tests/recursor-test @@ -31,7 +31,7 @@ rm -f recursor.pid pdns_recursor.pid system CPU seconds%S wallclock seconds%e %% CPU used%P -' ${RECURSOR} --daemon=no --local-port=$port --socket-dir=./ --trace=$TRACE --config-dir=. --max-mthreads=$mthreads --query-local-address="0.0.0.0${QLA6}" --threads=$threads --record-cache-shards=$shards --refresh-on-ttl-perc=10 --dnssec=validate --pdns-distributes-queries --reuseport=no > recursor.log 2>&1 & +' ${RECURSOR} --daemon=no --local-port=$port --socket-dir=./ --trace=$TRACE --config-dir=. --max-mthreads=$mthreads --query-local-address="0.0.0.0${QLA6}" --threads=$threads --record-cache-shards=$shards --refresh-on-ttl-perc=10 --dnssec=validate --pdns-distributes-queries --reuseport=no --enable-old-settings > recursor.log 2>&1 & sleep 3 if [ ! -e pdns_recursor.pid ]; then cat recursor.log