Skip to content

Server security checklist

This checklist covers the server under ClientFence: files, web server, PHP, database and mail. The in-app features, such as two-factor sign-in and rate limits, have their own pages. Most items match a check on the System Health page, so you can see at once what is left to do.

  1. Go to System → Settings → System and open the System Health tab.
  2. Select Run checks now.
  3. Work through Needs attention, then Warnings, with the items below. Each item names the check as the page shows it.

The checks also run every hour through the cron. See System health. Items marked not checked are yours to check by hand.

  • Why: config.php holds the database password and info.salt, the key that decrypts saved passwords and API keys. Admin pages that save a setting write config.php again (and copy the old one to config.old.php), so PHP must be able to write it and the ClientFence folder.

  • Check: config.php permissions needs attention when other users of the server can read the file, and warns when its group can write it. From the ClientFence folder:

    Terminal window
    stat -c '%a %U %n' config.php config.old.php
  • Fix: all ClientFence files belong to the site’s user, the user PHP runs as, never root. Set both files to 600. Use 600 even though the installer’s last screen shows 644.

    Terminal window
    chmod 600 config.php config.old.php
  • Read: The config.php file reference.

Keep a copy of config.php off the server too: without it, a restored database cannot read its saved keys.

  • Why: ticket attachments and payment receipts can hold personal and payment details.

  • Check: Private folder: ticket attachments and Private folder: payment receipts. Each folder must be outside the web root (needs attention otherwise), and mode 700 (warning otherwise).

  • Fix: keep .clientfence-ticket-files and .clientfence-receipts next to the site folder, not inside it, and close them to other users. Do the same for .clientfence-client-files and .clientfence-id-documents.

    Terminal window
    chmod 700 ../.clientfence-ticket-files ../.clientfence-receipts
  • Read: Backups and cloud copies.

  • Why: sign-ins, card pages and API keys must never travel as plain text.

  • Check: HTTPS only passes when the portal URL starts with https:// and security.force_https is true. Security headers asks your own site for its home page and needs HSTS, CSP and X-Content-Type-Options. General Check also fails while HTTPS is not enforced.

    Terminal window
    curl -sI https://billing.example.com/ | grep -i -E 'strict-transport|content-security|x-content-type'
  • Fix: install a certificate for the portal’s domain in your hosting panel (Let’s Encrypt is fine). Then set url and security.force_https in config.php. ClientFence sends the headers itself from clientfence-security-headers.php: if one is missing, upload that file from your release again, and check that a proxy in front of the site does not remove them.

  • Read: The config.php file reference.

Check on the page What it wants Fix
Debug and error display Debug mode off, PHP display_errors off Set debug_and_monitoring.debug to false and display_errors = Off in the site’s PHP settings
PHP version and PHP Version Check A PHP that ClientFence supports and that still gets security fixes Switch the site to PHP 8.3, 8.4 or 8.5 in your panel
PHP extensions Every required extension, and the recommended ones Turn them on in your panel’s PHP settings
PHP memory limit memory_limit of 256M or more Raise it in the site’s PHP settings
PHP OPcache OPcache on for the website’s PHP Set opcache.enable = 1 (often Opcode caching in the panel)
Dangerous PHP functions exec, passthru, system, shell_exec, popen, proc_open and pcntl_exec turned off Add them to disable_functions in the site’s PHP settings, if nothing else on the site needs them

The command-line update (php console.php system:update) finishes with passthru. If your command-line PHP disables it, run php console.php system:run-patcher yourself after the update.

See Requirements and Caching and speed.

  • Why: a few settings in config.php switch protections on or off.
  • Check: Strict security mode needs security.mode set to strict. General Check warns when session fingerprinting or api.CSRFPrevention is off, when twig.debug or debug mode is on, or when update_branch is not release.
  • Fix: put the default back for each key the check names.
  • Read: The config.php file reference.
  • Why: the cron writes cache files, logs and backups. Run as root, those files would belong to root and the website could no longer change them. Started as root, cron.php switches to the user that owns ClientFence first (with PHP’s posix extension), but the site user’s crontab is safer.

  • Check: Scheduled tasks (cron) passes when the last run is under 15 minutes old, warns up to two hours, and needs attention after that or when the cron never ran.

  • Fix: add the line from Recommended Schedule on System → Settings → Scheduled Tasks to the crontab of the site’s user, every five minutes.

    */5 * * * * php /path/to/clientfence/cron.php
  • Read: Scheduled tasks (cron).

