From b776003cf55e1035ac83186e44f72764e52e9e0d Mon Sep 17 00:00:00 2001 From: goodNETnick Date: Mon, 7 Feb 2022 02:04:28 -0500 Subject: ocserv: T4231: Added OTP support for Openconnect 2FA --- data/templates/ocserv/ocserv_config.tmpl | 11 +++- data/templates/ocserv/ocserv_otp_usr.tmpl | 8 +++ .../include/auth-local-users.xml.i | 69 ++++++++++++++++++++++ interface-definitions/vpn_openconnect.xml.in | 50 +++++++++++----- src/conf_mode/vpn_openconnect.py | 68 ++++++++++++++++++--- src/migration-scripts/openconnect/1-to-2 | 54 +++++++++++++++++ 6 files changed, 236 insertions(+), 24 deletions(-) create mode 100644 data/templates/ocserv/ocserv_otp_usr.tmpl create mode 100755 src/migration-scripts/openconnect/1-to-2 diff --git a/data/templates/ocserv/ocserv_config.tmpl b/data/templates/ocserv/ocserv_config.tmpl index 0be805235..19045c4b4 100644 --- a/data/templates/ocserv/ocserv_config.tmpl +++ b/data/templates/ocserv/ocserv_config.tmpl @@ -8,6 +8,14 @@ run-as-group = daemon {% if "radius" in authentication.mode %} auth = "radius [config=/run/ocserv/radiusclient.conf]" +{% elif "local" in authentication.mode %} +{% if authentication.mode.local == "password-otp" %} +auth = "plain[passwd=/run/ocserv/ocpasswd,otp=/run/ocserv/users.oath]" +{% elif authentication.mode.local == "otp" %} +auth = "plain[otp=/run/ocserv/users.oath]" +{% else %} +auth = "plain[/run/ocserv/ocpasswd]" +{% endif %} {% else %} auth = "plain[/run/ocserv/ocpasswd]" {% endif %} @@ -42,7 +50,8 @@ rekey-method = ssl try-mtu-discovery = true cisco-client-compat = true dtls-legacy = true - +max-ban-score = 80 +ban-reset-time = 300 # The name to use for the tun device device = sslvpn diff --git a/data/templates/ocserv/ocserv_otp_usr.tmpl b/data/templates/ocserv/ocserv_otp_usr.tmpl new file mode 100644 index 000000000..db8893ae8 --- /dev/null +++ b/data/templates/ocserv/ocserv_otp_usr.tmpl @@ -0,0 +1,8 @@ +#