For those of you on AWS, here's a nifty 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.
Systems Manager Doc to Unlock Google Authenticator
{
"schemaVersion": "2.2",
"description": "Unlock the Google Authenticator for a given Username. After doing this, the user must login to the OpenVPN server with their browser and scan the barcode.",
"parameters": {
"Username": {
"description": "Username of the user to unlock",
"minChars": 3,
"type": "String"
}
},
"mainSteps": [
{
"action": "aws:runShellScript",
"name": "OpenVPNASUnlockGoogleAuthenticator",
"inputs": {
"runCommand": [
"#!/bin/bash",
"cd /usr/local/openvpn_as/scripts",
"./sacli -u {{ Username }} --lock 0 GoogleAuthLock"
]
},
"precondition":{
"StringEquals":[
"platformType",
"Linux"
]
}
}
]
}
AWS SSM agent install
cd /tmp
wget https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_amd64/amazon-ssm-agent.deb
dpkg -i amazon-ssm-agent.deb
rm amazon-ssm-agent.deb
systemctl enable amazon-ssm-agent