You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

94 lines
3.0 KiB

  1. /*
  2. * This file is part of PowerDNS or dnsdist.
  3. * Copyright -- PowerDNS.COM B.V. and its contributors
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * In addition, for the avoidance of any doubt, permission is granted to
  10. * link this program with OpenSSL and to (re)distribute the binaries
  11. * produced as the result of such linking.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. #pragma once
  23. #include <set>
  24. #include "sholder.hh"
  25. #include "sortlist.hh"
  26. #include "filterpo.hh"
  27. #include "validate.hh"
  28. struct ProtobufExportConfig
  29. {
  30. std::set<uint16_t> exportTypes = { QType::A, QType::AAAA, QType::CNAME };
  31. std::vector<ComboAddress> servers;
  32. uint64_t maxQueuedEntries{100};
  33. uint16_t timeout{2};
  34. uint16_t reconnectWaitTime{1};
  35. bool asyncConnect{false};
  36. bool enabled{false};
  37. bool logQueries{true};
  38. bool logResponses{true};
  39. bool taggedOnly{false};
  40. };
  41. struct FrameStreamExportConfig
  42. {
  43. std::vector<string> servers;
  44. bool enabled{false};
  45. bool logQueries{true};
  46. bool logResponses{true};
  47. unsigned bufferHint{0};
  48. unsigned flushTimeout{0};
  49. unsigned inputQueueSize{0};
  50. unsigned outputQueueSize{0};
  51. unsigned queueNotifyThreshold{0};
  52. unsigned reopenInterval{0};
  53. };
  54. struct TrustAnchorFileInfo {
  55. uint32_t interval{24};
  56. std::string fname;
  57. };
  58. class LuaConfigItems
  59. {
  60. public:
  61. LuaConfigItems();
  62. SortList sortlist;
  63. DNSFilterEngine dfe;
  64. TrustAnchorFileInfo trustAnchorFileInfo; // Used to update the Trust Anchors from file periodically
  65. map<DNSName,dsmap_t> dsAnchors;
  66. map<DNSName,std::string> negAnchors;
  67. ProtobufExportConfig protobufExportConfig;
  68. ProtobufExportConfig outgoingProtobufExportConfig;
  69. FrameStreamExportConfig frameStreamExportConfig;
  70. /* we need to increment this every time the configuration
  71. is reloaded, so we know if we need to reload the protobuf
  72. remote loggers */
  73. uint64_t generation{0};
  74. uint8_t protobufMaskV4{32};
  75. uint8_t protobufMaskV6{128};
  76. };
  77. extern GlobalStateHolder<LuaConfigItems> g_luaconfs;
  78. struct luaConfigDelayedThreads
  79. {
  80. std::vector<std::tuple<std::vector<ComboAddress>, boost::optional<DNSFilterEngine::Policy>, bool, uint32_t, size_t, TSIGTriplet, size_t, ComboAddress, uint16_t, uint32_t, std::shared_ptr<SOARecordContent>, std::string> > rpzMasterThreads;
  81. };
  82. void loadRecursorLuaConfig(const std::string& fname, luaConfigDelayedThreads& delayedThreads);
  83. void startLuaConfigDelayedThreads(const luaConfigDelayedThreads& delayedThreads, uint64_t generation);