Securing Apache/mod_ssl with SSL/TLS on RHEL8
Request a new translation or translation update
A translation for your language preference does not exist. Click below to request a translation for your selected language.
Securing Apache (httpd-2.4.37), mod_ssl (mod_ssl-2.4.37) that uses openssl
This article is part of the Securing Applications Collection
Cryptography in RHEL8
RHEL8 has a new mechnism to centralise the cryptographic defaults for a machine.
This is handled by the crypto-policies package. Details of the rationale and update policy can be found in other documents
- Strong crypto defaults in RHEL-8 and deprecations of weak crypto algorithms
- System-wide crypto policies in RHEL 8
- The man page for the crypto-policies command.
Unless you have a very specific requirement for either restricting or relaxing the protocols or ciphers used by Apache the system-wide crypto policy is strongly recommended.
Configuration File
/etc/httpd/conf.d/ssl.conf
shortform using system-wide crypto policy
The only item that requires specific customisation is the location of a suitable certificate.
SSLCertificateKeyFile /etc/pki/tls/private/httpd.key
SSLCertificateFile /etc/pki/tls/certs/httpd.dh.crt
SSLCertificateChainFile /etc/pki/tls/certs/httpd-chain.crt
shortform for custom configuration
The equivalent of crypto-policy DEFAULT
SSLCertificateKeyFile /etc/pki/tls/private/httpd.key
SSLCertificateFile /etc/pki/tls/certs/httpd.dh.crt
SSLCertificateChainFile /etc/pki/tls/certs/httpd-chain.crt
SSLProtocol all -TLS1 -TLSv1.1
SSLCipherSuite @SECLEVEL=2:kEECDH:kRSA:kEDH:kPSK:kDHEPSK:kECDHEPSK:-aDSS:-3DES:!DES:!RC4:!RC2:!IDEA:-SEED:!eNULL:!aNULL:!MD5:-SHA384:-CAMELLIA:-ARIA:-AESCCM8
Protocols
SSLProtocol all -TLSv1 -TLSv1.1
Provides general compatibility.
Higher security, reduced compatibility protocols
SSLProtocol All -TLSv1 -TLSv1.1 -TLSv1.2Enable TLSv1.0 for obsolete Browser Compatibility
SSLProtocol all
Ciphers
SSLCipherSuite @SECLEVEL=2:kEECDH:kRSA:kEDH:kPSK:kDHEPSK:kECDHEPSK:-aDSS:-3DES:!DES:!RC4:!RC2:!IDEA:-SEED:!eNULL:!aNULL:!MD5:-SHA384:-CAMELLIA:-ARIA:-AESCCM8
Reasonable selection of strong ciphers
Higher security, reduced compatibility protocols
SSLCipherSuite @SECLEVEL=3:kEECDH:kEDH:kPSK:kDHEPSK:kECDHEPSK:-kRSA:-aDSS:-AES128:-SHA256:-3DES:!DES:!RC4:!RC2:!IDEA:-SEED:!eNULL:!aNULL:-SHA1:!MD5:-SHA384:-CAMELLIA:-ARIA:-AESCCM8Enable legacy ciphers for obsolete Browser Compatibility
SSLCipherSuite @SECLEVEL=1:kEECDH:kRSA:kEDH:kPSK:kDHEPSK:kECDHEPSK:!DES:!RC2:!IDEA:-SEED:!eNULL:!aNULL:!MD5:-SHA384:-CAMELLIA:-ARIA:-AESCCM8Allow very old browsers
Certificate Handling
Apache expects separate PEM format files for key and certificate, and another for the CA chain.
Key File
SSLCertificateKeyFile /etc/pki/tls/private/httpd.key
The key file should be readable only by the root user.
Certificate File
SSLCertificateFile /etc/pki/tls/certs/httpd.dh.crt
Since the SSLCertificateFile can contain Diffie-Helman parameters to enable PFS it is necessary to maintain an additional pair of files.
The actual certificate should be placed in/etc/pki/tls/certs/httpd.crtThen the following should be run to create the combined file
This sequence should then be run periodically (weekly) to update the DH parameters, followed by a service reload.openssl dhparam -out /etc/pki/tls/private/httpd.dh.param.tmp 4096 mv /etc/pki/tls/private/httpd.dh.param.tmp /etc/pki/tls/private/httpd.dh.param cat /etc/pki/tls/certs/httpd.crt /etc/pki/tls/private/httpd.dh.param >/etc/pki/tls/certs/httpd.dh.crt systemctl reload httpd
Certificate Authority Chain
SSLCertificateChainFile /etc/pki/tls/certs/httpd-chain.crt
Intermediate and Root certificates for the SSLCertificateFile
This solution is part of Red Hat's fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.