Page MenuHomePhabricator

Secure login notice on new vagrant install
Closed, ResolvedPublic

Description

After creating new Vagrant install, I get this on each wiki:

Notice: Secure login was enabled on a server that only supports HTTP or
HTTPS. Disabling secure login. [Called from require_once in
/vagrant/mediawiki/includes/Setup.php at line 680] in
/vagrant/mediawiki/includes/debug/MWDebug.php on line 309

when going to e.g. http://en.wiki.local.wmftest.net:8080/wiki/Main_Page
Roles enabled:

babel
gadgets
https
interwiki
jsonconfig
langwikis
memcached
oauth
xhprofgui

Event Timeline

Smalyshev triaged this task as Normal priority.Dec 19 2017, 10:31 PM
Smalyshev created this task.
Tgr added a comment.Dec 19 2017, 11:53 PM

$wgSecureLogin is set by the https role which also tries to override $wgServer to be protocol-relative (apparently unsuccessfully). The code block to debug is the one with the $mwvSupportsHttps condition in puppet/modules/mediawiki/templates/multiwiki/CommonSettings.php.erb / /vagrant/settings.d/wikis/CommonSettings.php.

If I dump $wgServer at includes/Setup.php:610 it is http://dev.wiki.local.wmftest.net:8080. It turns out that the block in settings.d/wikis/CommonSettings.php which is trying to mutate $wgServer based on the state of $mwvSupportsHttps is before the block where settings.d/puppet-managed/01-Vagrant-HTTPS-support-flag.php actually sets the flag.

Sort of strangely, things look to be correct with eval.php:

$ mwscript eval.php --wiki=wiki
> echo $wgServer;
//dev.wiki.local.wmftest.net:8080
> var_dump($wgSecureLogin);
/vagrant/mediawiki/maintenance/eval.php(78) : eval()'d code:1:
bool(true)

> 

The part that makes this strange is that the block in question from settings.d/wikis/CommonSettings.php is guarded by "if ( PHP_SAPI !== 'cli' ) {" which means that it does not apply to the eval.php path. If I remove the whole block that was introduced for T68399 then $wgServer ends up being "//dev.wiki.local.wmftest.net:8080" as hoped in the web path as well.

Change 400204 had a related patch set uploaded (by BryanDavis; owner: BryanDavis):
[mediawiki/vagrant@stretch-migration] Mutate $wgServer after applying local settings

https://gerrit.wikimedia.org/r/400204

Change 400204 merged by jenkins-bot:
[mediawiki/vagrant@stretch-migration] Mutate $wgServer after applying local settings

https://gerrit.wikimedia.org/r/400204

bd808 closed this task as Resolved.Jan 1 2018, 4:30 AM