Enable TLS for WebSocket

websocket-tls
Andri Yngvason 2023-04-30 16:43:37 +00:00
parent c9a3702940
commit cd030ce503
2 changed files with 13 additions and 4 deletions

View File

@ -21,6 +21,7 @@
#define X_CFG_LIST \
X(bool, enable_auth) \
X(bool, enable_tls) \
X(string, private_key_file) \
X(string, certificate_file) \
X(string, username) \

View File

@ -740,11 +740,19 @@ int init_nvnc(struct wayvnc* self, const char* addr, uint16_t port,
nvnc_set_name(self->nvnc, "WayVNC");
if (self->cfg.enable_auth &&
nvnc_enable_auth(self->nvnc, self->cfg.private_key_file,
if (self->cfg.enable_auth) {
if (nvnc_enable_auth(self->nvnc, self->cfg.private_key_file,
self->cfg.certificate_file, on_auth, self) < 0) {
nvnc_log(NVNC_LOG_ERROR, "Failed to enable authentication");
goto failure;
nvnc_log(NVNC_LOG_ERROR, "Failed to enable authentication");
goto failure;
}
} else if (self->cfg.enable_tls) {
if (nvnc_load_tls_credentials(self->nvnc,
self->cfg.private_key_file,
self->cfg.certificate_file) < 0) {
nvnc_log(NVNC_LOG_ERROR, "Failed to load TLS credentials");
goto failure;
}
}
if (self->pointer_manager)