]> granicus.if.org Git - pdns/commitdiff
dnsdist: Don't link OpenSSL's libssl or GnuTLS unless DoT is enabled
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 30 Jan 2019 15:01:39 +0000 (16:01 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 25 Mar 2019 09:22:41 +0000 (10:22 +0100)
m4/pdns_check_libcrypto.m4
pdns/dnsdist-lua-bindings.cc
pdns/dnsdist.cc
pdns/dnsdistdist/Makefile.am
pdns/dnsdistdist/configure.ac

index b0e6a39e4cf1b2f6eb5b4223f23e3d790429d099..c71c98acc8208cb22fee669e51cc582f2c731a0d 100644 (file)
@@ -90,6 +90,10 @@ AC_DEFUN([PDNS_CHECK_LIBCRYPTO], [
         # it will just work!
     fi
 
+    if $found; then
+        AC_DEFINE([HAVE_LIBCRYPTO], [1], [Define to 1 if you have OpenSSL libcrypto])
+    fi
+
     # try the preprocessor and linker with our new flags,
     # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
 
@@ -120,4 +124,5 @@ AC_DEFUN([PDNS_CHECK_LIBCRYPTO], [
     AC_SUBST([LIBCRYPTO_INCLUDES])
     AC_SUBST([LIBCRYPTO_LIBS])
     AC_SUBST([LIBCRYPTO_LDFLAGS])
+    AM_CONDITIONAL([HAVE_LIBCRYPTO], [test "x$LIBCRYPTO_LIBS" != "x"])
 ])
index bfb5b85fc1af817c0289bf91eae5eb8c3eed7dc2..b7702c0fcd62d88f674d726ff8ef808e5936610b 100644 (file)
@@ -23,6 +23,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include "config.h"
 #include "dnsdist.hh"
 #include "dnsdist-lua.hh"
 #include "dnsdist-protobuf.hh"
 #include "dolog.hh"
 #include "fstrm_logger.hh"
 #include "remote_logger.hh"
+
+#ifdef HAVE_LIBCRYPTO
 #include "ipcipher.hh"
+#endif /* HAVE_LIBCRYPTO */
 
 void setupLuaBindings(bool client)
 {
@@ -167,6 +171,7 @@ void setupLuaBindings(bool client)
   g_lua.registerFunction<ComboAddress(ComboAddress::*)()>("mapToIPv4", [](const ComboAddress& ca) { return ca.mapToIPv4(); });
   g_lua.registerFunction<bool(nmts_t::*)(const ComboAddress&)>("match", [](nmts_t& s, const ComboAddress& ca) { return s.match(ca); });
 
+#ifdef HAVE_LIBCRYPTO
   g_lua.registerFunction<ComboAddress(ComboAddress::*)(const std::string& key)>("ipencrypt", [](const ComboAddress& ca, const std::string& key) {
       return encryptCA(ca, key);
     });
@@ -177,6 +182,7 @@ void setupLuaBindings(bool client)
   g_lua.writeFunction("makeIPCipherKey", [](const std::string& password) {
       return makeIPCipherKey(password);
     });
+#endif /* HAVE_LIBCRYPTO */
   
   /* DNSName */
   g_lua.registerFunction("isPartOf", &DNSName::isPartOf);
index f2dfa39b218c0f3700345d9c20a9ece48c06d811..b995dd007c9f0feec40d5d0c99b3624cb94f006c 100644 (file)
@@ -2330,6 +2330,9 @@ try
 #ifdef HAVE_FSTRM
       cout<<"fstrm ";
 #endif
+#ifdef HAVE_LIBCRYPTO
+      cout<<"ipcipher ";
+#endif
 #ifdef HAVE_LIBSODIUM
       cout<<"libsodium ";
 #endif
index 030e0b22a4f00d086819ef6c2e4fff7cfcdecb68..8eb3f18eb832b0b5f416b841241c400f6d56487a 100644 (file)
@@ -171,13 +171,19 @@ if HAVE_RE2
 dnsdist_LDADD += $(RE2_LIBS)
 endif
 
+if HAVE_LIBCRYPTO
+dnsdist_LDADD += $(LIBCRYPTO_LIBS)
+dnsdist_SOURCES += ipcipher.cc ipcipher.hh ext/ipcrypt/ipcrypt.c ext/ipcrypt/ipcrypt.h
+endif
+
+if HAVE_DNS_OVER_TLS
 if HAVE_GNUTLS
 dnsdist_LDADD += -lgnutls
 endif
 
 if HAVE_LIBSSL
-dnsdist_LDADD += $(LIBSSL_LIBS) $(LIBCRYPTO_LIBS)
-dnsdist_SOURCES += ipcipher.cc ipcipher.hh ext/ipcrypt/ipcrypt.c ext/ipcrypt/ipcrypt.h 
+dnsdist_LDADD += $(LIBSSL_LIBS)
+endif
 endif
 
 if !HAVE_LUA_HPP
index f517885f06779cb24f06d8258fc3ccf5790c8431..a65ea40d7a26fb122ad101816bd0f0d9b9424ffa 100644 (file)
@@ -65,10 +65,6 @@ DNSDIST_ENABLE_DNS_OVER_TLS
 AS_IF([test "x$enable_dns_over_tls" != "xno"], [
   DNSDIST_WITH_GNUTLS
   DNSDIST_WITH_LIBSSL
-  AS_IF([test "$HAVE_LIBSSL" = "1"], [
-    # we need libcrypto if libssl is enabled
-
-  ])
   AS_IF([test "$HAVE_GNUTLS" = "0" -a "$HAVE_LIBSSL" = "0"], [
     AC_MSG_ERROR([DNS over TLS support requested but neither GnuTLS nor OpenSSL are available])
   ])
@@ -150,6 +146,10 @@ AS_IF([test "x$systemd" != "xn"],
   [AC_MSG_NOTICE([systemd: yes])],
   [AC_MSG_NOTICE([systemd: no])]
 )
+AS_IF([test "x$LIBCRYPTO_LIBS" != "x"],
+  [AC_MSG_NOTICE([ipcipher: yes])],
+  [AC_MSG_NOTICE([ipcipher: no])]
+)
 AS_IF([test "x$LIBSODIUM_LIBS" != "x"],
   [AC_MSG_NOTICE([libsodium: yes])],
   [AC_MSG_NOTICE([libsodium: no])]