We’re excited to introduce cPFence OLS Freeze, a powerful FREE script designed to help Enhance Control Panel users persist their OpenLiteSpeed (OLS) configurations across vhost rebuilds. This script ensures that any custom settings you apply in OLS are not overwritten by default configurations during domain or vhost updates.
- Download cPFence OLS Freeze on GitHub Gist:
https://gist.github.com/cPFence/041ef1ba10a41d62bd2a4d6cee2dae41
We’ve previously shared a guide on optimizing OpenLiteSpeed for large shared hosting servers:
How to Optimize OpenLiteSpeed for Large Shared Hosting Servers.
Since then, many Enhance admins have reached out, asking for a way to fully persist their OLS configurations, beyond the limited scope of our previous script. To address this, we created cPFence OLS Freeze—a script that ensures 100% persistence for all your OLS settings on Enhance CP servers.
While we initially planned to include this feature in the paid version of cPFence, we decided to make it available for free as a way to give back to the amazing Enhance community. You’ve been incredibly supportive, and this is our way of saying thank you!
What Does cPFence OLS Freeze Do?
The cPFence OLS Freeze script is a comprehensive solution to handle the persistence of your OpenLiteSpeed settings. It works by freezing your current OLS configuration and protecting it from being overwritten during vhost rebuilds or updates triggered by Enhance CP.
Key Features:
- Full Configuration Persistence:
- Ensures all custom settings, including advanced tuning, are preserved across vhost rebuilds.
- Freeze and Unfreeze Mechanism:
- Easily “freeze” your current settings to lock them in place.
- “Unfreeze” when you need to make updates through the OLS admin panel, then refreeze after making changes.
- Automated Backup Management:
- Backs up your OLS configuration before every freeze.
- Automatically deletes old backups (older than 7 days) to prevent clutter.
- MD5 Integrity Check:
- Continuously monitors your OLS configuration for unauthorized changes and reverts only the protected settings if discrepancies are detected.
- Works with Enhance CP:
- Fully compatible with Enhance CP’s dynamic vhost management, ensuring seamless operation even on busy shared hosting servers.
- Compatibility with Future Enhance v12:
- The script includes a built-in option to ensure compatibility with Enhance v12 upon its release. By setting the
Using_Enhance_v12
variable to"on"
, the script will automatically adapt to work seamlessly in environments running Enhance v12. This forward-thinking feature ensures that the script remains a reliable solution for managing OpenLiteSpeed configurations, even as Enhance evolves and introduces new updates.
- The script includes a built-in option to ensure compatibility with Enhance v12 upon its release. By setting the
Installation
Follow these steps to install and set up the script:
- Download the Script:
Download the latest version of the script from our GitHub Gist:
https://gist.github.com/cPFence/041ef1ba10a41d62bd2a4d6cee2dae41 - Make It Executable:
Save the script to your server (e.g.,/root/cPFence_ols_freeze.sh
) and make it executable:
chmod +x /root/cPFence_ols_freeze.sh
- Set Up a Cron Job:
Add a cron job to run the script every minute to monitor your configuration:
* * * * * /root/cPFence_ols_freeze.sh >> /var/log/cPFence_ols_freeze.log 2>&1
How to Use
Here’s how to use cPFence OLS Freeze effectively:
- Freeze Your Configuration:
- After making changes in the OLS admin panel, freeze your settings by running:
./cPFence_ols_freeze.sh freeze
- This will back up your current configuration, extract and store your OLS settings, and create an MD5 checksum to monitor future changes.
- After making changes in the OLS admin panel, freeze your settings by running:
- Unfreeze for Edits:
- If you need to make further changes in the OLS admin panel, unfreeze the settings first by running:
./cPFence_ols_freeze.sh unfreeze
- Once unfrozen, you can stop the cron job temporarily to avoid overwriting your changes.
- If you need to make further changes in the OLS admin panel, unfreeze the settings first by running:
- Refreeze After Updates:
- After completing your updates, run the
freeze
command again to lock in your new settings.
- After completing your updates, run the
- Automatic Enforcement:
- When running in cron mode with no arguments, the script automatically detects changes in your configuration and reverts your settings to its frozen state if any discrepancies are found.
Important Warning!
If the configuration is frozen, it is critical to unfreeze the settings before making any changes to cPFence WAF configurations, such as enabling or disabling the WAF. Failure to unfreeze before making these changes will cause the cron job to detect changes in the configuration, resulting in a continuous loop where OpenLiteSpeed is repeatedly restarted. To avoid this, always unfreeze the configuration before modifying WAF settings, and remember to freeze it again afterward to lock in your updates. Properly following this process ensures smooth operation and avoids unnecessary interruptions.
cPFence OLS Freeze vs. OLS Optimize: Which One to Choose?
Both cPFence OLS Freeze and OLS Optimize are powerful tools designed to help you manage and optimize OpenLiteSpeed configurations, but they serve different purposes:
- cPFence OLS Freeze is ideal for administrators who want 100% persistence of their custom OLS settings, ensuring that no changes made during vhost rebuilds or domain updates can overwrite their configurations. This script is perfect for environments where maintaining fine-tuned customizations is critical.
- OLS Optimize, on the other hand, focuses on applying preconfigured optimizations for OpenLiteSpeed to improve performance on large shared hosting servers. It’s more suitable for environments where standardized performance improvements are prioritized over maintaining unique configurations.
If your priority is to preserve custom settings and retain full control of your OLS setup, choose cPFence OLS Freeze. If you’re looking for performance-focused optimizations without heavy customization, OLS Optimize may be the better fit.
For many scenarios, these tools can complement each other, allowing you to optimize first with OLS Optimize and then lock in those settings with cPFence OLS Freeze!
Is it Safe to Use This Script in Production?
While we’ve tested this script on a couple of test servers, we haven’t deployed it in production yet, as we’re still using the old OLS optimize version that meets our current needs. We strongly recommend conducting extensive testing in non-production environments before using this script on live servers. Be sure to thoroughly debug and test it, including scenarios like adding or removing domains, subdomains, and other configurations. If we were to deploy it in production, we’d likely run extensive tests for at least a week before making it live. The script provides a solid base, and since it’s completely free, feel free to test, debug, and adapt it to suit your needs. We would have loved to test it further ourselves, but with our current focus on other projects and priorities, we wanted to share it with the community as-is for now.
As always, exercise caution and create backups before making significant changes to your server configuration.
Closing Thoughts
With cPFence OLS Freeze, you no longer have to worry about losing your custom OpenLiteSpeed configurations on Enhance servers. This script guarantees 100% persistence, ensuring that your carefully optimized settings remain intact, even during vhost rebuilds or domain updates.
Whether you’re managing a large shared hosting environment or running a smaller setup, cPFence OLS Freeze empowers you to take complete control of your OLS configurations. It’s simple, reliable, and tailored for the Enhance community.
We’re proud to share this tool with you for free and look forward to hearing your feedback!.
Happy hosting,
The cPFence Team
No comment