commit 8bf8388cd64920c75113a8152922fe386c4ae669 parent f1083495478711cc53b8ea062b7de16e1b1e100c Author: Daniel GarcĂa <dani-garcia@users.noreply.github.com> Date: Mon, 9 Jan 2023 18:23:11 +0100 Merge branch 'BlackDex-issue-3003' Diffstat:
M | src/config.rs | | | 13 | +++++++++++-- |
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/config.rs b/src/config.rs @@ -698,8 +698,17 @@ fn validate_config(cfg: &ConfigItems) -> Result<(), Error> { err!("All Duo options need to be set for global Duo support") } - if cfg._enable_yubico && cfg.yubico_client_id.is_some() != cfg.yubico_secret_key.is_some() { - err!("Both `YUBICO_CLIENT_ID` and `YUBICO_SECRET_KEY` need to be set for Yubikey OTP support") + if cfg._enable_yubico { + if cfg.yubico_client_id.is_some() != cfg.yubico_secret_key.is_some() { + err!("Both `YUBICO_CLIENT_ID` and `YUBICO_SECRET_KEY` must be set for Yubikey OTP support") + } + + if let Some(yubico_server) = &cfg.yubico_server { + let yubico_server = yubico_server.to_lowercase(); + if !yubico_server.starts_with("https://") { + err!("`YUBICO_SERVER` must be a valid URL and start with 'https://'. Either unset this variable or provide a valid URL.") + } + } } if cfg._enable_smtp {