1

I'm using google authenticator pam module on CentOS to create a 2FA authentication for my users, however, I want that only the users that have already registered with the authenticator are asked to input its code, while users that hasn't registered the 2FA are asked solely their password. How can I do that? Actually if a user without 2FA token tries to login, even when the password is correct, its connection gets refused. Here are my pam configuration. Note: For users which have ran google-authenticator so far it works smoothly.

auth        required      pam_env.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        required      pam_google_authenticator.so
auth        requisite     pam_succeed_if.so uid >= 500 quiet
auth        sufficient    pam_sss.so use_first_pass
#auth        required      pam_deny.so

account     required      pam_unix.so
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 500 quiet
account     [default=bad success=ok user_unknown=ignore] pam_sss.so
account     required      pam_permit.so

password    requisite     pam_cracklib.so try_first_pass retry=3 type= minlen=8 lcredit=2 ucredit=2 dcredit=2 ocredit=2
password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok
password    sufficient    pam_sss.so use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
session     optional      pam_sss.so

1 Answers1

0

You can edit this line:

auth        required      pam_google_authenticator.so

to

auth        required      pam_google_authenticator.so    nullok

this will allow both, the ones who have OATH-TO

Apoorv Joshi
  • 101
  • 2