diff --git a/Makefile.am b/Makefile.am
index 769fe9466da0808684f2bca27a7aea167f78014a..10650fcd1206f5ef5586a1e999f8deaad2ce6395 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -449,6 +449,7 @@ lib/_autoconf.py: Makefile stamp-directories
 	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
 	  echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
 	  echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
+	  echo "OPENSSL_PATH = '$(OPENSSL)'"; \
 	} > $@
 
 $(REPLACE_VARS_SED): Makefile
diff --git a/configure.ac b/configure.ac
index 9836008bf68d75ec2af5c81545155695be86dc5d..3bc5992de2a8d67ac0aa85472516ec82c81a6df6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -201,6 +201,14 @@ then
   AC_MSG_WARN([pylint not found, checking code will not be possible])
 fi
 
+# Check for openssl
+AC_ARG_VAR(OPENSSL, [openssl path])
+AC_PATH_PROG(OPENSSL, [openssl], [])
+if test -z "$OPENSSL"
+then
+  AC_MSG_ERROR([openssl not found])
+fi
+
 # Check for socat
 AC_ARG_VAR(SOCAT, [socat path])
 AC_PATH_PROG(SOCAT, [socat], [])
diff --git a/lib/constants.py b/lib/constants.py
index f73071fdbf3b5a57bff4471db7cde37540a5b7b8..574db4eaa56b483245c48baa59b24eaa5e55543a 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -112,6 +112,7 @@ DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
 SYSCONFDIR = _autoconf.SYSCONFDIR
 TOOLSDIR = _autoconf.TOOLSDIR
 CONF_DIR = SYSCONFDIR + "/ganeti"
+OPENSSL_PATH = _autoconf.OPENSSL_PATH
 
 MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
 
diff --git a/lib/utils.py b/lib/utils.py
index 1a4011ee1a67d2344e8c730efff385d06bb75121..cd899a7d3d374ecb79ab9b74ada22ed7d07dc0f9 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -2273,7 +2273,8 @@ def GenerateSelfSignedSslCert(file_name, validity=(365 * 5)):
       # Set permissions before writing key
       os.chmod(tmp_file_name, 0600)
 
-      result = RunCmd(["openssl", "req", "-new", "-newkey", "rsa:1024",
+      result = RunCmd([constants.OPENSSL_PATH, "req",
+                       "-new", "-newkey", "rsa:1024",
                        "-days", str(validity), "-nodes", "-x509",
                        "-keyout", tmp_file_name, "-out", tmp_file_name,
                        "-batch"])