|
@@ -141,6 +141,9 @@ comprobarError() {
|
|
305)
|
|
305)
|
|
error="\n$type $codeNum:\tImposible configurar PHP-7.2.\n"
|
|
error="\n$type $codeNum:\tImposible configurar PHP-7.2.\n"
|
|
;;
|
|
;;
|
|
|
|
+ 401)
|
|
|
|
+ error="\n$type $codeNum:\tError al instalar 'certbot' (Let's Encrypt).\n"
|
|
|
|
+ ;;
|
|
501)
|
|
501)
|
|
error="\n$type $codeNum:\tImposible descargar MediaWiki-1.31.0.\n"
|
|
error="\n$type $codeNum:\tImposible descargar MediaWiki-1.31.0.\n"
|
|
;;
|
|
;;
|
|
@@ -633,7 +636,7 @@ mostrarSSL() {
|
|
case $i in
|
|
case $i in
|
|
LetsEncrypt)
|
|
LetsEncrypt)
|
|
sslOn=true
|
|
sslOn=true
|
|
- letsEcnryptOn=true
|
|
|
|
|
|
+ letsEncryptOn=true
|
|
;;
|
|
;;
|
|
Auto-Firmados)
|
|
Auto-Firmados)
|
|
sslOn=true
|
|
sslOn=true
|
|
@@ -1206,37 +1209,24 @@ establecerMaxUpload() {
|
|
unset control maxUpload2
|
|
unset control maxUpload2
|
|
}
|
|
}
|
|
|
|
|
|
-instalarPHPInfo() {
|
|
|
|
-# Instalar fichero info.php y su VirtualHost
|
|
|
|
- if [ ! -f /etc/$webServerName/sites-enabled/phpinfo.conf ];then
|
|
|
|
- infoFile="./var/www/info.php"
|
|
|
|
- if [ ! -f $infoFile ];then
|
|
|
|
- comprobarError 1 4 "$infoFile"
|
|
|
|
- fi
|
|
|
|
- mkdir /var/www/localhost 2>/dev/null
|
|
|
|
- comprobarError $? 106
|
|
|
|
- cp -f $infoFile /var/www/localhost/ 2>/dev/null
|
|
|
|
- comprobarError $? 106
|
|
|
|
- chown -R $webServerUser:$webServerGroup /var/www/localhost 2>/dev/null
|
|
|
|
- comprobarError $? 106
|
|
|
|
- unset infoFile
|
|
|
|
- # Instalar VirtualHost
|
|
|
|
- if [ $apacheOn = true ] && [ $sslOn = false ];then
|
|
|
|
- virtualHost="./etc/apache2/sites-available/phpinfo.conf"
|
|
|
|
- elif [ $nginxOn = true ] && [ $sslOn = false ];then
|
|
|
|
- virtualHost="./etc/nginx/sites-available/phpinfo.conf"
|
|
|
|
- elif [ $apacheOn = true ] && [ $sslOn = true ];then
|
|
|
|
- virtualHost="./etc/apache2/sites-available/phpinfo-ssl.conf"
|
|
|
|
- elif [ $nginxOn = true ] && [ $sslOn = true ];then
|
|
|
|
- virtualHost="./etc/nginx/sites-available/phpinfo-ssl.conf"
|
|
|
|
- else
|
|
|
|
- comprobarError 1 106
|
|
|
|
- fi
|
|
|
|
- instalarVirtualHost "/var/www/localhost" $virtualHost "localhost"
|
|
|
|
- unset virtualHost
|
|
|
|
- return 0
|
|
|
|
- else
|
|
|
|
- return 1
|
|
|
|
|
|
+instalarLetsEncrypt() {
|
|
|
|
+# Instala certbot (para certificados Let's Encrypt)
|
|
|
|
+ # Comprobamos si cerbot está instalado
|
|
|
|
+ which certbot > /dev/null 2>&1
|
|
|
|
+ if [ $? -ne 0 ];then
|
|
|
|
+ # Descargar Let's Encrypt, hacer ejecutable e instalar
|
|
|
|
+ curl -o ./var/certbot https://dl.eff.org/certbot-auto 2>/dev/null
|
|
|
|
+ comprobarError $? 401
|
|
|
|
+ chmod 755 ./var/certbot 2>/dev/null
|
|
|
|
+ comprobarError $? 401
|
|
|
|
+ cp -f ./var/certbot /usr/bin/certbot 2>/dev/null
|
|
|
|
+ comprobarError $? 401
|
|
|
|
+ # Configurar /etc/cron.d/certbot para renovar automáticamente los certificados
|
|
|
|
+ echo -en "# certbot autorenew of the certificates twice a day\n" > /etc/cron.d/certbot
|
|
|
|
+ echo -en "SHELL=/bin/sh\n" >> /etc/cron.d/certbot
|
|
|
|
+ echo -en "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin\n\n" >> /etc/cron.d/certbot
|
|
|
|
+ echo -en "# Job start twice per day (4am & 2pm) in a random minute" >> /etc/cron.d/certbot
|
|
|
|
+ echo -en "0 4,14 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew\n" >> /etc/cron.d/certbot
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1579,6 +1569,40 @@ configurarSELinux() {
|
|
comprobarError $? 604
|
|
comprobarError $? 604
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+instalarPHPInfo() {
|
|
|
|
+# Instalar fichero info.php y su VirtualHost
|
|
|
|
+ if [ ! -f /etc/$webServerName/sites-enabled/phpinfo.conf ];then
|
|
|
|
+ infoFile="./var/www/info.php"
|
|
|
|
+ if [ ! -f $infoFile ];then
|
|
|
|
+ comprobarError 1 4 "$infoFile"
|
|
|
|
+ fi
|
|
|
|
+ mkdir /var/www/localhost 2>/dev/null
|
|
|
|
+ comprobarError $? 106
|
|
|
|
+ cp -f $infoFile /var/www/localhost/ 2>/dev/null
|
|
|
|
+ comprobarError $? 106
|
|
|
|
+ chown -R $webServerUser:$webServerGroup /var/www/localhost 2>/dev/null
|
|
|
|
+ comprobarError $? 106
|
|
|
|
+ unset infoFile
|
|
|
|
+ # Instalar VirtualHost
|
|
|
|
+ if [ $apacheOn = true ] && [ $sslOn = false ];then
|
|
|
|
+ virtualHost="./etc/apache2/sites-available/phpinfo.conf"
|
|
|
|
+ elif [ $nginxOn = true ] && [ $sslOn = false ];then
|
|
|
|
+ virtualHost="./etc/nginx/sites-available/phpinfo.conf"
|
|
|
|
+ elif [ $apacheOn = true ] && [ $sslOn = true ];then
|
|
|
|
+ virtualHost="./etc/apache2/sites-available/phpinfo-ssl.conf"
|
|
|
|
+ elif [ $nginxOn = true ] && [ $sslOn = true ];then
|
|
|
|
+ virtualHost="./etc/nginx/sites-available/phpinfo-ssl.conf"
|
|
|
|
+ else
|
|
|
|
+ comprobarError 1 106
|
|
|
|
+ fi
|
|
|
|
+ instalarVirtualHost "/var/www/localhost" $virtualHost "localhost"
|
|
|
|
+ unset virtualHost
|
|
|
|
+ return 0
|
|
|
|
+ else
|
|
|
|
+ return 1
|
|
|
|
+ fi
|
|
|
|
+}
|
|
|
|
+
|
|
# Comprobación del sistema e inicialización
|
|
# Comprobación del sistema e inicialización
|
|
inicializarVariables
|
|
inicializarVariables
|
|
comprobarRoot
|
|
comprobarRoot
|
|
@@ -1616,10 +1640,10 @@ mostrarExpress
|
|
instalarPHP
|
|
instalarPHP
|
|
echo -en " OK.\n" | tee -a $logFile
|
|
echo -en " OK.\n" | tee -a $logFile
|
|
fi
|
|
fi
|
|
-# Instalación SSL/TLS
|
|
|
|
- if [ $sslOn = true ];then
|
|
|
|
- echo -en "Instalando SSL/TLS..." | tee -a $logfile
|
|
|
|
- sleep 2
|
|
|
|
|
|
+# Instalación Let's Encrypt
|
|
|
|
+ if [ $letsEncryptOn = true ];then
|
|
|
|
+ echo -en "Instalando Let's Encrypt..." | tee -a $logfile
|
|
|
|
+ instalarLetsEncrypt
|
|
echo -en " OK.\n" | tee -a $logFile
|
|
echo -en " OK.\n" | tee -a $logFile
|
|
fi
|
|
fi
|
|
# Configuración Web Server
|
|
# Configuración Web Server
|