DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:twofactor

Two Factor Authentication - Core Plugin

Compatible with DokuWiki

  • 2017-02-19 "Frusterick Manners" yes
  • 2016-06-26 "Elenor Of Tsort" yes
  • 2015-08-10 "Detritus" yes
  • 2014-09-29 "Hrun" unknown

plugin Provides modular two factor authentication functionality to DokuWiki

Last updated on
2017-08-05
Provides
Admin, Action
Repository
Source
Requires
attribute

Similar to authgoogle2fa

Tagged with 2fa, authentication, security, two-factor

Summary

This module provides a two factor authentication framework to a wiki. It is designed to work with any wiki-based authentication mechanism (sorry Apache authentication users, I have not tested it for you). This module requires at least one Two Factor authentication module (listed below) in order to work.

MAJOR REVISION

As of 2016-01-06, I have completely overhauled this module and in order to use it you will need to add at least one supporting module. The benefit is that new modules can be added or updated without impacting other modules.

Installation

Install the plugin and at least one supporting module using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

This plugin requires configuration prior to being functional. However, it will not interfere with any existing authentication plugin. This plugin “wraps” the authentication module by preventing the user from accessing the wiki until the two factor challenge is completed.

Depending on how the Two Factor module is configured, users will be able to continue to use the wiki without using two factor authentication.

Two Factor Modules

  • Email - Send a one-time password to a user using their Dokuwiki registered email address.
  • Alternate Email - Send a one-time password to a user using an email address that is not registered with Dokuwiki.
  • Google Authenticator - Allow the use of Google Authenticator to generate login tokens.
  • SMS via Email Gateway - Send a one-time password to a user's cell phone using an email gateway.
  • SMS via Appliance - Send a one-time password to a user's cell phone using an SMS appliance.

How It Works

This is NOT an authentication plugin. Instead, it is a display barrier between your users and the wiki. When a user logs in but has not completed two factor authentication, they are guided to the Two Factor configuration page to configure it (if mandatory for the wiki) or to a separate screen where they can enter any received One-Time Passwords (OTP). This means that conceptually, this *should* work with ANY authentication plugin. As of Detritus, I have used this with authad in production and authplain in development with great success. Please post if you have success with other backends!

User Setup

User Configuration Page In order to use two factor authentication, the user will have to first configure their own two factor settings if any additional modules require it. This setup can be done through the Two Factor configuration page.

Unless the wiki uses mandatory two factor authentication, each user will have a master checkbox to turn on and off two factor authentication. When turned on, the user will then have the option to turn on and off the use of any installed modules. If the user turns on the use of a module, the user will have to verify that the module works for them by either supplying the correct token or one-time password. After the user has verified that it is working, the wiki will then allow that module to be used for two factor authentication.

The user may use any one of the modules they have configured to two factor authenticate, so configuring both Google Authenticator and and alternate email one-time password allows the user to use either method to login. Keep in mind that in order for multiple modules to be effective, the modules should not have a single point of failure, eg configuring Google Authenticator and SMS messages doesn't work if the user loses their cell phone.

User Login

If a module supports token-based authentication, like Google Authenticator, the token must be supplied at the login page. If the user is not using a token based method, such as a one-time password via SMS message, the user leaves that field blank at the login page and will be redirected to a separate page to supply the one-time password.

Any user that has not configured two factor authentication can login without supplying a token or one-time password, and will be redirected to the Two Factor configuration page if two factor authentication is required by the wiki admin.

Admin Page

There is an admin page to enable the reset of two factor settings for users that manage to get locked out. Face it, cellphones get lost and people mistype data in fields, so it's gonna happen…

Once in the admin page, check the box next to the user whose account you want to reset, then click the Reset selected button. This removes all user settings, and they will have to completely reconfigure their two factor setup from the beginning. There is no option to individually manage their settings to prevent tampering.

Configuration and Settings

“enable” - Turn on or off all two factor authentication functionality. Default: off

“optinout”- Configure two factor features as optin, optout, and mandatory. Default: optin

“otpcontent” - The message to deliver to the user. $otp is replaced with the randomly generated code. Default: $otp is your verification code.

“generatorexpiry” - How many windows of time a GA code is valid for. This setting allows for a code to be useful for longer than its display time in GA. Very helpful for slow typing users of if a code is seen at the end of its display time. Default: 2 (the time displayed plus one more code)

“otplength” - Length of the randomly generated OTP. Default: 7

“sentexpiry” - Time in minutes that a sent OTP is valid for. Default: 5

“loginnotice” (Not working yet) - Send a notice on successful login to the user. Options are never (none), user choice (user), and always send a message (always). Default: user

Development

Additional work will be based on my free time in the future. I was allowed to put this together for my work and release it, but future development will be on my personal time.

API

NOTE: Work In Progress I am going to document the Two Factor module API here in order to provide all information about this plugin in one place. I am open to suggestions if a better location can be found.

Change Log

Known Bugs and Issues

  • The login notification does not work yet.

ToDo/Wish List

  • I've had a request to add Twilio and Plivo as supported two factor resources. After the redesign, I will look into it. I will need some help for testing, my personal budget is zero dollars and zilch cents.
  • Possibly supply a configuration setting enabling the admin to designate which characters to use in the OTP generator. Right now it is fixed on Arabic numerals.

FAQ

WIP. I will pull discussion questions and post them here as blatant questions come up.

Big Thanks / Acknowledgement

First, I want to thank my employer, Antelope Valley College, for allowing me to release this code to the open source community.

A big thanks goes out to Dan Popp for the work on his Google 2FA plugin- it provided me with the idea, libraries, and a code template to get this project started.

Another big thanks to Christopher Smith and the developers that worked on the User Manager Plugin. I used their admin code as the basis for my plugin and have to give them credit for their work that I used.

Discussion

Feel free to write anything constructive. My hope is that this plugin will provide many admins with useful functionality.

plugin/twofactor.txt · Last modified: 2017-08-05 04:22 by wilminator