209 lines
12 KiB
HTML
209 lines
12 KiB
HTML
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
|
|
lang="en" dir="ltr">
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title></title>
|
|
<!-- metadata -->
|
|
<meta name="generator" content="Offline" />
|
|
<meta name="version" content="Offline 0.1" />
|
|
<!-- style sheet links -->
|
|
<link rel="stylesheet" media="all" type="text/css" href="../../../../css/all.css" />
|
|
<link rel="stylesheet" media="screen" type="text/css" href="../../../../css/screen.css" />
|
|
<link rel="stylesheet" media="print" type="text/css" href="../../../../css/print.css" />
|
|
|
|
</head>
|
|
<body>
|
|
<div class="dokuwiki export">
|
|
|
|
|
|
<h1 class="sectionedit1" id="mediawiki">MediaWiki</h1>
|
|
<div class="level1">
|
|
|
|
<p>
|
|
<a href="/_detail/applications/mediawiki_logo.png?id=documentation%3A2.0%3Aapplications%3Amediawiki" class="media" title="applications:mediawiki_logo.png"><img src="../../../../media/icons/kmultiple.png" class="mediacenter" alt="" /></a>
|
|
</p>
|
|
|
|
</div>
|
|
<!-- EDIT1 SECTION "MediaWiki" [1-66] -->
|
|
<h2 class="sectionedit2" id="presentation">Presentation</h2>
|
|
<div class="level2">
|
|
|
|
<p>
|
|
<a href="http://www.mediawiki.org" class="urlextern" title="http://www.mediawiki.org" rel="nofollow">MediaWiki</a> is a wiki software, used by the well known <a href="http://www.wikipedia.org" class="urlextern" title="http://www.wikipedia.org" rel="nofollow">Wikipedia</a>.
|
|
</p>
|
|
|
|
<p>
|
|
Several extensions allows to configure <abbr title="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>
|
|
We will explain how to use <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> extension.
|
|
</p>
|
|
|
|
</div>
|
|
<!-- EDIT2 SECTION "Presentation" [67-590] -->
|
|
<h2 class="sectionedit3" id="installation">Installation</h2>
|
|
<div class="level2">
|
|
|
|
<p>
|
|
The extension is presented here: <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>
|
|
You can download the code here: <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>
|
|
You have to install <code> Auth_remoteuser</code> in the <code>extensions/</code> directory of your MediaWiki installation:
|
|
</p>
|
|
<pre class="code">cp -a Auth_remoteuser/ extensions/</pre>
|
|
|
|
</div>
|
|
<!-- EDIT3 SECTION "Installation" [591-985] -->
|
|
<h2 class="sectionedit4" id="configuration">Configuration</h2>
|
|
<div class="level2">
|
|
|
|
</div>
|
|
<!-- EDIT4 SECTION "Configuration" [986-1012] -->
|
|
<h3 class="sectionedit5" id="mediwiki_local_configuration">MediWiki local configuration</h3>
|
|
<div class="level3">
|
|
|
|
<p>
|
|
Then edit MediaWiki local settings
|
|
</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>
|
|
Add then extension configuration, for example:
|
|
</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>
|
|
|
|
<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">&</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>
|
|
|
|
<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">&</span><span class="re0">$personal_urls</span><span class="sy0">,</span> <span class="sy0">&</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>
|
|
<!-- EDIT5 SECTION "MediWiki local configuration" [1013-2635] -->
|
|
<h3 class="sectionedit6" id="mediawiki_virtual_host">MediaWiki virtual host</h3>
|
|
<div class="level3">
|
|
|
|
<p>
|
|
Configure MediaWiki virtual host like other <a href="../../../documentation/2.0/configvhost.html" class="wikilink1" title="documentation:2.0:configvhost">protected virtual host</a>.
|
|
</p>
|
|
|
|
<p>
|
|
<p><div class="noteimportant">If you are protecting MediaWiki with <abbr title="LemonLDAP::NG">LL::NG</abbr> as reverse proxy, <a href="../../../documentation/2.0/header_remote_user_conversion.html" class="wikilink1" title="documentation:2.0:header_remote_user_conversion">convert header into REMOTE_USER environment variable</a>.
|
|
</div></p>
|
|
</p>
|
|
<ul>
|
|
<li class="level1"><div class="li"> For Apache:</div>
|
|
</li>
|
|
</ul>
|
|
<pre class="code file apache"><<span class="kw3">VirtualHost</span> *:<span class="nu0">80</span>>
|
|
<span class="kw1">ServerName</span> mediawiki.example.com
|
|
|
|
PerlHeaderParserHandler Lemonldap::NG::Handler
|
|
|
|
...
|
|
|
|
</<span class="kw3">VirtualHost</span>></pre>
|
|
<ul>
|
|
<li class="level1"><div class="li"> For Nginx:</div>
|
|
</li>
|
|
</ul>
|
|
<pre class="code file nginx">server {
|
|
listen 80;
|
|
server_name mediawiki.example.com;
|
|
root /path/to/application;
|
|
# Internal authentication request
|
|
location = /lmauth {
|
|
internal;
|
|
include /etc/nginx/fastcgi_params;
|
|
fastcgi_pass unix:/var/run/llng-fastcgi-server/llng-fastcgi.sock;
|
|
# Drop post datas
|
|
fastcgi_pass_request_body off;
|
|
fastcgi_param CONTENT_LENGTH "";
|
|
# Keep original hostname
|
|
fastcgi_param HOST $http_host;
|
|
# Keep original request (LLNG server will received /llauth)
|
|
fastcgi_param X_ORIGINAL_URI $request_uri;
|
|
}
|
|
|
|
# Client requests
|
|
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;
|
|
|
|
...
|
|
|
|
include /etc/lemonldap-ng/nginx-lua-headers.conf;
|
|
}
|
|
location / {
|
|
try_files $uri $uri/ =404;
|
|
}
|
|
}</pre>
|
|
|
|
</div>
|
|
<!-- EDIT6 SECTION "MediaWiki virtual host" [2636-4075] -->
|
|
<h3 class="sectionedit7" id="mediawiki_virtual_host_in_manager">MediaWiki virtual host in Manager</h3>
|
|
<div class="level3">
|
|
|
|
<p>
|
|
Go to the Manager and <a href="../../../documentation/2.0/configvhost.html#lemonldapng_configuration" class="wikilink1" title="documentation:2.0:configvhost">create a new virtual host</a> for MediaWiki.
|
|
</p>
|
|
|
|
<p>
|
|
Just configure the <a href="../../../documentation/2.0/writingrulesand_headers.html#rules" class="wikilink1" title="documentation:2.0:writingrulesand_headers">access rules</a>. You can also add a rule for logout:
|
|
</p>
|
|
<pre class="code">Userlogout => logout_sso</pre>
|
|
|
|
<p>
|
|
You can create these two headers to fill user name and mail (see extension configuration):
|
|
</p>
|
|
<pre class="code">Auth-Cn => $cn
|
|
Auth-Mail => $mail</pre>
|
|
|
|
<p>
|
|
If using <abbr title="LemonLDAP::NG">LL::NG</abbr> as reverse proxy, configure also the <code>Auth-User</code> <a href="../../../documentation/2.0/writingrulesand_headers.html#headers" class="wikilink1" title="documentation:2.0:writingrulesand_headers">header</a>,
|
|
</p>
|
|
|
|
</div>
|
|
</div><!-- closes <div class="dokuwiki export">--> |