How to Lock (and Restore) “Select WebServers” in CWP Panel & SSH

Started by its_me_rbk, April 10, 2025, 07:06:36 AM

Previous topic - Next topic

its_me_rbk

Hi all,

I'm running CWP Free (on AlmaLinux 8.10) and I'd like to lock down the "Select WebServers" option to prevent any accidental changes - both from the GUI and via SSH.

My current setup (Apache + Nginx + Varnish) is stable, and I want to:

  • Disable or hide the "Select WebServers" section in the CWP admin panel.
  • Prevent changes via SSH, such as running the web server switch scripts or reinstallation commands.
  • Have a safe and clean method to unlock or restore this functionality when I intentionally want to make a change in the future.

Essentially, I want to enforce a kind of "freeze" mode for the web server stack, and later be able to toggle it off safely without breaking anything.

Any guidance or script-based methods to:

  • Make the web server configuration unchangeable (GUI + SSH)?
  • Re-enable it cleanly without reinstalling CWP or the stack?

Thanks a ton in advance!

overseer

You could probably move the switcher script to another place to hide it (from yourself?), but each CWP update may restore it. Or you could always put an exit 0 line under the shebang line of script to make it inert (again, each CWP update may reset the change):
#!/bin/bash
exit 0

its_me_rbk

Quote from: overseer on April 10, 2025, 10:57:22 AM
You could probably move the switcher script to another place to hide it (from yourself?), but each CWP update may restore it. Or you could always put an exit 0 line under the shebang line of script to make it inert (again, each CWP update may reset the change):
#!/bin/bash
exit 0


Can you provide the path to that file?

overseer

The previous advice was for shell scripts under /scripts  -> /usr/local/cwpsrv/htdocs/resources/scripts

To accomplish what you want, in a root shell, edit this file with nano:
nano  /usr/local/cwpsrv/htdocs/resources/admin/modules/WebServers_manage.php
insert an exit(0) on the next line after the leading php stanza, before all the encoded PHP code:
<?php //0042b
// Copyright CentOS WebPanel, Decoding is FORBIDDEN
// All Rights Reserved. www.centos-webpanel.com
if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'$
?>

exit(0)

If you want it to survive a CWP update, you could make it immutable:
chattr +i /usr/local/cwpsrv/htdocs/resources/admin/modules/WebServers_manage.php
To reverse the process, unset the immutable bit and remove the exit(0) line.

its_me_rbk

Quote from: overseer on April 10, 2025, 11:59:22 PM
The previous advice was for shell scripts under /scripts  -> /usr/local/cwpsrv/htdocs/resources/scripts

To accomplish what you want, in a root shell, edit this file with nano:
nano  /usr/local/cwpsrv/htdocs/resources/admin/modules/WebServers_manage.php
insert an exit(0) on the next line after the leading php stanza, before all the encoded PHP code:
<?php //0042b
// Copyright CentOS WebPanel, Decoding is FORBIDDEN
// All Rights Reserved. www.centos-webpanel.com
if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'$
?>

exit(0)

If you want it to survive a CWP update, you could make it immutable:
chattr +i /usr/local/cwpsrv/htdocs/resources/admin/modules/WebServers_manage.php
To reverse the process, unset the immutable bit and remove the exit(0) line.

Thanks for your help!