mirror of
https://github.com/tommytran732/Pterodactyl-Script
synced 2024-11-22 10:31:34 -05:00
Added MariaDB SSL
This commit is contained in:
parent
b0f12401ba
commit
e55b1e13cc
36
install.sh
36
install.sh
@ -331,31 +331,46 @@ install_pterodactyl() {
|
|||||||
SQL="${Q0}${Q1}${Q2}${Q3}${Q4}${Q5}${Q6}${Q7}${Q8}${Q9}"
|
SQL="${Q0}${Q1}${Q2}${Q3}${Q4}${Q5}${Q6}${Q7}${Q8}${Q9}"
|
||||||
mysql -u root -e "$SQL"
|
mysql -u root -e "$SQL"
|
||||||
|
|
||||||
output "Binding MariaDB/MySQL to 0.0.0.0."
|
output "Binding MariaDB/MySQL to 0.0.0.0"
|
||||||
if grep -Fqs "bind-address" /etc/mysql/mariadb.conf.d/50-server.cnf ; then
|
if grep -Fqs "bind-address" /etc/mysql/mariadb.conf.d/50-server.cnf ; then
|
||||||
sed -i -- '/bind-address/s/#//g' /etc/mysql/mariadb.conf.d/50-server.cnf
|
sed -i -- '/bind-address/s/#//g' /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||||
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/mariadb.conf.d/50-server.cnf
|
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||||
output 'Restarting MySQL process...'
|
sed -i '/\[mysqld\]/a ssl-key=/etc/letsencrypt/live/'"${FQDN}"'/privkey.pem' /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||||
|
sed -i '/\[mysqld\]/a ssl-ca=/etc/letsencrypt/live/'"${FQDN}"'/chain.pem' /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||||
|
sed -i '/\[mysqld\]/a ssl-cert=/etc/letsencrypt/live/'"${FQDN}"'/cert.pem' /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||||
|
output 'Restarting MariaDB process...'
|
||||||
service mariadb restart
|
service mariadb restart
|
||||||
elif grep -Fqs "bind-address" /etc/mysql/my.cnf ; then
|
elif grep -Fqs "bind-address" /etc/mysql/my.cnf ; then
|
||||||
sed -i -- '/bind-address/s/#//g' /etc/mysql/my.cnf
|
sed -i -- '/bind-address/s/#//g' /etc/mysql/my.cnf
|
||||||
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
|
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
|
||||||
output 'Restarting MySQL process...'
|
sed -i '/\[mysqld\]/a ssl-key=/etc/letsencrypt/live/'"${FQDN}"'/privkey.pem' /etc/mysql/my.cnf
|
||||||
|
sed -i '/\[mysqld\]/a ssl-ca=/etc/letsencrypt/live/'"${FQDN}"'/chain.pem' /etc/mysql/my.cnf
|
||||||
|
sed -i '/\[mysqld\]/a ssl-cert=/etc/letsencrypt/live/'"${FQDN}"'/cert.pem' /etc/mysql/my.cnf
|
||||||
|
output 'Restarting MariaDB process...'
|
||||||
service mariadb restart
|
service mariadb restart
|
||||||
elif grep -Fqs "bind-address" /etc/my.cnf ; then
|
elif grep -Fqs "bind-address" /etc/my.cnf ; then
|
||||||
sed -i -- '/bind-address/s/#//g' /etc/my.cnf
|
sed -i -- '/bind-address/s/#//g' /etc/my.cnf
|
||||||
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/my.cnf
|
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/my.cnf
|
||||||
output 'Restarting MySQL process...'
|
sed -i '/\[mysqld\]/a ssl-key=/etc/letsencrypt/live/'"${FQDN}"'/privkey.pem' /etc/my.cnf
|
||||||
|
sed -i '/\[mysqld\]/a ssl-ca=/etc/letsencrypt/live/'"${FQDN}"'/chain.pem' /etc/my.cnf
|
||||||
|
sed -i '/\[mysqld\]/a ssl-cert=/etc/letsencrypt/live/'"${FQDN}"'/cert.pem' /etc/my.cnf
|
||||||
|
output 'Restarting MariaDB process...'
|
||||||
service mariadb restart
|
service mariadb restart
|
||||||
elif grep -Fqs "bind-address" /etc/mysql/my.conf.d/mysqld.cnf ; then
|
elif grep -Fqs "bind-address" /etc/mysql/my.conf.d/mysqld.cnf ; then
|
||||||
sed -i -- '/bind-address/s/#//g' /etc/mysql/my.conf.d/mysqld.cnf
|
sed -i -- '/bind-address/s/#//g' /etc/mysql/my.conf.d/mysqld.cnf
|
||||||
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/my.conf.d/mysqld.cnf
|
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/my.conf.d/mysqld.cnf
|
||||||
output 'Restarting MySQL process...'
|
sed -i '/\[mysqld\]/a ssl-key=/etc/letsencrypt/live/'"${FQDN}"'/privkey.pem' /etc/mysql/my.conf.d/mysqld.cnf
|
||||||
|
sed -i '/\[mysqld\]/a ssl-ca=/etc/letsencrypt/live/'"${FQDN}"'/chain.pem' /etc/mysql/my.conf.d/mysqld.cnf
|
||||||
|
sed -i '/\[mysqld\]/a ssl-cert=/etc/letsencrypt/live/'"${FQDN}"'/cert.pem' /etc/mysql/my.conf.d/mysqld.cnf
|
||||||
|
output 'Restarting MariaDB process...'
|
||||||
service mariadb restart
|
service mariadb restart
|
||||||
elif grep -Fqs "bind-address" /etc/my.cnf.d/mariadb-server.cnf ; then
|
elif grep -Fqs "bind-address" /etc/my.cnf.d/mariadb-server.cnf ; then
|
||||||
sed -i -- '/bind-address/s/#//g' /etc/my.cnf.d/mariadb-server.cnf
|
sed -i -- '/bind-address/s/#//g' /etc/my.cnf.d/mariadb-server.cnf
|
||||||
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/my.cnf.d/mariadb-server.cnf
|
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/my.cnf.d/mariadb-server.cnf
|
||||||
output 'Restarting MySQL process...'
|
sed -i '/\[mysqld\]/a ssl-key=/etc/letsencrypt/live/'"${FQDN}"'/privkey.pem' /etc/my.cnf.d/mariadb-server.cnf
|
||||||
|
sed -i '/\[mysqld\]/a ssl-ca=/etc/letsencrypt/live/'"${FQDN}"'/chain.pem' /etc/my.cnf.d/mariadb-server.cnf
|
||||||
|
sed -i '/\[mysqld\]/a ssl-cert=/etc/letsencrypt/live/'"${FQDN}"'/cert.pem' /etc/my.cnf.d/mariadb-server.cnf
|
||||||
|
output 'Restarting MariaDB process...'
|
||||||
service mariadb restart
|
service mariadb restart
|
||||||
else
|
else
|
||||||
output 'A MariaDB configuration file could not be detected! Please contact support.'
|
output 'A MariaDB configuration file could not be detected! Please contact support.'
|
||||||
@ -745,6 +760,8 @@ install_phpmyadmin(){
|
|||||||
\$cfg['Servers'][\$i]['auth_type'] = 'cookie';
|
\$cfg['Servers'][\$i]['auth_type'] = 'cookie';
|
||||||
\$cfg['Servers'][\$i]['user'] = 'root';
|
\$cfg['Servers'][\$i]['user'] = 'root';
|
||||||
\$cfg['Servers'][\$i]['password'] = '';
|
\$cfg['Servers'][\$i]['password'] = '';
|
||||||
|
\$cfg['Servers'][$i]['ssl'] = true;
|
||||||
|
\$cfg['ForceSSL'] = true;
|
||||||
/* End of servers configuration */
|
/* End of servers configuration */
|
||||||
\$cfg['blowfish_secret'] = '${BOWFISH}';
|
\$cfg['blowfish_secret'] = '${BOWFISH}';
|
||||||
\$cfg['DefaultLang'] = 'en';
|
\$cfg['DefaultLang'] = 'en';
|
||||||
@ -768,11 +785,13 @@ EOF
|
|||||||
\$i++;
|
\$i++;
|
||||||
\$cfg['Servers'][\$i]['verbose'] = 'MariaDB';
|
\$cfg['Servers'][\$i]['verbose'] = 'MariaDB';
|
||||||
\$cfg['Servers'][\$i]['host'] = '${SERVER_IP}';
|
\$cfg['Servers'][\$i]['host'] = '${SERVER_IP}';
|
||||||
\$cfg['Servers'][\$i]['port'] = '';
|
\$cfg['Servers'][\$i]['port'] = '3306';
|
||||||
\$cfg['Servers'][\$i]['socket'] = '';
|
\$cfg['Servers'][\$i]['socket'] = '';
|
||||||
\$cfg['Servers'][\$i]['auth_type'] = 'cookie';
|
\$cfg['Servers'][\$i]['auth_type'] = 'cookie';
|
||||||
\$cfg['Servers'][\$i]['user'] = 'root';
|
\$cfg['Servers'][\$i]['user'] = 'root';
|
||||||
\$cfg['Servers'][\$i]['password'] = '';
|
\$cfg['Servers'][\$i]['password'] = '';
|
||||||
|
\$cfg['Servers'][$i]['ssl'] = true;
|
||||||
|
\$cfg['ForceSSL'] = true;
|
||||||
/* End of servers configuration */
|
/* End of servers configuration */
|
||||||
\$cfg['blowfish_secret'] = '${BOWFISH}';
|
\$cfg['blowfish_secret'] = '${BOWFISH}';
|
||||||
\$cfg['DefaultLang'] = 'en';
|
\$cfg['DefaultLang'] = 'en';
|
||||||
@ -806,6 +825,9 @@ ssl_certs(){
|
|||||||
dnf -y install python3-certbot-nginx
|
dnf -y install python3-certbot-nginx
|
||||||
fi
|
fi
|
||||||
certbot --nginx --redirect --no-eff-email --email "$email" --agree-tos -d "$FQDN"
|
certbot --nginx --redirect --no-eff-email --email "$email" --agree-tos -d "$FQDN"
|
||||||
|
setfacl -Rdm u:mysql:rx /etc/letsencrypt
|
||||||
|
setfacl -Rm u:mysql:rx /etc/letsencrypt
|
||||||
|
systemctl restart mariadb
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$installoption" = "2" ]; then
|
if [ "$installoption" = "2" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user