Author Topic: How to Lock (and Restore) “Select WebServers” in CWP Panel & SSH  (Read 161 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
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!

Offline
*****
Re: How to Lock (and Restore) “Select WebServers” in CWP Panel & SSH
« Reply #1 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):
Code: [Select]
#!/bin/bash
exit 0

Offline
*
Re: How to Lock (and Restore) “Select WebServers” in CWP Panel & SSH
« Reply #2 on: April 10, 2025, 05:55:20 PM »
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):
Code: [Select]
#!/bin/bash
exit 0

Can you provide the path to that file?

Offline
*****
Re: How to Lock (and Restore) “Select WebServers” in CWP Panel & SSH
« Reply #3 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:
Code: [Select]
nano  /usr/local/cwpsrv/htdocs/resources/admin/modules/WebServers_manage.phpinsert an exit(0) on the next line after the leading php stanza, before all the encoded PHP code:
Code: [Select]
<?php //0042b
// Copyright CentOS WebPanel, Decoding is FORBIDDEN
// All Rights Reserved. www.centos-webpanel.com
if(!extension_loaded(&#39;ionCube Loader&#39;)){$__oc=strtolower(substr(php_uname(),0,3));$__ln=&#39;ioncube_loader_&#39;.$__oc.&#39;_&#39;.substr(phpversion(),0,3).(($__oc==&#39;win&#39;)?&#39;.dll&#39;:&#39;$
?>

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

Offline
*
Re: How to Lock (and Restore) “Select WebServers” in CWP Panel & SSH
« Reply #4 on: April 11, 2025, 04:45:42 AM »
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:
Code: [Select]
nano  /usr/local/cwpsrv/htdocs/resources/admin/modules/WebServers_manage.phpinsert an exit(0) on the next line after the leading php stanza, before all the encoded PHP code:
Code: [Select]
<?php //0042b
// Copyright CentOS WebPanel, Decoding is FORBIDDEN
// All Rights Reserved. www.centos-webpanel.com
if(!extension_loaded(&#39;ionCube Loader&#39;)){$__oc=strtolower(substr(php_uname(),0,3));$__ln=&#39;ioncube_loader_&#39;.$__oc.&#39;_&#39;.substr(phpversion(),0,3).(($__oc==&#39;win&#39;)?&#39;.dll&#39;:&#39;$
?>

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

Thanks for your help!