return toHash;
}
+std::unordered_set<unsigned int> DNSCryptoKeyEngine::s_switchedOff;
+
+bool DNSCryptoKeyEngine::isAlgorithmSwitchedOff(unsigned int algo)
+{
+ return s_switchedOff.count(algo) != 0;
+}
+
+void DNSCryptoKeyEngine::switchOffAlgorithm(unsigned int algo)
+{
+ s_switchedOff.insert(algo);
+}
+
bool DNSCryptoKeyEngine::isAlgorithmSupported(unsigned int algo)
{
+ if (isAlgorithmSwitchedOff(algo)) {
+ return false;
+ }
const makers_t& makers = getMakers();
- makers_t::const_iterator iter = makers.find(algo);
+ auto iter = makers.find(algo);
return iter != makers.cend();
}
static std::unique_ptr<DNSCryptoKeyEngine> makeFromPublicKeyString(unsigned int algorithm, const std::string& raw);
static std::unique_ptr<DNSCryptoKeyEngine> make(unsigned int algorithm);
static bool isAlgorithmSupported(unsigned int algo);
+ static bool isAlgorithmSwitchedOff(unsigned int algo);
+ static void switchOffAlgorithm(unsigned int algo);
static bool isDigestSupported(uint8_t digest);
using maker_t = std::unique_ptr<DNSCryptoKeyEngine> (unsigned int);
static allmakers_t s_allmakers;
return s_allmakers;
}
+ static std::unordered_set<unsigned int> s_switchedOff;
protected:
const unsigned int d_algorithm;
g_dnssecLogBogus = ::arg().mustDo("dnssec-log-bogus");
g_maxNSEC3Iterations = ::arg().asNum("nsec3-max-iterations");
+
+ vector<string> nums;
+ if (!::arg()["dnssec-disabled-algorithms"].empty()) {
+ stringtok(nums, ::arg()["dnssec-disabled-algorithms"], ", ");
+ for (auto num: nums) {
+ DNSCryptoKeyEngine::switchOffAlgorithm(pdns::checked_stoi<unsigned int>(num));
+ }
+ } else {
+ // Auto determine algos to switch off
+ }
+ if (!nums.empty()) {
+ if (!g_slogStructured) {
+ g_log << Logger::Warning << "Disabled DNSSEC algorithm: ";
+ for (auto i = nums.begin(); i != nums.end(); ++i) {
+ if (i != nums.begin()) {
+ g_log << Logger::Warning << ", ";
+ }
+ g_log << Logger::Warning << *i;
+ }
+ g_log << Logger::Warning << endl;
+ }
+ else {
+ log->info(Logr::Notice, "Disabled DNSSEC algorithms", "algorithms", Logging::IterLoggable(nums.begin(), nums.end()));
+ }
+ }
+
return 0;
}
::arg().set("dnssec", "DNSSEC mode: off/process-no-validate/process (default)/log-fail/validate") = "process";
::arg().set("dnssec-log-bogus", "Log DNSSEC bogus validations") = "no";
::arg().set("signature-inception-skew", "Allow the signature inception to be off by this number of seconds") = "60";
+ ::arg().set("dnssec-disabled-algorithms", "List of DNSSEC algorithm numbers that are considered unsupported") = "";
::arg().set("daemon", "Operate as a daemon") = "no";
::arg().setSwitch("write-pid", "Write a PID file") = "yes";
::arg().set("loglevel", "Amount of logging. Higher is more. Do not set below 3") = "6";