Apache Security Check
Apache Security Check
Section titled “Apache Security Check”The rConfig Apache Security Check reviews how Apache is set up on your rConfig server and fixes unsafe defaults. It is free, it backs up every file before it changes anything, and it is safe to run on a live server. This page accompanies the rConfig Security Advisory rCFG-SA-2026-15.
On some Rocky Linux, AlmaLinux, RHEL, CentOS Stream and Amazon Linux installs, Apache’s stock HTTPS site could serve files from outside the rConfig web folder, including the .env file. The check finds and fixes this.
Am I at risk?
Section titled “Am I at risk?”Your server is at risk if all of these are true:
- it runs Rocky Linux, AlmaLinux, RHEL, CentOS Stream or Amazon Linux;
- Apache’s SSL module (
mod_ssl) is installed; - the stock HTTPS site in
/etc/httpd/conf.d/ssl.conf(<VirtualHost _default_:443>) is still active and, as shipped, has noDocumentRootof its own.
In that setup, HTTPS requests that don’t match one of your own sites, for example a request to the server’s IP address, are answered by the stock site. It serves /var/www/html, where rConfig is installed.
You are probably not at risk if:
- you serve rConfig over HTTP only and
mod_sslis not installed; - you set up your own HTTPS site for rConfig and removed, switched off or replaced the stock HTTPS site in
ssl.conf; - the server runs Ubuntu, or rConfig runs in Docker.
Please run the test below anyway. It takes a few seconds and shows for certain.
Deploys and updates of rConfig Pro, Vector and Prism from 19 November 2026 run the check automatically. If you haven’t deployed since then, run it by hand.
Test your server first
Section titled “Test your server first”From any machine that can reach the server, run this line. Replace SERVER with the server’s IP address or hostname. It prints each path and its status code only.
for p in /rconfig8/current/.env /rconfig8/persistentData/.env /rconfig8/persistentData/storage/; do echo "$p $(curl -sk -o /dev/null -w '%{http_code}' https://SERVER$p)"; doneRun the check
Section titled “Run the check”On the rConfig server, as root:
-
Review only. This never prompts and never changes anything:
Terminal window curl -fsSL https://dl.rconfig.com/downloads/rconfig-apache-check.sh | bash -s -- --check -
Review and fix. The check lists the fixes and asks
Apply these fixes now? [y/N]before changing anything. The default answer is No:Terminal window curl -fsSL https://dl.rconfig.com/downloads/rconfig-apache-check.sh | bash
To apply the fixes without the prompt, for example from automation, add --yes. Without a terminal and without --yes, the check only reports, as with --check.
Prefer not to pipe a download into bash? Download the script and run it instead.
What it checks and fixes
Section titled “What it checks and fixes”| Check | Fix |
|---|---|
Apache’s stock HTTPS site in ssl.conf serves the main web folder |
Switches the stock site off and keeps it as a disabled block. Global SSL settings stay |
| The Apache test page is enabled | Empties welcome.conf, so package updates don’t bring it back |
<Directory /> has been opened up |
Resets it to Apache’s safe default |
/var/www/html is readable and listable |
Denies it and allows only rConfig’s public/ folders (dedicated servers only) |
| No safe default site on port 80 or 443 | Adds a catch-all site that denies every request |
| The rConfig site allows directory listing, or uses old Apache 2.2 access lines | Removes them |
The rConfig site serves hidden files such as .env |
Adds a rule that blocks them (/.well-known/ stays open for certificates) |
| MariaDB listens on all network interfaces | Reported only. Check that port 3306 is blocked by a firewall, or set bind-address=127.0.0.1 |
Sensitive files such as .env and .git/HEAD are reachable |
Requested over HTTP and HTTPS from 127.0.0.1 and the server’s IP addresses, as a final test |
| The rConfig login page loads | Checked by the host name in APP_URL and by IP address, so you know the fixes left the app working |
The check only edits Apache’s stock files (ssl.conf, welcome.conf and <Directory /> in the main config) while they still have their stock content, and rConfig’s own site files. It never edits, moves or switches off anyone else’s site, and anything that looks customised is left alone and reported. Your own sites, certificates and HTTPS settings are not changed. If other websites run on the same server, the /var/www/html lock-down is skipped. We recommend running rConfig on a dedicated server.
Safety
Section titled “Safety”- Every file is backed up before any change, to
/root/rconfig-apache-check-backup-<time>/, together with arestore.shscript. - The new configuration is tested with
apachectl configtest. If the test or the reload fails, the changes are rolled back. - Apache is reloaded, not restarted.
To undo every change from a run, run the restore.sh in that run’s backup folder:
bash /root/rconfig-apache-check-backup-<time>/restore.shOpt out
Section titled “Opt out”For fully custom web setups, you can stop deploys and updates from changing Apache. Create this file (any content):
mkdir -p /etc/rconfig && touch /etc/rconfig/skip-apache-hardeningSetting RCONFIG_SKIP_APACHE_HARDENING=1 has the same effect. Deploys and updates then skip the fixes and only run the self-check, with a warning if anything is exposed. Running the check by hand ignores the opt-out unless you add --respect-optout.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 0 | All checks pass. Warnings are advice and do not change the exit code |
| 1 | Issues were found and not fixed |
| 2 | A fix failed (configtest or reload) and was rolled back |
| 3 | Unsupported environment: the operating system, nginx, or no Apache |
| 64 | Wrong options |
Servers without internet access
Section titled “Servers without internet access”The check runs entirely on the server and doesn’t need internet access, apart from downloading it.
-
On a machine with internet access, download the script.
Linux or macOS:
Terminal window curl -fsSL -o rconfig-apache-check.sh https://dl.rconfig.com/downloads/rconfig-apache-check.shWindows (PowerShell):
Terminal window curl.exe -fsSL -o rconfig-apache-check.sh https://dl.rconfig.com/downloads/rconfig-apache-check.sh -
Copy it to the rConfig server, for example to
/root/. On Windows, WinSCP works too.Terminal window scp rconfig-apache-check.sh root@SERVER:/root/ -
On the rConfig server, as root, make it executable and run it:
Terminal window chmod +x /root/rconfig-apache-check.sh/root/rconfig-apache-check.sh --check/root/rconfig-apache-check.shThe first run only reports. The second lists the fixes and asks before changing anything.
Older and unsupported systems
Section titled “Older and unsupported systems”The check supports RHEL-family 9 and 10 (Rocky Linux, AlmaLinux, RHEL, CentOS Stream), Amazon Linux 2023 and Ubuntu 22.04 or later. RHEL 8 and its rebuilds, Amazon Linux 2, older Ubuntu releases and rConfig V7 are not supported. On those systems, run the test above. If any line shows 200, make these changes by hand, then test again:
- In
/etc/httpd/conf.d/ssl.conf, comment out the whole<VirtualHost _default_:443>block, unless you use it for your own HTTPS site. - Empty
/etc/httpd/conf.d/welcome.conf. Don’t delete it, or a package update brings it back. - Run
apachectl configtest, thenapachectl graceful.
Contact security@rconfig.com if you need help.
Check whether the files were accessed
Section titled “Check whether the files were accessed”If the test showed 200, check your Apache logs for requests to these files:
grep -hE '\.env|persistentData|storage/logs' /var/log/httpd/*access_log* | grep -v ' 40[34] 'If you find requests you don’t recognise:
- change the database password, the Redis password and any mail credentials in
.env; - revoke and recreate rConfig API tokens;
- leave
APP_KEYas it is until you have read the warning below.