Sou relativamente novo no Linux, configurando servidores e principalmente lidando com coisas relacionadas a correio. Comprei um novo domínio e aluguei um VPS, que agora hospeda meu site. Preciso de um ambiente mais aberto para meu projeto web, incluindo a geração automática de endereços de e-mail e a leitura de suas caixas de entrada. É por isso que não consegui usar um pacote normal de hospedagem na web.
Resumindo, sou um iniciante e tive um problema ao configurar o postfix, para o qual não consegui encontrar nenhuma solução online. Cheguei ao ponto em que o servidor web é executado com um certificado válido e o mesmo nome de domínio do meu servidor web. Significa que solicitar https://example.com funciona e enviar mensagens [email protegido] funciona.
Parece bom até agora. Meu problema é que qualquer e-mail enviado para qualquer caixa de entrada é automaticamente redirecionado para meu e-mail particular.
Isso significa o seguinte, digamos que alguém envie um email para [email protected] . Em vez de poder visualizar este e-mail usando s-nail
, o e-mail é encaminhado para meu endereço privado.
[e-mail protegido] -> [e-mail protegido] -> ??? -> [e-mail protegido]
Provavelmente cometi um erro ao configurar o postfix. Achei que poderia ter definido o valor errado para "Destinatário de correio raiz e postmaster".
Por esse motivo tentei reconfigurar o postfix usando sudo dpkg-reconfigure postfix
e reiniciar o serviço usando sudo systemctl restart postfix
. Isso não mudou nada.
Histórico:
Jun 28 13:40:44 srv552577 postfix/postfix-script[61682]: waiting for the Postfix mail system to terminate
Jun 28 13:40:45 srv552577 postfix/postfix-script[61994]: starting the Postfix mail system
Jun 28 13:40:45 srv552577 postfix/master[61996]: daemon started -- version 3.8.6, configuration /etc/postfix
Jun 28 13:42:16 srv552577 postfix/smtpd[62024]: warning: database /etc/postfix/virtual.db is older than source file /etc/postfix/virtual
Jun 28 13:42:16 srv552577 postfix/smtpd[62024]: connect from mail-yb1-f179.google.com[209.85.219.179]
Jun 28 13:42:17 srv552577 postfix/trivial-rewrite[62028]: warning: database /etc/postfix/virtual.db is older than source file /etc/postfix/virtual
Jun 28 13:42:17 srv552577 postfix/cleanup[62029]: warning: database /etc/postfix/virtual.db is older than source file /etc/postfix/virtual
Jun 28 13:42:17 srv552577 postfix/smtpd[62024]: 56BFF40D79: client=mail-yb1-f179.google.com[209.85.219.179]
Jun 28 13:42:17 srv552577 postfix/cleanup[62029]: 56BFF40D79: message-id=<CAF41jLugJXH2jx6K8X+wh01Fb7-ru_mTO_Nyqf8ALEwg_y1vQA@mail.gmail.com>
Jun 28 13:42:17 srv552577 postfix/qmgr[61998]: 56BFF40D79: from=<[email protected]>, size=2827, nrcpt=1 (queue active)
Jun 28 13:42:17 srv552577 postfix/cleanup[62029]: 5A00740D7B: message-id=<CAF41jLugJXH2jx6K8X+wh01Fb7-ru_mTO_Nyqf8ALEwg_y1vQA@mail.gmail.com>
Jun 28 13:42:17 srv552577 postfix/local[62030]: 56BFF40D79: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.03, delays=0.01/0.01/0/0, dsn=2.0.0, status=sent (forwarded as 5A00740D7B)
Jun 28 13:42:17 srv552577 postfix/qmgr[61998]: 5A00740D7B: from=<[email protected]>, size=2964, nrcpt=1 (queue active)
Jun 28 13:42:17 srv552577 postfix/qmgr[61998]: 56BFF40D79: removed
Jun 28 13:42:17 srv552577 postfix/smtpd[62024]: disconnect from mail-yb1-f179.google.com[209.85.219.179] ehlo=2 starttls=1 mail=1 rcpt=1 bdat=1 quit=1 commands=7
Jun 28 13:42:24 srv552577 postfix/smtp[62031]: 5A00740D7B: to=<[email protected]>, orig_to=<[email protected]>, relay=mail.protonmail.ch[176.119.200.128]:25, delay=6.9, delays=0/0.02/5.9/1, dsn=2.0.0, status=sent (250 2.0.0 Ok: q>
Jun 28 13:42:24 srv552577 postfix/qmgr[61998]: 5A00740D7B: removed
Jun 28 13:45:37 srv552577 postfix/anvil[62027]: statistics: max connection rate 1/60s for (smtp:209.85.219.179) at Jun 28 13:42:16
Jun 28 13:45:37 srv552577 postfix/anvil[62027]: statistics: max connection count 1 for (smtp:209.85.219.179) at Jun 28 13:42:16
Jun 28 13:45:37 srv552577 postfix/anvil[62027]: statistics: max cache size 1 at Jun 28 13:42:16
/etc/postfix/virtual
:
[email protected] brent
[email protected] brent
/etc/postfix/main.cf
:
GNU nano 7.2 main.cf *
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 3.6 on
# fresh installs.
compatibility_level = 3.6
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level=may
smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = srv552577.hstgr.cloud
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = srv552577.hstgr.cloud, IREPLACEDTHISDOMAIN.de, srv552577.hstgr.cloud, localhost.hstgr.cloud, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
home_mailbox = Maildir/
virtual_alias_maps = hash:/etc/postfix/virtual
/etc/postfix/master.cf
:
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: http://www.postfix.org/master.5.html).
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (no) (never) (100)
# ==========================================================================
smtp inet n - y - - smtpd
#smtp inet n - y - 1 postscreen
#smtpd pass - - y - - smtpd
#dnsblog unix - - y - 0 dnsblog
#tlsproxy unix - - y - 0 tlsproxy
# Choose one: enable submission for loopback clients only, or for any client.
#127.0.0.1:submission inet n - y - - smtpd
#submission inet n - y - - smtpd
# -o syslog_name=postfix/submission
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_tls_auth_only=yes
# -o local_header_rewrite_clients=static:all
# -o smtpd_reject_unlisted_recipient=no
# Instead of specifying complex smtpd_<xxx>_restrictions here,
# specify "smtpd_<xxx>_restrictions=$mua_<xxx>_restrictions"
# here, and specify mua_<xxx>_restrictions in main.cf (where
# "<xxx>" is "client", "helo", "sender", "relay", or "recipient").
# -o smtpd_client_restrictions=
# -o smtpd_helo_restrictions=
# -o smtpd_sender_restrictions=
# -o smtpd_relay_restrictions=
# -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
# Choose one: enable submissions for loopback clients only, or for any client.
#127.0.0.1:submissions inet n - y - - smtpd
#submissions inet n - y - - smtpd
# -o syslog_name=postfix/submissions
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=yes
# -o local_header_rewrite_clients=static:all
# -o smtpd_reject_unlisted_recipient=no
# Instead of specifying complex smtpd_<xxx>_restrictions here,
# specify "smtpd_<xxx>_restrictions=$mua_<xxx>_restrictions"
# here, and specify mua_<xxx>_restrictions in main.cf (where
# "<xxx>" is "client", "helo", "sender", "relay", or "recipient").
# -o smtpd_client_restrictions=
# -o smtpd_helo_restrictions=
# -o smtpd_sender_restrictions=
# -o smtpd_relay_restrictions=
# -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - y - - qmqpd
pickup unix n - y 60 1 pickup
cleanup unix n - y - 0 cleanup
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - y 1000? 1 tlsmgr
Meus registros DNS TXT e MX:
Deixe-me saber o que posso fazer para corrigir isso ou se devo fornecer qualquer outra informação.
Desde já, obrigado
Parece que o problema ocorreu devido à não atualização do banco de dados de alias virtual do Postfix após a edição do
/etc/postfix/virtual
arquivo. Eu não sabia que esta etapa era crucial para aplicar as alterações feitas.Aqui está o que fiz para corrigir meu problema:
Atualizado o banco de dados de alias virtuais:
Depois de fazer alterações no
/etc/postfix/virtual
arquivo, você precisa executar o seguinte comando:Isso atualiza o arquivo
/etc/postfix/virtual.db
e aplica quaisquer alterações feitas em/etc/postfix/virtual
Postfix reiniciado:
Assim que o banco de dados for atualizado, reinicie o Postfix para aplicar as alterações:
Ao não executar o
postmap
comando, minhas alterações novirtual
arquivo não foram aplicadas, fazendo com que os emails fossem encaminhados incorretamente.