From 135dc56eb600320f64aac019adf30a2611072057 Mon Sep 17 00:00:00 2001 From: marcoitaloesp-ai Date: Wed, 17 Dec 2025 10:04:44 +0000 Subject: [PATCH] chore: Improve email anti-spam compliance and update server docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add proper email headers: X-Mailer, X-Priority, Precedence, List-Unsubscribe - Improve HTML template with XHTML doctype for better compatibility - Add compliance footer with unsubscribe link and address - Remove accented characters from email template (spam trigger) - Update CREDENCIAIS_SERVIDOR.md with: - Current service versions (PHP 8.4.15, Nginx 1.29.4, etc) - DNS anti-spam status (SPF ✅, DMARC ✅, DKIM ⚠️ pending) - DKIM key for DNS publication - Cron job documentation - New API endpoints (/preferences) --- CREDENCIAIS_SERVIDOR.md | 214 ++++++++++++------ backend/app/Mail/DuePaymentsAlert.php | 6 +- .../views/emails/due-payments-alert.blade.php | 31 ++- 3 files changed, 174 insertions(+), 77 deletions(-) diff --git a/CREDENCIAIS_SERVIDOR.md b/CREDENCIAIS_SERVIDOR.md index 86f82bf..59b67ec 100644 --- a/CREDENCIAIS_SERVIDOR.md +++ b/CREDENCIAIS_SERVIDOR.md @@ -2,7 +2,7 @@ > **⚠️ DOCUMENTO CONFIDENCIAL - NÃO COMPARTILHAR** > -> Última atualização: 07 de Dezembro de 2025 +> Última atualização: 17 de Dezembro de 2025 --- @@ -10,14 +10,14 @@ | Campo | Valor | |-------|-------| -| **Host** | `213.165.93.60` | -| **Usuário** | `root` | -| **Senha** | `Master9354` | -| **Porta** | `22` | +| **Host** | \`213.165.93.60\` | +| **Usuário** | \`root\` | +| **Senha** | \`Master9354\` | +| **Porta** | \`22\` | -```bash -ssh root@213.165.93.60 -``` +\`\`\`bash +sshpass -p 'Master9354' ssh -o StrictHostKeyChecking=no root@213.165.93.60 +\`\`\` --- @@ -35,15 +35,15 @@ ssh root@213.165.93.60 | URL | Descrição | Usuário | Senha | |-----|-----------|---------|-------| -| https://phpmyadmin.cnxifly.com | phpMyAdmin (Banco de Dados) | `root` | `M@ster9354` | -| https://mail.cnxifly.com | PostfixAdmin (Admin Email) | `admin@cnxifly.com` | `M@ster9354` | -| https://webmail.cnxifly.com | Roundcube (Webmail) | `marco@cnxifly.com` | `M@ster9354` | +| https://phpmyadmin.cnxifly.com | phpMyAdmin (Banco de Dados) | \`root\` | \`M@ster9354\` | +| https://mail.cnxifly.com | PostfixAdmin (Admin Email) | \`admin@cnxifly.com\` | \`M@ster9354\` | +| https://webmail.cnxifly.com | Roundcube (Webmail) | \`marco@cnxifly.com\` | \`M@ster9354\` | ### WEBMoney App (Login Sistema) | URL | Usuário | Senha | Descrição | |-----|---------|-------|-----------| -| https://webmoney.cnxifly.com | `marco@cnxifly.com` | `M@ster9354` | Administrador | +| https://webmoney.cnxifly.com | \`marco@cnxifly.com\` | \`M@ster9354\` | Administrador | --- @@ -53,49 +53,59 @@ ssh root@213.165.93.60 | Campo | Valor | |-------|-------| -| **Host** | `localhost` ou `127.0.0.1` | -| **Porta** | `3306` | -| **Usuário** | `root` | -| **Senha** | `M@ster9354` | +| **Host** | \`localhost\` ou \`127.0.0.1\` | +| **Porta** | \`3306\` | +| **Usuário** | \`root\` | +| **Senha** | \`M@ster9354\` | -```bash +\`\`\`bash mysql -u root -p'M@ster9354' -``` +# ou via SSH: +sshpass -p 'Master9354' ssh root@213.165.93.60 "mysql -u webmoney -p'M@ster9354' webmoney -e 'QUERY'" +\`\`\` ### Databases e Usuários | Database | Usuário | Senha | Descrição | |----------|---------|-------|-----------| -| `webmoney` | `webmoney` | `M@ster9354` | Aplicação principal | -| `postfixadmin` | `postfixadmin` | `M@ster9354` | Gerenciamento de emails | -| `roundcube` | `roundcube` | `M@ster9354` | Webmail | -| `phpmyadmin` | `phpmyadmin` | `M@ster9354` | Controle phpMyAdmin | +| \`webmoney\` | \`webmoney\` | \`M@ster9354\` | Aplicação principal | +| \`postfixadmin\` | \`postfixadmin\` | \`M@ster9354\` | Gerenciamento de emails | +| \`roundcube\` | \`roundcube\` | \`M@ster9354\` | Webmail | +| \`phpmyadmin\` | \`phpmyadmin\` | \`M@ster9354\` | Controle phpMyAdmin | --- ## 📧 SERVIDOR DE EMAIL +### Versões dos Serviços de Email + +| Serviço | Versão | +|---------|--------| +| Postfix | 3.8.6 | +| Dovecot | 2.3.21 | +| OpenDKIM | 2.11.0 | + ### Configuração SMTP/IMAP | Campo | Valor | |-------|-------| -| **Servidor** | `mail.cnxifly.com` | -| **SMTP Porta** | `587` (STARTTLS) | -| **SMTPS Porta** | `465` (SSL/TLS) | -| **IMAP Porta** | `993` (SSL/TLS) | +| **Servidor** | \`mail.cnxifly.com\` | +| **SMTP Porta** | \`587\` (STARTTLS) | +| **SMTPS Porta** | \`465\` (SSL/TLS) | +| **IMAP Porta** | \`993\` (SSL/TLS) | | **Autenticação** | Necessária | ### Contas de Email | Email | Senha | Descrição | |-------|-------|-----------| -| `admin@cnxifly.com` | `M@ster9354` | Administrador PostfixAdmin | -| `marco@cnxifly.com` | `M@ster9354` | Email pessoal Marco | -| `no-reply@cnxifly.com` | `M@ster9354` | Notificações do sistema | +| \`admin@cnxifly.com\` | \`M@ster9354\` | Administrador PostfixAdmin | +| \`marco@cnxifly.com\` | \`M@ster9354\` | Email pessoal Marco | +| \`no-reply@cnxifly.com\` | \`M@ster9354\` | Notificações do sistema | ### Configuração Cliente de Email -``` +\`\`\` Servidor de entrada (IMAP): Host: mail.cnxifly.com Porta: 993 @@ -105,33 +115,75 @@ Servidor de saída (SMTP): Host: mail.cnxifly.com Porta: 587 Segurança: STARTTLS -``` +\`\`\` + +--- + +## 🛡️ CONFIGURAÇÕES ANTI-SPAM (DNS) + +### Registros DNS para Entrega de Email + +| Tipo | Nome | Valor | Status | +|------|------|-------|--------| +| **SPF** | \`cnxifly.com\` | \`v=spf1 mx a ip4:213.165.93.60 -all\` | ✅ OK | +| **DMARC** | \`_dmarc.cnxifly.com\` | \`v=DMARC1; p=quarantine; ...\` | ✅ OK | +| **DKIM** | \`mail._domainkey.cnxifly.com\` | (chave RSA 2048-bit) | ⚠️ **PENDENTE** | +| **PTR/rDNS** | \`213.165.93.60\` | \`mail.cnxifly.com\` | ✅ OK | + +### ⚠️ AÇÃO NECESSÁRIA: Adicionar DKIM no DNS + +A chave DKIM existe no servidor mas **NÃO está publicada no DNS**. Adicionar o seguinte registro TXT: + +\`\`\` +Nome: mail._domainkey.cnxifly.com +Tipo: TXT +Valor: v=DKIM1; h=sha256; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1A8I6ZHyZ0PYdOjB2BSQbH8q6WOJ2dO2zHiIn/bolAGl5ITo5hfn3Zv2fpHBMzcWbDITugSQFuQ3XJeF6oBNdWVvBqnEvI8pCJWzzhZ8Oj9rU+mEPOhIcmmDU6kHCTOFWFxgxbLd2es34rmts06xpF7nI4mWuJq8VVtkrqT0UkZNjjZrNO9KXfdTzV3pP0IEZA+KJlYqVDwnALL62z6GT9xAQi2eytoRSXbTzGDC4+kNXE3v2zMB5+CY9CbH3LZ7SFoJUQJCTf43zc4ea+nWsE/Y2DR5ky2hSwOh7FRJ2nXV07N2VlLu9LekZl08q9G49mwEY6ORT0aShL7RYsNTKQIDAQAB +\`\`\` + +### Verificação Anti-Spam + +\`\`\`bash +# Testar SPF +dig +short TXT cnxifly.com | grep spf + +# Testar DMARC +dig +short TXT _dmarc.cnxifly.com + +# Testar DKIM (após adicionar no DNS) +dig +short TXT mail._domainkey.cnxifly.com + +# Testar rDNS +dig +short -x 213.165.93.60 + +# Verificar assinatura DKIM +opendkim-testkey -d cnxifly.com -s mail -vvv +\`\`\` --- ## 🔧 API ENDPOINTS ### Base URL -``` +\`\`\` https://webmoney.cnxifly.com/api -``` +\`\`\` ### Endpoints Disponíveis | Método | Endpoint | Descrição | |--------|----------|-----------| -| `POST` | `/api/login` | Autenticação | -| `POST` | `/api/register` | Registro de usuário | -| `POST` | `/api/logout` | Logout | -| `GET` | `/api/me` | Dados do usuário autenticado | -| `GET` | `/api/user` | Informações do usuário | -| `GET` | `/api/email/anti-spam-info` | Informações anti-spam | -| `POST` | `/api/email/send-test` | Enviar email de teste | +| \`POST\` | \`/api/login\` | Autenticação | +| \`POST\` | \`/api/register\` | Registro de usuário | +| \`POST\` | \`/api/logout\` | Logout | +| \`GET\` | \`/api/me\` | Dados do usuário autenticado | +| \`GET\` | \`/api/preferences\` | Preferências do usuário | +| \`PUT\` | \`/api/preferences\` | Atualizar preferências | +| \`POST\` | \`/api/preferences/test-notification\` | Testar notificação | ### Health Check -``` +\`\`\` GET https://cnxifly.com/up -``` +\`\`\` --- @@ -140,42 +192,67 @@ GET https://cnxifly.com/up | Campo | Valor | |-------|-------| | **Emissor** | Let's Encrypt | +| **Início** | 07 de Dezembro de 2025 | | **Válido até** | 07 de Março de 2026 | | **Domínios cobertos** | cnxifly.com, www, mail, webmail, phpmyadmin, webmoney | +| **Renovação** | Automática via Certbot | --- ## 📁 ESTRUTURA DE DIRETÓRIOS -``` +\`\`\` /var/www/webmoney/ -├── backend/ # Laravel API -├── frontend/ # Vue/React App -└── public/ # Arquivos públicos +├── backend/ # Laravel API (PHP 8.4) +│ └── storage/logs/ # Logs do Laravel +└── frontend/ + └── dist/ # React build (Nginx root) /var/www/postfixadmin/ # PostfixAdmin /var/www/roundcube/ # Roundcube Webmail /var/www/phpmyadmin/ # phpMyAdmin -``` +\`\`\` --- ## 🔄 SERVIÇOS DO SISTEMA -| Serviço | Comando de Status | -|---------|-------------------| -| Nginx | `systemctl status nginx` | -| PHP-FPM | `systemctl status php8.4-fpm` | -| MariaDB | `systemctl status mariadb` | -| Redis | `systemctl status redis-server` | -| Postfix | `systemctl status postfix` | -| Dovecot | `systemctl status dovecot` | -| OpenDKIM | `systemctl status opendkim` | +### Versões + +| Serviço | Versão | +|---------|--------| +| Nginx | 1.29.4 | +| PHP-FPM | 8.4.15 | +| MariaDB | 11.4.9 | +| Redis | 7.0.15 | +| Postfix | 3.8.6 | +| Dovecot | 2.3.21 | +| OpenDKIM | 2.11.0 | + +### Comandos de Status + +| Serviço | Comando | +|---------|---------| +| Nginx | \`systemctl status nginx\` | +| PHP-FPM | \`systemctl status php8.4-fpm\` | +| MariaDB | \`systemctl status mariadb\` | +| Redis | \`systemctl status redis-server\` | +| Postfix | \`systemctl status postfix\` | +| Dovecot | \`systemctl status dovecot\` | +| OpenDKIM | \`systemctl status opendkim\` | ### Reiniciar Todos os Serviços -```bash +\`\`\`bash systemctl restart nginx php8.4-fpm mariadb redis-server postfix dovecot opendkim -``` +\`\`\` + +--- + +## ⏰ CRON JOBS + +| Cron | Comando | Descrição | +|------|---------|-----------| +| \`* * * * *\` | \`cd /var/www/webmoney/backend && php artisan schedule:run\` | Laravel Scheduler | --- @@ -184,21 +261,24 @@ systemctl restart nginx php8.4-fpm mariadb redis-server postfix dovecot opendkim 1. **Backup**: Realizar backup regular do banco de dados e arquivos 2. **SSL**: Certificado renova automaticamente via Certbot 3. **Firewall**: UFW ativo com portas 22, 25, 80, 143, 443, 465, 587, 993 -4. **Logs**: - - Nginx: `/var/log/nginx/` - - PHP: `/var/log/php8.4-fpm.log` - - Mail: `/var/log/mail.log` - - Laravel: `/var/www/webmoney/backend/storage/logs/` +4. **DKIM**: ⚠️ Chave existe no servidor mas falta registro DNS +5. **Logs**: + - Nginx: \`/var/log/nginx/\` + - PHP: \`/var/log/php8.4-fpm.log\` + - Mail: \`/var/log/mail.log\` + - Laravel: \`/var/www/webmoney/backend/storage/logs/\` --- ## 🆘 SUPORTE Em caso de problemas, verificar: -1. Status dos serviços: `systemctl status [serviço]` -2. Logs de erro: `tail -f /var/log/nginx/error.log` -3. Conectividade: `curl -I https://cnxifly.com` +1. Status dos serviços: \`systemctl status [serviço]\` +2. Logs de erro: \`tail -f /var/log/nginx/error.log\` +3. Logs Laravel: \`tail -f /var/www/webmoney/backend/storage/logs/laravel.log\` +4. Logs de email: \`tail -f /var/log/mail.log\` +5. Conectividade: \`curl -I https://cnxifly.com\` --- -> **Gerado automaticamente em 07/12/2025** +> **Gerado automaticamente em 17/12/2025** diff --git a/backend/app/Mail/DuePaymentsAlert.php b/backend/app/Mail/DuePaymentsAlert.php index 7d26a75..d8b511b 100644 --- a/backend/app/Mail/DuePaymentsAlert.php +++ b/backend/app/Mail/DuePaymentsAlert.php @@ -109,7 +109,11 @@ public function headers(): Headers { return new Headers( text: [ - 'List-Unsubscribe' => '', + 'X-Mailer' => 'WEBMoney/1.44.5', + 'X-Priority' => '3', + 'X-Auto-Response-Suppress' => 'OOF, AutoReply', + 'Precedence' => 'bulk', + 'List-Unsubscribe' => ', ', 'List-Unsubscribe-Post' => 'List-Unsubscribe=One-Click', ], ); diff --git a/backend/resources/views/emails/due-payments-alert.blade.php b/backend/resources/views/emails/due-payments-alert.blade.php index a173e6a..c1faddf 100644 --- a/backend/resources/views/emails/due-payments-alert.blade.php +++ b/backend/resources/views/emails/due-payments-alert.blade.php @@ -1,10 +1,17 @@ - - + + - - - Alerta de Pagamentos - + +