Add global duo config and document options in .env template

This commit is contained in:
Daniel García
2019-04-07 18:58:15 +02:00
parent cfbeb56371
commit 754087b990
4 changed files with 99 additions and 83 deletions

View File

@@ -302,6 +302,20 @@ make_config! {
yubico_server: String, true, option;
},
/// Duo settings
duo: _enable_duo {
/// Enabled
_enable_duo: bool, true, def, true;
/// Integration Key
duo_ikey: String, true, option;
/// Secret Key
duo_skey: Pass, true, option;
/// Host
duo_host: String, true, option;
/// Application Key
duo_akey: Pass, true, option;
},
/// SMTP Email Settings
smtp: _enable_smtp {
/// Enabled
@@ -332,6 +346,12 @@ fn validate_config(cfg: &ConfigItems) -> Result<(), Error> {
}
}
if (cfg.duo_host.is_some() || cfg.duo_ikey.is_some() || cfg.duo_skey.is_some() || cfg.duo_akey.is_some())
&& !(cfg.duo_host.is_some() && cfg.duo_ikey.is_some() && cfg.duo_skey.is_some() && cfg.duo_akey.is_some())
{
err!("All Duo options need to be set for Duo support")
}
if 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")
}