|
Server : Apache System : Linux vps.urbanovitalino.adv.br 3.10.0-1062.12.1.el7.x86_64 #1 SMP Tue Feb 4 23:02:59 UTC 2020 x86_64 User : urbanovitalinoad ( 1001) PHP Version : 7.3.33 Disable Function : exec,passthru,shell_exec,system Directory : /opt/fleetssl-cpanel/ |
Upload File : |
#!/usr/bin/env bash
okPrint() {
echo -e "\e[32m${1}\e[0m"
}
warnPrint() {
echo -e "\e[33m${1}\e[0m"
}
failPrint() {
echo -e "\e[91m${1}\e[0m"
exit 1
}
fileExists() {
if [ -s "$1" ]; then
return 0 # true
else
return 1 # false
fi
}
daemonRunning() {
pidof letsencrypt.live.cgi > /dev/null
return $?
}
checkRoot() {
if (( EUID != 0 )); then
failPrint "Please run installer as root"
fi
okPrint "Running installer as root"
}
checkOsVersion() {
if [ "$FLEETSSL_SKIP_OS_CHECK" = "y" ]; then
return
fi
if ! fileExists "/etc/os-release"; then
# CloudLinux is missing /etc/os-release. Let's silently ignore it.
return
fi
. /etc/os-release
# Any non-EOL RHEL variant is okay
if fileExists "/etc/redhat-release" && [ $(echo "$VERSION_ID >= 7" | bc -l) = 1 ]; then
okPrint "RHEL-like OS version OK!"
return
fi
# Ubuntu 20.04 is okay
if [ \( "$ID" = "ubuntu" -a "$VERSION_ID" = "20.04" \) ]; then
okPrint "Ubuntu OS version OK!"
return
fi
failPrint "Unsupported operating system $ID ($VERSION_ID). Set the env variable FLEETSSL_SKIP_OS_CHECK=y to force installation."
}
checkCpanelVersion() {
if ! fileExists "/usr/local/cpanel/cpanel"; then
failPrint "Cannot find cPanel installed"
fi
}
checkLicence() {
if ! fileExists "/etc/letsencrypt-cpanel.licence"; then
warnPrint "No licence file detected at /etc/letsencrypt-cpanel.licence"
warnPrint "Fetching new trial licence ... "
local trial
trial="$(curl -sS --data hostname="${HOSTNAME}" https://cpanel.fleetssl.com/generatetrial)"
if [ ! "${trial:0:1}" == "{" ]; then
warnPrint "Error downloading trial licence: ${trial}"
failPrint "Please install a licence or contact support"
fi
echo "${trial}" > /etc/letsencrypt-cpanel.licence
chmod 0400 /etc/letsencrypt-cpanel.licence
fi
if ! fileExists "/etc/letsencrypt-cpanel.licence"; then
failPrint "No licence file present"
fi
okPrint "Licence file present"
}
stopService() {
service letsencrypt-cpanel stop > /dev/null
if daemonRunning; then
warnPrint "Daemon service not stopped successfully, attempting manual shutdown"
killall -TERM letsencrypt.live.cgi
sleep 5s
if daemonRunning; then
warnPrint "Manual shutdown not successful, killing process"
killall -9 letsencrypt.live.cgi
fi
fi
okPrint "FleetSSL cPanel service daemon stopped"
}
okPrint "*** By running this installer, you indicate that you have read the end-user\n licence agreement (https://cpanel.fleetssl.com/eula) and agree to all of its terms, as stated. ***\n"
checkRoot
checkOsVersion
checkCpanelVersion
checkLicence
stopService