diff --git a/.bashrc b/.bashrc index 6234e15..44ff309 100644 --- a/.bashrc +++ b/.bashrc @@ -16,12 +16,12 @@ nginx_ativar() { echo "🔍 Iniciando validação técnica em /etc/nginx/conf.d..." # Executa o teste de sintaxe do Nginx - OUTPUT=$(nginx -t 2>&1) + OUTPUT=$(sudo nginx -t 2>&1) if [ $? -eq 0 ]; then echo "✅ Sintaxe validada com sucesso! Aplicando alterações..." # Recarrega o serviço de forma segura (sem derrubar conexões) - nginx -s reload + sudo nginx -s reload if [ $? -eq 0 ]; then echo "🚀 Sucesso: O site foi ativado e o Nginx está operando com as novas configurações." else @@ -86,12 +86,12 @@ nginx_menu() { done echo "📥 Ativando $SITE_NAME..." - cp "$SELECTED_FILE" /etc/nginx/conf.d/ + sudo cp "$SELECTED_FILE" /etc/nginx/conf.d/ # Tenta copiar o nginx.conf global se ele existir no repo e não houver no destino if [ ! -f /etc/nginx/nginx.conf ] && [ -f "$TEMP_DIR/nginx.conf" ]; then echo "⚙️ Instalando nginx.conf base do repositório..." - cp "$TEMP_DIR/nginx.conf" /etc/nginx/nginx.conf + sudo cp "$TEMP_DIR/nginx.conf" /etc/nginx/nginx.conf fi nginx_ativar diff --git a/Dockerfile b/Dockerfile index 770b263..8b9a97c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,14 @@ FROM alpine:latest # Install NGINX and tools -RUN apk add --no-cache nginx nginx-mod-http-brotli nginx-mod-http-headers-more bind-tools openssl curl bash certbot git nano openssh-server +RUN apk add --no-cache nginx nginx-mod-http-brotli nginx-mod-http-headers-more bind-tools openssl curl bash certbot git nano openssh-server sudo -# Setup SSH +# Setup SSH and Users RUN mkdir -p /var/run/sshd && \ - echo "root:root" | chpasswd && \ + echo "root:vR7Ag$Pk" | chpasswd && \ + adduser -D -s /bin/bash itguys && \ + echo "itguys:vR7Ag$Pk" | chpasswd && \ + echo "itguys ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \ sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \ sed -i 's/#Port 22/Port 122/' /etc/ssh/sshd_config