thorko . de
Linux / Unix systems administrator
Apache SSL howto
To create a self-signed CA certificate do
openssl genrsa -out ca.key 4096
openssl req -new -key ca.key -out ca.csr
openssl x509 -req -days 3650 -in ca.csr -signkey ca.key -out ca.crt
Create a self-signed webserver certificate
openssl genrsa -out webserver.key 4096
openssl req -new -key webserver.key -out webserver.csr
Sign your webserver certificate with your CA file
openssl x509 -req -days 365 -in webserver.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out webserver.crt
Update your apache configuration and restart apache afterwards
SSLEngine On
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
SSLCertificateFile /path/to/webserver.crt
SSLCertificateKeyFile /path/to/webserver.key
SSLCACertificateFile /path/to/ca.crt
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
Create a client certificate
Sometimes it is useful to authenticate to a webserver using a client certificate.
openssl genrsa -out client.key 4096
openssl req -new -key client.key -out client.csr
openssl x509 -req -days 365 -CA ca.crt -CAkey ca.key -CAcreateserial -in client.csr -out client.crt
Convert your certificate to PKCS12 to be able to import it to your browser.
openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.p12
Update your apache configuration and add the following lines where you want to have a client certificate authentication
<Location /cert>
SSLRequireSSL
SSLVerifyClient require
SSLVerifyDepth 10
</Location>
Revoke a client certificate
When you have to revoke a certificate because it got lost do
openssl ca -keyfile ca.key -cert ca.crt -revoke client.crt
openssl ca -gencrl -crldays 365 -keyfile ca.key -cert ca.crt -out cacrl.crl
Update your apache configuration and add the following two lines
SSLCARevocationFile /etc/apache2/ssl/crl/cacert.crl
SSLCARevocationPath /etc/apache2/ssl/crl/
restart apache. Every time you revoke a client certificate you will have to restart apache.
![]() | Download Zabbix Agent 1.8.10 - amd64 deb file Zabbix Server MySQL 1.8.10 - amd64 deb file Zabbix Frontend 1.8.10 - amd64 deb file Firefox 9.0.1 - x86_64 Thunderbird 9.0 - x86_64 LSI Util - manage LSI raid controller Nictool 2.0.8 Cisco VPN Client 4.9.01 for Mac |
![]() | Goodies Varnishd - Highly scalable web caching server CFengine - Configuration and installation automation of enterprise environments Open Benno - Another open source mail archive system (License: GPL). Lucene search engine, no database needed, mails stored in a directory structure |



