Enable TLS for WebSocket
parent
c9a3702940
commit
cd030ce503
|
@ -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) \
|
||||
|
|
16
src/main.c
16
src/main.c
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue