Last modified: 2014-11-21 00:43:24 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T40516, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 38516 - Enable HSTS on Wikimedia sites
Enable HSTS on Wikimedia sites
Status: PATCH_TO_REVIEW
Product: Wikimedia
Classification: Unclassified
SSL related (Other open bugs)
unspecified
All All
: Low enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on: 34670 36126 35313
Blocks: 35079
  Show dependency treegraph
 
Reported: 2012-07-20 05:16 UTC by Phillip Patriakeas
Modified: 2014-11-21 00:43 UTC (History)
17 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Phillip Patriakeas 2012-07-20 05:16:11 UTC
[[HTTP Strict Transport Security]] tells a user's browser to load all resources for a website over HTTPS, even if the resources are referenced with an "http://" URI. More information at http://www.imperialviolet.org/2012/07/19/hope9talk.html
Comment 1 MZMcBride 2012-07-20 06:42:07 UTC
I think you'd do this at the Squid level. The Squid configuration is in Wikimedia's git repo somewhere...
Comment 2 Krinkle 2012-07-20 06:52:39 UTC
CC-ing Ryan Lane.

Note that until the SSL cluster is expanded and more stable, this must *not* happen at the Squid level, or any other level for that matter.

Right now the plan (afaik) is:
* Keep testing and allow natural usage increase by word of mouth
* Increase SSL cluster
* Enable for logged-in users by default
* ....
* ...
* Enable for everybody by default (?)
* ... (?)
* Increase SSL cluster ++ ++ ++
* Send HSTS and thus force all modern browsers to use HTTPS unconditionally. This would probably require most servers to have SSL on them internally, instead of the current situation in which we have a couple of SSL proxies that fetch from the protocol-relative (HTTP) squids.
Comment 3 Ryan Lane 2012-07-20 21:58:15 UTC
We can turn it on by default for logged-in users right now. We can easily handle that load.

To enable it for all users we'd need to expand the cluster so that every squid/varnish node is also an HTTPS node. That would be a requirement for HSTS. Indeed HSTS is the last in the chain for this.

