Extension:OATHAuth
OATHAuth Release status: stable |
|
---|---|
Implementation | User rights , Special page , Page action |
Description | Provides two-factor authentication for logging in |
Author(s) | Ryan Lane |
Latest version | Continuous updates |
Compatibility policy | Snapshots releases along with MediaWiki. Master is not backward compatible. |
MediaWiki | >= 1.43 |
Database changes | Yes |
Tables | oathauth_users |
License | GPL-2.0-or-later AND GPL-3.0-or-later |
Download | |
|
|
|
|
Quarterly downloads | 77 (Ranked 66th) |
Public wikis using | 1,459 (Ranked 205th) |
Translate the OATHAuth extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
The OathAuth extension provides two-factor authentication support. By default, this includes a time-based one-time password (TOTP) implementation that allows users to generate 2FA codes from their phone or desktop app. Client support is available for most feature phones, smartphones, and desktops.
Usage
[edit]The help page on Two-factor authentication provides information for end users on how to use this extension. However, the special page will also guide users.
Installation
[edit]- Download and move the extracted
OATHAuth
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth - Only when installing from Git, run Composer to install PHP dependencies, by issuing
composer install --no-dev
in the extension directory. (See task T173141 for potential complications.) - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'OATHAuth' );
- Run the update script which will automatically create the necessary database tables that this extension needs.
- Configure as required.
- It is strongly recommended to setup caching when using OATHAuth. This will improve performance, but also the security of your wiki if you're using OATHAuth. If you are only running one application/web server and have php-apcu installed, and no specific cache configured, MediaWiki will likely fallback to using APCu. If you are using multiple application/web server it is advised to set up local cluster caching that all hosts can use. Examples include Memcached .
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Configuration
[edit]Parameters
[edit]Configuration Flag | Default Value | Description |
---|---|---|
$wgOATHAuthWindowRadius
|
4
|
The number of token windows in each direction that should be valid.
This tells OATH to accept tokens for a range of effectively |
$wgOATHAuthDatabase
|
false
|
(deprecated) The database domain. Only used in a multi-database environment. After MediaWiki 1.42, you should use $wgVirtualDomainsMapping['virtual-oathauth'] instead of this option. |
$wgOATHAuthSecret
|
false
|
The base OATHAuth secret for this wiki from which all encryption keys are derived.
If |
$wgOATHAuthAccountPrefix
|
false
|
The prefix used for the OATHAuth user account name and the issuer used for the account.
If |
$wgOATHExclusiveRights
|
[]
|
Set of permissions that are revoked from users who did not login using two-factor authentication. |
$wgOATHRequiredForGroups
|
[]
|
Sets a list of user groups that are required to have two-factor authentication enabled. Use 'user' if you want all logged-in users required to enable two-factor authentication. |
OATHAuth also adds a key to the $wgRateLimits array to define rate limits for authentication attempts:
'badoath' => [
'&can-bypass' => false,
'user' => [ 10, 60 ],
'user-global' => [ 10, 60 ],
]
Note that the user-global
key is available only since 1.35.
Earlier version have to rely on user
and perhaps ip-all
.
See the documentation of $wgRateLimits
for details.
User permission
[edit]- Granting access to enable OATHAuth
Users should be given access to the oathauth-enable
user right so that they can enable it at Special:OATHAuth (a link to which appears at Special:Preferences).
$wgGroupPermissions['user']['oathauth-enable'] = true;
The above will grant all registered users access to enable OATHAuth.
Administration
[edit]Resetting a user token
[edit]If a user loses both their token generator and the recovery tokens, two-factor authentication may be removed from the user by running the disableOATHAuthForUser
maintenance script:
MediaWiki version: | 1.40 |
$ ./maintenance/run OATHAuth:disableOATHAuthForUser <user>
MediaWiki version: | ≤ 1.39 |
$ php ./extensions/OATHAuth/maintenance/disableOATHAuthForUser.php <user>
Where <user>
is the name of the user to have 2FA disabled.
Shared database tables
[edit]Some Wikis may want to share the 2FA data amongst multiple Wikis.Shared database tables , the previous method for doing so is deprecated in MediaWiki 1.42 and later. For new wiki-farm installations where you want users to share their 2FA token amongst multiple wikis, please use $wgVirtualDomainsMapping and the extensions will automatically make its tables use the specified database name.
$wgVirtualDomainsMapping['virtual-oathauth'] = [ 'db' => 'sharedbname' ]
When using shared database tables, i.e., the same set of users for different wikis, add oathauth_devices
and oathauth_types
to $wgSharedTables
.
$wgSharedTables[] = 'oathauth_devices';
$wgSharedTables[] = 'oathauth_types';
See also
[edit]- Wikimedia Security Team/Two-factor Authentication for CentralAuth wikis
- Two-factor authentication (TFA)
- Extension:WebAuthn
- Initiative for Open Authentication (OATH)
This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page. |
This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |
- Extensions bundled with MediaWiki 1.31
- Stable extensions
- User rights extensions
- Special page extensions
- Page action extensions
- Extensions with unknown license
- Extensions in Wikimedia version control
- Extensions which add rights
- AuthChangeFormFields extensions
- BeforeCreateEchoEvent extensions
- GetPreferences extensions
- LoadExtensionSchemaUpdates extensions
- UserEffectiveGroups extensions
- UserGetRights extensions
- GetUserPermissionsErrors extensions
- All extensions
- Extensions requiring Composer with git
- Extensions used on Wikimedia
- Extensions included in BlueSpice
- Extensions included in Canasta
- Extensions available as Debian packages
- Extensions included in Miraheze
- Extensions included in MyWikis
- Extensions included in ProWiki
- Extensions included in semantic::core
- Extensions included in wiki.gg
- Extensions included in WikiForge
- Login extensions