06 - Apache with TLS

Encryption Methods and Algorithms

HTTPS and SSL/TLS

HTTPS uses public-key encryption to verify the identity of the server, and to exchange a shared key, and then switches to using symmetric encryption for communication using that shared key. The reason for using two different algorithms is that RSA encryption keys are large and computationally more expensive, while symmetric keys are smaller and faster to compute.
When you are configuring an HTTPS site, you will need to:

The SSL Handshake

SSL/TLS protocols:

Please note that currently, the minimum acceptable protocol is TLS 1.2 for backward compatibility, while TLS 1.3 is recommended. For most modern applications and clients, you may disable other protocols or use TLS 1.3 exclusively. Additionally, disabling the less secure and older protocols reduces the attack surface; for example, it will prevent protocol downgrade attacks.

Protocol Published Status
SSL 1.0 Unpublished Unpublished
SSL 2.0 1995 Deprecated in 2011
SSL 3.0 1996 Deprecated in 2015
TLS 1.0 1999 Deprecated in 2021
TLS 1.1 2006 Deprecated in 2021
TLS 1.2 2008 In use since 2008
TLS 1.3 2018 In use since 2018 (Latest)

PKI and SSL Certificates

Terminology

The Chain of Trust

There are many CAs and many more RAs. You could imagine that if every system is required to have all the CA certificates in order to be able to establish trust, it can lead to scalability problems. Chain of Trust is a security model which is used to enable scalability and ease of management. It creates a hierarchy of trust, from the root certificates down to the end-entity certificate. In short, your system can trust an entity because your system trusts the Root CA, and the Root CA trusts the RA/CA, which trusts the entity.

d35f8dfa4e75f67b1e53f1a195880cd2.png

Certification Process

The role of CA/RA is to verify the identity of the requester and digitally sign the Public keys and publish the certificates. A certificate is signed using the CA’s private key. The verification of the identity of the requester is achieved either via software or under human supervision. SSL certificates can be issued with different levels of assurance; some require more extensive vetting, and costs are associated with the process.

Steps to get your SSL certificate signed:

Types of SSL certificates

There are several different. One certificate can apply to a single website or several websites, depending on the type:

SSL certificates also come with different validation levels. A validation level is like a background check, and the level changes depending on the thoroughness of the check (provided at a different cost).

Please note that there are other types of certificates issued by trusted CAs that are not in scope for discussion here. An example is "Code Signing Certificates," which requires OV or EV level verification for developers to be able to publish software for Microsoft and Apple platforms.

Tools and Utilities

OpenSSL (Wikipedia Article)

OpenSSL is a CLI tool and libraries for all SSL activities. These tools and libraries are available for a variety of operating systems, including Linux, Unix, and Windows. It can generate keys, create a CA, generate a CSR, and sign certificates. It is also used for examining certificate files for troubleshooting or manual verification. All major operating systems and many services rely on OpenSSL. OpenSSL supports almost all new and old algorithms and processes; the code base has grown to be complex, with many options to choose from in the utilities.

OpenSSL has faced challenges in the past. Despite the project being used by many major tech companies and the internet at large, the open-source project was not adequately supported. In the past, the development and maintenance of OpenSSL was mostly done by volunteers and only two full-time employees. This led to a number of bugs and vulnerabilities over the years, and the code audits were not positive. OpenSSL is currently well supported and well founded, and the software is well maintained.

One of the biggest criticisms of OpenSSL is the sheer number of available options, which can lead to confusion and misconfigurations (see If OpenSSL were a GUI and the following image).
c82508c1a73d86259fcf2d13ceabc918.png

The extensive coverage of OpenSSL has led to other alternative SSL library implementations. The alternatives seek to reduce exposure by removing outdated or unused options and functions, and limiting algorithms to secure or modern ones. Some of these alternative implementations are open, while others are proprietary. Some examples of such efforts (with varying degrees of popularity and success) include:

Easy-RSA

Easy-RSA is a set of scripts developed by the creators of OpenVPN to simplify SSL operations. You may use OpenSSL utilities and libraries using the complex commands and options available, but using Easy-RSA will reduce the steps substantially.

Using SSL in Apache2

In the Apache2 HTTP server, an SSL module is already provided. Enable the module using a2enmod ssl, and modify the site configuration file to enable HTTPS. The most basic configurations are: