Add TLS debug info for influxs and mqtts

This commit is contained in:
Christian W. Zuckschwerdt 2023-02-07 16:01:22 +01:00
parent 787268709d
commit 2122f8dbc3
2 changed files with 32 additions and 1 deletions

View file

@ -112,6 +112,22 @@ static void influx_client_send(influx_client_t *ctx)
char const *error_string = NULL;
struct mg_connect_opts opts = {.user_data = ctx, .error_string = &error_string};
if (ctx->tls_opts.tls_ca_cert) {
print_logf(LOG_INFO, "InfluxDB", "influxs (TLS) parameters are: "
"tls_cert=%s "
"tls_key=%s "
"tls_ca_cert=%s "
"tls_cipher_suites=%s "
"tls_server_name=%s "
"tls_psk_identity=%s "
"tls_psk_key=%s ",
ctx->tls_opts.tls_cert,
ctx->tls_opts.tls_key,
ctx->tls_opts.tls_ca_cert,
ctx->tls_opts.tls_cipher_suites,
ctx->tls_opts.tls_server_name,
ctx->tls_opts.tls_psk_identity,
ctx->tls_opts.tls_psk_key);
#if MG_ENABLE_SSL
opts.ssl_cert = ctx->tls_opts.tls_cert;
opts.ssl_key = ctx->tls_opts.tls_key;
@ -121,7 +137,7 @@ static void influx_client_send(influx_client_t *ctx)
opts.ssl_psk_identity = ctx->tls_opts.tls_psk_identity;
opts.ssl_psk_key = ctx->tls_opts.tls_psk_key;
#else
print_logf(LOG_FATAL, __func__, "influxs (TLS) not available");
print_log(LOG_FATAL, __func__, "influxs (TLS) not available");
exit(1);
#endif
}

View file

@ -126,6 +126,21 @@ static mqtt_client_t *mqtt_client_init(struct mg_mgr *mgr, tls_opts_t *tls_opts,
ctx->connect_opts.user_data = ctx;
if (tls_opts && tls_opts->tls_ca_cert) {
print_logf(LOG_INFO, "MQTT", "mqtts (TLS) parameters are: "
"tls_cert=%s "
"tls_key=%s "
"tls_ca_cert=%s "
"tls_cipher_suites=%s "
"tls_server_name=%s "
"tls_psk_identity=%s "
"tls_psk_key=%s ",
tls_opts->tls_cert,
tls_opts->tls_key,
tls_opts->tls_ca_cert,
tls_opts->tls_cipher_suites,
tls_opts->tls_server_name,
tls_opts->tls_psk_identity,
tls_opts->tls_psk_key);
#if MG_ENABLE_SSL
ctx->connect_opts.ssl_cert = tls_opts->tls_cert;
ctx->connect_opts.ssl_key = tls_opts->tls_key;