🔒

Installing Self-Signed SSL Certificate on Ubuntu

Aug 30, 2024

Lecture Notes: Installing a Self-Signed SSL Certificate on Ubuntu 18.04

Introduction to SSL

  • SSL (Secure Sockets Layer): Protocol for secure and encrypted transactions between browser and websites.
  • Function: Generates a certificate for authentication.

Pre-requisites

  • LAMP Setup: Required on your system.
  • OpenSSL Package: Must be installed (use command openssl).

Steps to Install Self-Signed SSL Certificate

Creating a Self-Signed SSL Certificate

  • Command: Use openssl
    • Specify protocol as x509 for self-signing.
    • Use -nodes to skip passphrase option for Apache access.
    • Set expiry with -days 365.
    • Create new key with RSA algorithm (2048 bits).
    • Specify -keyout for private key file destination.
    • Specify -out for certificate file destination.

Creating Directory and Index File

  • New Directory: Create inside HTML directory.
  • Index File: Create within the new directory, add content, save, and exit.

Configuring Virtual Host

  • Configuration File: Create mine-ssl.conf for virtual host.
    • Mention port number for HTTPS.
    • Enable SSL engine.
    • Provide certificate and private key paths.
    • Specify server name and document root.
  • Save and Exit: From the configuration file.

Enabling Site Access and SSL Module

  • Enable Site: For new virtual host configuration.
  • Disable Default Site: Access using command line.
  • Enable SSL Module: Required for SSL operation.
  • Restart Apache Service: Use command line.

Verification

  • Open Browser: Input URL with domain or local IP.
  • Handle Security Warning:
    • Click 'Advanced'.
    • Add and confirm security exception.
  • Result: Secured access with HTTPS.

Conclusion

  • Summary: Steps to create and configure a self-signed SSL certificate on Ubuntu 18.04.
  • Further Resources: