diff options
author | Kim Hagen <kim@sentrium.io> | 2021-10-07 08:44:00 -0500 |
---|---|---|
committer | Kim Hagen <kim@sentrium.io> | 2021-10-07 08:44:00 -0500 |
commit | ba8630da96396f09c638fccdc9cfe6a3ee70fd58 (patch) | |
tree | a4bedef0d677fa8179dd76c7c8d314476f3683cd /src/op_mode | |
parent | eb7f8904076e749e18c10b6374bf363dfa009c19 (diff) | |
download | vyos-1x-ba8630da96396f09c638fccdc9cfe6a3ee70fd58.tar.gz vyos-1x-ba8630da96396f09c638fccdc9cfe6a3ee70fd58.zip |
pull request fixes
Diffstat (limited to 'src/op_mode')
-rwxr-xr-x | src/op_mode/show_openvpn_mfa.py (renamed from src/op_mode/show_openvpn_2fa.py) | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/op_mode/show_openvpn_2fa.py b/src/op_mode/show_openvpn_mfa.py index 8600f755d..1ab54600c 100755 --- a/src/op_mode/show_openvpn_2fa.py +++ b/src/op_mode/show_openvpn_mfa.py @@ -24,7 +24,7 @@ from vyos.util import popen otp_file = '/config/auth/openvpn/{interface}-otp-secrets' -def get_2fa_secret(interface, client): +def get_mfa_secret(interface, client): try: with open(otp_file.format(interface=interface), "r") as f: users = f.readlines() @@ -34,7 +34,7 @@ def get_2fa_secret(interface, client): except: pass -def get_2fa_uri(client, secret): +def get_mfa_uri(client, secret): hostname = socket.gethostname() fqdn = socket.getfqdn() uri = 'otpauth://totp/{hostname}:{client}@{fqdn}?secret={secret}' @@ -42,23 +42,23 @@ def get_2fa_uri(client, secret): return urllib.parse.quote(uri.format(hostname=hostname, client=client, fqdn=fqdn, secret=secret), safe='/:@?=') if __name__ == '__main__': - parser = argparse.ArgumentParser(add_help=False, description='Show 2fa information') + parser = argparse.ArgumentParser(add_help=False, description='Show two-factor authentication information') parser.add_argument('--intf', action="store", type=str, default='', help='only show the specified interface') parser.add_argument('--user', action="store", type=str, default='', help='only show the specified users') parser.add_argument('--action', action="store", type=str, default='show', help='action to perform') args = parser.parse_args() - secret = get_2fa_secret(args.intf, args.user) + secret = get_mfa_secret(args.intf, args.user) if args.action == "secret" and secret: print(secret) if args.action == "uri" and secret: - uri = get_2fa_uri(args.user, secret) + uri = get_mfa_uri(args.user, secret) print(uri) if args.action == "qrcode" and secret: - uri = get_2fa_uri(args.user, secret) + uri = get_mfa_uri(args.user, secret) qrcode,err = popen('qrencode -t ansiutf8', input=uri) print(qrcode) |