mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
openvpn-authenticator: Return only available data
For connections which have not enabled OTP return connection name and common_name attributes only.
This commit is contained in:
committed by
Michael Tremer
parent
74ab6f9fc0
commit
a4a42daeea
@@ -286,15 +286,19 @@ class OpenVPNAuthenticator(object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Return match!
|
# Return match!
|
||||||
return {
|
conn = {}
|
||||||
"name" : row[2],
|
if len(row) < 45:
|
||||||
"common_name" : row[3],
|
# General connection data
|
||||||
|
conn['name'] = row[2]
|
||||||
|
conn['common_name'] = row[3]
|
||||||
|
elif len(row) >= 45:
|
||||||
# TOTP options
|
# TOTP options
|
||||||
"totp_protocol" : row[43],
|
conn['totp_protocol'] = row[43]
|
||||||
"totp_status" : row[44],
|
conn['totp_status'] = row[44]
|
||||||
"totp_secret" : row[45],
|
conn['totp_secret'] = row[45]
|
||||||
}
|
|
||||||
|
return conn
|
||||||
|
|
||||||
|
|
||||||
def _check_totp_token(self, token, secret):
|
def _check_totp_token(self, token, secret):
|
||||||
p = subprocess.run(
|
p = subprocess.run(
|
||||||
|
|||||||
Reference in New Issue
Block a user