Extension:OATHAuth/zh
扩展OATHAuth[1]提供了双因素身份验证的支持。 默认情况下,这包括一个基于时间的一次性密码(TOTP)的实现,可讓用户通过手机或桌面应用程序生成双因素身份验证的代码。 大多数功能手机,智能手机和台式机都有客户端支持。
用法
双因素身份验证上的帮助页面为终端用户提供了有关如何使用此扩展的信息。 然而,使用的特殊页面也将引导用户。
安裝
- 下载,并将解压后的
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 。
完成 – 在您的wiki上至Special:Version,以验证已成功安装。
参数
配置标志 | 描述 | |
---|---|---|
$wgOATHAuthWindowRadius |
4 |
每个方向上应该有效的令牌窗口数。
这告诉OATH接受令牌的有效范围为 |
$wgOATHAuthDatabase |
false |
(已弃用) 数据库域。 仅用于多数据库环境。 After MediaWiki 1.42, you should use $wgVirtualDomainsMapping['virtual-oathauth'] instead of this option. |
$wgOATHAuthSecret |
false |
此Wiki的基本OATHAuth密钥,从中派生所有加密密钥。
如果为 |
$wgOATHAuthAccountPrefix |
false |
用于OATHAuth用户帐户名称的前缀和用于该帐户的颁发者。
如果为 |
$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
- ↑ OATH is an acronym for open authentication.
![]() | 此用于一个或多个维基媒体项目。 这可能意味着足够稳定、运作足够良好,可以用在这样的高流量的网站上。 请在维基媒体的CommonSettings.php和InitialiseSettings.php中查找此的名称以查看哪些网站安装了该。 特定wiki上的已安装的的完整列表位于Special:Version页面。 |