Control Web Panel

WebPanel => Installation => Topic started by: its_me_rbk on April 10, 2025, 07:06:36 AM

Title: How to Lock (and Restore) “Select WebServers” in CWP Panel & SSH
Post by: its_me_rbk on April 10, 2025, 07:06:36 AM
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:

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:

Thanks a ton in advance!
Title: Re: How to Lock (and Restore) “Select WebServers” in CWP Panel & SSH
Post by: 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):
Code: [Select]
#!/bin/bash
exit 0
Title: Re: How to Lock (and Restore) “Select WebServers” in CWP Panel & SSH
Post by: its_me_rbk 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?
Title: Re: How to Lock (and Restore) “Select WebServers” in CWP Panel & SSH
Post by: 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:
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.
Title: Re: How to Lock (and Restore) “Select WebServers” in CWP Panel & SSH
Post by: its_me_rbk 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!