Thach Mai // TODO: a witty tagline

Hello WebAssembly

Why you should care about HTTPS and how to get it for free

Web browser makers are encouraging the use of HTTPS over traditional HTTP. Chrome only supports geolocatiozation and web RTC over HTTPS. Firefox, Chrome, MS Edge only supports HTTP 2.0 for secured sites.

Plain old HTTP is no longer good enough for them anymore. Why? To understand their motivations, we should take a look at the unsecured nature of the internet.

The network by itself is not secured

If I want to google something, behind the scene this is what happened:

[/home/thach] traceroute 
traceroute to (, 30 hops max, 60 byte packets
 1  livebox.home (  2.140 ms  3.921 ms  3.847 ms
 2 (  7.877 ms  8.927 ms  8.905 ms
 3 (  8.856 ms  8.807 ms  8.738 ms
 4 (  9.923 ms  9.884 ms  9.836 ms
 5 (  24.124 ms  25.413 ms  25.357 ms
 6 (  15.111 ms  10.417 ms  9.893 ms
 7 (  10.726 ms (  11.089 ms (  11.345 ms
 8 (  18.451 ms (  28.290 ms (  18.362 ms
 9 (  30.822 ms (  32.303 ms (  32.281 ms
10 (  30.685 ms (  28.956 ms (  28.825 ms
11 (  29.805 ms (  30.585 ms (  30.537 ms
12 (  28.796 ms  28.691 ms (  29.793 ms
13 (  29.899 ms  30.860 ms  30.797 ms

Visually, we can see it this way:

My network hops

Each hop that I have to go through can be a potential security risk. Let's take a look at two simple examples:


A malicious (or curious) person who can listen to traffic on your network can eavesdrop on your exchange with

Eavesdropping attack

If the traffic on the network is pure HTTP, an eavesdropper can:

  • Steals my account credentials through login forms.
  • Captures my cookie or token ID to impersonate me.
  • Stores sensitive information communicated over the network.

Man in the middle

A more sophisticated attacker can intercept your traffic and modifies the content before passing to the next hop. Anyone who control your network gateway or switch can be this "man in the middle":

Man in the middle attack

A man in the middle can do everything an eavesdropper can, and more:

  • Sends me to a different server than the one requested.
  • Modifies downloads to inject virus.

Can we secure the network somehow?

Unfortunately we don't know how to migitate much of the network risks, at least not for the internet. But we can use encryptions to render these attacks ineffective by using HTTPS.

HTTPS advantages

A website served over HTTPS can guarantee two things to the client:

  • Identity: it's really the web site requested by the client and not a fake.
  • Secrecy: the content exchanged between the client and the site can be understood only by the two parties and no one else.

How HTTPS works

How HTTPS works is rather elaborate; but for the purpose of our discussion we can simplify it as:

HTTPS handshake

Three things that you should remember:

  • The server must possess a public key that its annouces to connecting clients.
  • The server uses its secret private key to authenticate itself to the client.
  • The server key must be signed by a certificate authority to prove its validity.

To generate and sign the keys used to be somewhat costly and inconvenient. Fortunately, there is a recent player that seeks to disrupt the model: Letsencrypt.

A canadian non-profit organization; backed by some of the biggest players on the web.

Letsencrypt provides two things:

  • The ACME protocol to simplify key generation and renewal.
  • A public infrastructure to freely generate and renew keys.

Generate your first certificate

There are several ways you can generate certificates with Letsencrypt, here I'll walk through the webroot method:

TLS certificate generation

Basically, you need to prove to Letsencrypt that you control the domain by placing a file in the path: After validation, Letsencrypt will sign your certificate and you can use that certificate to turn on HTTPS.

Doing this is rather straight-forward using the official Letsencrypt client and the nginx web server:

1. Install the client

cd /opt
git clone

2. Prepare NGINX to serve the challenge

In your site's configuration:

server {
    listen 80;
    location /.well-known/acme-challenge {
        allow all;
        root /tmp/letsencrypt;

Reload the configuration file with nginx -s reload

3. Generate the certificate

/opt/certbot/letsencrypt-auto certonly --webroot --webroot-path /tmp/letsencrypt -d [email protected]

The generated certificate is stored at /etc/letsencrypt/live/

4. Turn on HTTPS

Modify the site's configuration to enable HTTPS using the generated certificate:

server {
  listen 80;
  listen 443 ssl;
  ssl_certificate /etc/letsencrypt/live/;
  ssl_certificate_key /etc/letsencrypt/live/;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;

5. Automatic renewal

Renewal is as simple as running /opt/certbot/letsencrypt-auto renew

Put it in a crontab to run every day/week and you're set.


Another simple option to provide HTTPS to your site is through Cloudfare CDN. This blog is hosted by Github page but served by Cloudfare; therefore I get HTTPS for free.

Setting up Cloudfare is very easy. You do have to surrender DNS control to Cloudfare though so it's certainly not everyone's cup of tea. Head over to their website if you're curious.

Functional Programming - A Sightseeing Tour

Functional Programming is a subject that I hold dear. In this short presentation at Human Talks Grenoble on 10/05/2016, I gave a brief overview of Functional Programming as well as a small demonstration of a functional program implemeted in Clojure.

The source code for the example can be found at:

Terraform and the Hashicorp ecosystem

Here's the presentation on Terraform and Hashicorp ecosystem:

Running MongoDB as a Docker container

Here's the presentation on Docker presented at the Grenoble Docker Meetup: