OpenVPN Google authenticator setup
How to enable Google Authenticator**
The Access Server supports the Google Authenticator multi-factor authentication system, but it is not enabled by default. It can be enabled globally via the admin web service (AS 2.7.4 and older) or via the .Authentication" section (AS 2.7.5 and newer) or via the command line with the command line examples given below. It is also possible to enable or disable the requirement for a Google Authenticator per user or per group on the command line. This can be important if for example for some reason a client device making a VPN connection is unable to provide the Google Authenticator key by itself.
Command line configuration parameters
Disable Google Authenticator globally for all users and groups (the default):
1 2 |
|
Enable Google Authenticator globally for all users and groups:
1 2 |
|
Disable Google Authenticator for a specific user or group:
1
|
|
Enable Google Authenticator for a specific user or group:
1
|
|
Undo an enable/disable override for Google Authenticator on a group or user, so that it inherits the setting instead:
1
|
|
To unlock an already scanned and locked secret for a user, so the user can obtain/scan it again:
1
|
|
To manually lock a secret key, for example when you as administrator have already set up the user.s device yourself:
1
|
|
To generate a new secret key and unlock it so the user can enroll anew:
1
|
|
To generate a new secret key and lock it so the user must obtain the secret key from the server administrator:
1
|
|
The GoogleAuthLock and GoogleAuthRegen functions that actually handle these two keys, which can also be edited manually:
1 2 3 |
|
Where
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
1
|
|
1 2 3 4 5 |
|
1 2 3 |
|
1 2 3 |
|
1 2 3 |
|
1 2 3 4 5 |
|
The GoogleAuthLock and GoogleAuthRegen functions that actually handle these two keys, which can also be edited manually
1 2 3 |
|
Logs
1
|
|
When new MFA/Google secret has been generated user need to login to Access Server, scann QR code, then download the Connection Client that the bundle contains the new user settings; this will enable VPN login.
AWS SSM Document:
Handy AWS Sytems Manager Document that can be used to unlock Google Authenticator for a user. Simply add this Document to Systems Manager and Run it with an instance and the username of the user to unlock. This requires installation of the SSM agent on each OpenVPN instance. You'll probably need to read up on the AWS Systems Manager docs but it is well worth it for this and a whole host of other use cases.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
Issues:
Sometimes you would wonder , why is my EC2 instance not appearing under Managed Instances in the Systems Manager console?
A managed instance is an EC2 instance that is configured for use with Systems Manager. Managed instances can use Systems Manager services such as Run Command, Patch Manager, and Automation workflows.
Instances must meet the following prerequisites to be managed instances:
Have the AWS Systems Manager Agent (SSM Agent) installed and running.
Have connectivity with Systems Manager endpoints using the SSM Agent.
Have the correct AWS Identity and Access Management (IAM) role attached.
Have connectivity to the instance metadata service
Resolution
- SSM Agent is installed and running on the instance
Latest Ubuntu 18.04 systems that use snap:
1 2 3 4 5 |
|
- Verify connectivity to Systems Manager endpoints on port 443 To test connectivity to endpoints from port 443, use the telnet command. The following example shows how to test connectivity to endpoints in the us-east-1 Region.
1
|
|
1
|
|
1
|
|
Verify that the correct IAM role is attached to the instance To use APIs to call a Systems Manager endpoint, the correct IAM role must be attached to the instance. Make sure that the IAM role has the AWS managed policy AmazonSSMManagedInstanceCore attached to it. If you are using a custom IAM policy, make sure that the permissions found under AmazonSSMManagedInstanceCore are used in your custom policy. Also, make sure that the trust policy of the IAM role allows ec2.amazonaws.com to assume this role.
Verify connectivity to the instance metadata service SSM Agent must be able to communicate with the instance metadata service in order to get necessary information about the instance. To test this connection, use the telnet command.
1
|
|
References
https://openvpn.net/vpn-server-resources/google-authenticator-multi-factor-authentication/
https://openvpn.net/vpn-server-resources/additional-security-command-line-options/
https://aws.amazon.com/premiumsupport/knowledge-center/systems-manager-ec2-instance-not-appear/
https://docs.aws.amazon.com/systems-manager/latest/userguide/agent-install-ubuntu.html