• Wed. May 8th, 2024

Tony's Bit

Software Development, Cloud Computing, Blockchain Technology and Finance.

Deploying a SSL Protected Containerized App: Part 2

ByTony Nguyen

Mar 9, 2018

Checklist

Let’s quickly do a checklist of what we have so far

  1. SSH Accessible Virtual Machine (Running Centos 7.4)
  2. Ports 22, 443, 80 are open on the virtual machine
  3. Domain pointed at the public IP of the Virtual machine

If you have not done these things, you can deploy your virtual machine following the steps in part 1.

Preparing the Host

Start this part by initializing a SSH session into the virtual machine.

Swap to the root user by running

su root

Installing Docker

Install docker

On the virtual machine that you have deployed run the following commands:

sudo yum install -y yum-utils  device-mapper-persistent-data  lvm2

​​​​​​sudo yum-config-manager    --add-repo https://download.docker.com/linux/centos/docker-ce.repo

sudo yum install docker-ce

Note: These are the quick commands to install docker, for more information as to what they do exactly visit the docs.

Downloading CertBot

Certbot is a nifty client that will fetch SSL/TLS certificates and is used as the client for Let’s Encrypt.

Download Cert Bot

Pre-requisites:

yum -y install yum-utils
yum install epel-release

Run installation:

sudo yum install certbot

Note: These are the quick commands to install certbot, for more information as to what they do exactly visit the docs.

Generating a SSL Certificate

On the virtual machine that you have deployed run the following commands:

When running certbot to obtain a SSL certificate, too many attempts will result in a lockout of the domain of up to a hour. To prevent a lockout we will be testing the creation of the certificate with a –staging command.

sudo certbot certonly --staging

Run through the prompts and at the very end enter your domain address (domain.com.au).

The successful output is shown below

92f0915b-1ae6-4894-b127-899415893848

Once you can confirm that a staging certificate can be generated, run the process again without the --staging tag.

Once you have completed the deployment of a production ready SSL certificate, you can now move on to part 3.