Also, it isn't necessary for squid/varnish to send these headers. It would actually be nice if MediaWiki handled this, since then anyone could enable it.
Comment 4 Roan Kattouw 2012-07-20 22:05:46 UTC
(In reply to comment #3)
> We can turn it on by default for logged-in users right now. We can easily
> handle that load.
> 
You should realize that that means that once a browser is used by a logged-in user *once*, it will use HTTPS for *everyone* *forever* (really until the STS header expires, usually that's a year), even if they're not logged in. So in practice that means that every shared computer (libraries, internet cafes) in the world is gonna be hitting us exclusively via HTTPS within a few days of deploying this change.

This is not necessarily a huge problem, but I just wanted to point this out.

Also, STS forbids accepting invalid certs, and we're currently serving wrong certs for domains like wikipedia.com and wikidata.org; essentially all the misc domains we have are sent to wikimedia-lb, which means they get the star-wikimedia cert, which is bad. Serving STS fro those domains would be deadly.

> To enable it for all users we'd need to expand the cluster so that every
> squid/varnish node is also an HTTPS node. That would be a requirement for HSTS.
> Indeed HSTS is the last in the chain for this.
> 
Why is Squid/Varnish-side SSL termination required for STS? Why can't we just scale up our current nginx cluster?

> Also, it isn't necessary for squid/varnish to send these headers. It would
> actually be nice if MediaWiki handled this, since then anyone could enable it.
Yes, MW should send these headers.
Comment 5 Ryan Lane 2012-07-20 22:28:24 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > We can turn it on by default for logged-in users right now. We can easily
> > handle that load.
> > 
> You should realize that that means that once a browser is used by a logged-in
> user *once*, it will use HTTPS for *everyone* *forever* (really until the STS
> header expires, usually that's a year), even if they're not logged in. So in
> practice that means that every shared computer (libraries, internet cafes) in
> the world is gonna be hitting us exclusively via HTTPS within a few days of
> deploying this change.
> 
> This is not necessarily a huge problem, but I just wanted to point this out.
> 

Sorry, sorry. I meant send all logged-in traffic to https, not use HSTS.

> Also, STS forbids accepting invalid certs, and we're currently serving wrong
> certs for domains like wikipedia.com and wikidata.org; essentially all the misc
> domains we have are sent to wikimedia-lb, which means they get the
> star-wikimedia cert, which is bad. Serving STS fro those domains would be
> deadly.
> 

Eh? Since when are we serving incorrect certificates? Do you mean for mobile?

> > To enable it for all users we'd need to expand the cluster so that every
> > squid/varnish node is also an HTTPS node. That would be a requirement for HSTS.
> > Indeed HSTS is the last in the chain for this.
> > 
> Why is Squid/Varnish-side SSL termination required for STS? Why can't we just
> scale up our current nginx cluster?
> 

It makes more sense to just stick HTTPS on every box, than to have a separate cluster, if we're going to do HTTPS by default.
Comment 6 Roan Kattouw 2012-07-20 22:30:18 UTC
(In reply to comment #5)
> Eh? Since when are we serving incorrect certificates? Do you mean for mobile?
> 
https://wikipedia.com
https://wikipedia.net
https://wikidata.org

> It makes more sense to just stick HTTPS on every box, than to have a separate
> cluster, if we're going to do HTTPS by default.
Right, OK.
Comment 7 Ryan Lane 2012-07-20 22:34:50 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > Eh? Since when are we serving incorrect certificates? Do you mean for mobile?
> > 
> https://wikipedia.com
> https://wikipedia.net
> https://wikidata.org
> 

Ah. Those, yes. We only send redirects from there, so, MediaWiki wouldn't send headers from that.
Comment 8 dkeeler 2013-02-04 19:44:20 UTC
Hi folks,
Just wanted to say 1) this would be awesome and 2) it would be even more awesome if you could configure these sites to be on the HSTS preload lists currently in Firefox and Chrome. To do so, you simply need to have max-age be 10886400 or larger and contact Adam Langley as per http://dev.chromium.org/sts
There's a bit more of an explanation here: https://blog.mozilla.org/security/2012/11/01/preloading-hsts/
Thanks!
Comment 9 Tyler Romeo 2013-08-03 05:08:32 UTC
Note that you can disable HSTS at any point by sending the header with an expiry that already expired (similar to how it's done with cookies). This is what Extension:SecureSessions does to implement HSTS in MediaWiki, and as long as Squid/Varnish allows MediaWiki to override the HSTS header it sends somehow, it should still be possible even with an HTML cache.
Comment 10 Ryan Lane 2013-08-03 07:57:37 UTC
(In reply to comment #9)
> Note that you can disable HSTS at any point by sending the header with an
> expiry that already expired (similar to how it's done with cookies). This is
> what Extension:SecureSessions does to implement HSTS in MediaWiki, and as
> long
> as Squid/Varnish allows MediaWiki to override the HSTS header it sends
> somehow,
> it should still be possible even with an HTML cache.

Let's assume we need to turn off HSTS for a really great reason, like a country being blocked on HTTPS. How would those users get the expired header if they can't reach the site?
Comment 11 Phillip Patriakeas 2013-08-03 08:31:11 UTC
Adding bug 35313 and bug 36126 as blockers per comment 4 (how is there no tracking bug for invalid SSL certs?). I may be misunderstanding Roan's comment, though, so if invalid certs wouldn't actually be blockers for enabling HSTS, adjust as needed. =)
Comment 12 Ryan Lane 2013-08-03 08:34:26 UTC
(In reply to comment #11)
> Adding bug 35313 and bug 36126 as blockers per comment 4 (how is there no
> tracking bug for invalid SSL certs?). I may be misunderstanding Roan's
> comment,
> though, so if invalid certs wouldn't actually be blockers for enabling HSTS,
> adjust as needed. =)

We're no longer serving invalid certs.
Comment 13 Phillip Patriakeas 2013-08-03 08:37:19 UTC
(In reply to comment #12) 
> We're no longer serving invalid certs.

Okay, guess I should've actually read them. Sorry about that. =X
Comment 14 Matthew Flaschen 2013-08-03 09:04:13 UTC
(In reply to comment #12)
> We're no longer serving invalid certs.

That may be the case for wikis, but it's still an issue for redirects like https://wikipedia.com and https://bugzilla.wikipedia.org/ .
Comment 15 Tyler Romeo 2013-08-03 15:34:40 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > Note that you can disable HSTS at any point by sending the header with an
> > expiry that already expired (similar to how it's done with cookies). This is
> > what Extension:SecureSessions does to implement HSTS in MediaWiki, and as
> > long
> > as Squid/Varnish allows MediaWiki to override the HSTS header it sends
> > somehow,
> > it should still be possible even with an HTML cache.
> 
> Let's assume we need to turn off HSTS for a really great reason, like a
> country
> being blocked on HTTPS. How would those users get the expired header if they
> can't reach the site?

I meant in reference to comment 4, which mentioned that if somebody uses it on a shared computer then it will use TLS for practically ever. We could make it so logging out causes HSTS to be disabled, although honestly it'd be better if we didn't now that I think about it...
Comment 16 dkeeler 2013-08-05 16:42:17 UTC
(In reply to comment #10)
> Let's assume we need to turn off HSTS for a really great reason, like a
> country
> being blocked on HTTPS. How would those users get the expired header if they
> can't reach the site?

They wouldn't be able to. They would have to manually clear the cached HSTS information (in Firefox, users can do this by using "Clear Recent History -> Site Preferences").

(In reply to comment #15)
> I meant in reference to comment 4, which mentioned that if somebody uses it
> on
> a shared computer then it will use TLS for practically ever. We could make it
> so logging out causes HSTS to be disabled, although honestly it'd be better
> if
> we didn't now that I think about it...

The weak point of HSTS is the first connection. By doing this, there would be many more first connections for things to go wrong.
Comment 17 Ryan Lane 2013-08-05 18:03:05 UTC
(In reply to comment #16)
> (In reply to comment #10)
> > Let's assume we need to turn off HSTS for a really great reason, like a
> > country
> > being blocked on HTTPS. How would those users get the expired header if they
> > can't reach the site?
> 
> They wouldn't be able to. They would have to manually clear the cached HSTS
> information (in Firefox, users can do this by using "Clear Recent History ->
> Site Preferences").
> 

https://bugzilla.mozilla.org/show_bug.cgi?id=572803
Comment 18 Tyler Romeo 2013-08-05 21:33:24 UTC
(In reply to comment #16)
> The weak point of HSTS is the first connection. By doing this, there would be
> many more first connections for things to go wrong.

Yeah, this would be the main reason of why we would not want to do what I mentioned earlier. :/
Comment 19 Gerrit Notification Bot 2014-05-22 05:11:33 UTC
Change 132393 had a related patch set uploaded by MZMcBride:
Improve nginx TLS/SSL settings.

https://gerrit.wikimedia.org/r/132393
Comment 20 fn84b 2014-06-25 09:11:24 UTC
I also wish Wikimedia to enable HSTS. How about we add it to Beta features [1], so that users can optionally enable HSTS? The feature description on that page can tell users how to remove HSTS record by deleting browsers' cache.

I don't think it's necessary to disable HSTS when users log off, because shared computers are usually configured to clear all caches when browsers are closed.

[1] https://en.wikipedia.org/wiki/Special:Preferences#mw-prefsection-betafeatures
Comment 21 Andre Klapper 2014-06-30 18:10:27 UTC
*** Bug 67303 has been marked as a duplicate of this bug. ***
Comment 22 fn84b 2014-07-01 08:53:03 UTC
bugzilla.wikimedia.org, wikitech.wikimedia.org and lists.wikimedia.org require HTTPS connections. Could we enable HSTS on these domains first?
Comment 23 Jan Zerebecki 2014-07-01 08:59:03 UTC
Yes, enabling those first is fine. The patch for bugzilla is at https://gerrit.wikimedia.org/r/#/c/127256/ .
Comment 24 chmarkine 2014-07-09 09:01:41 UTC
(In reply to fn84b from comment #22)
> bugzilla.wikimedia.org, wikitech.wikimedia.org and lists.wikimedia.org
> require HTTPS connections. Could we enable HSTS on these domains first?

I made a table, which summarizes which domains require HTTPS: https://wikitech.wikimedia.org/wiki/User:Chmarkine/HTTPS

There are many other domains besides these three.
Comment 25 Daniel Zahn 2014-07-11 01:48:54 UTC
fyi. this is enabled on Bugzilla since 	Jul 8 6:17 PM

we set it to max-age 7 days only for now (see csteipp's comment on https://gerrit.wikimedia.org/r/#/c/127256/) 

we want to wait for one full cycle, then raise that value,and then the Qualis SSL labs test will not say it's "TOOSHORT" anymore
Comment 27 Gerrit Notification Bot 2014-07-11 03:21:01 UTC
Change 145500 had a related patch set uploaded by Dzahn:
StrictTransportSecurity for lists.wm.org

https://gerrit.wikimedia.org/r/145500
Comment 28 Gerrit Notification Bot 2014-07-11 12:51:55 UTC
Change 145495 had a related patch set uploaded by Krinkle:
StrictTransportSecurity for OTRS

https://gerrit.wikimedia.org/r/145495
Comment 29 Gerrit Notification Bot 2014-07-11 12:52:45 UTC
Change 145491 had a related patch set uploaded by Krinkle:
Enable StrictTransportSecurity for wikitech

https://gerrit.wikimedia.org/r/145491
Comment 30 Gerrit Notification Bot 2014-07-11 14:11:14 UTC
Change 145491 merged by Andrew Bogott:
Enable StrictTransportSecurity for wikitech

https://gerrit.wikimedia.org/r/145491
Comment 31 Gerrit Notification Bot 2014-07-11 18:17:22 UTC
Change 145495 merged by Dzahn:
StrictTransportSecurity for OTRS

https://gerrit.wikimedia.org/r/145495
Comment 32 Daniel Zahn 2014-07-11 18:21:18 UTC
Just enabled it on OTRS a minute ago. 

11:21 < mutante> !log OTRS - enabled STS, updated SSL cipher list, restarted Apache on iodine
Comment 33 chmarkine 2014-07-19 16:07:29 UTC
Could we now raise the max-age to 1 year or longer?
Comment 34 Jan Zerebecki 2014-07-20 21:21:41 UTC
Yes, I think after no known issues with HSTS being enabled with 7day max-age for 7 days, it makes sense to extend it. I don't know of any reason not to use 1 year. So lets go with that.

Out of curiosity: Any special reason for 1 year? The longest suggestions I have seen is 186 days from http://www.chromium.org/sts .
Comment 36 Gerrit Notification Bot 2014-07-22 11:02:31 UTC
Change 148285 had a related patch set uploaded by JanZerebecki:
bugzilla - raise max-age for STS to 1 year

https://gerrit.wikimedia.org/r/148285
Comment 37 Gerrit Notification Bot 2014-07-22 11:03:48 UTC
Change 148289 had a related patch set uploaded by JanZerebecki:
OTRS - raise max-age for STS to 1 year

https://gerrit.wikimedia.org/r/148289
Comment 38 Gerrit Notification Bot 2014-07-22 11:10:51 UTC
Change 148290 had a related patch set uploaded by JanZerebecki:
wikitech - raise max-age for STS to 1 year

https://gerrit.wikimedia.org/r/148290
Comment 39 Gerrit Notification Bot 2014-07-22 14:04:20 UTC
Change 148290 merged by Andrew Bogott:
wikitech - raise max-age for STS to 1 year

https://gerrit.wikimedia.org/r/148290
Comment 40 Gerrit Notification Bot 2014-07-24 23:01:27 UTC
Change 148285 merged by Dzahn:
bugzilla - raise max-age for STS to 1 year

https://gerrit.wikimedia.org/r/148285
Comment 41 Gerrit Notification Bot 2014-08-15 18:08:32 UTC
Change 148289 merged by Dzahn:
OTRS - raise max-age for STS to 1 year

https://gerrit.wikimedia.org/r/148289
Comment 42 Daniel Zahn 2014-08-15 18:20:53 UTC
OTRS (ticket.wikimedia.org) - now "This server supports HTTP Strict Transport Security with long duration." (1 year)
Comment 43 Gerrit Notification Bot 2014-09-02 05:55:14 UTC
Change 157789 had a related patch set uploaded by Chmarkine:
gerrit: Enable StrictTransportSecurity max-age=7days

https://gerrit.wikimedia.org/r/157789
Comment 44 Gerrit Notification Bot 2014-09-05 01:00:52 UTC
Change 157789 merged by Dzahn:
gerrit: Enable StrictTransportSecurity max-age=7days

https://gerrit.wikimedia.org/r/157789
Comment 45 Gerrit Notification Bot 2014-09-11 01:50:53 UTC
Change 145500 merged by Dzahn:
StrictTransportSecurity for lists.wm.org

https://gerrit.wikimedia.org/r/145500
Comment 46 Gerrit Notification Bot 2014-09-11 14:22:38 UTC
Change 159729 had a related patch set uploaded by Chmarkine:
gerrit - raise HSTS max-age to 1 year

https://gerrit.wikimedia.org/r/159729
Comment 47 Gerrit Notification Bot 2014-09-18 05:53:14 UTC
Change 161177 had a related patch set uploaded by Chmarkine:
lists.wm.org - raise HSTS max-age to 1 year

https://gerrit.wikimedia.org/r/161177
Comment 48 Filippo Giunchedi 2014-09-18 08:37:27 UTC
sounds good, please let ops@ know this is going on so people are aware (that is, hsts on non-mediawiki sites being turned on)
Comment 49 Gerrit Notification Bot 2014-09-25 01:33:07 UTC
Change 162805 had a related patch set uploaded by Chmarkine:
phabricator - enable HSTS with max-age 7 days

https://gerrit.wikimedia.org/r/162805
Comment 50 Gerrit Notification Bot 2014-09-29 19:58:41 UTC
Change 162805 merged by Rush:
phabricator - enable HSTS with max-age 7 days

https://gerrit.wikimedia.org/r/162805
Comment 51 Gerrit Notification Bot 2014-09-29 22:50:37 UTC
Change 159729 merged by Dzahn:
gerrit - raise HSTS max-age to 1 year

https://gerrit.wikimedia.org/r/159729
Comment 52 Gerrit Notification Bot 2014-10-06 04:43:32 UTC
Change 164897 had a related patch set uploaded by Chmarkine:
phabricator - raise HSTS max-age to 1 year

https://gerrit.wikimedia.org/r/164897
Comment 53 Gerrit Notification Bot 2014-10-06 15:47:08 UTC
Change 164897 merged by Rush:
phabricator - raise HSTS max-age to 1 year

https://gerrit.wikimedia.org/r/164897
Comment 54 Gerrit Notification Bot 2014-10-07 09:12:53 UTC
Change 161177 merged by Filippo Giunchedi:
lists.wm.org - raise HSTS max-age to 1 year

https://gerrit.wikimedia.org/r/161177
Comment 55 chmarkine 2014-11-02 22:48:11 UTC
How about installing Extension:HSTS on Wikipedia and other projects? It seems to be very useful.

[1] https://www.mediawiki.org/wiki/Extension:HSTS
Comment 56 Sam Reed (reedy) 2014-11-02 22:50:04 UTC
(In reply to chmarkine from comment #55)
> How about installing Extension:HSTS on Wikipedia and other projects? It
> seems to be very useful.
> 
> [1] https://www.mediawiki.org/wiki/Extension:HSTS

 * Note that if you intend to activate HSTS on the whole website, it will be
 * more efficient and robust to add it directly in the server configuration.
Comment 57 chmarkine 2014-11-02 23:17:12 UTC
(In reply to Sam Reed (reedy) from comment #56)
> (In reply to chmarkine from comment #55)
> > How about installing Extension:HSTS on Wikipedia and other projects? It
> > seems to be very useful.
> > 
> > [1] https://www.mediawiki.org/wiki/Extension:HSTS
> 
>  * Note that if you intend to activate HSTS on the whole website, it will be
>  * more efficient and robust to add it directly in the server configuration.

Yeah, I agree. But what the extension does is to allow registered users to optionally enable HSTS, rather than enforcing everyone to use it.
Comment 58 Seb35 2014-11-10 15:41:15 UTC
(In reply to chmarkine from comment #57)
> (In reply to Sam Reed (reedy) from comment #56)
> > (In reply to chmarkine from comment #55)
> > > How about installing Extension:HSTS on Wikipedia and other projects? It
> > > seems to be very useful.
> > > 
> > > [1] https://www.mediawiki.org/wiki/Extension:HSTS
> > 
> >  * Note that if you intend to activate HSTS on the whole website, it will be
> >  * more efficient and robust to add it directly in the server configuration.
> 
> Yeah, I agree. But what the extension does is to allow registered users to
> optionally enable HSTS, rather than enforcing everyone to use it.

This extension aims at smoothly deploy HSTS on MediaWiki wikis, and I added some months ago the possibility to enable it as a BetaFeature.

This would gradually increase the load on the servers and the users could say if they have problems before a wider deployment.
Comment 59 chmarkine 2014-11-21 00:43:24 UTC
And payments.wikimedia.org should use HSTS as well.

https://www.ssllabs.com/ssltest/analyze.html?d=payments.wikimedia.org

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links