start SSL
This commit is contained in:
@@ -18,6 +18,10 @@ if(HAVE_MQTT)
|
||||
set(ebusd_LIBS ${ebusd_LIBS} mosquitto)
|
||||
endif(HAVE_MQTT)
|
||||
|
||||
if(HAVE_SSL)
|
||||
set(ebusd_LIBS ${ebusd_LIBS} ssl crypto)
|
||||
endif(HAVE_SSL)
|
||||
|
||||
if(HAVE_CONTRIB)
|
||||
set(ebusd_LIBS ${ebusd_LIBS} ebuscontrib)
|
||||
endif(HAVE_CONTRIB)
|
||||
|
||||
+7
-3
@@ -65,7 +65,11 @@ using std::cout;
|
||||
#endif
|
||||
|
||||
/** the default path of the configuration files. */
|
||||
#ifdef HAVE_SSL
|
||||
#define CONFIG_PATH "https://cfg.ebusd.eu/"
|
||||
#else
|
||||
#define CONFIG_PATH "http://cfg.ebusd.eu/"
|
||||
#endif
|
||||
|
||||
/** the opened PID file, or nullptr. */
|
||||
static FILE* pidFile = nullptr;
|
||||
@@ -189,7 +193,7 @@ static const struct argp_option argpoptions[] = {
|
||||
{"latency", O_DEVLAT, "MSEC", 0, "Extra transfer latency in ms [0]", 0 },
|
||||
|
||||
{nullptr, 0, nullptr, 0, "Message configuration options:", 2 },
|
||||
{"configpath", 'c', "PATH", 0, "Read CSV config files from PATH (local folder or HTTP URL) [" CONFIG_PATH
|
||||
{"configpath", 'c', "PATH", 0, "Read CSV config files from PATH (local folder or HTTPS URL) [" CONFIG_PATH
|
||||
"]", 0 },
|
||||
{"scanconfig", 's', "ADDR", OPTION_ARG_OPTIONAL, "Pick CSV config files matching initial scan (ADDR="
|
||||
"\"none\" or empty for no initial scan message, \"full\" for full scan, or a single hex address to scan, "
|
||||
@@ -308,7 +312,7 @@ error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||
break;
|
||||
|
||||
// Message configuration options:
|
||||
case 'c': // --configpath=http://cfg.ebusd.eu/
|
||||
case 'c': // --configpath=https://cfg.ebusd.eu/
|
||||
if (arg == nullptr || arg[0] == 0 || strcmp("/", arg) == 0) {
|
||||
argp_error(state, "invalid configpath");
|
||||
return EINVAL;
|
||||
@@ -1307,7 +1311,7 @@ int main(int argc, char* argv[]) {
|
||||
logError(lf_main, "invalid configPath URL");
|
||||
return EINVAL;
|
||||
}
|
||||
if (!s_configHttpClient.connect(configHost, configPort, PACKAGE_NAME "/" PACKAGE_VERSION)) {
|
||||
if (!s_configHttpClient.connect(configHost, configPort, proto=="https", PACKAGE_NAME "/" PACKAGE_VERSION)) {
|
||||
logError(lf_main, "invalid configPath URL");
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ struct options {
|
||||
bool initialSend; //!< send an initial escape symbol after connecting device
|
||||
unsigned int extraLatency; //!< extra transfer latency in ms [0 for USB, 10 for IP]
|
||||
|
||||
const char* configPath; //!< path to CSV configuration files [http://cfg.ebusd.eu/]
|
||||
const char* configPath; //!< path to CSV configuration files [https://cfg.ebusd.eu/]
|
||||
bool scanConfig; //!< pick configuration files matching initial scan
|
||||
/** the initial address to scan for scanconfig
|
||||
* (@a ESC=none, 0xfe=broadcast ident, @a SYN=full scan, else: single slave address). */
|
||||
|
||||
@@ -332,7 +332,13 @@ void MainLoop::run() {
|
||||
}
|
||||
if (m_runUpdateCheck && !m_shutdown && now > nextCheckRun) {
|
||||
HttpClient client;
|
||||
if (!client.connect("upd.ebusd.eu", 80, PACKAGE_NAME "/" PACKAGE_VERSION)) {
|
||||
if (!client.connect("upd.ebusd.eu",
|
||||
#ifdef HAVE_SSL
|
||||
443, true,
|
||||
#else
|
||||
80, false,
|
||||
#endif
|
||||
PACKAGE_NAME "/" PACKAGE_VERSION)) {
|
||||
logError(lf_main, "update check connect error");
|
||||
} else {
|
||||
ostringstream ostr;
|
||||
|
||||
Reference in New Issue
Block a user