Enable TLS for WebSocket
parent
c9a3702940
commit
cd030ce503
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#define X_CFG_LIST \
|
#define X_CFG_LIST \
|
||||||
X(bool, enable_auth) \
|
X(bool, enable_auth) \
|
||||||
|
X(bool, enable_tls) \
|
||||||
X(string, private_key_file) \
|
X(string, private_key_file) \
|
||||||
X(string, certificate_file) \
|
X(string, certificate_file) \
|
||||||
X(string, username) \
|
X(string, username) \
|
||||||
|
|
12
src/main.c
12
src/main.c
|
@ -740,12 +740,20 @@ int init_nvnc(struct wayvnc* self, const char* addr, uint16_t port,
|
||||||
|
|
||||||
nvnc_set_name(self->nvnc, "WayVNC");
|
nvnc_set_name(self->nvnc, "WayVNC");
|
||||||
|
|
||||||
if (self->cfg.enable_auth &&
|
if (self->cfg.enable_auth) {
|
||||||
nvnc_enable_auth(self->nvnc, self->cfg.private_key_file,
|
if (nvnc_enable_auth(self->nvnc, self->cfg.private_key_file,
|
||||||
self->cfg.certificate_file, on_auth, self) < 0) {
|
self->cfg.certificate_file, on_auth, self) < 0) {
|
||||||
nvnc_log(NVNC_LOG_ERROR, "Failed to enable authentication");
|
nvnc_log(NVNC_LOG_ERROR, "Failed to enable authentication");
|
||||||
goto failure;
|
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)
|
if (self->pointer_manager)
|
||||||
nvnc_set_pointer_fn(self->nvnc, on_pointer_event);
|
nvnc_set_pointer_fn(self->nvnc, on_pointer_event);
|
||||||
|
|
Loading…
Reference in New Issue