Extension:OATHAuth/zh

本页面的主题不是 Extension:OAuth.
随附于MediaWiki 1.31及更高版本。 其余配置说明仍必须遵循。
Category:Extensions bundled with MediaWiki 1.31/zh Category:Extensions with unknown license/zh
OATHAuth
Category:Stable extensions/zh
Category:User rights extensions/zh, Category:Special page extensions/zh, Category:Page action extensions/zh
描述 为登录提供
作者 Ryan Lane
最新版本
Category:Pages using deprecated NoteTA template#%20 持续更新
快照跟随MediaWiki发布。
oathauth_types
oathauth_devices
oathauth_users
GPL-2.0-or-later AND GPL-3.0-or-later
下載 Category:Extensions in Wikimedia version control/zh
  • $wgOATHAuthWindowRadius
  • $wgOATHRequiredForGroups
  • $wgOATHAuthAccountPrefix
  • $wgOATHExclusiveRights
前往translatewiki.net翻譯OATHAuth
問題 开启的任务 ·
Category:All extensions/zh

扩展OATHAuth[1]提供了双因素身份验证的支持。 默认情况下,这包括一个基于时间的一次性密码(TOTP)的实现,可讓用户通过手机或桌面应用程序生成双因素身份验证的代码。 大多数功能手机,智能手机和台式机都有客户端支持。

此扩展与OAuth无关,它是一個完全不同的协议。

用法

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

安裝

警告 警告: There is a bug with this extension where it does not update properly from the web (mw-config) updater and must instead use the update.php command line update script (phab:T371849)
  • 下载,并将解压后的OATHAuth移动到extensions/目录中。
    开发者和代码贡献人员应从Git安装扩展,输入:
    cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth
    
  • 只有是從Git安裝的才需Composer来安装PHP发行composer install --no-dev的目录。 (参见T173141了解潜在问题。)Category:Extensions requiring Composer with git/zh
  • 将下列放置在您的LocalSettings.php 的底部:
    wfLoadExtension( 'OATHAuth' );
    
  • 更新脚本,它将自动必须的数据库表。
  • 强烈建议在使用OATHAuth时设置缓存 。 如果使用OATHAuth,这不仅能提高性能,还能提高维基的安全性。 如果只运行一个应用程序或网络服务器并安装好了php-apcu,且未配置特定缓存,MediaWiki 很可能会退回到使用APCu。 如果您使用多个应用程序/网络服务器,建议设置对象缓存 缓存,供所有主机使用。 例子包括Memcached
  • Yes 完成 – 在您的wiki上Special:Version,以验证已成功安装

参数

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

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

$wgOATHAuthDatabase false (已弃用) 数据库域。 仅用于多数据库环境。 After MediaWiki 1.42, you should use $wgVirtualDomainsMapping['virtual-oathauth'] instead of this option.
$wgOATHAuthSecret false 此Wiki的基本OATHAuth密钥,从中派生所有加密密钥。

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

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

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

$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.

用户权限

授予访问权限以启用OATHAuth

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

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

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

管理

重置用户令牌

在用户遺失了令牌生成器“和”恢复令牌這樣的事件中,双因素身份验证可通过运行disableOATHAuthForUser维护脚本而从用户身上移除:

MediaWiki版本:
1.40
$ ./maintenance/run OATHAuth:disableOATHAuthForUser <user>
MediaWiki版本:
1.39
$ php ./extensions/OATHAuth/maintenance/disableOATHAuthForUser.php <user>

Where <user> is the name of the user to have 2FA disabled.

Shared database tables

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';


參見

References

  1. OATH is an acronym for open authentication.
Category:Extensions used on Wikimedia/zh#OATHAuth/zh Category:Login extensions/zh
Category:All extensions/zh Category:AuthChangeFormFields extensions/zh Category:Extensions available as Debian packages/zh Category:Extensions bundled with MediaWiki 1.31/zh Category:Extensions in Wikimedia version control/zh Category:Extensions included in BlueSpice/zh Category:Extensions included in Canasta/zh Category:Extensions included in Miraheze/zh Category:Extensions included in MyWikis/zh Category:Extensions included in ProWiki/zh Category:Extensions included in WikiForge/zh Category:Extensions included in semantic::core/zh Category:Extensions included in wiki.gg/zh Category:Extensions requiring Composer with git/zh Category:Extensions used on Wikimedia/zh Category:Extensions which add rights/zh Category:Extensions with unknown license/zh Category:GetPreferences extensions/zh Category:GetUserPermissionsErrors extensions/zh Category:LoadExtensionSchemaUpdates extensions/zh Category:Login extensions/zh Category:Page action extensions/zh Category:Pages using deprecated NoteTA template Category:Special page extensions/zh Category:Stable extensions/zh Category:UnitTestsAfterDatabaseSetup extensions/zh Category:UnitTestsBeforeDatabaseTeardown extensions/zh Category:UserEffectiveGroups extensions/zh Category:UserGetRights extensions/zh Category:User rights extensions/zh