Bläddra i källkod

HPCC-20776 Unable to start ESP if https and no passphrase

If HTTPS is enabled in the ESP configuration, and no passphrase is provided,
then ESP throws and aborts.  The passphrase is optional and ESP should start
without if, unless the certificates require it. This PR removes the requirement
for passphrase

Signed-off-by: Russ Whitehead <william.whitehead@lexisnexis.com>
Russ Whitehead 6 år sedan
förälder
incheckning
367651b5e9
2 ändrade filer med 8 tillägg och 14 borttagningar
  1. 8 11
      esp/bindings/http/platform/httpprot.cpp
  2. 0 3
      esp/bindings/http/platform/httpprot.hpp

+ 8 - 11
esp/bindings/http/platform/httpprot.cpp

@@ -233,24 +233,21 @@ CSecureHttpProtocol::CSecureHttpProtocol(IPropertyTree* cfg)
     if(cfg != NULL)
     {
         m_config.setown(cfg);
-        cfg->getProp("certificate", m_certfile);
-        if(m_certfile.length() == 0)
+
+        //ensure keys are specified. Passphrase is optional
+        StringBuffer sb;
+        cfg->getProp("certificate", sb);
+        if(sb.length() == 0)
         {
             throw MakeStringException(-1, "certificate file not specified in config file");
         }
-        cfg->getProp("privatekey", m_privkeyfile);
-        if(m_privkeyfile.length() == 0)
+
+        cfg->getProp("privatekey", sb.clear());
+        if(sb.length() == 0)
         {
             throw MakeStringException(-1, "private key file not specified in config file");
         }
-        StringBuffer pphrase;
-        cfg->getProp("passphrase", pphrase);
-        if(pphrase.length() == 0)
-        {
-            throw MakeStringException(-1, "passphrase not specified in config file");
-        }
 
-        //m_ssctx.setown(createSecureSocketContextEx(m_certfile.str(), m_privkeyfile.str(), m_passphrase.str(), ServerSocket));
         createSecureSocketContextEx2_t xproc = NULL;
         IEspPlugin *pplg = loadPlugin(SSLIB);
         if (pplg)

+ 0 - 3
esp/bindings/http/platform/httpprot.hpp

@@ -127,9 +127,6 @@ public:
 class esp_http_decl CSecureHttpProtocol : public CEspProtocol
 {
 private:
-    StringBuffer m_certfile;
-    StringBuffer m_privkeyfile;
-    StringBuffer m_passphrase;
     Owned<ISecureSocketContext> m_ssctx;
 
     Owned<IPropertyTree> m_config;