This exercise aims to teach students how to set up a secure server using OpenSSL to provide secure communications via SSL/TLS.

A new repository will be created in your account.
In an HTTPS connection, the web server needs to prove its identity and encrypt the communication. For this, a digital certificate is used, which contains a public key; this public key is useless without its corresponding private key. The private key is a secret file that allows encrypting and decrypting data. Now, we will generate a private key using OpenSSL, a command-line tool for creating and managing certificates and cryptography.
Now we need to make a Certificate Signing Request (CSR). This is a file that contains the public key you want to certify and information about your organization or server (country, city, name, domain, email, etc.).
This file is usually sent to a Certificate Authority (CA), such as Let's Encrypt or DigiCert, to issue a valid digital certificate. In our lab, we will not send it to a CA, but we will sign it ourselves (self-signed). However, the process is the same.
Once we have the .csr file (the certificate request), we need to sign it to generate the final .crt certificate. In a real environment, this step would be done by a Certificate Authority (CA), which would verify your identity and sign the CSR to issue a trusted certificate.
Now that we have the certificate (myserver.crt) and the private key (myserver.key), we need to tell Apache to use them when serving content over HTTPS.

💡 NOTE: For the purposes of this educational exercise, while using localhost with HTTPS (https://localhost/) is sufficient to demonstrate the basic setup of SSL/TLS using OpenSSL, including the configuration of a custom domain like my-domain.com provides a more comprehensive and practical learning experience. This additional step allows understanding how DNS resolution works in a real environment. When generating the SSL/TLS certificate, it is crucial that the domain name (Common Name) matches the domain used to access the server, thus avoiding errors and security warnings in browsers. This reinforces the understanding of essential concepts and enhances the practical skills needed to handle SSL/TLS configurations in a professional environment.
We have developed a script to help you measure your success during this project.