1
0
mirror of https://github.com/tommytran732/Pterodactyl-Script synced 2024-11-22 18:41:32 -05:00

Removed apache2 support

Support for it was never great anyways, the code was buggy, and everyone is using NGINX.
This commit is contained in:
TommyTran732 2021-09-25 23:48:39 -04:00
parent 20525fe6b0
commit 0ab38d20de
No known key found for this signature in database
GPG Key ID: 8825C3851DC29C20
2 changed files with 69 additions and 282 deletions

View File

@ -14,6 +14,8 @@ This Script now includes the new Pterodactyl v1.0 release <br />
This Script also includes a migration script for 0.7 to 1.0 and Daemon to Wings This Script also includes a migration script for 0.7 to 1.0 and Daemon to Wings
<br /> <br />
# Supported Operating System # Supported Operating System
Note: This list will soon change. The project will focus on supporting more distributions (openSUSE Tumbleweed/Leap, other RHEL derivatives, etc). Support for older versions for these distributions will be dropped.
| Operating System | Version | Supported | Recommended | Notes | | Operating System | Version | Supported | Recommended | Notes |
| ----------------- | ------- | -------------------- | ------------------ | ------------------------------------ | | ----------------- | ------- | -------------------- | ------------------ | ------------------------------------ |
| Ubuntu | 20.04 | :heavy_check_mark: | :heavy_check_mark: | | | Ubuntu | 20.04 | :heavy_check_mark: | :heavy_check_mark: | |

View File

