diff --git a/contrib/src/libressl/rules.mak b/contrib/src/libressl/rules.mak
index a39219b93df3ee558f749f5999979b645a2d45b0..e24404ae575577b0cb0256e69f98c0006839baf4 100644
--- a/contrib/src/libressl/rules.mak
+++ b/contrib/src/libressl/rules.mak
@@ -22,6 +22,10 @@
 LIBRESSL_VERSION := 190bd346e75575b9436a2e9e14b28618f0234e1b
 LIBRESSL_URL := https://github.com/libressl-portable/portable/archive/$(LIBRESSL_VERSION).tar.gz
 
+# Check if openssl or libressl is already present on the system
+ifeq ($(call need_pkg,"openssl >= 1.0.0" || call need_pkg,"libressl >= 1.0.0"),)
+PKGS_FOUND += libressl
+endif
 
 # Pure dependency of restbed: do not add to PKGS.
 
diff --git a/contrib/src/restbed/findopenssl.patch b/contrib/src/restbed/findopenssl.patch
new file mode 100644
index 0000000000000000000000000000000000000000..835d7c383cc4bf95c3391a2a79a08abc2f39586b
--- /dev/null
+++ b/contrib/src/restbed/findopenssl.patch
@@ -0,0 +1,38 @@
+From 4df62857834ac7d2f7919e2d71f07530883a8dc2 Mon Sep 17 00:00:00 2001
+From: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
+Date: Thu, 5 Apr 2018 21:11:13 -0400
+Subject: [PATCH] findopenssl: avoid cmake to add root_path
+
+---
+ cmake/modules/Findopenssl.cmake | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/cmake/modules/Findopenssl.cmake b/cmake/modules/Findopenssl.cmake
+index 4edbf5a..3455a1f 100644
+--- a/cmake/modules/Findopenssl.cmake
++++ b/cmake/modules/Findopenssl.cmake
+@@ -1,8 +1,19 @@
+ # Copyright 2013-2017, Corvusoft Ltd, All Rights Reserved.
+
+-find_library( ssl_LIBRARY ssl ssleay32 HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
+-find_library( crypto_LIBRARY crypto libeay32 HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" )
+-find_path( ssl_INCLUDE openssl/ssl.h HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/inc32" "${PROJECT_SOURCE_DIR}/dependency/openssl/include" "/usr/local/opt/openssl/include" "/usr/include" "/usr/local/include" "/opt/local/include" )
++find_library( ssl_LIBRARY ssl ssleay32 HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib")
++find_library( crypto_LIBRARY crypto libeay32 HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib")
++find_path( ssl_INCLUDE openssl/ssl.h HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/inc32" "${PROJECT_SOURCE_DIR}/dependency/openssl/include" "/usr/local/opt/openssl/include" "/usr/include" "/usr/local/include" "/opt/local/include")
++
++if ( NOT ssl_LIBRARY )
++  find_library( ssl_LIBRARY ssl ssleay32 HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" NO_CMAKE_FIND_ROOT_PATH)
++endif ( )
++if ( NOT crypto_LIBRARY )
++  find_library( crypto_LIBRARY crypto libeay32 HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" NO_CMAKE_FIND_ROOT_PATH)
++endif ( )
++if ( NOT ssl_INCLUDE )
++  find_path( ssl_INCLUDE openssl/ssl.h HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/inc32" "${PROJECT_SOURCE_DIR}/dependency/openssl/include" "/usr/local/opt/openssl/include" "/usr/include" "/usr/local/include" "/opt/local/include" NO_CMAKE_FIND_ROOT_PATH)
++endif ( )
++
+
+ if ( ssl_INCLUDE AND ssl_LIBRARY AND crypto_LIBRARY )
+     set( OPENSSL_FOUND TRUE )
+--
+2.14.3
diff --git a/contrib/src/restbed/rules.mak b/contrib/src/restbed/rules.mak
index 318c67545357b5408dd9916cc46508ccf0d1aa07..4f96fc55a424f67d039ebdf05d526068bed6ea0f 100644
--- a/contrib/src/restbed/rules.mak
+++ b/contrib/src/restbed/rules.mak
@@ -45,6 +45,7 @@ restbed: restbed-$(RESTBED_VERSION).tar.gz .sum-restbed
 	$(UNPACK)
 	$(APPLY) $(SRC)/restbed/strand.patch
 	$(APPLY) $(SRC)/restbed/async_read_until.patch
+	$(APPLY) $(SRC)/restbed/findopenssl.patch
 	$(MOVE)
 
 .restbed: restbed toolchain.cmake