扩展:双因素身份验证

本頁使用了標題或全文手工轉換
From mediawiki.org
This page is a translated version of the page Extension:OATHAuth and the translation is 84% complete.
本页面的主题不是 Extension:OAuth.
此扩展已绑定在MediaWiki 1.31及以上版本。 因此您不需要再次下载。 然而,您仍需要跟随提供的其他指示。
MediaWiki的扩展的手冊
OATHAuth
發佈狀態: 穩定版本
实现 用户权限 , 特殊页面 , 页面操作
描述 为登录提供双因素身份验证
作者 Ryan Lane
最新版本 持续更新
兼容性政策 快照跟随MediaWiki发布。 master分支不向後兼容。
MediaWiki 1.29+
数据库更改
oathauth_users
许可协议 GPL-2.0-or-later AND GPL-3.0-or-later
下載
  • $wgOATHRequiredForGroups
  • $wgOATHAuthMultipleDevicesMigrationStage
  • $wgOATHAuthWindowRadius
  • $wgOATHExclusiveRights
  • $wgOATHAuthAccountPrefix
  • $wgOATHAuthDatabase

  • oathauth-enable
  • oathauth-api-all
  • oathauth-disable-for-user
  • oathauth-view-log
  • oathauth-verify-user
季度下載量 117 (Ranked 78th)
公開的wiki使用 1,459 (Ranked 205th)
翻譯OATHAuth的扩展,若在translatewiki.net可用
問題 尚未完成的工作 · 报告錯誤

扩展OathAuth提供了双因素身份验证支持。 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. 大多数功能手机,智能手机和台式机都有客户端支持。

此扩展名与OAuth无关,后者是完全不同的协议。

用法

双因素身份验证上的帮助页面为最终用户提供了有关如何使用此扩展的信息。 但是,使用的特殊页面也将引导用户。

安裝

  • 下载文件,并将其放置在您extensions/文件夹中的OATHAuth目录内。
  • 只有從git安裝才运行Composer来安装PHP依赖,通过发行composer install --no-dev至扩展目录。 (参见任务T173141了解潜在问题。)
  • 将下列代码放置在您的LocalSettings.php 的底部:
    wfLoadExtension( 'OATHAuth' );
    
  • 运行更新脚本,它将自动创建此扩展必须依赖的数据库表。
  • 根据需要配置。
  • 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 setup local cluster caching that can be used by all hosts. Examples include Memcached.
  • Yes 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。


配置

参数

配置标志 默认值 描述
$wgOATHAuthWindowRadius 4 每个方向上应该有效的令牌窗口数。

这告诉OATH接受令牌的有效范围为((1 + 2 * $wgOATHAuthWindowRadius) * 30)秒。 此有效窗口范围以当前时间为中心。 此配置变量的目的是考虑用户时钟和服务器时钟之间的差异。 但是,建议尽可能降低它。

$wgOATHAuthDatabase false 数据库域。 仅用于多数据库环境。
$wgOATHAuthSecret false 此Wiki的基本OATHAuth密钥,从中派生所有加密密钥。

如果为false,则使用$wgSecretKey的值。

$wgOATHAuthAccountPrefix false 用于OATHAuth用户帐户名称的前缀和用于该帐户的颁发者。

如果为false,则使用$wgSitename的值。

$wgOATHExclusiveRights [] Set of permissions that are revoked from users who did not log in 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 to be required to have two-factor authentication enabled.

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.

用户权限

授予访问权限以启用OATHAuth

应该允许用户访问oathauth-enable用户权限,以便他们可以以Special:OATHAuth启用它(链接显示为Special:Preferences)。

$wgGroupPermissions['user']['oathauth-enable'] = true;

以上将授予所有注册用户启用OATHAuth的权限。

管理

重置用户令牌

如果用户丢失了令牌生成器和恢复令牌,可以通过从oathauth_users数据库表中删除它们的行来从用户中删除双因素身份验证。 具有shell访问权限的系统管理员可以在命令行cd /path/to/mediawiki/extensions/OATHAuth/maintenance/上键入然后执行php disableOATHAuthForUser.php "username",其中"username"是禁用2FA以禁用它的用户。

參見