Learn about DokuWiki
Learn about DokuWiki
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.
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.
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.
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 back-ends!
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, e.g. configuring Google Authenticator and SMS messages doesn't work if the user loses their cell phone.
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.
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.
enable– Turn on or off all two factor authentication functionality. Default:
optinout– Configure two factor features as
otpcontent– The message to deliver to the user.
$otpis replaced with the randomly generated code. Default:
$otpis 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:
sentexpiry– Time in minutes that a sent OTP is valid for. Default:
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:
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.
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.
I originally wrote this because we needed 2FA for our wiki at work. Our use of DokuWiki has come to a close, but I will continue to maintain this code for the foreseeable future on my own time. That said, I will post fixes that are brought to my attention and test it our in my development environment as best as possible, but now I need your help to confirm that it is working. Also, please let me know that this update does or does not work with the current stable release so I can update this compatibility page.
WIP. I will pull discussion questions and post them here as blatant questions come up.
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.
Feel free to write anything constructive. My hope is that this plugin will provide many admins with useful functionality.