A lot of times during development I need to make a “box” accessible to the internet using SSL (HTTPS).

In order to use SSL you need a certificate. The free option to get a certificate is to use let’s encrypt. In order to get a certificate using let’s encrypt you need a DNS pointing at your server.

xip.io allows you to have a hostname that can be resolved to your ip without any configuration. All that you need is for the server to have a public ip.

With let’s encrypt and xip.io, you have all that you will need to get a SSL for a developer server entirely free!

How to make it better we can get one using docker! 🙂

Before you start, make sure port 80 of your host is accessible from the internet (e.g. if using aws ec2 that the security group allows inbound connections to port 80 from 0.0.0.0/0). Also make sure that you don’t have any other application running on port 80.

You can get it done two ways:

With Cerbot installed on the host

Install certbot:

sudo apt-get update
sudo apt-get install certbot

Get the certificate

sudo certbot certonly --standalone -n $(wget -qO - http://ipecho.net/plain).xip.io

Using docker

Assuming you have already docker installed on the host, create a folder to keep the keys generated:

mkdir letsencrypt

Get the keys:

sudo docker run -p 80:80 -v $(pwd)/letsencrypt:/etc/letsencrypt -it certbot/certbot \
certonly --standalone \
-d $(wget -qO - http://ipecho.net/plain).xip.io

You will find the keys under ./letsencrypt/live/…

…and just in case

  • Keep in mind that the certificate (keys) will expire after 90 days (you can renew them by repeating the process)
  • If your host IP Address changes you need to start over…
  • Since you don’t own or can control the DNS (hostname), how people will get to this server is completely out of your control – you don’t have any control to make the “public address” of your server point anywhere other than the IP address on it.


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *