Last active
January 4, 2016 20:39
-
-
Save rafaelfoster/8675479 to your computer and use it in GitHub Desktop.
Linux - PAM Google Two Factor Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RHEL based | |
yum install gcc make pam-devel | |
# Debian Based | |
apt-get install build-essential make libpam0g-dev libpam0g; LDFLAGS="-lpam" | |
version=1.0 | |
mkdir ${HOME}/tmp | |
cd ${HOME}/tmp | |
wget https://google-authenticator.googlecode.com/files/libpam-google-authenticator-$version-source.tar.bz2 | |
tar xjvf libpam-google-authenticator-$version-source.tar.bz2 | |
cd libpam-google-authenticator-$version | |
make | |
make install | |
echo Y | google-authenticator -d -t -r 1 -R 30 -f -w 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/ssh/sshd_config | |
# Tips to enforce SSH access | |
DenyUsers root@!192.168.*.* | |
# Change to no to disable Password requirement (usable to combine OTP + Keys Login) | |
PasswordAuthentication no | |
# Change to no to disable s/key passwords | |
ChallengeResponseAuthentication yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/pam.d/sshd | |
#%PAM-1.0 | |
auth include google-otp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/pam.d/google-otp | |
auth required pam_unix.so | |
# If the user is NOT in group "otp_auth", skip next module | |
auth [success=1 default=ignore] pam_succeed_if.so user ingroup otp_auth | |
auth required pam_google_authenticator.so secret=${HOME}/.google_authenticator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment