| 
					
				 | 
			
			
				@@ -513,7 +513,7 @@ inicializarVariables() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 instalacionExpress() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # Permite una instalación rápida, haciendo el menor número de preguntas 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	apacheOn=true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	nginxOn=true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	mariaDBOn=true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	phpOn=true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	sslOn=true 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -542,7 +542,7 @@ mostrarBienvenida() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 mostrarExpress() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # Pantalla de elección entre instalación express o avanzada 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	express=$(whiptail --title "INSTALACION EXPRESS" --radiolist "<ESPACIO>: seleccionar   <TAB>: cambiar   <FLECHAS>: moverse\n\nLa instalación express instala Apache2, MariaDB, PHP-7, Let's Encrypt, MediaWiki, Moodle y backups automático.\nSeleccione el tipo de instalación que desee:" $((ALTO * 9 / 10)) $((ANCHO * 9 / 10)) 2 \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	express=$(whiptail --title "INSTALACION EXPRESS" --radiolist "<ESPACIO>: seleccionar   <TAB>: cambiar   <FLECHAS>: moverse\n\nLa instalación express instala Nginx, MariaDB, PHP-7, Let's Encrypt, MediaWiki, Moodle y backups automático.\nSeleccione el tipo de instalación que desee:" $((ALTO * 9 / 10)) $((ANCHO * 9 / 10)) 2 \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"Express" "Instalación rápida" ON \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"Avanzada" "Permite escoger todas las opciones disponibles" OFF \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	--ok-button "Continuar" --cancel-button "Salir" 3>&1 1>&2 2>&3) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -565,18 +565,18 @@ mostrarExpress() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 mostrarAvanzada() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # Pantalla que permite instalar un servidor LAMP o LEMP 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	webServer=$(whiptail --title "INSTALACION AVANZADA" --radiolist "<ESPACIO>: seleccionar   <TAB>: cambiar   <FLECHAS>: moverse\n\nEscoge el tipo de Servidor Web que quieres instalar:" $((ALTO * 9 / 10)) $((ANCHO * 9 / 10)) 2 \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	"LAMP" "GNU/Linux + Apache + MySQL/MariaDB + PHP-7" ON \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	"LEMP" "GNU/Linux + Nginx + MySQL/MariaDB + PHP-7" OFF \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	"LEMP" "GNU/Linux + (E)Nginx + MySQL/MariaDB + PHP-7" ON \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	"LAMP" "GNU/Linux + Apache + MySQL/MariaDB + PHP-7" OFF \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	--ok-button "Continuar" --cancel-button "Salir" 3>&1 1>&2 2>&3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	comprobarError $? 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	for i in $webServer; do 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		case $i in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			LAMP) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				apacheOn=true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				;; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			LEMP) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				nginxOn=true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				;; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			LAMP) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				apacheOn=true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				;; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			*) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				comprobarError 1 100 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				;; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1281,6 +1281,7 @@ generarCertAutofirmado() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	keyFile="$sslDir/$dominio.key" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	reqFile="$sslDir/$dominio.csr" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	certFile="$sslDir/$dominio.crt" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	dhParamFile="$sslDir/dhparam.pem" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if [ ! -d "$sslDir" ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		mkdir "$sslDir" 2>/dev/null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		comprobarError $? 5 "$sslDir" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1297,12 +1298,17 @@ generarCertAutofirmado() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	# Eliminamos petición 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	rm -f $reqFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	comprobarError $? 402 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	# Añadimos clave Diffie-Hellman al certificado 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if [ -f "$dhParamFile" ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		cat "$dhParamFile" >> $certFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		comprobarError $? 402 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	# Cambiamos permisos 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	chmod 644 $certFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	comprobarError $? 402 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	chmod 400 $keyFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	comprobarError $? 402 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	unset dominio sslDir keyFile reqFile certFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	unset dominio sslDir keyFile reqFile certFile dhParamFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 generarDHParam() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1310,7 +1316,7 @@ generarDHParam() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # Esto aumenta notablemente la seguridad de SSL/TLS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	sslDir="/etc/$webServerName/ssl" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	dhParamFile="$sslDir/dhparam.pem" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	apacheConfFile="" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#	apacheConfFile="" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	nginxConfFile="/etc/$webServerName/nginx.conf" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if [ ! -d "$sslDir" ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		mkdir "$sslDir" 2>/dev/null 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1319,21 +1325,25 @@ generarDHParam() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	openssl dhparam -out "$dhParamFile" 2048 >/dev/null 2>&1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	comprobarError $? 403 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	# Configuramos Servidor Web 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if [ $apacheOn = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if [ $debianOS = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			apacheConfFile="/etc/$webServerName/apache2.conf" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		elif [ $rhelOS = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			apacheConfFile="/etc/$webServerName/conf/httpd.conf" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			comprobarError 1 403 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		echo -en "\n# Set Stronger Diffie-Hellman key exchange\n" >> $apacheConfFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		echo -en "SSLOpenSSLConfCmd DHParameters \"$dhParamFile\"\n" >> $apacheConfFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	elif [ $nginxOn = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#	if [ $apacheOn = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#		if [ $debianOS = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#			apacheConfFile="/etc/$webServerName/apache2.conf" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#		elif [ $rhelOS = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#			# La version de httpd de RHEL no acepta SSLOpenSSLConfCmd 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#			# Solución: añadirlo al certificado 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#			apacheConfFile="/etc/$webServerName/conf/httpd.conf" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#		else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#			comprobarError 1 403 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#		fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#		echo -en "\n# Set Stronger Diffie-Hellman key exchange\n" >> $apacheConfFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#		echo -en "SSLOpenSSLConfCmd DHParameters \"$dhParamFile\"\n" >> $apacheConfFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#	el 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if [ $nginxOn = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		sed -i '/ssl_param /c\\tssl_dhparam '$dhParamFile';' $nginxConfFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		comprobarError $? 403 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	unset sslDir dhParamFile apacheConfFile nginxConfFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#	unset sslDir dhParamFile apacheConfFile nginxConfFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	unset sslDir dhParamFile nginxConfFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 habilitarServicio() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1788,6 +1798,9 @@ instalarPHPInfo() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # Configuración SSL/TLS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	# Generar certificados auto-firmados 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if [ $sslOn = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		echo -en "Generando claves de intercambio Diffie-Hellman (puede llevar un largo tiempo)..." | tee -a $logFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		generarDHParam 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		echo -en " OK.\n" | tee -a $logFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		echo -en "Generando Certificados Auto-Firmados..." | tee -a $logFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if [ $mediaWikiOn = true ];then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			generarCertAutofirmado $dominioMediaWiki 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1799,9 +1812,6 @@ instalarPHPInfo() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			generarCertAutofirmado "localhost" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		echo -en " OK.\n" | tee -a $logFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		echo -en "Generando claves de intercambio Diffie-Hellman (puede llevar un largo tiempo)..." | tee -a $logFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		generarDHParam 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		echo -en " OK.\n" | tee -a $logFile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # Arrancar y habilitar todos los servicios (SystemD, Service o SystemV) 
			 |