Merge pull request #3585 from dedeckeh/strongswan_uci
[feed/packages.git] / utils / domoticz / patches / 001-Add-sslkey-option-to-allow-separate-cert-key-files-1.patch
1 From 2504f02de752aceb5a3c1d4749032147efde8082 Mon Sep 17 00:00:00 2001
2 From: dwmw2 <dwmw2@infradead.org>
3 Date: Fri, 3 Feb 2017 07:40:35 +0000
4 Subject: [PATCH] Add -sslkey option to allow separate cert/key files (#1195)
5
6 ---
7 main/domoticz.cpp | 11 +++++++++++
8 webserver/server_settings.hpp | 2 +-
9 2 files changed, 12 insertions(+), 1 deletion(-)
10
11 --- a/main/domoticz.cpp
12 +++ b/main/domoticz.cpp
13 @@ -76,6 +76,7 @@ const char *szHelp=
14 #ifdef WWW_ENABLE_SSL
15 "\t-sslwww port (for example -sslwww 443, or -sslwww 0 to disable https)\n"
16 "\t-sslcert file_path (for example /opt/domoticz/server_cert.pem)\n"
17 + "\t-sslkey file_path (if different from certificate file)\n"
18 "\t-sslpass passphrase (to access to server private key in certificate)\n"
19 "\t-sslmethod method (for SSL method)\n"
20 "\t-ssloptions options (for SSL options, default is 'default_workarounds,no_sslv2,single_dh_use')\n"
21 @@ -682,6 +683,16 @@ int main(int argc, char**argv)
22 return 1;
23 }
24 secure_webserver_settings.cert_file_path = cmdLine.GetSafeArgument("-sslcert", 0, "");
25 + secure_webserver_settings.private_key_file_path = secure_webserver_settings.cert_file_path;
26 + }
27 + if (cmdLine.HasSwitch("-sslkey"))
28 + {
29 + if (cmdLine.GetArgumentCount("-sslkey") != 1)
30 + {
31 + _log.Log(LOG_ERROR, "Please specify a file path for your server SSL key file");
32 + return 1;
33 + }
34 + secure_webserver_settings.private_key_file_path = cmdLine.GetSafeArgument("-sslkey", 0, "");
35 }
36 if (cmdLine.HasSwitch("-sslpass"))
37 {
38 --- a/webserver/server_settings.hpp
39 +++ b/webserver/server_settings.hpp
40 @@ -227,7 +227,7 @@ public:
41 // use certificate file for all usage by default
42 certificate_chain_file_path = ssl_settings.cert_file_path;
43 ca_cert_file_path = ssl_settings.cert_file_path;
44 - private_key_file_path = ssl_settings.cert_file_path;
45 + private_key_file_path = ssl_settings.private_key_file_path;
46 tmp_dh_file_path = ssl_settings.cert_file_path;
47 verify_file_path = ssl_settings.cert_file_path;
48 }