TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Websites Must Use HSTS in Order to Be Secure

52 pointsby zoowarabout 11 years ago

10 comments

ggreerabout 11 years ago
If you operate a website and want to enable HSTS, you should know about a few caveats:<p>1. You can&#x27;t go back! As soon as a browser sees Strict-Transport-Security &quot;max-age=31536000&quot;, it will refuse to load your site over HTTP for the next year.<p>2. The includeSubDomains option can cause problems in hard-to-predict ways. For example, Mailgun lets you set a CNAME for unsubscribe links. If a browser tries to load the HTTPS version, they&#x27;ll get mailgun.com&#x27;s cert, which is invalid for your domain.<p>3. Secure transport doesn&#x27;t stop XSS, CSRF, etc. There are other headers such as Content-Security-Policy that can ameliorate some of these attacks. Also, sanitize!<p>4. HSTS is just one part of ensuring secure transport. It&#x27;s also important to check your cipher suites. Not all TLS is created equal. SSL Labs is an extremely useful tool for testing your config: <a href="https://www.ssllabs.com/ssltest/analyze.html?d=floobits.com" rel="nofollow">https:&#x2F;&#x2F;www.ssllabs.com&#x2F;ssltest&#x2F;analyze.html?d=floobits.com</a><p>If you&#x27;re curious what the final result of all this paranoia looks like, take a look at the httpd config for floobits.com: <a href="https://gist.github.com/ggreer/9984770" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;ggreer&#x2F;9984770</a><p>You&#x27;ll also notice mod_authn_yubikey. We require multi-factor auth (YubiKey + password) for our admin interface. There&#x27;s tons of other stuff I could go into, but the real lesson is that security is like raking pine needles: You will never be done.
评论 #7535236 未加载
评论 #7535414 未加载
评论 #7535399 未加载
评论 #7535405 未加载
评论 #7535398 未加载
marcosdumayabout 11 years ago
Of course, it would help if browsers stopped letting sites put an image at the same place they show the locker (like they used to)... But that would require a few more pixels for canvas, and security is a secondary concern (just like usability).
评论 #7535445 未加载
dazbradburyabout 11 years ago
Can&#x27;t a MITM (as described in the article) strip out any HSTS headers automatically, thus thwarting this quite simply?<p>As with HTTPS, you need a shared secret <i>before</i> communication begins for anything like this to combat MITM attacks. Unless the browser communicates with a secure server to assess whether the website should be sending HSTS headers... Is that the idea?
评论 #7534975 未加载
评论 #7535102 未加载
derefrabout 11 years ago
One interesting thing I&#x27;ve noticed about HSTS (which is probably a good thing in the long run, but kind of painful for now): it breaks wi-fi capture-portal redirects. Try to load <a href="https://news.ycombinator.com/" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;</a> on a fresh connection to a wi-fi hotspot, and you just get a connection error.
评论 #7535556 未加载
conductorabout 11 years ago
I would like to point out that HSTS is not compatible with private browsing because by saving the information that the particular site must be accessed by HTTPS the browser exposes the fact that the said site was previously accessed. I hope we will eventually come to required secure HTTP by default with the next versions of the protocol.
评论 #7535719 未加载
WhiteDawnabout 11 years ago
For anyone wondering general best practices for setting up HTTPS on Apache&#x2F;nginx I found this to be a really great resource<p><a href="https://wiki.mozilla.org/Security/Server_Side_TLS" rel="nofollow">https:&#x2F;&#x2F;wiki.mozilla.org&#x2F;Security&#x2F;Server_Side_TLS</a>
wglbabout 11 years ago
One drastic solution if your web site has lots of IE users: Simply don&#x27;t answer the phone on port 80.<p>[Edit] Duh. As agentS points out, this won&#x27;t work.
评论 #7534940 未加载
评论 #7534926 未加载
评论 #7535404 未加载
tootieabout 11 years ago
My current client is insisting that all https traffic be served over a separate subdomain.
chris_mahanabout 11 years ago
Alternatively, make a plain html website and don&#x27;t ask users to log in and don&#x27;t track them with cookies, etc. If you want to collect money from them, make a real product and mail it to them after they sent you a postal money order.<p>Any attempt to defeat that model will be handled by the US Postal Inspection Service, (see also <a href="https://postalinspectors.uspis.gov/aboutus/mission.aspx" rel="nofollow">https:&#x2F;&#x2F;postalinspectors.uspis.gov&#x2F;aboutus&#x2F;mission.aspx</a>)
评论 #7535119 未加载
mch0licabout 11 years ago
HTTPS sounds great and s<i></i>t but HTTPS won&#x27;t help you if you dumb enough to execute shell commands as a root on your server based on unfiltered user form inputs... Unfortunately, I noticed that lots of &#x27;idea guys&#x27; trust the dev they hire first even if they have absolutely no skills whatsoever. lOOOl