Self-Signed SSL/TLS with Subject Alternative Names for Local Networks
#What You'll Learn
This guide covers creating self-signed SSL certificates with Subject Alternative Names (SAN) for secure HTTPS communication on your local network. Perfect for homelab environments, development servers, and internal infrastructure.
Generate Certificate
Configure SSL
Trust Certificate
cerberus-ai.local) without certificate warnings.
#Generate SSL Certificate on Server
#1.1 Create Certificate Directory
#1.2 Create OpenSSL Configuration with SAN
Create a configuration file that includes Subject Alternative Names:
cerberus-ai.local with your hostname and 192.168.1.32 with your server's IP.
#1.3 Generate Private Key and Certificate
#1.4 Verify Certificate
#1.5 Set Proper Permissions
#Configure Apache for SSL
#2.1 Enable SSL Module
#2.2 Edit SSL Virtual Host Configuration
Add/modify these lines inside the <VirtualHost *:443> section:
#2.3 Complete Configuration Example
#2.4 Enable SSL Site and Restart Apache
#Install Certificate on Ubuntu Client
#3.1 Copy Certificate from Server
On your client machine, copy the certificate:
#3.2 Install to System Trust Store
Updating certificates in /etc/ssl/certs...
1 added, 0 removed; done.
#3.3 Verify Installation
- curl
- wget
- Python requests library
- Chrome/Chromium
- Most command-line tools
#Browser-Specific Configuration
#4.1 Firefox (Uses Own Certificate Store)
Firefox doesn't use the system certificate store, so you need to import manually:
- Open Firefox
- Go to Settings โ Privacy & Security
- Scroll to Certificates โ Click View Certificates
- Go to Authorities tab
- Click Import
- Select
~/cerberus-ai.local.crt - Check "Trust this CA to identify websites"
- Click OK
#4.2 Chrome/Chromium
Chrome uses the system certificate store on Linux, so it should work automatically after step 3.2.
- Restart Chrome completely
- Clear Chrome's SSL state:
chrome://settings/securityโ Clear browsing data โ Cached images and files
#4.3 Testing Browser Access
#Optional: HTTP to HTTPS Redirect
#5.1 Enable Rewrite Module
#5.2 Configure Redirect
Edit your default site configuration:
Add inside the <VirtualHost *:80> section:
#5.3 Restart Apache
http://cerberus-ai.local will automatically redirect to https://cerberus-ai.local
#Troubleshooting
#6.1 Certificate Not Trusted
#6.2 Apache Won't Start
#6.3 Browser Still Shows Warning
- Clear browser cache and SSL state
- Completely close and restart browser
- Check certificate expiry:
sudo openssl x509 -in /etc/ssl/cerberus/cerberus-ai.local.crt -noout -dates - Verify SAN includes the hostname you're accessing
#6.4 Connection Refused
#๐ Congratulations! SSL/TLS is Now Configured
What you've achieved:
- Self-signed SSL certificate with SAN support
- Secure HTTPS access on your local network
- No browser certificate warnings
- Support for multiple hostnames and IP addresses
- System-wide trust configuration
#Advanced Tips
#Adding More Devices to Trust Store
To add the certificate to other Ubuntu machines on your network:
#Certificate Renewal
Self-signed certificates last 10 years (3650 days). When it expires:
#Using Custom CA for Multiple Servers
For advanced setups with multiple servers, create your own Certificate Authority:
- Generate a CA certificate once
- Sign individual server certificates with your CA
- Install only the CA certificate on clients
- All servers signed by your CA will be trusted
#Security Best Practices
- Keep private keys secure: Never share
.keyfiles - Use strong key sizes: 2048 bits minimum (4096 for higher security)
- Restrict key permissions:
chmod 600on private keys - Regular rotation: Consider rotating certificates annually
- Monitor expiry: Set reminders before certificates expire