The original google-authenticator-libpam verifies the code in the login server. If the server is hacked, all the secret will be lost. To improve the security for the system, the code is modified to verify the code in remote server. The code is sent to another python socket server called ClientServer through unix file. The the code then is sent to Server to verify. The Server connects with mysql to get the otp secret to verify.
cd google-authenticator-libpam
./bootstrap.sh
./configure
make
cp .libs/pam_google_authenticator.so /usr/lib64/security- The
userparameter must be set in/etc/pam.d/sshd - The
socketparameter must be set to connect with ClientServer and is should be the same withSOCK_ADDRinconfig.py - Other setting is the same in original google-authenticator-libpam
- The following parameters do not work any more: secret, noskewadj, grace_period
- Example:
auth required pam_google_authenticator.so user=otp socket=/tmp/sock1
- Server:
python3 OTPServer.py serverin a verification server which can connect to mysql. - ClientServer:
sudo -u username python3 OTPServer.py clientin the login server.usernameshould be the same with user in/etc/pam.d/sshd
python3 OTPServer.py util new usernameset new otp secret the speficy user.python3 OTPServer.py util get usernameget otp secret the speficy user.python3 OTPServer.py util verify username otpcodeverify the otpcode for a specific user.