From 0a530e9d549bb88ee43ee2770b17c74c68c8db91 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 6 Feb 2020 10:06:39 +0100 Subject: [PATCH] dnsdist: Fix key logging for DNS over TLS --- pdns/dnsdistdist/tcpiohandler.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pdns/dnsdistdist/tcpiohandler.cc b/pdns/dnsdistdist/tcpiohandler.cc index 59017d8f81..71ca39f516 100644 --- a/pdns/dnsdistdist/tcpiohandler.cc +++ b/pdns/dnsdistdist/tcpiohandler.cc @@ -42,6 +42,7 @@ public: OpenSSLTLSTicketKeysRing d_ticketKeys; std::map d_ocspResponses; std::unique_ptr d_tlsCtx{nullptr, SSL_CTX_free}; + std::unique_ptr d_keyLogFile{nullptr, fclose}; }; class OpenSSLTLSConnection: public TLSConnection @@ -303,6 +304,10 @@ public: libssl_set_error_counters_callback(d_feContext->d_tlsCtx, &fe.d_tlsCounters); + if (!fe.d_tlsConfig.d_keyLogFile.empty()) { + d_feContext->d_keyLogFile = libssl_set_key_log_file(d_feContext->d_tlsCtx, fe.d_tlsConfig.d_keyLogFile); + } + try { if (fe.d_tlsConfig.d_ticketKeyFile.empty()) { handleTicketsKeyRotation(time(nullptr)); -- 2.47.2