VPN: OpenVPN: Client Export - add "Enable static challenge (OTP)" option, closes https://github.com/opnsense/core/issues/8488

This commit is contained in:
Ad Schellevis 2025-03-31 18:52:26 +02:00
parent f698e25cbb
commit d8adc429f7
5 changed files with 15 additions and 3 deletions

View File

@ -57,6 +57,13 @@
<style>export_option</style>
<help>Sets auth-nocache in the exported configuration when password authentication is used. This prevents OpenVPN from caching passwords in memory.</help>
</field>
<field>
<id>openvpn_export.static_challenge</id>
<label>Enable static challenge (OTP)</label>
<type>checkbox</type>
<style>export_option</style>
<help>Ask the user for its one time password token separately (instead of as part the password).</help>
</field>
<field>
<id>openvpn_export.plain_config</id>
<label>Custom config</label>

View File

@ -48,7 +48,7 @@ class ArchiveOpenVPN extends PlainOpenVPN
*/
public function supportedOptions()
{
return array("plain_config", "p12_password", "random_local_port", "auth_nocache", "cryptoapi");
return ["plain_config", "p12_password", "random_local_port", "auth_nocache", "cryptoapi", "static_challenge"];
}
/**

View File

@ -48,7 +48,7 @@ class PlainOpenVPN extends BaseExporter implements IExportProvider
*/
public function supportedOptions()
{
return array("plain_config", "random_local_port", "auth_nocache", "cryptoapi");
return ["plain_config", "random_local_port", "auth_nocache", "cryptoapi", "static_challenge"];
}
/**
@ -143,6 +143,10 @@ class PlainOpenVPN extends BaseExporter implements IExportProvider
}
}
if (!empty($this->config['static_challenge'])) {
$conf[] = sprintf('static-challenge "%s" 1', addslashes(gettext('Enter OTP token:')));
}
if (!empty($this->config['compression'])) {
switch ($this->config['compression']) {
case 'no':

View File

@ -48,7 +48,7 @@ class ViscosityVisz extends PlainOpenVPN
*/
public function supportedOptions()
{
return array("plain_config", "p12_password", "random_local_port", "auth_nocache", "cryptoapi");
return ["plain_config", "p12_password", "random_local_port", "auth_nocache", "cryptoapi", "static_challenge"];
}
/**

View File

@ -29,6 +29,7 @@
</validate_server_cn>
<cryptoapi type="BooleanField"/>
<auth_nocache type="BooleanField"/>
<static_challenge type="BooleanField"/>
<plain_config type="TextField"/>
</server>
</servers>