Don't run cPanel installation script if a web server is already installed
I was recently looking into the source code of the cpanel installation script in order to gain a better grasp of the installation process and possibly examine the security of all the sources that this script takes from the cpanel.net website. While the majority of the code is encrypted, the readable portion confirms that it has been audited and upgraded during the years that cpanel has been around.
However, one thing I found during the cpanel installation process that I think is worth addressing is checking if a webserver is already installed and operating. This is important because installing cpanel on a system with websites operating under another hosting panel or even a basic web server would result in downtime or even conflicts.
to be fair, cpanel installation script does alert you:
But, hold on, why would anyone put cPanel on a server that is already hosting websites?
The first thing that comes to mind is ignorance: users attempting to transfer from one hosting panel to another, e.g. plesk to cpanel, without uninstalling the latter. Yes, I've seen it.
Okay, what can we do about it? cPanel is not an opensource project that we can just fork, add code to, and submit a pull request for. All we can do is make a suggestion on their website and leave it at that.
Later I went trough some other popular hosting panels and noticed this excellent example from the Aapanel installation script:
Install_Check(){
if [ "${INSTALL_FORCE}" ];then
return
fi
echo -e "----------------------------------------------------"
echo -e "Web service is alreday installed,installing aaPanel may affect existing sites."
echo -e "----------------------------------------------------"
echo -e "Enter [yes] to force installation"
read -p "Enter yes to force installation: " yes;
if [ "$yes" != "yes" ];then
echo -e "------------"
echo "Installation canceled"
exit;
fi
INSTALL_FORCE="true"
}
System_Check(){
MYSQLD_CHECK=$(ps -ef |grep mysqld|grep -v grep|grep -v /www/server/mysql)
PHP_CHECK=$(ps -ef|grep php-fpm|grep master|grep -v /www/server/php)
NGINX_CHECK=$(ps -ef|grep nginx|grep master|grep -v /www/server/nginx)
HTTPD_CHECK=$(ps -ef |grep -E 'httpd|apache'|grep -v /www/server/apache|grep -v grep)
if [ "${PHP_CHECK}" ] || [ "${MYSQLD_CHECK}" ] || [ "${NGINX_CHECK}" ] || [ "${HTTPD_CHECK}" ];then
Install_Check
fi
}
Kudos to the pagoda team!
Leave Don't run cPanel installation script if a web server is already installed to:
Read more #wordpress posts
Best Posts From PCx3
We have not curated any of pcx3's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From PCx3
- 🚨 Critical Vulnerability in Sitepad cPanel plugin ≤ 1.7.0
- Fatal Error Unable to create lock file: Bad file descriptor (9)
- Remove custom reseller branding when transferring cPanel accounts
- No request delivery notification has been received from LSAPI application, possible dead lock.
- aaPanel security log is vulnerable to stored XSS
- logrotate usage with examples
- Exclude ai1wm-backup folder from Softaculous backups
- CWP Successful login keeps redirecting back to the login page
- UID MOVE: IMAP session state is inconsistent, please relogin.
- Softaculuos Prestashop installation error: Unable to generate new_cookie_key, hence can not install Prestashop 1.7