Zum Inhalt springen

Anhang 5: Erhöhen Sie die Sicherheit Ihrer XOOPS-Installation

Nach der Installation von XOOPS 2.7.0 ergreifen Sie die folgenden Schritte, um die Site zu sichern. Jeder Schritt ist einzeln optional, aber zusammen erhöhen sie die Baseline-Sicherheit der Installation erheblich.

The bundled protector module is the XOOPS firewall. If you did not install it during the initial wizard, install it from the Admin → Modules screen now.

Open Protector’s admin panel and review the warnings it displays. Legacy PHP directives such as register_globals no longer exist (PHP 8.2+ has removed them), so you will not see those warnings anymore. Current warnings usually relate to directory permissions, session settings, and trust-path configuration.

When the installer finishes it tries to mark both files as read-only, but some hosts revert the permissions. Verify and re-apply if needed:

  • mainfile.php0444 (owner, group, other read-only)
  • xoops_data/data/secure.php0444

mainfile.php defines the path constants (XOOPS_ROOT_PATH, XOOPS_PATH, XOOPS_VAR_PATH, XOOPS_URL, XOOPS_COOKIE_DOMAIN, XOOPS_COOKIE_DOMAIN_USE_PSL) and production flags. secure.php holds the database credentials:

  • In 2.5.x, the database credentials used to live in mainfile.php. They are now stored in xoops_data/data/secure.php, which is loaded by mainfile.php at runtime. Keeping secure.php inside xoops_data/ — a directory you are encouraged to relocate outside the document root — makes it much harder for an attacker to reach the credentials over HTTP.

3. Move xoops_lib/ and xoops_data/ outside the document root

Abschnitt betitelt „3. Move xoops_lib/ and xoops_data/ outside the document root“

If you have not already done so, move these two directories one level above your web root and rename them. Then update the corresponding constants in mainfile.php:

define('XOOPS_ROOT_PATH', '/home/you/www');
define('XOOPS_PATH', '/home/you/zubra_mylib');
define('XOOPS_VAR_PATH', '/home/you/zubra_mydata');
define('XOOPS_TRUST_PATH', XOOPS_PATH);

Placing these directories outside the document root prevents direct access to Composer’s vendor/ tree, cached templates, session files, uploaded data, and the database credentials in secure.php.

XOOPS 2.7.0 introduces two cookie-domain constants in mainfile.php:

// Use the Public Suffix List (PSL) to derive the registrable domain.
define('XOOPS_COOKIE_DOMAIN_USE_PSL', true);
// Explicit cookie domain; may be blank, the full host, or the registrable domain.
define('XOOPS_COOKIE_DOMAIN', '');

Guidelines:

  • Leave XOOPS_COOKIE_DOMAIN blank if you serve XOOPS from a single hostname or from an IP.
  • Use the full host (e.g. www.example.com) to scope cookies to that hostname only.
  • Use the registrable domain (e.g. example.com) when you want cookies shared across www.example.com, blog.example.com, etc.
  • XOOPS_COOKIE_DOMAIN_USE_PSL = true lets XOOPS correctly split compound TLDs (co.uk, com.au, …) instead of accidentally setting a cookie on the effective TLD.

mainfile.dist.php ships with these two flags set to false for production:

define('XOOPS_DB_LEGACY_LOG', false); // disable legacy SQL usage logging
define('XOOPS_DEBUG', false); // disable debug notices

Leave them off on production. Enable them temporarily in a development or staging environment when you want to:

  • hunt down lingering legacy database calls (XOOPS_DB_LEGACY_LOG = true);
  • surface E_USER_DEPRECATED notices and other debug output (XOOPS_DEBUG = true).

After the install is complete:

  1. Delete any renamed install_remove_* directory from the web root.
  2. Delete any install_cleanup_*.php script that the wizard created during cleanup.
  3. Confirm the install/ directory is no longer reachable over HTTP.

Leaving a disabled but present installer directory is a low-severity but avoidable risk.

XOOPS follows a regular patch cadence. Subscribe to the XoopsCore27 GitHub repository for release notifications, and update your site and any third-party modules whenever a new release ships. The security updates for 2.7.x are published via the repository’s Releases page.