Just got my MediaWiki running on a local domain (running as container on Synology nas). Now I want to configure so only domain users can access the Wiki and are automatically logged in.
This is for the sole purpose of tracking user name with page edits.
My local domain is abc.local
and my domain controller is Windows Server 2008 R2.
I've done the following:
Installed extensions
LDAPProvider
,LDAPAuthentication2
, andPluggableAuth
.Added the following to the bottom of my
LocalSettings.php
.
wfLoadExtension( 'PluggableAuth' );
$wgPluggableAuth_EnabledAutoLogin = true;
wfLoadExtension( 'LDAPAuthentication2' );
wfLoadExtension( 'LDAPProvider' );
$LDAPProviderDomainConfigProvider = function () {
$config = [
'LDAP' => [
'connection' => [
"server" => "abc.local",
"user" => "cn=Administrator,dc=abc,dc=local",
"pass" => 'passwordhere',
"options" => [
"LDAP_OPT_DEREF" => 1
],
"basedn" => "dc=abc,dc=local",
"groupbasedn" => "dc=abc,dc=local",
"userbasedn" => "dc=abc,dc=local",
"searchstring" => "uid=USER-NAME,dc=abc,dc=local",
"emailattribute" => "mail"
"usernameattribute" => "uid",
"realnameattribute" => "cn",
"searchattribute" => "uid",
]
]
];
return new \MediaWiki\Extension\LDAPProvider\DomainConfigProvider\InlinePHPArray( $config );
};
The pluggins are running:
When i go to the main page i'm not automatically logged in, so i try to log in with domain creds and get the following:
I'm pretty green here and not sure how to configure things. Any ideas?
thanks, russ
EDIT: After adding $wgShowExceptionDetails = true;
I'm getting the following error message:
EDIT2: Snip from phpinfo()
EDIT3: Started over with new containers in attempt to get php-ldap extension working and get around the ldap_connect()
error.
Here are the steps I took with my last attempt:
REFERENCE: https://wiki.chairat.me/books/docker/page/how-to-setup-mediawiki-with-docker
Enable SSH service from control panel Terminal & SNMP and then open an SSH connection to the Synology box (using Putty). Login as box admin.
Run the following command to create a new docker container named mediawiki based on the latest mediawiki image:
sudo docker container run -d --name mediawiki -p 8080:80 mediawiki
Run the following command to create a new docker container named mediakwiki-mysql based on the latest MySQL image.
Replace <root_pwd> with desired MySQL root password:sudo docker container run -d --name mediawiki-mysql -v mediawiki-mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=<root_pwd> mysql
Run the following 3 commands to create a docker network and then tie both images into it:
sudo docker network create mediawiki sudo docker network connect mediawiki mediawiki sudo docker network connect mediawiki mediawiki-mysql
Next, open a bash terminal in the mediawiki-mysql container and set the root plugin to mysql_native_password if necessary:
mysql -uroot -p<root_pwd>
(this opens a MySQL prompt where <root_pwd> is what you set up in 3. without the <>)SELECT user,authentication_string,plugin,host FROM mysql.user; (this lists user attributes) ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; (password is the <root_pwd> set above too) ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
Add a volume mapping in the mediawiki-mysql container so you can copy files to/from the container and a share you can access with File Station on the Synology.
Stop the container if it is running.
Right-click and select Edit, then click on Volume.
Click "Add Folder" and select the shared volume you will use.
For "Mount path" put /var/lib/mysql
Start the container.REFERENCE: https://computingforgeeks.com/how-to-install-php-7-3-on-debian-9-debian-8/
Add php-ldap extension to the mediawiki container if you want to enable LDAP authentication (e.g. if you have domain with active directory etc.). Open a bash terminal in the mediawiki container:
php -m (this will list all of the active PHP modules - ldap is not listed if not installed yet) php -v (this will show you what version of PHP you are running) apt-get update apt-get upgrade -y apt-get install libldb-dev libldap2-dev cd /usr/local/bin docker-php-ext-install ldap (this takes a while) php -m (this shows ldap in the list)
Setup the MediaWiki before going on to the LDAP extension stuff.
Open "http://XXX.XXX.XXX.XXX:8080/" in browser and configure.
Use "mediawiki-mysql" in place of "localhost" for mysql.
Put LocalSettings.php into the /usr/www/html folder.Install the LDAPProvider mediawiki extension needed to support LdapAuthentication2
wget "https://extdist.wmflabs.org/dist/extensions/LDAPProvider-master-04dc101.tar.gz" tar -xzf LDAPProvider-master-04dc101.tar.gz -C /var/www/html/extensions rm LDAPProvider-master-04dc101.tar.gz add "wfLoadExtension( 'LDAPProvider' );" to the LocalSettings.php file. run "php maintenance/update.php" to create the required databases (takes a few seconds). wget "https://extdist.wmflabs.org/dist/extensions/PluggableAuth-REL1_34-17fb1ea.tar.gz" tar -xzf PluggableAuth-REL1_34-17fb1ea.tar.gz -C /var/www/html/extensions rm PluggableAuth-REL1_34-17fb1ea.tar.gz add "wfLoadExtension( 'PluggableAuth' );" to the LocalSettings.php file. wget "https://extdist.wmflabs.org/dist/extensions/LDAPAuthentication2-master-cb07184.tar.gz" tar -xzf LDAPAuthentication2-master-cb07184.tar.gz -C /var/www/html/extensions rm LDAPAuthentication2-master-cb07184.tar.gz add "wfLoadExtension( 'LDAPAuthentication2' );" to the LocalSettings.php file. copy in the LocalSettings.php file that has the LDAP configuration (item 2 in my original question above).