<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sonica Arora</title>
    <description>The latest articles on DEV Community by Sonica Arora (@sonica).</description>
    <link>https://dev.to/sonica</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F92487%2Fb0781136-a4c1-4fcf-83ff-82a8ce946b4e.jpg</url>
      <title>DEV Community: Sonica Arora</title>
      <link>https://dev.to/sonica</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sonica"/>
    <language>en</language>
    <item>
      <title>HSTS Preloading using Nginx, Letsencrypt and Capistrano.😎</title>
      <dc:creator>Sonica Arora</dc:creator>
      <pubDate>Mon, 15 Oct 2018 14:40:36 +0000</pubDate>
      <link>https://dev.to/sonica/hsts-preloading-using-nginx-letsencrypt-and-capistrano-18l7</link>
      <guid>https://dev.to/sonica/hsts-preloading-using-nginx-letsencrypt-and-capistrano-18l7</guid>
      <description>

&lt;p&gt;Quick tip: HSTS stands for &lt;a href="https://tools.ietf.org/html/rfc6797"&gt;HTTPS Strict Transport Security&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;HSTS is a security policy mechanism that protects against protocol downgrade attacks. In simple terms it means forcing the browsers to always use &lt;code&gt;https&lt;/code&gt; over &lt;code&gt;http&lt;/code&gt; for your website. HSTS also protects against cookie hijacking but we'll leave that discussion out for another post. &lt;/p&gt;

&lt;p&gt;In the post below we talk about how to quickly configure your web-server (nginx) to imply HSTS on all subsequent requests and then &lt;em&gt;hardcode&lt;/em&gt; this rule into Chrome and other major browsers to default on &lt;code&gt;https&lt;/code&gt; for your website using HSTS preloading. &lt;/p&gt;

&lt;p&gt;We're doing this on &lt;a href="https://bubblin.io"&gt;Bubblin Superbooks&lt;/a&gt; now. 😇&lt;/p&gt;

&lt;p&gt;I recommend reading the following blog by Scott Helme to learn more about &lt;a href="https://scotthelme.co.uk/hsts-preloading/" rel="nofollow"&gt; HSTS preloading&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;…a list of hosts that wish to enforce the use of SSL/TLS on their site is built into a browser. This list is compiled by Google and is utilised by Chrome, Firefox and Safari. These sites do not depend on the issuing of the HSTS response header to enforce the policy, instead the browser is already aware that the host requires the use of SSL/TLS before any connection or communication even takes place.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The ‘preloading’ part here is a way for site administrators to tell the vendors in advance that their site is on &lt;code&gt;https&lt;/code&gt; only. This way browsers can skip trying downgraded requests over insecure http altogether.&lt;/p&gt;

&lt;h3&gt;HSTS directive for Nginx&lt;/h3&gt;

&lt;p&gt;Now we use the old boy &lt;a href="https://capistranorb.com/" rel="nofollow"&gt;Capistrano&lt;/a&gt; for automatic deployments of Bubblin and serve books  over https only, so configuring &lt;code&gt;nginx&lt;/code&gt; over to strict &lt;code&gt;https&lt;/code&gt; with preloads was super easy. I edited the template picked up by the &lt;a href="https://github.com/treenewbee/capistrano3-nginx" rel="nofollow"&gt;capistrano3-nginx&lt;/a&gt; gem for http --&amp;gt; https redirection and added the following directive at the end of the file to what is now our &lt;a href="https://gist.github.com/marvindanig/0bdd7d8768cbf5eab2fc4782803df87d"&gt;latest nginx config template&lt;/a&gt;. &lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;
&lt;span class="c1"&gt;# Path to ./config/deploy/templates/nginx_conf.erb on your rails app&lt;/span&gt;
&lt;span class="c1"&gt;# Jump over to the last line!&lt;/span&gt;
&lt;span class="err"&gt;…&lt;/span&gt; 

&lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;listen&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;&lt;span class="mi"&gt;80&lt;/span&gt; &lt;span class="n"&gt;ipv6only&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;on&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="n"&gt;server_name&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;%= fetch(:nginx_server_name) %&amp;gt; www.&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:nginx_server_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;rewrite&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="p"&gt;(.&lt;/span&gt;&lt;span class="nf"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="ss"&gt;:/&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="vg"&gt;$host$1$request_uri&lt;/span&gt; &lt;span class="n"&gt;permanent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="n"&gt;ssl&lt;/span&gt; &lt;span class="n"&gt;http2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;listen&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;&lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="n"&gt;ssl&lt;/span&gt; &lt;span class="n"&gt;http2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  
  &lt;span class="n"&gt;server_name&lt;/span&gt; &lt;span class="n"&gt;www&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;&amp;lt;&lt;/span&gt;&lt;span class="o"&gt;%=&lt;/span&gt; &lt;span class="n"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:nginx_server_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


  &lt;span class="c1"&gt;# Redirection from http --&amp;gt; https is mandatory.&lt;/span&gt;
  &lt;span class="n"&gt;rewrite&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="ss"&gt;:/&lt;/span&gt;&lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;%= fetch(:nginx_server_name) %&amp;gt;$request_uri permanent; 

}

server {
  server_name &amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:nginx_server_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;%= current_path %&amp;gt;/public;
  try_files $uri/index.html $uri @puma_&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:nginx_config_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="err"&gt;…&lt;/span&gt;
  &lt;span class="err"&gt;…&lt;/span&gt;

  &lt;span class="c1"&gt;# Plenty of nginx configuration here.&lt;/span&gt;

  &lt;span class="c1"&gt;# SSL is mandatory for HSTS. We're using &lt;/span&gt;
  &lt;span class="c1"&gt;# Certbot to manage Letsencrypt for us.&lt;/span&gt;

  &lt;span class="n"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="n"&gt;ssl&lt;/span&gt; &lt;span class="n"&gt;http2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;# managed by Certbot&lt;/span&gt;
  &lt;span class="n"&gt;listen&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;&lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="n"&gt;ssl&lt;/span&gt; &lt;span class="n"&gt;http2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;



  &lt;span class="c1"&gt;# Add HSTS header with preload. This is the line that does it.&lt;/span&gt;
  &lt;span class="n"&gt;add_header&lt;/span&gt; &lt;span class="no"&gt;Strict&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;Transport&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;Security&lt;/span&gt; &lt;span class="s2"&gt;"max-age=31536000; includeSubDomains; preload"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The HSTS directive &lt;code&gt;add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";&lt;/code&gt; at the bottom does it and tells the user's browser to always use &lt;code&gt;https&lt;/code&gt; for your site. &lt;/p&gt;

&lt;p&gt;Commit the changes and then re-deploy ($ cap production deploy). Now head over to &lt;a href="https://hstspreload.org" rel="nofollow"&gt;hstspreload.org&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;This is where we submit our site for inclusion in Chrome's HTTP Strict Transport Security (HSTS) &lt;em&gt;preload list&lt;/em&gt;. The list of sites that are hardcoded into Chrome as being &lt;code&gt;https&lt;/code&gt; only. Most major browsers like Firefox, Opera, Safari, IE 11 and Edge also have HSTS preload lists based on the list compiled by Chrome. In order to be accepted to and remain on the HSTS preload list through this form, your site must satisfy the following set of requirements perpetually:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Serve a valid certificate.
2. Redirect from HTTP to HTTPS on the same host, if you are listening on port 80.
3. Serve all subdomains over HTTPS.
    In particular, you must support HTTPS for the www subdomain if a DNS record for that subdomain exists.
4. Serve an HSTS header on the base domain for HTTPS requests:
    i. The max-age must be at least 31536000 seconds (1 year).
    ii. The includeSubDomains directive must be specified.
    iii. The preload directive must be specified.
    iv. If you are serving an additional redirect from your HTTPS site, that redirect must still have the HSTS header (rather than the page it redirects to).
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It should also be noted here that hardcoding HSTS preloading into browsers doesn't automatically mean that all aspects of security have been taken care of. It surely helps with security and plus there is a small improvement in speed and performance of your web-server because it no longer has to determine and switch between secure and insecure protocols.&lt;/p&gt;

&lt;p&gt;That's all there is to it with HSTS folks. ❤️&lt;/p&gt;




&lt;p&gt;I'm Sonica Arora, CTO of Bubblin Superbooks and you can follow me here on &lt;a href="https://twitter.com/marvindanig"&gt;Twitter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;P.S.:&lt;/strong&gt; Did you know that &lt;a href="https://bubblin.io"&gt;Bubblin&lt;/a&gt; is a cool new way to read books on your iPad?&lt;/p&gt;


</description>
      <category>devops</category>
      <category>security</category>
      <category>browsers</category>
      <category>https</category>
    </item>
    <item>
      <title>We got our green cards and here is our startup!</title>
      <dc:creator>Sonica Arora</dc:creator>
      <pubDate>Thu, 30 Aug 2018 12:31:11 +0000</pubDate>
      <link>https://dev.to/sonica/we-got-our-green-cards-and-here-is-our-startup-2488</link>
      <guid>https://dev.to/sonica/we-got-our-green-cards-and-here-is-our-startup-2488</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TLDR; Meet ✨Bubblin Superbooks–A modern book reader for web.✨ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;[…a huge yay!, a thousand 🎉🎉🎉s pop, and the 🍾🍾🍾 flows and a million 🎊 🎊 🎊 fall to the ground…]&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hello! &lt;/p&gt;

&lt;p&gt;It feels awesome to finally be able to say this (after five years of wait):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We have a startup! 😇&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Meet &lt;a href="https://bubblin.io"&gt;Bubblin Superbooks&lt;/a&gt; - a fun little project that my husband and I have built using Ruby on Rails, Postgres and JavaScript (Node). &lt;strong&gt;Bubblin&lt;/strong&gt; is &lt;em&gt;tablet first&lt;/em&gt;, so please pick up your iPad and flip open a book to start reading. &lt;/p&gt;

&lt;p&gt;A little backstory. We always thought that if books are not files, why should e-books be?! To escape this notion of a file masquerading as an e-book (sic), we created Bubblin Superbooks and gave free and beautiful books a new home on web.&lt;/p&gt;

&lt;p&gt;On Bubblin, you can heart books that you like or share them with your friends. Or you can simply hangout with other book lovers and be a part of a quiet, calm and level-headed community.&lt;/p&gt;

&lt;p&gt;Since Bubblin is all about reading longform, we wanted the books to go &lt;em&gt;offline-first&lt;/em&gt;. How couldn't we?! &lt;/p&gt;

&lt;p&gt;We use a simple &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"&gt;Service Worker&lt;/a&gt; instance under each book and introduce &lt;strong&gt;offline book reading on web&lt;/strong&gt;, thus making it a very close to experience of reading real books offline. While Bubblin has been designed for a power tablet user on mind, it works just as good on desktops and mobile. It scales perfectly even on Apple Watch and an LCD TV.&lt;/p&gt;

&lt;p&gt;Bubblin makes books enjoyable like never before, without ever needing us to leave the one place that we have come to love so much—the web! And, without felling a single happy tree! 🌱:)&lt;/p&gt;

