Skip to content
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

Two factor authentication login: new GoogleAuthenticator plugin on Marketplace! #2846

Closed
robocoder opened this issue Jan 1, 2012 · 18 comments
Labels
answered For when a question was asked and we referred to forum or answered it. c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Milestone

Comments

@robocoder
Copy link
Contributor

Proposing Yubico integration initially since I already have a Yubikey.

Can look into other vendors later.

@mattab
Copy link
Member

mattab commented Feb 17, 2012

Can you please elaborate on this one? is it a proposal for core or a plugin?

@robocoder
Copy link
Contributor Author

Changes to core are needed either way.

@mattab
Copy link
Member

mattab commented Dec 14, 2012

It would be great to have, even using Google two factor authentication API.

@halfdan
Copy link
Member

halfdan commented Sep 5, 2013

I started an implementation for two-factor authentication:

  • It integrates into the standard login
    • After entering username + password the Login checks if 2FA is activated and requires a two-factor auth secret
  • A user can activate 2FA in UsersManager by scanning a QRCode and typing in the current number

Some refactoring has to happen to the Login plugin in order to make this work. Right now the Auth mechanism depends on AuthRequest with extends Zend_Auth_AuthRequest (a dependency we should get rid of). AuthRequest only provides states for SUCCESS and FAILURE, but I need a new state "TWO_FACTOR_REQUIRED" to mark the attempt as valid (username + password correct, two factor secret missing).

I would also like to propose a change in the authentication logic. The API.Request.authenticate event should be changed, so that we could offer alternative authentication methods that do NOT rely on token_auth. E.g. for two-factor auth, as an additional security feature we need at least token_auth + verfication_secret to authenticate the request. There might be other login solutions that would make the token_auth obsolete, so the API.Request.authenticate event should just pass the $_REQUEST array.

Current status is attached as screenshot.

@halfdan
Copy link
Member

halfdan commented Sep 5, 2013

Attachment: Two Factor Authentication in Admin backend
two-factor-auth-piwik.png

@mattab
Copy link
Member

mattab commented Sep 6, 2013

It is a great feature for sure. You are welcome to refactor the Login plugin to make this possible. This feature has to be provided by a Plugin, not in core. It is better to keep such advanced yet awesome feature out of core. Investigate how this can be done with a refactor of Login class + adding new events to let plugin extend the ValidateUser/Login/Logout workflows.

I suggest you submit your code as a Pull Request so we can further discuss the design.

@mattab
Copy link
Member

mattab commented Sep 6, 2013

as a small first step it's good if you can get rid of Zend_Auth_AuthRequest as in general we'd like to move away from Zend_* (we'll tacke Registry and Log* for sure)

@halfdan
Copy link
Member

halfdan commented Sep 6, 2013

I'll try to implement this in the Login plugin. There is no other solution IMO.

Since two-factor auth comes after the normal Login process (username + password), the only way to implement this in a new plugin is by copying Login plugin.. (which I will not do)

TOTP is a defacto standard (http://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm#Public_Server_Implementations) across many services, so I really think this should be a core feature and provided by the Login plugin. The feature is not "advanced", it's just an improvement over the relatively low security Piwik currently provides (md5 + single salt).

@robocoder robocoder added this to the 2.x - The Great Piwik 2.x Backlog milestone Jul 8, 2014
@mattab mattab removed the P: normal label Aug 3, 2014
@mattab mattab added the c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github. label Mar 8, 2015
@ghost
Copy link

ghost commented Jul 10, 2015

This should be back in the roadmap!

@MagicFab
Copy link

Other free open source implementations of this exist, this reminds me of this 2FA plugin for WordPress, very nicely implemented.

@strobeltobias
Copy link

Two factor authentication for Piwik would be awesome! Especially the data of website visitors would be better protected against hackers.
Maybe a Yubikey integration would also be possible. I live great with this gadget!

@robocoder
Copy link
Contributor Author

There are ways to approach this:

  1. 2fa is enabled for everyone, so the pin is input on the same form as the user+password
  2. 2fa is enabled per user, so requires an intermediate pin page

@sgiehl
Copy link
Member

sgiehl commented Jul 24, 2015

There is now a plugin for GoogleAuthenticator. See http://plugins.piwik.org/GoogleAuthenticator

@robocoder
Copy link
Contributor Author

@sgiehl : how hard to allow API requests without the auth_code?

@sgiehl
Copy link
Member

sgiehl commented Jul 24, 2015

Guess we would need to add app specific passwords or something like that.
Otherwise a login would be possible using token_auth in the url only

@mattab
Copy link
Member

mattab commented Jul 25, 2015

@sgiehl Well done, this looks epic. It is an excellent news for the Piwik community 🚀

@MagicFab
Copy link

@sgiehl app-specific passwords: #6559

I believe we can now close this one?

@mattab
Copy link
Member

mattab commented Aug 12, 2015

I guess the issue can be closed and all further requests regarding two factor auth can go into the plugin github repository: https://github.com/sgiehl/piwik-plugin-GoogleAuthenticator

@sgiehl I'll let you the pleasure the close it 🎉

@sgiehl sgiehl closed this as completed Aug 12, 2015
@mattab mattab changed the title Two factor authentication login Two factor authentication login: new GoogleAuthenticator plugin on Marketplace! Oct 13, 2015
@mattab mattab added the answered For when a question was asked and we referred to forum or answered it. label Oct 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it. c: Security For issues that make Matomo more secure. Please report issues through HackerOne and not in Github. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

6 participants