Extensão:OATHAuth
Estado de lançamento: estável |
|
|---|---|
| Implementação | Direitos do utilizador, Página espacial, Ação de página |
| Descrição | Fornece a autenticação de dois fatores para iniciar a sessão |
| Autor(es) | Ryan Lane |
| Última versão | Atualizações contínuas |
| Política de compatibilidade | Lançamentos de capturas de ecrã em conjunto com o MediaWiki. Original não é compatível com as versões anteriores. |
| Alterações à base de dados | Sim |
| Tabelas | oathauth_types oathauth_devices oathauth_users |
| Licença | GPL-2.0-or-later AND GPL-3.0-or-later |
| Transferência | |
|
|
|
|
|
| Traduza a extensão OATHAuth se esta estiver disponível em translatewiki.net | |
| Problemas | Tarefas em aberto · Reportar um erro |
The OATHAuth[1] 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.
Utilização
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.
Instalação
- Exporte e coloque o ficheiro, ou ficheiros, num diretório chamado
OATHAuth, na sua pastaextensions/.
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-devin the extension directory. (See T173141 for potential complications.) - Acrescente o seguinte código ao fundo do ficheiro $LocalSettings:
wfLoadExtension( 'OATHAuth' );
- Execute o script de atualização que irá criar automaticamente as tabelas da base de dados necessárias para esta extensão.
- Configure conforme necessário.
- 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.
Pronto – Na página especial Special:Version da sua wiki verifique se a extensão foi instalada.
Configuração
Parâmetros
| Configuration Flag | Valor Predefinido | Descrição |
|---|---|---|
$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. |
$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. |
$wgOATHRolloutPercent
|
0
|
Percentage of users to add to two-factor authentication rollout. |
$wgOATHAllowMultipleModules
|
false
|
(deprecated) Temporary (in the MW 1.45 development cycle) feature flag to allow users to have multiple two-factor authentication modules active at the same time. |
$wgOATHAuthNewUI
|
false
|
(deprecated) Temporary (in the MW 1.45 development cycle) feature flag for the redesigned UI. (T401774) |
$wgOATHSecretKey
|
false
|
(introduzido(a) na 1.45) Update to 1.45 (or later) and run the update script before enabling this feature and running its own maintenance script! A secret key value for encrypting OATH-related data which should be SODIUM_CRYPTO_SECRETBOX_KEYBYTES hexadecimal bytes (64 chars) in length. This variable is currently considered immutable. Do not publicly set this value. There are a few ways to create a cryptographically-secure, random key value, such as the unix command: $ hexdump -vn32 -e'8/8 "%08X" "\n"' /dev/urandom.
Run Note that it is not currently possible to change this value once it is set, and be able to update existing encrypted codes. See T403180 for more information. |
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.
Permissão do utilizador
- 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.
Administração
Resetting a user token
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:
| Versão MediaWiki: | 1.40 |
$ ./maintenance/run OATHAuth:disableOATHAuthForUser <user>
| Versão 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';
Ver também
- Product_Safety_and_Integrity/Account_Security
- Two-factor authentication (TFA)
- Extension:WebAuthn - module for the OATHAuth extension that provides support for U2F devices (such as YubiKey) and password managers.
- Initiative for Open Authentication (OATH)
References
- ↑ OATH is an acronym for open authentication.
| Este extensão está a ser utilizado em um ou mais projetos da Wikimedia. Isso provavelmente significa que a extensão é estável e funciona bem o suficiente para ser usada por esses sites de alto tráfego. Procure o nome desta extensão nos arquivos de configuração CommonSettings.php e InitialiseSettings.php da Wikimedia para ver onde está instalado. Uma lista completa das extensões instaladas em um determinado wiki pode ser vista na página Special:Version do wiki. |
| 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. |
- Stable extensions/pt
- User rights extensions/pt
- Special page extensions/pt
- Page action extensions/pt
- Extensions with unknown license/pt
- Extensions in Wikimedia version control/pt
- Extensions which add rights/pt
- AuthChangeFormFields extensions/pt
- GetPreferences extensions/pt
- LoadExtensionSchemaUpdates extensions/pt
- UnitTestsAfterDatabaseSetup extensions/pt
- UnitTestsBeforeDatabaseTeardown extensions/pt
- UserEffectiveGroups extensions/pt
- UserGetRights extensions/pt
- GetUserPermissionsErrors extensions/pt
- All extensions/pt
- Extensions bundled with MediaWiki 1.31/pt
- Extensions requiring Composer with git/pt
- Extensions used on Wikimedia/pt
- Extensions included in BlueSpice/pt
- Extensions included in Canasta/pt
- Extensions available as Debian packages/pt
- Extensions included in Miraheze/pt
- Extensions included in MyWikis/pt
- Extensions included in ProWiki/pt
- Extensions included in semantic::core/pt
- Extensions included in wiki.gg/pt
- Extensions included in WikiForge/pt
- Login extensions/pt