&lt;p&gt;For books we're relying on the awesome Gutenberg classics along with a &lt;a href="https://bubblin.io/cover/let-s-learn-es6-by-ryan-christiani"&gt;few&lt;/a&gt;+&lt;a href="https://bubblin.io/cover/ladakh-by-satie-sharma"&gt;new&lt;/a&gt;+&lt;a href="https://bubblin.io/michaeljsullivan-michael-j-sullivan"&gt;titles&lt;/a&gt; contributed by the awesome community of writers. There's an OSS writer's &lt;a href="https://bubblin.io/tools"&gt;tool&lt;/a&gt; in the works so hit me up if you wish it give its prerelease a go!&lt;/p&gt;

&lt;p&gt;Now there's a lot going on with this little project of ours, and not everything is cool or even easy to reason about at the moment. But I'm sure that some of you’ll like it and share a word about us with your friends.&lt;/p&gt;

&lt;p&gt;Good or bad, we are eager to hear your thoughts and feedback in the comments below. &lt;/p&gt;




&lt;p&gt;An alternate version of this article appeared on &lt;a href="https://bubblin.io/blog/announcement"&gt;The Bubblin Blog&lt;/a&gt;. &lt;/p&gt;

</description>
      <category>showdev</category>
      <category>books</category>
      <category>web</category>
    </item>
  </channel>
</rss>
