#!/bin/bash # scripts/instalar_ssl.sh # Script para instalar Certbot y obtener certificado SSL para ns8.frlr.utn.edu.ar DOMAIN="ns8.frlr.utn.edu.ar" EMAIL="admin@ns8.frlr.utn.edu.ar" # Ajustar si es necesario, Certbot pedirá uno real interactivo o usará este RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' if [ "$EUID" -ne 0 ]; then echo -e "${RED}Ejecutar con sudo.${NC}" exit 1 fi echo -e "${YELLOW}[1/4] Instalando Certbot y plugin Nginx...${NC}" apt-get update apt-get install -y certbot python3-certbot-nginx echo -e "${YELLOW}[2/4] Activando configuración del dominio $DOMAIN...${NC}" # Enlazar la nueva config si no existe ln -sf /home/rmonla/Documentos/GitHub/dtic-DIIAA/servicios/nginx/conf.d/ns8.conf /etc/nginx/conf.d/ns8.conf echo -e "${YELLOW}[3/4] Verificando y Recargando Nginx...${NC}" nginx -t && systemctl reload nginx echo -e "${YELLOW}[4/4] Ejecutando Certbot...${NC}" echo "Sigue las instrucciones en pantalla (ingresa tu email si se solicita)." certbot --nginx -d $DOMAIN echo -e "${GREEN}Proceso finalizado.${NC}" echo "Prueba acceder a https://$DOMAIN"