Mediawiki in chroot – php in hell

Setting Mediawiki’s LDAP authentication and mail functionality while it is running in an OpenBSD’s nginx chroot took some time to debug and prepare.

As always, the first thing should be the set-up of a log:

$wgDebugLogFile = “../logs/mediawiki/debug-{$wgDBname}.log”;
error_reporting( -1 );
ini_set( ‘display_errors’, 1 );

That said that there were pear-Net-SMTP and pear-Mail missing, and that would be a breeze if I hadn’t already installed Php 5.5. There are no pear-Net-SMTP and pear-Mail for Php 5.5 in OpenBSD’s packages, and will definitely not roll my own. Thus, a pkg_delete of all php-packages, and a re-install of those in their 5.4 versions was the next thing to do. Don’t forget to re-link the new, 5.4 modules after! I did! 🙂

Setting the watch on a change was not receiving an e-mail when the change occurs, and I couldn’t find a working combination for the set-up. Logs to the help, they gave away only this much:

PEAR::Mail failed: Failed to connect to ssl://mail.simulakrum.org:465 [SMTP: Failed to connect socket: php_network_getaddresses: getaddrinfo failed: no address associated with name (code: -1, response: )]

Why? We’re in the chroot! An ../etc/hosts with the mail-server’s IP sorted that problem.

Alerts work, and do send mail, but the lad who sends them calls himself “apache@wiki.simulakrum.org”! Who the heck is “apache”? Don’t let the fact that nobody is actually sending passwords ( as $wgPasswordSender variables suggest ) confuse you because those passwords are regulated through the LDAP – that is where “apache” is coming from. Sort your smtp-related part of the LocalSettings.php to cover that up, $wgPasswordSender and $wgPasswordSenderName in particular:

$wgEnableEmail = true;
$wgEnableUserEmail = true;
$wgEmergencyContact = “admin@simulakrum.org”;
$wgPasswordSenderName = “Wiki Admin”;
$wgPasswordSender = “admin@simulakrum.org”;
$wgNoReplyAddress = “noreply@simulakrum.org”;
$wgEnotifUserTalk = true;
$wgEnotifWatchlist = true;
$wgSMTP = array(
‘host’ => “ssl://mail.simulakrum.org”,
‘IDhost’ => “simulakrum.org”,
‘port’ => 465,
‘auth’ => true,
‘username’ => “admin@simulakrum.org”,
‘password’ => “adminspassword”
);

That is better, but, yet another problem remains: a user that has an underscore in the username cannot log in!

Fortunately, that last one turned out to be a known bug, with an ugly and a short ‘ack that can help, and it is described here.

Finally, a working instance of mediawiki! When I started with the installation, I did have a hunch that a simple “pkg_add mediawiki” was too easy, and that I was not done in 30 seconds… 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *