Featured resource
Forrester Wave Report 2025
Pluralsight named a Leader in the Forrester Wave™

Our tech skill development platform earned the highest scores possible across 11 criteria.

Learn more
  • Labs icon Lab
  • Cloud
  • Security
Google Cloud Platform icon
Labs

Working with OpenSSL and Httpd

Approximately 25% of the LPIC-3 Security exam is based on cryptography and how to employ it in Linux. In this hands-on lab, we will learn how to generate a signed certificate using `openssl` and use that certificate to secure HTTP traffic. We will then use the `openssl` command to verify the Apache configuration.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Advanced
Duration
Clock icon 1h 0m
Published
Clock icon Nov 05, 2018

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Install `mod_ssl` on the host `webserver`.

    Run yum install mod_ssl, and accept the prompts.

  2. Challenge

    Generate and sign the private key for `shop.example.com` using `openssl`.

    1. Create a new encrypted private key.
    openssl genrsa -aes128 -out /etc/pki/tls/private/httpdkey.pem
    
    1. Enter httpd at the passphrase prompt.
    2. Generate a self-signed certificate using the key.
    openssl req -new -x509 -key /etc/pki/tls/private/httpdkey.pem -out /etc/pki/tls/certs/httpdcert.pem -days 365
    
    1. Enter httpd at the passphrase prompt.
    2. At the prompts, enter the field information provided in the instructions (use defaults where not specified).
  3. Challenge

    Update the default Apache virtual host to accept connections on `shop.example.com` using the new keypair, and allow HTTPS traffic through the firewall.

    1. Make the following changes to /etc/httpd/conf.d/ssl.conf:

      • At the end of the <VirtualHost _default_:443> section, add the following on a new line:
        • ServerName shop.example.com:443
      • Locate the line SSLCertificateFile /etc/pki/tls/certs/localhost.crt, and change it to the following:
        • SSLCertificateFile /etc/pki/tls/certs/httpdcert.pem
      • Locate the line SSLCertificateKeyFile /etc/pki/tls/private/localhost.key, and change it to the following:
        • SSLCertificateKeyFile /etc/pki/tls/private/httpdkey.pem
    2. Restart httpd to put the changes into effect.

    systemctl restart httpd
    
    1. Enter httpd at the passphrase prompt.
    2. Open port 443 on the OS firewall.
    sudo firewall-cmd --add-service=https --permanent 
    sudo firewall-cmd --reload
    
  4. Challenge

    Verify the configuration with `openssl` from the host `workstation`.

    1. On the workstation machine, run the following command:
    openssl s_client -connect shop.example.com:443 > /home/cloud_user/httpd_output
    
    **Note:** The OpenSSL `s_client` will briefly wait for input before terminating the connection. You may either interrupt the running command or let it close automatically. No further input is required.
    

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.