Not checked. Database version only checks the version (MySQL 8.0 or MariaDB 10.6 and newer recommended).

  • Why: a leaked password for a user with rights on every database exposes every site on the server.
  • Check: sign in to MySQL as the ClientFence user and run SHOW GRANTS;.
  • Fix: give ClientFence its own database user with all rights on its own database only, never the MySQL root user. Updates create and change tables, so keep those rights. Do not open the database port to the internet.
  • Read: Install ClientFence.
  • Why: a backup you never restored is a guess.
  • Check: Database backup and Site files backup look at every source: the daily database backup and cloud copies for the database, cloud copies for the files. Each warns when nothing backs it up or its newest copy is old (two days for the daily backup, twice the schedule for cloud copies). ClientFence cannot see backups your host makes. Daily database backup (when a destination is on) warns when its newest backup is more than two days old or stays only on this server with no cloud copy, and needs attention when the last one failed. Cloud backups (when on) warns when a copy failed or is too old.
  • Fix: turn on a destination off this server, and keep config.php and the private upload folders in your file backups. A few times a year, restore a backup on a test install and check that Encryption key passes there.
  • Read: Backups and cloud copies and Restore a backup.
  • Why: releases fix security issues.
  • Check: ClientFence version shows the version you run. Database updates, Core patches, Pack files unchanged and Pack manifest need attention when an update did not finish or shipped files were changed or are missing.
  • Fix: install new releases from System → Update ClientFence. When a file check fails, upload the files of the release you run again (your config.php is not in the release), then remove the install folder. Keep the server’s own packages (operating system, web server, PHP, database) updated too: your host or panel does that, ClientFence does not.
  • Read: Update ClientFence.
  • Why: code, libraries, logs and config.php must be read by PHP only, never served to visitors.

  • Check: Private paths blocked asks your own site for seven private paths, such as vendor/composer/installed.json and data/index.html, and lists any it gets back. Webserver Check asks for config.php, data/log/php_error.log and vendor/autoload.php. Pack .htaccess rules checks that the ClientFence rule blocks are in .htaccess.

    Terminal window
    curl -s -o /dev/null -w '%{http_code}\n' https://billing.example.com/config.php

    Anything but 200 is right.

  • Fix: keep .htaccess in the site folder and data/.htaccess in the data folder (upload hidden files too), and use a web server that reads them: Apache, LiteSpeed or OpenLiteSpeed. On Nginx, add the rules from Run ClientFence on Nginx. Remove the install folder if it is still there.

  • Read: Install ClientFence.

  • Why: bots try /admin first.
  • Check: Admin area address warns while the admin area is at /admin. The report never shows your own address.
  • Fix: choose an Admin address in the Security step of System → Settings → Quick setup, or set admin_area_prefix in config.php. Add staff sign-in rules, such as sign-in only from your IP addresses.
  • Read: Quick setup and Staff sign-in rules.

The firewall is not checked. Visitor addresses checks the proxy part.

  • Why: every open port is a way in. Behind a proxy that is not trusted, every visitor shows with the proxy’s address, so sign-in limits and logs see one visitor.
  • Check: list the open ports from another machine, and read Visitor addresses.
  • Fix: open only HTTP and HTTPS (80, 443) to everyone. Keep SSH to your own addresses and the database, Redis and Memcached closed to the internet. Allow outgoing HTTPS: ClientFence connects to your control panels, registrars, payment gateways, backup destinations and the release list on clientfence.com. Behind Cloudflare or another proxy, trust it on Security → Settings, Proxies tab.
  • Read: Proxies, access lists and sessions.

SPF, DKIM and DMARC are not checked. Email delivery checks the transport.

  • Why: without these DNS records, invoices and password resets land in spam, and anyone can send email in your name.
  • Check: Email delivery passes for SMTP on port 465 (TLS) or 587 (STARTTLS) and for SendGrid, warns for other ports and mailers, and needs attention when no transport is set. For the DNS records, send a test email to a Gmail address and open Show original: SPF, DKIM and DMARC should say PASS.
  • Fix: publish the SPF, DKIM and DMARC records your mail provider gives for the sender domain, and send through SMTP with TLS.
  • Read: Emails and Troubleshoot queued email delivery.
Check What it wants
Captcha on public forms A captcha on with its keys set. See Captcha and anti-spam
Script policy No script blocked by the page policy in the last 7 days
Encryption key Every module setting readable with info.salt
Email queue No failed emails and none waiting over an hour
Help desk: name A help desk email address of your own, not the installer’s placeholder
Google sign-in When on, a client ID and secret
Registrar: name, Hosting server: name Each Dynadot registrar’s API and each active hosting server’s control panel answer
Free disk space 5 GB or more (warning under 5 GB, attention under 1 GB)
Cache backend The chosen cache reachable; Redis or Memcached for a busy site
GeoIP database Present and updated in the last 60 days

Warnings and errors from the admin dashboard alerts also appear under Core checks.