Add config parameter for RSA private key file
parent
31e19757d1
commit
fce9a2eb69
|
@ -23,6 +23,7 @@
|
||||||
X(bool, enable_auth) \
|
X(bool, enable_auth) \
|
||||||
X(string, private_key_file) \
|
X(string, private_key_file) \
|
||||||
X(string, certificate_file) \
|
X(string, certificate_file) \
|
||||||
|
X(string, rsa_private_key_file) \
|
||||||
X(string, username) \
|
X(string, username) \
|
||||||
X(string, password) \
|
X(string, password) \
|
||||||
X(string, address) \
|
X(string, address) \
|
||||||
|
|
26
src/main.c
26
src/main.c
|
@ -740,15 +740,29 @@ 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 && self->cfg.private_key_file[0] == '\0') {
|
if (self->cfg.enable_auth) {
|
||||||
nvnc_enable_auth2(self->nvnc, on_auth, self);
|
if (self->cfg.rsa_private_key_file) {
|
||||||
} else if (self->cfg.enable_auth &&
|
if (nvnc_enable_auth2(self->nvnc, on_auth, self) < 0) {
|
||||||
nvnc_enable_auth(self->nvnc, self->cfg.private_key_file,
|
nvnc_log(NVNC_LOG_ERROR, "Failed to enable RSA authentication");
|
||||||
self->cfg.certificate_file, on_auth, self) < 0) {
|
|
||||||
nvnc_log(NVNC_LOG_ERROR, "Failed to enable authentication");
|
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nvnc_set_rsa_creds(self->nvnc, self->cfg.rsa_private_key_file) < 0) {
|
||||||
|
nvnc_log(NVNC_LOG_ERROR, "Failed to load RSA credentials");
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self->cfg.private_key_file) {
|
||||||
|
int r = nvnc_enable_auth(self->nvnc, self->cfg.private_key_file,
|
||||||
|
self->cfg.certificate_file, on_auth, self);
|
||||||
|
if (r < 0) {
|
||||||
|
nvnc_log(NVNC_LOG_ERROR, "Failed to enable TLS authentication");
|
||||||
|
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