Creating and Applying SSL Certificate to Apache HTTPD
#Certificates #SSL #ApacheHTTPD
Full steps can be found at https://i12bretro.github.io/tutorials/0007.html
This is part four of a series of creating your own self-signed PKI and some ways to utilize the PKI to setup SSL for your web server or create your own OpenVPN server.
Disclaimer: I am not a security expert. This is just the easiest way I have found to create and utilize SSL for my homelab services.
--------------------------------------------------------------------
Prerequisites
--------------------------------------------------------------------
- A XCA PKI database https://youtu.be/ezzj3x207lQ
--------------------------------------------------------------------
Create Your SSL Certificate
--------------------------------------------------------------------
01. Launch XCA
02. Open the PKI database if it is not already (File ≫ Open DataBase), enter password
03. Click on the Certificates tab, right click on your Intermediate CA certificate
04. Select New
05. On the Source tab, make sure Use this Certificate for signing is selected
06. Verify your Intermediate CA certificate is selected from the drop down
07. Click the Subject tab
08. Complete the Distinguished Name section
internalName: WebDev SSL
countryName: US
stateOrProvinceName: Virginia
localityName: Northern
organizationName: i12bretro
organizationUnitName: i12bretro Certificate Authority
commonName: webdev.i12bretro.local
09. Click the Generate a New Key button
10. Enter a name and set the key size to at least 2048
11. Click Create
12. Click on the Extensions tab
13. Select End Entity from the type list
14. Click Edit next to Subject Alternative Name
15. Add any DNS or IP addresses that the certificate will identify
16. Update the validity dates to fit your needs
17. Click the Key Usage tab
18. Under Key Usage select Digital Signature, Key Encipherment
19. Under Extended Key Usage select Web Server and Web Client Authentication
20. Click the Netscape tab
21. Select SSL Server
22. Click OK to create the certificate
--------------------------------------------------------------------
Exporting Required Files
--------------------------------------------------------------------
01. In XCA, click on the Certificates tab
02. Right click the Intermediate CA certificate ≫ Export ≫ File
03. Set the file name with a .crt extension and verify the export format is PEM chain (*.pem)
04. Click OK
05. Right click the SSL certificate ≫ Export ≫ File
06. Set the file name with a .crt extension and verify the export format is PEM (*.crt)
07. Click OK
08. Click the Private Keys tab
09. Right click the private key generated for the SSL certificate ≫ Export ≫ File
10. Set the file name with a .key extension and verify the export format is PEM private (*.pem)
11. Click OK
--------------------------------------------------------------------
Setting Up Apache For SSL
--------------------------------------------------------------------
01. Navigate to /conf
02. Create a certs directory if it does not exist
03. Copy the exported SSL certificate, private key and certificate chain files to /conf/certs
04. Edit /conf/httpd.conf
05. At the bottom of the file add a VirtualHost block
Listen 443
≪virtualhost :443≫
SSLEngine on
SSLProtocol -All +TLSv1.2 +TLSv1.3
SSLCipherSuite HIGH:!aNULL:!MD5
SSLCertificateFile /conf/certs/%ssl.crt file%
SSLCertificateKeyFile /conf/certs/%ssl.key file%
SSLCertificateChainFile /conf/certs/%ssl-chain.crt file%
≪/virtualhost≫
06. Restart the Apache Service
07. Open a web browser
08. Navigate to https://DNSorIP from your certificate
09. Click the lock and select view certificate
10. Validate the certificate and certificate chain being presented by Apache HTTPD
### Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro