Skip to content

Commit

Permalink
Relax auth parameter sanitation
Browse files Browse the repository at this point in the history
Since more authentication modes have been added, it's no longer a
requirement to have key files set.
  • Loading branch information
any1 committed Nov 5, 2023
1 parent b4c234b commit 6470dfe
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,18 +1017,14 @@ int check_cfg_sanity(struct cfg* cfg)

if (!nvnc_has_auth()) {
nvnc_log(NVNC_LOG_ERROR, "Authentication can't be enabled because it was not selected during build");
return -1;
}

if (!cfg->certificate_file && !cfg->rsa_private_key_file) {
nvnc_log(NVNC_LOG_ERROR, "Authentication enabled, but missing certificate_file");
rc = -1;
}

if (!cfg->private_key_file && !cfg->rsa_private_key_file) {
nvnc_log(NVNC_LOG_ERROR, "Authentication enabled, but missing private_key_file");
if (!!cfg->certificate_file != !!cfg->private_key_file) {
nvnc_log(NVNC_LOG_ERROR, "Need both certificate_file and private_key_file for TLS");
rc = -1;
}

if (!cfg->username && !cfg->enable_pam) {
nvnc_log(NVNC_LOG_ERROR, "Authentication enabled, but missing username");
rc = -1;
Expand All @@ -1038,6 +1034,11 @@ int check_cfg_sanity(struct cfg* cfg)
nvnc_log(NVNC_LOG_ERROR, "Authentication enabled, but missing password");
rc = -1;
}

if (cfg->relax_encryption) {
nvnc_log(NVNC_LOG_WARNING, "Authentication enabled with relaxed encryption; not all sessions are guaranteed to be encrypted");
}

return rc;
}

Expand Down

0 comments on commit 6470dfe

Please sign in to comment.