Start interactive tutorial

← Back to Projects

Configuring a Secure Server with SSL/TLS Using OpenSSL

Difficulty

  • intermediate

Average duration

2 hrs

Technologies

Difficulty

  • intermediate

Average duration

2 hrs

🌱 How to start this project?
  • Requirements

🌱 How to start this project?

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

Requirements

  • A Debian virtual machine installed in VirtualBox. (we will use the previously configured machine in previous classes).

📝 Instructions

  • Open this URL and fork the repository https://github.com/breatheco-de/set-up-an-SSL-in-openSSL-with-a-secure-server

fork button

A new repository will be created in your account.

  • Clone the newly created repository into your localhost computer.
  • Once you have cloned successfully, follow the steps below carefully, one by one.

Step 1: Generate a Private Key and a Certificate Signing Request (CSR):

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.

Step 2: Sign the CSR to Obtain a Self-Signed Certificate:

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.

Step 3: Configure Apache to Use the SSL 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.

Step 4: Enable the SSL Site and SSL Module:

Step 5: Update the Hosts File:

Step 6: Test the Connection:

my-domain.com

💡 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.

🚛 How to submit this project?

We have developed a script to help you measure your success during this project.

Signup and get access to this project for free

We will use it to give you access to your account.
Already have an account? Login here.

By signing up, you agree to the Terms and conditions and Privacy policy.

Difficulty

  • intermediate

Average duration

2 hrs

Difficulty

  • intermediate

Average duration

2 hrs

Difficulty

  • intermediate

Average duration

2 hrs

Difficulty

  • intermediate

Average duration

2 hrs

Signup and get access to this project for free

We will use it to give you access to your account.
Already have an account? Login here.

By signing up, you agree to the Terms and conditions and Privacy policy.

Difficulty

  • intermediate

Average duration

2 hrs

Difficulty

  • intermediate

Average duration

2 hrs