lemonldap-ng/po-doc/fr/pages/documentation/current/applications/mediawiki.html
Xavier Guimard 43fbe42b7e Update doc
2017-02-22 12:41:23 +00:00

273 lines
15 KiB
HTML

<!DOCTYPE html>
<html lang="fr" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8" />
<title>documentation:2.0:applications:mediawiki</title><!-- //if:usedebianlibs
<link rel="stylesheet" type="text/css" href="/javascript/bootstrap/css/bootstrap.min.css" />
//elsif:useexternallibs
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></script>
//elsif:cssminified
<link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.min.css" />
//else --><!-- //endif -->
<meta name="generator" content="DokuWiki"/>
<meta name="robots" content="index,follow"/>
<meta name="keywords" content="documentation,2.0,applications,mediawiki"/>
<link rel="search" type="application/opensearchdescription+xml" href="../lib/exe/opensearch.html" title="LemonLDAP::NG"/>
<link rel="start" href="mediawiki.html"/>
<link rel="contents" href="mediawiki.html" title="Sitemap"/>
<link rel="stylesheet" type="text/css" href="../lib/exe/css.php.t.bootstrap3.css"/>
<link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.css" />
<script type="text/javascript">/*<![CDATA[*/var NS='documentation:2.0:applications';var JSINFO = {"id":"documentation:2.0:applications:mediawiki","namespace":"documentation:2.0:applications"};
/*!]]>*/</script>
<script type="text/javascript" charset="utf-8" src="../lib/exe/js.php.t.bootstrap3.js"></script><!-- //if:usedebianlibs
<script type="text/javascript" src="/javascript/jquery/jquery.min.js"></script>
//elsif:useexternallibs
<script type="text/javascript" src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
//elsif:jsminified
<script type="text/javascript" src="/static/bwr/jquery/dist/jquery.min.js"></script>
//else -->
<script type="text/javascript" src="/static/bwr/jquery/dist/jquery.js"></script><!-- //endif --><!-- //if:usedebianlibs
<script type="text/javascript" src="/javascript/jquery-ui/jquery-ui.min.js"></script>
//elsif:useexternallibs
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
//elsif:jsminified
<script type="text/javascript" src="/lib/scripts/jquery-ui.min.js"></script>
//else -->
<script type="text/javascript" src="/lib/scripts/jquery-ui.js"></script><!-- //endif -->
</head>
<body>
<div class="dokuwiki export container"><!-- TOC START -->
<div id="dw__toc">
<h3 class="toggle">Table of Contents</h3>
<div>
<ul class="toc">
<li class="level1"><div class="li"><a href="#presentation">Présentation</a></div></li>
<li class="level1"><div class="li"><a href="#installation">Installation</a></div></li>
<li class="level1"><div class="li"><a href="#configuration">Configuration</a></div>
<ul class="toc">
<li class="level2"><div class="li"><a href="#mediwiki_local_configuration">Configuration locale MediaWiki</a></div></li>
<li class="level2"><div class="li"><a href="#mediawiki_virtual_host">Hôte virtuel MediaWiki</a></div></li>
<li class="level2"><div class="li"><a href="#mediawiki_virtual_host_in_manager">Hôte virtuel Mediawiki dans le manager</a></div></li>
</ul></li>
</ul>
</div>
</div><!-- TOC END -->
<h1 class="sectionedit1" id="mediawiki">MediaWiki</h1>
<div class="level1">
<p>
<a href="mediawiki_logo.png_documentation_2.0_applications_mediawiki.html" class="media" title="applications:mediawiki_logo.png"><img src="mediawiki_logo.png" class="mediacenter" alt="" /></a>
</p>
</div><!-- EDIT1 SECTION "MediaWiki" [1-66] -->
<h2 class="sectionedit2" id="presentation">Présentation</h2>
<div class="level2">
<p>
<a href="http://www.mediawiki.org" class="urlextern" title="http://www.mediawiki.org" rel="nofollow">MediaWiki</a> est un logiciel wiki utilisé par le très connu <a href="http://www.wikipedia.org" class="urlextern" title="http://www.wikipedia.org" rel="nofollow">Wikipedia</a>.
</p>
<p>
Several extensions allows one to configure <abbr title="Authentification unique (Single Sign On)">SSO</abbr> on MediaWiki:
</p>
<ul>
<li class="level1"><div class="li"> <a href="http://www.mediawiki.org/wiki/Extension:AutomaticREMOTE_USER" class="urlextern" title="http://www.mediawiki.org/wiki/Extension:AutomaticREMOTE_USER" rel="nofollow">Automatic REMOTE_USER</a></div>
</li>
<li class="level1"><div class="li"> <a href="http://www.mediawiki.org/wiki/Extension:Siteminder_Authentication" class="urlextern" title="http://www.mediawiki.org/wiki/Extension:Siteminder_Authentication" rel="nofollow">Siteminder Authentication</a></div>
</li>
</ul>
<p>
Nous expliquons ici comment utiliser l'extension <a href="http://www.mediawiki.org/wiki/Extension:AutomaticREMOTE_USER" class="urlextern" title="http://www.mediawiki.org/wiki/Extension:AutomaticREMOTE_USER" rel="nofollow">REMOTE_USER automatique</a>.
</p>
</div><!-- EDIT2 SECTION "Presentation" [67-594] -->
<h2 class="sectionedit3" id="installation">Installation</h2>
<div class="level2">
<p>
L'extension est présentée ici : <a href="http://www.mediawiki.org/wiki/Extension:AutomaticREMOTE_USER" class="urlextern" title="http://www.mediawiki.org/wiki/Extension:AutomaticREMOTE_USER" rel="nofollow">http://www.mediawiki.org/wiki/Extension:AutomaticREMOTE_USER</a>
</p>
<p>
Il est possible de télécharger le code source ici : <a href="https://www.mediawiki.org/wiki/Special:ExtensionDistributor/Auth_remoteuser" class="urlextern" title="https://www.mediawiki.org/wiki/Special:ExtensionDistributor/Auth_remoteuser" rel="nofollow">https://www.mediawiki.org/wiki/Special:ExtensionDistributor/Auth_remoteuser</a>
</p>
<p>
Il faut installer <code> Auth_remoteuser</code> dans le répertoire des <code>extensions/</code> ve votre serveur MediaWiki :
</p>
<pre class="code">cp -a Auth_remoteuser/ extensions/</pre>
</div><!-- EDIT3 SECTION "Installation" [595-989] -->
<h2 class="sectionedit4" id="configuration">Configuration</h2>
<div class="level2">
</div><!-- EDIT4 SECTION "Configuration" [990-1016] -->
<h3 class="sectionedit5" id="mediwiki_local_configuration">Configuration locale MediaWiki</h3>
<div class="level3">
<p>
Éditer ensuite les paramètres locaux MediaWiki
</p>
<pre class="code">vi LocalSettings.php</pre>
<pre class="code file php"><span class="kw1">require_once</span> <span class="st0">"<span class="es4">$IP</span>/extensions/Auth_remoteuser/Auth_remoteuser.php"</span><span class="sy0">;</span>
<span class="re0">$wgAuth</span> <span class="sy0">=</span> <span class="kw2">new</span> Auth_remoteuser<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span></pre>
<p>
Puis, configuration de l'extension, par exemple :
</p>
<pre class="code file php"><span class="re0">$wgAuthRemoteuserAuthz</span> <span class="sy0">=</span> <span class="kw4">true</span><span class="sy0">;</span> <span class="coMULTI">/* Your own authorization test */</span>
<span class="re0">$wgAuthRemoteuserName</span> <span class="sy0">=</span> <span class="re0">$_SERVER</span><span class="br0">[</span><span class="st0">"HTTP_AUTH_CN"</span><span class="br0">]</span><span class="sy0">;</span> <span class="coMULTI">/* User's name */</span>
<span class="re0">$wgAuthRemoteuserMail</span> <span class="sy0">=</span> <span class="re0">$_SERVER</span><span class="br0">[</span><span class="st0">"HTTP_AUTH_MAIL"</span><span class="br0">]</span><span class="sy0">;</span> <span class="coMULTI">/* User's Mail */</span>
<span class="re0">$wgAuthRemoteuserNotify</span> <span class="sy0">=</span> <span class="kw4">false</span><span class="sy0">;</span> <span class="coMULTI">/* Do not send mail notifications */</span>
<span class="co1">//$wgAuthRemoteuserDomain = "NETBIOSDOMAIN"; /* Remove NETBIOSDOMAIN\ from the beginning or @NETBIOSDOMAIN at the end of a IWA username */</span>
<span class="coMULTI">/* User's mail domain to append to the user name to make their email address */</span>
<span class="co1">//$wgAuthRemoteuserMailDomain = "example.com";</span>
&nbsp;
<span class="co1">// see http://www.mediawiki.org/wiki/Manual:Hooks/SpecialPage_initList</span>
<span class="co1">// and http://www.mediawiki.org/w/Manual:Special_pages</span>
<span class="co1">// and http://lists.wikimedia.org/pipermail/mediawiki-l/2009-June/031231.html</span>
<span class="co1">// disable login and logout functions for all users</span>
<span class="kw2">function</span> LessSpecialPages<span class="br0">(</span><span class="sy0">&amp;</span><span class="re0">$list</span><span class="br0">)</span> <span class="br0">{</span>
<a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">(</span> <span class="re0">$list</span><span class="br0">[</span><span class="st_h">'Userlogout'</span><span class="br0">]</span> <span class="br0">)</span><span class="sy0">;</span>
<a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">(</span> <span class="re0">$list</span><span class="br0">[</span><span class="st_h">'Userlogin'</span><span class="br0">]</span> <span class="br0">)</span><span class="sy0">;</span>
<span class="kw1">return</span> <span class="kw4">true</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re0">$wgHooks</span><span class="br0">[</span><span class="st_h">'SpecialPage_initList'</span><span class="br0">]</span><span class="br0">[</span><span class="br0">]</span><span class="sy0">=</span><span class="st_h">'LessSpecialPages'</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// http://www.mediawiki.org/wiki/Extension:Windows_NTLM_LDAP_Auto_Auth</span>
<span class="co1">// remove login and logout buttons for all users</span>
<span class="kw2">function</span> StripLogin<span class="br0">(</span><span class="sy0">&amp;</span><span class="re0">$personal_urls</span><span class="sy0">,</span> <span class="sy0">&amp;</span><span class="re0">$wgTitle</span><span class="br0">)</span> <span class="br0">{</span>
<a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">(</span> <span class="re0">$personal_urls</span><span class="br0">[</span><span class="st0">"login"</span><span class="br0">]</span> <span class="br0">)</span><span class="sy0">;</span>
<a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">(</span> <span class="re0">$personal_urls</span><span class="br0">[</span><span class="st0">"logout"</span><span class="br0">]</span> <span class="br0">)</span><span class="sy0">;</span>
<a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">(</span> <span class="re0">$personal_urls</span><span class="br0">[</span><span class="st_h">'anonlogin'</span><span class="br0">]</span> <span class="br0">)</span><span class="sy0">;</span>
<span class="kw1">return</span> <span class="kw4">true</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re0">$wgHooks</span><span class="br0">[</span><span class="st_h">'PersonalUrls'</span><span class="br0">]</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <span class="st_h">'StripLogin'</span><span class="sy0">;</span></pre>
<div class="notewarning">In last version of Auth_remoteuser and Mediawiki, empty passwords are not authorized, so you may need to patch the extension code if you get the error:
“Unexpected REMOTE_USER authentication failure. Login Error was:EmptyPass”.
</div>
<p>
If necessary, use the code below to patch the extension:
</p>
<pre class="code">sed -i "s/'wpPassword' =&gt; ''/'wpPassword' =&gt; 'none'/" extensions/Auth_remoteuser/Auth_remoteuser.body.php</pre>
<div class="notewarning">In last version of Auth_remoteuser and Mediawiki, auto-provisioning requires REMOTE_USER to match the normalized mediawiki username (for example: john_doe → john doe), so you may need to patch the extension code if you get the error:
“Unexpected REMOTE_USER authentication failure. Login Error was:WrongPluginPass”
</div>
<p>
You can use the code below for normalizing logins containing “_” in the extension:
</p>
<pre class="code">sed -i '/$usertest = $this-&gt;getRemoteUsername();/a\ $usertest = str_replace( "_"," ", $usertest );' extensions/Auth_remoteuser/Auth_remoteuser.body.php</pre>
</div><!-- EDIT5 SECTION "MediWiki local configuration" [1017-3670] -->
<h3 class="sectionedit6" id="mediawiki_virtual_host">Hôte virtuel MediaWiki</h3>
<div class="level3">
<p>
Configurer l'hôte virtuel Mediawiki comme n'importe quel autre <a href="../configvhost.html" class="wikilink1" title="documentation:2.0:configvhost">hôte virtuel protégé</a>.
</p>
<div class="noteimportant">Si Mediawiki est protégé par un reverse-proxy <abbr title="LemonLDAP::NG">LL::NG</abbr>, <a href="../header_remote_user_conversion.html" class="wikilink1" title="documentation:2.0:header_remote_user_conversion">convertir l'en-tête en variable d'environnement REMOTE_USER</a>.
</div><ul>
<li class="level1"><div class="li"> Pour Apache:</div>
</li>
</ul>
<pre class="code file apache">&lt;<span class="kw3">VirtualHost</span> *:<span class="nu0">80</span>&gt;
<span class="kw1">ServerName</span> mediawiki.example.com
&nbsp;
PerlHeaderParserHandler Lemonldap::NG::Handler
&nbsp;
...
&nbsp;
&lt;/<span class="kw3">VirtualHost</span>&gt;</pre>
<ul>
<li class="level1"><div class="li"> Pour Nginx:</div>
</li>
</ul>
<pre class="code file nginx">server {
listen 80;
server_name mediawiki.example.com;
root /path/to/application;
# Requête interne d'authentification
location = /lmauth {
internal;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/llng-fastcgi-server/llng-fastcgi.sock;
# Ignorer les données postées
fastcgi_pass_request_body off;
fastcgi_param CONTENT_LENGTH "";
# Conserver le nom d'hôte original
fastcgi_param HOST $http_host;
# Conserver la requête originale (le serveur LLNG va recevoir /llauth)
fastcgi_param X_ORIGINAL_URI $request_uri;
}
&nbsp;
# Requêtes clients
location / {
auth_request /lmauth;
auth_request_set $lmremote_user $upstream_http_lm_remote_user;
auth_request_set $lmlocation $upstream_http_location;
error_page 401 $lmlocation;
try_files $uri $uri/ =404;
&nbsp;
...
&nbsp;
include /etc/lemonldap-ng/nginx-lua-headers.conf;
}
location / {
try_files $uri $uri/ =404;
}
}</pre>
</div><!-- EDIT6 SECTION "MediaWiki virtual host" [3671-5110] -->
<h3 class="sectionedit7" id="mediawiki_virtual_host_in_manager">Hôte virtuel Mediawiki dans le manager</h3>
<div class="level3">
<p>
Aller dans le manager et <a href="../configvhost.html#lemonldapng_configuration" class="wikilink1" title="documentation:2.0:configvhost">créer un nouvel hôte virtuel</a> pour Mediawiki.
</p>
<p>
Configurer simplement la <a href="../writingrulesand_headers.html#rules" class="wikilink1" title="documentation:2.0:writingrulesand_headers">règle d'accès</a>. Il est possible d'ajouter une règle pour la déconnexion :
</p>
<pre class="code">Userlogout =&gt; logout_sso</pre>
<p>
On peut créer ces 2 en-têtes pour qu'ils corresponde au nom d'utilisateur et a son adresse mail (voir la configuration de l'extension) :
</p>
<pre class="code">Auth-Cn =&gt; $cn
Auth-Mail =&gt; $mail</pre>
<p>
Si <abbr title="LemonLDAP::NG">LL::NG</abbr> est utilisé par reverse-proxy, configurer l'<a href="../writingrulesand_headers.html#headers" class="wikilink1" title="documentation:2.0:writingrulesand_headers">en-tête</a> <code>Auth-User</code>,
</p>
</div><!-- EDIT7 SECTION "MediaWiki virtual host in Manager" [5111-] -->
</div>
</body>
</html>