Security Best Practices

This page provides a hardening checklist for production LicenceForge deployments. Following these recommendations significantly reduces your attack surface and protects both your licensing data and your customers.

Note

These recommendations complement the built-in security features described in Encryption and Download Security. Apply them in addition to the defaults, not as replacements.

Transport Security

All communication between client plugins and the LicenceForge REST API must occur over HTTPS. License keys, API keys, and download tokens are transmitted in request headers and URLs — without TLS, these values are exposed to network interception.

  • Install a valid SSL/TLS certificate on your WordPress site.
  • Force HTTPS for the entire site, or at minimum for all /wp-json/wplf/ endpoints.
  • Enable HSTS headers to prevent protocol downgrade attacks.

WordPress and PHP Updates

Keep WordPress core, PHP, and all plugins up to date. Security patches for WordPress and PHP frequently address vulnerabilities that could allow attackers to bypass authentication, execute arbitrary code, or access your database directly.

  • Enable automatic minor WordPress updates (enabled by default).
  • Run PHP 8.1 or later (see Requirements).
  • Remove unused themes and plugins to reduce the attack surface.

WordPress Authentication Keys

LicenceForge derives its encryption keys from the WordPress authentication constants defined in wp-config.php. Specifically, AUTH_KEY and AUTH_SALT are used to generate HMAC keys for license key hashing and download token signing.

Critical

If your wp-config.php still contains the default placeholder salts, your encryption is effectively compromised. Generate strong, unique salts using the WordPress salt generator and replace them immediately.

  • Ensure all eight salt constants (AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY, NONCE_KEY, and their _SALT counterparts) are set to unique, random values.
  • Changing these keys after deployment will invalidate all existing license key hashes, API key hashes, and download tokens. Plan a key rotation carefully.

API Key Security

LicenceForge supports optional API key authentication for all REST endpoints. Enabling this requirement ensures that only authorised applications can interact with your licensing API.

  • Set the wplf_require_api_key option to yes in LicenceForge > Settings.
  • Create separate API keys for each integration (one per client application, one per CI/CD pipeline, etc.).
  • Use the minimum required permission level: read for validation-only clients, write for activation workflows, admin only for management tools.
  • Review the last_used_at timestamp in the API Keys admin panel regularly. Revoke any key that has not been used recently or is no longer needed.

Rate Limiting

LicenceForge enforces per-IP rate limits on validation and activation endpoints to prevent brute-force attacks and abuse.

Endpoint Option Default Limit
License validation wplf_rate_limit_validate 30 requests/minute
License activation wplf_rate_limit_activate 10 requests/minute

Review these defaults and adjust them based on your traffic patterns. Lower limits provide stronger protection but may impact legitimate bulk operations.

File Storage

Product ZIP files can be stored locally in wp-content/uploads/licenceforge/ or externally in an Amazon S3 bucket. S3 storage is strongly recommended for production deployments because it:

  • Avoids direct filesystem access from the web server.
  • Enables pre-signed URLs with time-limited access (managed automatically by LicenceForge).
  • Provides redundancy and scalability independent of your WordPress server.

If using local storage, ensure the .htaccess rules generated by LicenceForge are in place to block direct access to ZIP files. See Download Security for details.

File Permissions

Apply standard WordPress file permission recommendations to your installation:

Target Permission
Files 644
Directories 755
wp-config.php 440 or 400 (read-only)

Debug Mode in Production

Warning

Never leave WP_DEBUG enabled on a production site. Debug output can leak database table names, file paths, PHP version information, and other details that assist attackers in crafting targeted exploits.

Ensure your production wp-config.php contains:

define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', false );

For debugging production issues, use the Debug Mode guide, which covers enabling logging temporarily and safely.

Database Backups

Maintain regular automated backups of your entire WordPress database, with particular attention to the eight LicenceForge tables. See Backup & Restore for specific commands and recommendations.

Web Application Firewall

A WAF (Web Application Firewall) adds an additional layer of protection by filtering malicious requests before they reach WordPress. Consider deploying a WAF at the server or CDN level to mitigate:

  • SQL injection attempts targeting the REST API.
  • Cross-site scripting (XSS) payloads.
  • Distributed denial-of-service (DDoS) floods against license validation endpoints.

Monitoring and Audit Logging

LicenceForge maintains a detailed audit log of all license operations. Use it proactively to detect suspicious activity:

  • Monitor for unusual spikes in failed validation attempts (potential brute-force attacks).
  • Watch for bulk activation requests from a single IP hash.
  • Enable health alerts by setting wplf_health_alerts_enabled to true in LicenceForge > Settings > Health Alerts. This sends email notifications when health checks detect anomalies.
  • Review the Audit Log regularly from the admin panel.

Device Fingerprinting

For high-security deployments where you need to ensure a license is used only on authorised hardware, enable device fingerprinting. This feature ties each activation to a unique device identifier, preventing license sharing across machines. See Device Fingerprinting for configuration details.

Hardening Checklist

Use the following checklist to verify your production environment is properly secured.

Item Status
SSL/TLS certificate installed and HTTPS enforced
WordPress, PHP, and all plugins up to date
Strong, unique wp-config.php salts configured
API key requirement enabled (wplf_require_api_key = yes)
Rate limits reviewed and appropriate for traffic volume
S3 storage configured for product ZIP files
File permissions set to 644/755
WP_DEBUG disabled in production
Database backups automated
WAF deployed
Health alerts enabled
Unused API keys revoked

Related Pages