Hardening Apache and TLS for rConfig
Hardening Apache and TLS for rConfig
Section titled “Hardening Apache and TLS for rConfig”The web server must serve rConfig’s public/ folder and nothing else. On some RHEL-family installs the stock HTTPS site served the whole web folder, .env included (rCFG-SA-2026-15). From V8.5.0, Security Review requests .env, storage, .git, composer.json, directory listings and debug tools on 127.0.0.1, every server address and the APP_URL host, over HTTP and HTTPS, and fails if any is served.
Fix it with the script
Section titled “Fix it with the script”sudo bash /var/www/html/rconfig8/resources/scripts/rconfig-apache-check.shIt backs up your Apache files, makes the fixes it can (default sites, the stock ssl.conf site, the test page, <Directory />, directory listings, dotfile access), tests the result with apachectl configtest, and reloads Apache. It never edits another application’s vhost. See Apache hardening.
Recommended settings
Section titled “Recommended settings”# Main config (httpd.conf / apache2.conf) (web.server_tokens, web.trace_method)ServerTokens ProdServerSignature OffTraceEnable off
<VirtualHost *:443> ServerName rconfig.example.com DocumentRoot /var/www/html/rconfig8/public
<Directory /var/www/html/rconfig8/public> # web.dir_listing Options -Indexes -MultiViews +FollowSymLinks AllowOverride All Require all granted </Directory>
# Dotfiles (.env, .git) are never served, .well-known is (web.env_exposed, web.vcs_exposed) <LocationMatch "(?i)/\.(?!well-known(/|$))"> Require all denied </LocationMatch>
SSLEngine on # tls.legacy_protocols SSLProtocol -all +TLSv1.2 +TLSv1.3 SSLCertificateFile /etc/pki/tls/certs/rconfig.crt SSLCertificateKeyFile /etc/pki/tls/private/rconfig.key</VirtualHost>
# Plain HTTP only redirects (web.https_redirect)<VirtualHost *:80> ServerName rconfig.example.com Redirect permanent / https://rconfig.example.com/</VirtualHost>Behind a TLS-terminating proxy or load balancer, add SetEnvIf X-Forwarded-Proto https HTTPS=on so Apache’s own redirects stay on https (web.https_redirect catches a redirect back to http://).
Certificates
Section titled “Certificates”Use a certificate from your internal or public CA that names the APP_URL host (tls.self_signed), with an RSA 2048-bit or larger, or EC P-256 or larger, key (tls.weak_key). tls.cert_expiry warns 30 days and fails 14 days before expiry. For a quick self-signed certificate: sudo php artisan rconfig:ssl-self-signed. See SSL setup.
Standards: CIS Apache HTTP Server 2.4 Benchmark, NIST SP 800-52r2, NIST SP 800-53 CM-7, SC-8, SC-17, OWASP ASVS V9 and V14.