Расширение:OATHAuth

From mediawiki.org
This page is a translated version of the page Extension:OATHAuth and the translation is 24% complete.
Outdated translations are marked like this.
Not to be confused with Extension:OAuth.
Это расширение поставляется с MediaWiki 1.31 и выше. Таким образом, вам не нужно загружать его снова. Тем не менее, вы всё равно должны следовать другим инструкциям.
Справка по расширениям MediaWiki
OATHAuth
Статус релиза: стабильно
Реализация Права пользователя , Служебная страница , Действие страницы
Описание Provides two-factor authentication for logging in
Автор(ы) Ryan Lane
Последняя версия Постоянные обновления
Политика совместимости Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki >= 1.42
Изменения в БД Да
Таблицы oathauth_users
Лицензия GPL-2.0-or-later AND GPL-3.0-or-later
Скачать
  • $wgOATHRequiredForGroups
  • $wgOATHAuthWindowRadius
  • $wgOATHExclusiveRights
  • $wgOATHAuthAccountPrefix
  • $wgOATHAuthDatabase

  • oathauth-enable
  • oathauth-api-all
  • oathauth-disable-for-user
  • oathauth-view-log
  • oathauth-verify-user
Ежеквартальные загрузки 89 (Ranked 63rd)
Использование общедоступными вики 1,459 (Ranked 205th)
Переведите расширение OATHAuth, если оно доступно на translatewiki.net
Проблемы Открытые задачи · Сообщить об ошибке

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. Клиент поддерживают большинство телефонов, смартфонов и настольных компьютеров.

Это расширение не имеет ничего общего с OAuth — совершенно другим протоколом.

Использование

The help page on Two-factor authentication provides information for end users on how to use this extension. However the special page used will also guide users.

Установка

  • Скачайте и распакуйте файл(ы) в папку с названием OATHAuth в вашей папке extensions/.
    Вместо этого разработчикам и соавторам кода следует установить расширение из Git, используя:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth
  • Если и только если устанавливаете из git, запустите Composer для установки зависимостей PHP, запустив composer install --no-dev в каталоге расширений. (Смотрите задача T173141 о возможных осложнениях.)
  • Добавьте следующий код в конце вашего файла LocalSettings.php :
    wfLoadExtension( 'OATHAuth' );
    
  • Выполните скрипт обновления, который автоматически создаст необходимые таблицы, используемые расширением.
  • 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 setup local cluster caching that can be used by all hosts. Examples include Memcached .
  • Yes Готово – Перейдите на страницу Special:Version на своей вики, чтобы удостовериться в том, что расширение успешно установлено.

Настройка

Параметры

Configuration Flag Значение по умолчанию Описание
$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 ((1 + 2 * $wgOATHAuthWindowRadius) * 30) seconds. This range of valid windows is centered around the current time. The purpose of this configuration variable is to account for differences between the user's clock and the server's clock. However, it is recommended to keep it as low as possible.

$wgOATHAuthDatabase false The database domain. Only used in a multi-database environment.
$wgOATHAuthSecret false The base OATHAuth secret for this wiki from which all encryption keys are derived.

If false, the value of $wgSecretKey is used.

$wgOATHAuthAccountPrefix false The prefix used for the OATHAuth user account name and the issuer used for the account.

If false, the value of $wgSitename is used.

$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 также добавляет ключ в массив $wgRateLimits для определения ограничений скорости для попыток аутентификации:

		'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

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

Сброс пользовательского токена

In the event that a user both loses their token generator and the recovery tokens, two-factor authentication may be removed from the user by running the disableOATHAuthForUser maintenance script:

Версия 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

When using shared database tables , i.e. same set of users for different wikis, add oathauth_devices and oathauth_types to $wgSharedTables.

$wgSharedTables[] = 'oathauth_devices';
$wgSharedTables[] = 'oathauth_types';

См. также