-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numerous Improvements for Two Factor Authentication #223
Conversation
…dir from /etc/passwd
Thanks for submitting your first pull request! You are awesome! 🤗 |
for more information, see https://pre-commit.ci
The failed tests seem to be related to I'll try to add some new unit tests for 2FA as well while I'm at it. |
New features:
Changes:
NativeAuthenticator.change_2fa()
functionChange2FAHandler
andChange2FAAdminHandler
ChangePasswordHandler
to include 2FALoginHandler
to check if 2FA is required, and if so, automatically enable it for users without 2FA during loginSignUpHandler
to check if 2FA is required, and if so, automatically enable it for all new usersUserInfo.get_otp_secret()
to optionally usegoogle-authenticator
to generate the 2FA secret key, or inherit the existing one from/home/user/.google_authenticator
onetimepass
withpyotp
to support OTP URI links and improve compliance with newer Google Authenticator implementations that use anissuer
parameter in the URI for internal disambiguationoptions.md
Related Issues: #152, #155 #167, #172, #185
Notes:
The Google Authenticator PAM Module interaction is a little bit hacky right now. When NativeAuthenticator is configured to use this module, UserInfo first attempts to pull an existing 2FA secret out of
/home/user/.google_authenticator
and if there is no existing secret file, then it uses anos.system()
call togoogle-authenticator
to generate a new one.I took a swing at doing this more cleanly by using pamela to authenticate through a JupyterHub PAM service that defines
auth required pam_google_authenticator.so nullok
. Unfortunately I never managed to get it to authenticate correctly with credentials and 2FA codes that I knew were correct. If someone else has experience making this work, please let me know.Looking forward to any feedback. Happy to discuss and modify any UI and/or functionality choices.