-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add Google Authenticator with pam as a package for TOTP in ssh #4852
Add Google Authenticator with pam as a package for TOTP in ssh #4852
Conversation
You can use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution, I just overlooked a few tiny things earlier
Thanks @publicarray for pointing out some of the things that I've overlooked |
any new updates on merging? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some more suggestions
Please rename the folder cross/libpam
to cross/linux-pam
to match the lowercase name of the package.
Even linux-pam is used for BUILD_DEPENDS only and therefore does not install the libpam libraries for google auth., we should add a PLIST file for generic use.
such a PLIST file contains at least the *.so files like
lnk:lib/libpam.so
lnk:lib/libpam.so.0
lib:lib/libpam.so.0.85.1
lnk:lib/libpam_misc.so
lnk:lib/libpam_misc.so.0
lib:lib/libpam_misc.so.0.82.1
lnk:lib/libpamc.so
lnk:lib/libpamc.so.0
lib:lib/libpamc.so.0.82.1
I found a way to avoid unsupported archs But this requires to patch the toolchains and this does not work with the current dev-env |
472ae5f
to
c81f6b9
Compare
@soraxas hi, it would be great, when you add a wiki page about how to configure TOTP with google auth.
|
The failing builds will be solved by patching the related toolchains. but those github actions (checks) will still fail, as the toolchains are cached and will not get patched, until the patches are merged and the toolchains are rebuilt. |
Thanks @hgy59 for the review and fixes/patches on the PR. I'll try write a wiki entry regarding how to set it up. |
I've added a wiki entry at https://github.com/SynoCommunity/spksrc/wiki/Google-Authenticator-PAM |
Just a hint to make the guide independent of the volume the package is installed in: you can reference the *.so file by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
can anyone test this on ARMv7 or even qoriq (needs local build)?
I can confirm that at least the google-authenticator app runs on ppc853x-5.2, arch-x64-7.0 and arch-aarch64-6.1. on aarch64 I had to call |
Ah thanks for the tips I never knew they are symlinked over there. re ANSI: I see we can add that to the wiki |
with unfortunately the android google-authenticator is not able to read this output (but the dedicated qrreader app sometimes can). |
until now the google-autenticator does not work.
|
The invalid rpath does not cause the error. I created a test user Some information grabbed from first I changed the mod of
further logs:
|
So indeed, the secret in .google_autenticator is not a valid BASE32 string. This might be related to the diskstation model with aarch64 ( On my DS-210+ (ppc853x-5.2) the secret is valid BASE32. |
Ah yep I checked and the permission for Does google-authenticator works on your DS-210+? Furthermore, if the issue is with the encoding within |
Now I tried on armv7 ( the binary file is ok for this arch, but the source code might have issues with cross compilation.
|
I don't know what's wrong here, but all (but the 32-bit ppc) generate base64 encoded secrets. base32 has only uppercase letters, digits and the |
Just installed On the diskstation it does not work and the only question is asks is:
May be there is a better repository for This is an ugly tool, it does not even support a --version parameter. |
Problem SOLVED! There is So it is not possible to call the authenticator of this package without the full qualified path: With this, all runs as expected and the qr code is displayed as console output and codes are base32. On DSM 5.2 there is no default app so this is the only test above with the real google-authenticator that created valid secrets. Sorry for the noise, but it would be worth to mention this in the wiki. PS: |
Oh that's interesting, I didn't realise DSM comes with a pre-packaged Symlink sounds like a good solution, and I think the full name |
Done. BTW the DSM 5.2 has installed google-authenticator too ( So Synology has it's own 2FA system that is not compatible with google-authenticator. |
Awesome thanks for adding the symlink! I've updated the wiki page to the corresponding symlink, and I've put a link that points to your post for details on this strange base64 behaviour. |
Signed-off-by: Tin Lai <[email protected]>
Signed-off-by: Tin Lai <[email protected]>
Signed-off-by: Tin Lai <[email protected]>
- fix spksrc.patch.mk (authored by @th0ma7) - fix order in spksrc.tc.mk to apply patches after files are writable (by spksrc.tc-fix.mk)
- fix signature of function quotactl in quota.h
- create link sc-google-authenticator to avoid conflict with synology specific version
1343978
to
4626c34
Compare
- create optimized code - remove obsolete PLIST file
* rustc: Install compiler with toolchain at spksrc.tc.mk time * tc-rust.mk: Use flock to avoid collisions on parallel builds * spksrc: Use realpath for RUSTUP_HOME, CARGO_HOME and PATH * cryptography: Update to 38.0.4 and test build with new rustc * rustc: Update bcrypt to 4.0.1 and test rustc py310 & py311 * python310-311: Align maturin usage and version * python310+311: Further align code & dependencies * pip: Update from versiopn 22.2.2 to 22.3.1 * setuptools: Align with py310+py311 version * tc.mk: Fix to align with PR #4852 * poetry: Remove as unused anymore * cffi: Update from version 1.15.0 to 1.15.1 * python310: Update from version 3.10.8 to 3.10.9 * python311: Update from version 3.11.0 to 3.11.1
…ommunity#4852) * add google authenticator as package Signed-off-by: Tin Lai <[email protected]> * fix build script and simplify PLIST Signed-off-by: Tin Lai <[email protected]> * fix licenses of the packages Signed-off-by: Tin Lai <[email protected]> * enable toolchain patches - fix spksrc.patch.mk (authored by @th0ma7) - fix order in spksrc.tc.mk to apply patches after files are writable (by spksrc.tc-fix.mk) * incorporate review * add toolchain patches - fix signature of function quotactl in quota.h * cleanup - fix the executable name - add wiki page as support url * use custom name for authenticator - create link sc-google-authenticator to avoid conflict with synology specific version * add toolchain patch for arch-88f6281-5.2 * minor improvements - create optimized code - remove obsolete PLIST file * add wizard page with link to the wiki page Signed-off-by: Tin Lai <[email protected]> Co-authored-by: hgy59 <[email protected]>
…unity#5508) * rustc: Install compiler with toolchain at spksrc.tc.mk time * tc-rust.mk: Use flock to avoid collisions on parallel builds * spksrc: Use realpath for RUSTUP_HOME, CARGO_HOME and PATH * cryptography: Update to 38.0.4 and test build with new rustc * rustc: Update bcrypt to 4.0.1 and test rustc py310 & py311 * python310-311: Align maturin usage and version * python310+311: Further align code & dependencies * pip: Update from versiopn 22.2.2 to 22.3.1 * setuptools: Align with py310+py311 version * tc.mk: Fix to align with PR SynoCommunity#4852 * poetry: Remove as unused anymore * cffi: Update from version 1.15.0 to 1.15.1 * python310: Update from version 3.10.8 to 3.10.9 * python311: Update from version 3.11.0 to 3.11.1
Motivation: Adds google authenticator.
Linked issues: closes #4884
This PR adds the google authenticator as a package for the libpam. This allows users to use google authenticator to generates TOTP when signing into services such as ssh.
Installing this package alone would have no effects, as it will requires user to manually utilised the installed
.so
file in their authentication service.For example, for my usecase, after install this package to volume 1 I can add the following to
/etc/ssh/sshd_config
... auth requisite pam_syno_ipblocklist.so + auth required /volume1/@appstore/google-authenticator-libpam/lib/security/pam_google_authenticator.so nullok auth [success=3 default=ignore] pam_unix.so auth [success=2 default=ignore] pam_winbind.so use_first_pass auth [success=1 default=ignore] pam_ldap.so auth [default=die] pam_syno_log_fail.so [SSH] auth [default=done] pam_syno_log_success.so [SSH] log=no account [success=3 default=ignore] pam_unix.so ...
After adding that line to
sshd_config
and generated~/.google_authenticator
, trying to ssh into synology will request TOTP:$ ssh synology (foo@synology) Verification code: (foo@synology) Password: foo@synology ~ $
I've set it up such that ssh-ing with password requires TOTP, and ssh-ing with key will not. See other guides, e.g., this, for how to configure it.
Checklist
all-supported
completed successfully (local build succeeds, some github build actions fail, until the toolchain cache will be rebuilt with the patches from this PR)