@ -121,8 +121,8 @@ os_check(){
fi fi
if [ "$lsb_dist" = "ubuntu" ]; then if [ "$lsb_dist" = "ubuntu" ]; then
if [ "$dist_version" != "20.04" ] && [ "$dist_version" != "18.04" ]; then if [ "$dist_version" != "20.04" ]; then
output "Unsupported Ubuntu version. Only Ubuntu 20.04 and 18.04 are supported." output "Unsupported Ubuntu version. Only Ubuntu 20.04 is supported."
exit 2 exit 2
fi fi
elif [ "$lsb_dist" = "debian" ]; then elif [ "$lsb_dist" = "debian" ]; then
@ -131,13 +131,13 @@ os_check(){
exit 2 exit 2
fi fi
elif [ "$lsb_dist" = "fedora" ]; then elif [ "$lsb_dist" = "fedora" ]; then
if [ "$dist_version" != "34" ] && [ "$dist_version" != "33" ]; then if [ "$dist_version" != "34" ]; then
output "Unsupported Fedora version. Only Fedora 34 and 33 are supported." output "Unsupported Fedora version. Only Fedora 34 is supported."
exit 2 exit 2
fi fi
elif [ "$lsb_dist" = "centos" ]; then elif [ "$lsb_dist" = "centos" ]; then
if [ "$dist_version" != "8" ]; then if [ "$dist_version" != "8" ]; then
output "Unsupported CentOS version. Only CentOS Stream and 8 are supported." output "Unsupported CentOS version. Only CentOS Stream 8 is supported."
exit 2 exit 2
fi fi
elif [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "rhel" ]; then
@ -149,10 +149,10 @@ os_check(){
output "Unsupported operating system." output "Unsupported operating system."
output "" output ""
output "Supported OS:" output "Supported OS:"
output "Ubuntu: 20.04, 18.04" output "Ubuntu: 20.04"
output "Debian: 10" output "Debian: 10"
output "Fedora: 33, 32" output "Fedora: 34"
output "CentOS: 8, 7" output "CentOS Stream: 8"
output "RHEL: 8" output "RHEL: 8"
exit 2 exit 2
fi fi
@ -211,23 +211,6 @@ install_options(){
esac esac
} }
webserver_options() {
output "Please select which web server you would like to use:\n[1] Nginx (recommended).\n[2] Apache2/httpd."
read -r choice
case $choice in
1 ) webserver=1
output "You have selected Nginx."
output ""
;;
2 ) webserver=2
output "You have selected Apache2/httpd."
output ""
;;
* ) output "You did not enter a valid selection."
webserver_options
esac
}
required_infos() { required_infos() {
output "Please enter the desired user email address:" output "Please enter the desired user email address:"
read -r email read -r email
@ -264,23 +247,16 @@ repositories_setup(){
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
if [ "$lsb_dist" = "ubuntu" ]; then if [ "$lsb_dist" = "ubuntu" ]; then
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
add-apt-repository -y ppa:chris-lea/redis-server
if [ "$dist_version" != "20.04" ]; then
add-apt-repository -y ppa:certbot/certbot
add-apt-repository -y ppa:nginx/development
fi
apt -y install tuned dnsutils apt -y install tuned dnsutils
tuned-adm profile latency-performance tuned-adm profile latency-performance
elif [ "$lsb_dist" = "debian" ]; then elif [ "$lsb_dist" = "debian" ]; then
apt-get -y install ca-certificates apt-transport-https apt-get -y install ca-certificates apt-transport-https
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
if [ "$dist_version" = "10" ]; then
apt -y install dirmngr apt -y install dirmngr
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add - wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
apt -y install tuned apt -y install tuned
tuned-adm profile latency-performance tuned-adm profile latency-performance
fi
apt-get -y update apt-get -y update
apt-get -y upgrade apt-get -y upgrade
apt-get -y autoremove apt-get -y autoremove
@ -288,17 +264,13 @@ repositories_setup(){
apt-get -y install curl apt-get -y install curl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ]; then
if [ "$lsb_dist" = "fedora" ] ; then if [ "$lsb_dist" = "fedora" ] ; then
if [ "$dist_version" = "34" ]; then
dnf -y install http://rpms.remirepo.net/fedora/remi-release-34.rpm dnf -y install http://rpms.remirepo.net/fedora/remi-release-34.rpm
elif [ "$dist_version" = "33" ]; then
dnf -y install http://rpms.remirepo.net/fedora/remi-release-33.rpm
fi
dnf -y install dnf-plugins-core python2 libsemanage-devel dnf -y install dnf-plugins-core python2 libsemanage-devel
dnf config-manager --set-enabled remi dnf config-manager --set-enabled remi
dnf -y module enable php:remi-8.0 dnf -y module enable php:remi-8.0
dnf -y module enable nginx:mainline/common dnf -y module enable nginx:mainline/common
dnf -y module enable mariadb:14/server dnf -y module enable mariadb:14/server
elif [ "$lsb_dist" = "centos" ] && [ "$dist_version" = "8" ]; then elif [ "$lsb_dist" = "centos" ]; then
dnf -y install epel-release boost-program-options dnf -y install epel-release boost-program-options
dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf config-manager --set-enabled remi dnf config-manager --set-enabled remi
@ -353,11 +325,7 @@ EOF
install_dependencies(){ install_dependencies(){
output "Installing dependencies..." output "Installing dependencies..."
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
if [ "$webserver" = "1" ]; then
apt -y install php8.0 php8.0-{cli,gd,mysql,pdo,mbstring,tokenizer,bcmath,xml,fpm,curl,zip} nginx tar unzip git redis-server nginx git wget expect apt -y install php8.0 php8.0-{cli,gd,mysql,pdo,mbstring,tokenizer,bcmath,xml,fpm,curl,zip} nginx tar unzip git redis-server nginx git wget expect
elif [ "$webserver" = "2" ]; then
apt -y install php8.0 php8.0-{cli,gd,mysql,pdo,mbstring,tokenizer,bcmath,xml,fpm,curl,zip} curl tar unzip git redis-server apache2 libapache2-mod-php8.0 redis-server git wget expect
fi
sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server" sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server"
else else
if [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then if [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
@ -368,11 +336,7 @@ install_dependencies(){
dnf -y install MariaDB-server dnf -y install MariaDB-server
fi fi
dnf -y module install php:remi-8.0 dnf -y module install php:remi-8.0
if [ "$webserver" = "1" ]; then
dnf -y install redis nginx git policycoreutils-python-utils unzip wget expect jq php-mysql php-zip php-bcmath tar dnf -y install redis nginx git policycoreutils-python-utils unzip wget expect jq php-mysql php-zip php-bcmath tar
elif [ "$webserver" = "2" ]; then
dnf -y install redis httpd git policycoreutils-python-utils mod_ssl unzip wget expect jq php-mysql php-zip php-mcmath tar
fi
fi fi
output "Enabling Services..." output "Enabling Services..."
@ -389,21 +353,8 @@ install_dependencies(){
fi fi
systemctl enable cron systemctl enable cron
systemctl enable mariadb systemctl enable --now mariadb
systemctl enable --now nginx
if [ "$webserver" = "1" ]; then
systemctl enable nginx
service nginx start
elif [ "$webserver" = "2" ]; then
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
systemctl enable apache2
service apache2 start
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
systemctl enable httpd
service httpd start
fi
fi
service mysql start
} }
install_pterodactyl() { install_pterodactyl() {
@ -474,11 +425,7 @@ install_pterodactyl() {
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
chown -R www-data:www-data * /var/www/pterodactyl chown -R www-data:www-data * /var/www/pterodactyl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
if [ "$webserver" = "1" ]; then
chown -R nginx:nginx * /var/www/pterodactyl chown -R nginx:nginx * /var/www/pterodactyl
elif [ "$webserver" = "2" ]; then
chown -R apache:apache * /var/www/pterodactyl
fi
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?" semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?"
restorecon -R /var/www/pterodactyl restorecon -R /var/www/pterodactyl
fi fi
@ -501,7 +448,6 @@ ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,stan
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
if [ "$webserver" = "1" ]; then
cat > /etc/systemd/system/pteroq.service <<- 'EOF' cat > /etc/systemd/system/pteroq.service <<- 'EOF'
Description=Pterodactyl Queue Worker Description=Pterodactyl Queue Worker
After=redis-server.service After=redis-server.service
@ -513,20 +459,6 @@ ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,stan
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
elif [ "$webserver" = "2" ]; then
cat > /etc/systemd/system/pteroq.service <<- 'EOF'
[Unit]
Description=Pterodactyl Queue Worker
After=redis-server.service
[Service]
User=apache
Group=apache
Restart=always
ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
[Install]
WantedBy=multi-user.target
EOF
fi
setsebool -P httpd_can_network_connect 1 setsebool -P httpd_can_network_connect 1
setsebool -P httpd_execmem 1 setsebool -P httpd_execmem 1
setsebool -P httpd_unified 1 setsebool -P httpd_unified 1
@ -549,7 +481,6 @@ upgrade_pterodactyl(){
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
chown -R www-data:www-data * /var/www/pterodactyl chown -R www-data:www-data * /var/www/pterodactyl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
chown -R apache:apache * /var/www/pterodactyl
chown -R nginx:nginx * /var/www/pterodactyl chown -R nginx:nginx * /var/www/pterodactyl
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?" semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?"
restorecon -R /var/www/pterodactyl restorecon -R /var/www/pterodactyl
@ -650,38 +581,6 @@ server {
service nginx restart service nginx restart
} }
apache_config() {
output "Disabling default configuration..."
rm -rf /etc/nginx/sites-enabled/default
output "Configuring Apache2 web server..."
echo '
<VirtualHost *:80>
ServerName '"$FQDN"'
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</VirtualHost>
<VirtualHost *:443>
ServerName '"$FQDN"'
DocumentRoot "/var/www/pterodactyl/public"
AllowEncodedSlashes On
php_value upload_max_filesize 100M
php_value post_max_size 100M
<Directory "/var/www/pterodactyl/public">
AllowOverride all
</Directory>
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/'"$FQDN"'/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/'"$FQDN"'/privkey.pem
</VirtualHost>
' | sudo -E tee /etc/apache2/sites-available/pterodactyl.conf >/dev/null 2>&1
ln -s /etc/apache2/sites-available/pterodactyl.conf /etc/apache2/sites-enabled/pterodactyl.conf
a2enmod ssl
a2enmod rewrite
service apache2 restart
}
nginx_config_redhat(){ nginx_config_redhat(){
output "Configuring Nginx web server..." output "Configuring Nginx web server..."
@ -775,30 +674,6 @@ server {
restorecon -R /var/www/pterodactyl restorecon -R /var/www/pterodactyl
} }
apache_config_redhat() {
output "Configuring Apache2 web server..."
echo '
<VirtualHost *:80>
ServerName '"$FQDN"'
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</VirtualHost>
<VirtualHost *:443>
ServerName '"$FQDN"'
DocumentRoot "/var/www/pterodactyl/public"
AllowEncodedSlashes On
<Directory "/var/www/pterodactyl/public">
AllowOverride all
</Directory>
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/'"$FQDN"'/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/'"$FQDN"'/privkey.pem
</VirtualHost>
' | sudo -E tee /etc/httpd/conf.d/pterodactyl.conf >/dev/null 2>&1
service httpd restart
}
php_config(){ php_config(){
output "Configuring PHP socket..." output "Configuring PHP socket..."
bash -c 'cat > /etc/php-fpm.d/www-pterodactyl.conf' <<-'EOF' bash -c 'cat > /etc/php-fpm.d/www-pterodactyl.conf' <<-'EOF'
@ -819,51 +694,11 @@ EOF
webserver_config(){ webserver_config(){
if [ "$lsb_dist" = "debian" ] || [ "$lsb_dist" = "ubuntu" ]; then if [ "$lsb_dist" = "debian" ] || [ "$lsb_dist" = "ubuntu" ]; then
if [ "$installoption" = "1" ]; then
if [ "$webserver" = "1" ]; then
nginx_config nginx_config
elif [ "$webserver" = "2" ]; then
apache_config
fi
elif [ "$installoption" = "2" ]; then
if [ "$webserver" = "1" ]; then
nginx_config_0.7.19
elif [ "$webserver" = "2" ]; then
apache_config
fi
elif [ "$installoption" = "3" ]; then
if [ "$webserver" = "1" ]; then
nginx_config
elif [ "$webserver" = "2" ]; then
apache_config
fi
elif [ "$installoption" = "4" ]; then
if [ "$webserver" = "1" ]; then
nginx_config_0.7.19
elif [ "$webserver" = "2" ]; then
apache_config
fi
elif [ "$installoption" = "5" ]; then
if [ "$webserver" = "1" ]; then
nginx_config
elif [ "$webserver" = "2" ]; then
apache_config
fi
elif [ "$installoption" = "6" ]; then
if [ "$webserver" = "1" ]; then
nginx_config_0.7.19
elif [ "$webserver" = "2" ]; then
apache_config
fi
fi
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
if [ "$webserver" = "1" ]; then
php_config php_config
nginx_config_redhat nginx_config_redhat
chown -R nginx:nginx /var/lib/php/session chown -R nginx:nginx /var/lib/php/session
elif [ "$webserver" = "2" ]; then
apache_config_redhat
fi
fi fi
} }
@ -1059,7 +894,6 @@ EOF
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
chown -R www-data:www-data * /var/www/pterodactyl chown -R www-data:www-data * /var/www/pterodactyl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
chown -R apache:apache * /var/www/pterodactyl
chown -R nginx:nginx * /var/www/pterodactyl chown -R nginx:nginx * /var/www/pterodactyl
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?" semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?"
restorecon -R /var/www/pterodactyl restorecon -R /var/www/pterodactyl
@ -1074,16 +908,7 @@ ssl_certs(){
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
yum -y install certbot yum -y install certbot
fi fi
if [ "$webserver" = "1" ]; then
service nginx stop service nginx stop
elif [ "$webserver" = "2" ]; then
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
service apache2 stop
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
service httpd stop
fi
fi
certbot certonly --standalone --email "$email" --agree-tos -d "$FQDN" --non-interactive certbot certonly --standalone --email "$email" --agree-tos -d "$FQDN" --non-interactive
if [ "$installoption" = "2" ]; then if [ "$installoption" = "2" ]; then
@ -1094,62 +919,24 @@ ssl_certs(){
firewall-cmd --reload firewall-cmd --reload
fi fi
else else
if [ "$webserver" = "1" ]; then
service nginx restart service nginx restart
elif [ "$webserver" = "2" ]; then
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
service apache2 restart
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
service httpd restart
fi
fi
fi fi
if [ "$lsb_dist" = "debian" ] || [ "$lsb_dist" = "ubuntu" ]; then if [ "$lsb_dist" = "debian" ] || [ "$lsb_dist" = "ubuntu" ]; then
if [ "$installoption" = "1" ]; then if [ "$installoption" = "1" ]; then
if [ "$webserver" = "1" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service nginx stop" --post-hook "service nginx restart" >> /dev/null 2>&1')| crontab - (crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service nginx stop" --post-hook "service nginx restart" >> /dev/null 2>&1')| crontab -
elif [ "$webserver" = "2" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service apache2 stop" --post-hook "service apache2 restart" >> /dev/null 2>&1')| crontab -
fi
elif [ "$installoption" = "2" ]; then elif [ "$installoption" = "2" ]; then
if [ "$webserver" = "1" ]; then (crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "ufw allow 80" --pre-hook "service wings stop" --post-hook "ufw deny 80" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab -
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service nginx stop" --post-hook "service nginx restart" >> /dev/null 2>&1')| crontab -
elif [ "$webserver" = "2" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service apache2 stop" --post-hook "service apache2 restart" >> /dev/null 2>&1')| crontab -
fi
elif [ "$installoption" = "3" ]; then elif [ "$installoption" = "3" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "ufw allow 80" --pre-hook "service wings stop" --post-hook "ufw deny 80" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab -
elif [ "$installoption" = "4" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "ufw allow 80" --pre-hook "service wings stop" --post-hook "ufw deny 80" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab -
elif [ "$installoption" = "5" ]; then
if [ "$webserver" = "1" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service nginx stop" --pre-hook "service wings stop" --post-hook "service nginx restart" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab - (crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service nginx stop" --pre-hook "service wings stop" --post-hook "service nginx restart" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab -
elif [ "$webserver" = "2" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service apache2 stop" --pre-hook "service wings stop" --post-hook "service apache2 restart" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab -
fi
elif [ "$installoption" = "6" ]; then
if [ "$webserver" = "1" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service nginx stop" --pre-hook "service wings stop" --post-hook "service nginx restart" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab -
elif [ "$webserver" = "2" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service apache2 stop" --pre-hook "service wings stop" --post-hook "service apache2 restart" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab -
fi
fi fi
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
if [ "$installoption" = "1" ]; then if [ "$installoption" = "1" ]; then
if [ "$webserver" = "1" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service nginx stop" --post-hook "service nginx restart" >> /dev/null 2>&1')| crontab - (crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service nginx stop" --post-hook "service nginx restart" >> /dev/null 2>&1')| crontab -
elif [ "$webserver" = "2" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service httpd stop" --post-hook "service httpd restart" >> /dev/null 2>&1')| crontab -
fi
elif [ "$installoption" = "2" ]; then elif [ "$installoption" = "2" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "firewall-cmd --add-port=80/tcp && firewall-cmd --reload" --pre-hook "service wings stop" --post-hook "firewall-cmd --remove-port=80/tcp && firewall-cmd --reload" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab - (crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "firewall-cmd --add-port=80/tcp && firewall-cmd --reload" --pre-hook "service wings stop" --post-hook "firewall-cmd --remove-port=80/tcp && firewall-cmd --reload" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab -
elif [ "$installoption" = "3" ]; then elif [ "$installoption" = "3" ]; then
if [ "$webserver" = "1" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service nginx stop" --pre-hook "service wings stop" --post-hook "service nginx restart" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab - (crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service nginx stop" --pre-hook "service wings stop" --post-hook "service nginx restart" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab -
elif [ "$webserver" = "2" ]; then
(crontab -l ; echo '0 0,12 * * * certbot renew --pre-hook "service httpd stop" --pre-hook "service wings stop" --post-hook "service httpd restart" --post-hook "service wings restart" >> /dev/null 2>&1')| crontab -
fi
fi fi
fi fi
} }
@ -1393,8 +1180,7 @@ broadcast_database(){
preflight preflight
install_options install_options
case $installoption in case $installoption in
1) webserver_options 1) repositories_setup
repositories_setup
required_infos required_infos
firewall firewall
setup_pterodactyl setup_pterodactyl
@ -1409,8 +1195,7 @@ case $installoption in
broadcast broadcast
broadcast_database broadcast_database
;; ;;
3) webserver_options 3) repositories_setup
repositories_setup
required_infos required_infos
firewall firewall
ssl_certs ssl_certs