]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Merge pull request #11100 from omoerbeek/zonemd
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 14 Jan 2022 10:48:33 +0000 (11:48 +0100)
committerGitHub <noreply@github.com>
Fri, 14 Jan 2022 10:48:33 +0000 (11:48 +0100)
First part of ZONEMD support

1  2 
.github/actions/spell-check/expect.txt
docs/manpages/pdnsutil.1.rst
pdns/dnssecinfra.cc
pdns/pdnsutil.cc

Simple merge
Simple merge
index 0605bd387c65587711ea6ae85d03f3f9c91cc142,25fb93c4336c2a5e9cad7f0b51019a2d67945b75..8b419d236f2a51d2934d930e55a67f3395ae6200
@@@ -1357,8 -1358,40 +1358,40 @@@ static int xcryptIP(const std::string& 
    cout<<ret.toString()<<endl;
    return EXIT_SUCCESS;
  }
 -
 +#endif /* HAVE_IPCIPHER */
  
+ static int zonemdVerifyFile(const DNSName& zone, const string& fname) {
+   ZoneParserTNG zpt(fname, zone);
+   zpt.setMaxGenerateSteps(::arg().asNum("max-generate-steps"));
+   bool validationDone, validationOK;
+   try {
+     pdns::zonemdVerify(zone, zpt, validationDone, validationOK);
+   }
+   catch (const PDNSException& ex) {
+     cerr << "zonemd-verify-file: " << ex.reason << endl;
+     return EXIT_FAILURE;
+   }
+   catch (const std::exception& ex) {
+     cerr << "zonemd-verify-file: " << ex.what() << endl;
+     return EXIT_FAILURE;
+   }
+   if (validationDone) {
+     if (validationOK) {
+       cout << "zonemd-verify-file: Verification of ZONEMD record succeeded" << endl;
+       return EXIT_SUCCESS;
+     } else {
+       cerr << "zonemd-verify-file: Verification of ZONEMD record(s) failed" << endl;
+     }
+   }
+   else {
+     cerr << "zonemd-verify-file: No suitable ZONEMD record found to verify against" << endl;
+   }
+   return EXIT_FAILURE;
+ }
  static int loadZone(const DNSName& zone, const string& fname) {
    UeberBackend B;
    DomainInfo di;