How To Create Internal Ssl Certificate For Pfsense Firewall

7 min read Oct 04, 2024
How To Create Internal Ssl Certificate For Pfsense Firewall

How to Create Internal SSL Certificates for pfSense Firewall

pfSense is a powerful open-source firewall that offers a wide range of features, including the ability to create and manage SSL certificates. This is crucial for securing web servers, email servers, and other services running within your network. While you can use publicly trusted certificates from Certificate Authorities (CAs) for external facing services, generating internal SSL certificates for internal network communication is a cost-effective and efficient solution.

Why Use Internal SSL Certificates?

Internal SSL certificates offer several advantages, especially for internal network communication:

  • Enhanced Security: Internal SSL certificates encrypt communication between servers and clients within your network, safeguarding sensitive data from potential eavesdropping.
  • Improved Trust: Using internal SSL certificates establishes trust between internal services, improving security and reliability.
  • Cost Savings: Generating and using your own certificates eliminates the cost associated with purchasing certificates from CAs.
  • Control and Flexibility: You have complete control over the certificate creation process, including its validity period, the domains it covers, and the private key.

Creating Internal SSL Certificates in pfSense

Here's a step-by-step guide to creating internal SSL certificates using pfSense:

  1. Navigate to the Certificates Menu: In your pfSense web interface, go to System > Certificates.
  2. Create a Certificate Authority (CA):
    • Click the Add button and select CA.
    • Name: Choose a descriptive name for your CA.
    • Type: Select Internal.
    • Country: Select the appropriate country code.
    • State/Province: Enter your state or province.
    • Locality/City: Enter the city.
    • Organization: Enter your organization name.
    • Organizational Unit: Enter your organizational unit.
    • Common Name: Enter a descriptive name for your CA (e.g., "Internal CA").
    • Email Address: Enter an email address for your CA.
    • Validity Period: Set the validity period for your CA.
    • Key Length: Choose a strong key length (e.g., 2048 bits).
    • Digest Algorithm: Select SHA256.
    • Sign Algorithm: Select RSA.
    • Certificate Signing Request (CSR) Options: Leave the default settings unless you have specific requirements.
    • Advanced Options: Leave the default settings unless you have specific requirements.
  3. Generate the CA: Click the Save button. This will generate your CA certificate.
  4. Create a Server Certificate:
    • Click the Add button and select Server.
    • Name: Choose a descriptive name for your server certificate.
    • Type: Select Server.
    • Country: Select the appropriate country code.
    • State/Province: Enter your state or province.
    • Locality/City: Enter the city.
    • Organization: Enter your organization name.
    • Organizational Unit: Enter your organizational unit.
    • Common Name: Enter the fully qualified domain name (FQDN) of the server for which you're generating the certificate (e.g., "internal-webserver.example.com").
    • Email Address: Enter an email address associated with the server.
    • Validity Period: Set the validity period for the certificate.
    • Key Length: Choose a strong key length (e.g., 2048 bits).
    • Digest Algorithm: Select SHA256.
    • Sign Algorithm: Select RSA.
    • Certificate Signing Request (CSR) Options: Leave the default settings unless you have specific requirements.
    • Advanced Options: Leave the default settings unless you have specific requirements.
  5. Sign the Server Certificate:
    • Click Save.
    • Select the CA you created earlier.
    • Click Sign to sign the server certificate.

Important: Keep your private key secure! It's essential for decrypting the SSL connection.

Importing and Using the Internal SSL Certificates

Once you've created your internal SSL certificates, you can import them into your services (web servers, mail servers, etc.). The specific method for importing the certificates depends on the application or service. You will typically need to:

  • Import the Server Certificate: This is the certificate that will be presented to clients connecting to your service.
  • Import the CA Certificate: This certificate is used to validate the server certificate.

Example:

To configure Apache web server to use the internal SSL certificates:

  1. Copy the server certificate and CA certificate files from pfSense to your web server.
  2. Edit the Apache configuration file (usually /etc/apache2/sites-available/your-site.conf):
    
        ServerName your-server.example.com
        DocumentRoot /var/www/your-site
        SSLEngine on
        SSLCertificateFile /etc/ssl/certs/your-server.crt
        SSLCertificateKeyFile /etc/ssl/private/your-server.key
        SSLCACertificateFile /etc/ssl/certs/your-ca.crt
    
    
  3. Restart Apache:
    sudo systemctl restart apache2
    

Conclusion

Creating and managing your own internal SSL certificates provides a cost-effective and secure way to protect communication within your network. With pfSense's user-friendly interface, the process is relatively simple. By following these steps, you can enhance your internal network's security and establish trust between services within your organization.