Last active
February 3, 2025 06:22
-
-
Save sshimko/0f865cd9f954889c5b4000e8e23bdc1f to your computer and use it in GitHub Desktop.
MacOS/OS X google authenticator pam configs for screensaver, ssh, sudo, authotization (GUI login)
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
# screensaver: auth account | |
# the tricky bit - needs to be first *and* use_first_pass and forward_pass | |
# segfaults the login prompt in any other configuration i tried. | |
# NOTE: user must enter their password followed by the google autb string in the pasasword prompt, no space in between. | |
# e.g., foobar123456 where "foobar" is the pw and "123456" is the code from google authenticator. | |
auth required /usr/local/lib/security/pam_google_authenticator.so use_first_pass forward_pass nullok | |
auth optional pam_krb5.so use_first_pass use_kcminit | |
auth required pam_opendirectory.so use_first_pass nullok | |
account required pam_opendirectory.so | |
account sufficient pam_self.so | |
account required pam_group.so no_warn group=admin,wheel fail_safe | |
account required pam_group.so no_warn deny group=admin,wheel ruser fail_safe |
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
# sshd: auth account password session | |
# this one was tricky too - if you use public key auth and disable keyboard interactive in sshd_config | |
# these auth hooks are never hit, including the google authenticator. | |
# so enable keyboard interactive and challenge response. these fields need to be in /etc/ssh/sshd_config: | |
# PasswordAuthentication no | |
# AuthenticationMethods publickey,keyboard-interactive | |
# ChallengeResponseAuthentication yes | |
# UsePAM yes | |
auth required /usr/local/lib/security/pam_google_authenticator.so nullok | |
#auth optional pam_krb5.so use_kcminit | |
#auth optional pam_ntlm.so try_first_pass | |
#auth optional pam_mount.so try_first_pass | |
#auth required pam_opendirectory.so try_first_pass | |
account required pam_nologin.so | |
account required pam_sacl.so sacl_service=ssh | |
account required pam_opendirectory.so | |
password required pam_opendirectory.so | |
session required pam_launchd.so | |
session optional pam_mount.so |
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
# sudo: auth account password session | |
auth required /usr/local/lib/security/pam_google_authenticator.so nullok | |
auth sufficient pam_smartcard.so | |
auth required pam_opendirectory.so | |
account required pam_permit.so | |
password required pam_deny.so | |
session required pam_permit.so |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any modifications to these files will get blown away whenever Apple ships an update with these files in it - .e.g a major release.