Emita o encaminhamento de email com o POSTFIX

1

Eu preciso que os e-mails cheguem de um e-mail externo (por exemplo, " usuário@dominio_external.com.br ") para uma conta de e-mail no meu servidor (por exemplo: " root@meu_dominio.com "), ser encaminhado para outro endereço externo (exemplo:" [email protected] "). Mas não funciona e não há erros nos arquivos de LOG.

Endereços de domínio, e-mails e IPs alterados apenas para manter a privacidade do meu cliente.

Ao enviar uma mensagem de um email externo, por exemplo, usuário@dominio_external.com , para uma conta de e-mail no meu servidor, por exemplo: raiz@meu_dominio.com , chega corretamente na caixa de e-mail raiz.

Faça o login abaixo:

May 24 18:47:58 mail postfix/smtpd[1711]: connect from a4-salsa4-1.my_domain.com[62.14.x.x] 
May 24 18:47:58 mail postfix/smtpd[1711]: 6C776419DE: client=a4-salsa4-1.my_domain.com[62.14.x.x] 
May 24 18:47:58 mail postfix/cleanup[1715]: 6C776419DE: message-id=<[email protected]> 
May 24 18:47:58 mail postfix/qmgr[1415]: 6C776419DE: from=<exemplo user@external_domain.com>, size=2087, nrcpt=1 (queue active) 
May 24 18:47:58 mail postfix/smtpd[1711]: disconnect from a4-salsa4-1.my_domain.com[62.14.x.x] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5 
May 24 18:47:58 mail postfix/local[1716]: 6C776419DE: to=<root@my_domain.com>, relay=local, delay=0.07, delays=0.06/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox) 
May 24 18:47:58 mail postfix/qmgr[1415]: 6C776419DE: removed

Eu quero que todos os e-mails que chegaram na conta "raiz" ( root@my_domain.com ) sejam encaminhados para " [email protected] ", então configurou o roteamento.

Ativando o encaminhamento (no shell com o usuário root):

# echo "\ root [email protected]"> ~ / .forward

Com essa configuração de roteamento, os e-mails enviados de " usuário@dominio_external.com " para o endereço de e-mail " raiz@meu_dominio.com " chegam à conta de e-mail local (no meu vps), mas não chega em " [email protected] ".

No entanto, os registros indicam que eles foram enviados para " [email protected] ", veja abaixo o log:

May 24 17:58:14 mail postfix/smtpd[32297]: connect from a4-salsa4-1.my_domain.com[62.14.x.x]
May 24 17:58:14 mail postfix/smtpd[32297]: 7A43B41A02: client=a4-salsa4-1.my_domain.com[62.14.x.x]
May 24 17:58:14 mail postfix/cleanup[32301]: 7A43B41A02: message-id=<[email protected]>
May 24 17:58:14 mail postfix/qmgr[30879]: 7A43B41A02: from=<user@external_domain.com>, size=2087, nrcpt=1 (queue active)
May 24 17:58:14 mail postfix/smtpd[32297]: disconnect from a4-salsa4-1.my_domain.com[62.14.x.x] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
May 24 17:58:14 mail postfix/cleanup[32301]: 7FD4D41A08: message-id=<[email protected]>
May 24 17:58:14 mail postfix/qmgr[30879]: 7FD4D41A08: from=<user@external_domain.com>, size=2231, nrcpt=1 (queue active)
May 24 17:58:14 mail postfix/local[32302]: 7A43B41A02: to=<root@my_domain.com>, relay=local, delay=0.03, delays=0.02/0.01/0/0, dsn=2.0.0, status=sent (forwarded as 7FD4D41A08)
May 24 17:58:14 mail postfix/qmgr[30879]: 7A43B41A02: removed
May 24 17:58:14 mail postfix/smtp[32303]: 7FD4D41A08: to=<[email protected]>, orig_to=<root@my_domain.com>, relay=relay.my_vps_host.com[177.153.9.96]:25, delay=0.33, delays=0/0.01/0.31/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as CE14D777DC134)
May 24 17:58:14 mail postfix/qmgr[30879]: 7FD4D41A08: removed

Ao enviar um email local para o usuário root (por exemplo: trabalhos do crontab), o email chega com êxito na conta local e também em " [email protected] ", consulte o log:

May 24 17:55:03 mail postfix/smtp[32250]: 6E08B41A02: to=<[email protected]>, orig_to=<root>, relay=relay.my_vps_host.com[177.153.9.96]:25, delay=1.2, delays=0.01/0.02/0.93/0.28, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 6732B777D6711)
May 24 17:55:03 mail postfix/qmgr[30879]: 6E08B41A02: removed

Suspeito que tenha um filtro em " relay.my_vps_host.com " que bloqueia as mensagens.

Então eu abri uma solicitação de cheque com o suporte do meu servidor e eles me informaram que não há nenhum tipo de bloqueio no relay (" relay.my_vps_host.com ").

Os e-mails que devem ser encaminhados simplesmente não chegam em " [email protected] ".

/etc/postfix/main.cf:

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 2
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated 
defer_unauth_destination
myhostname = mail.my_domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, my_domain.com,  mail.my_domain.com, localhost.my_domain.com, , localhost
relayhost = relay.my_vps_host.com
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

/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
submission inet n       -       y       -       -       smtpd
#  -o syslog_name=postfix/submission
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       y       -       -       smtpd
#  -o syslog_name=postfix/smtps
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_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
rewrite   unix  -       -       y       -       -       trivial-rewrite
bounce    unix  -       -       y       -       0       bounce
defer     unix  -       -       y       -       0       bounce
trace     unix  -       -       y       -       0       bounce
verify    unix  -       -       y       -       1       verify
flush     unix  n       -       y       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       y       -       -       smtp
relay     unix  -       -       y       -       -       smtp
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       y       -       -       showq
error     unix  -       -       y       -       -       error
retry     unix  -       -       y       -       -       error
discard   unix  -       -       y       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       y       -       -       lmtp
anvil     unix  -       -       y       -       1       anvil
scache    unix  -       -       y       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
#  mailbox_transport = lmtp:inet:localhost
#  virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus     unix  -       n       n       -       -       pipe
#  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix  -       n       n       -       -       pipe
#  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender     $recipient
scalemail-backend unix  -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}

O SPF para my_domain.com:

  • v = spf1 + a + mx + ptr: my_vps_host.com incluem: _spf.google.com -all

Estou usando:

  • Debian 9 (extensão).
  • Postfix 3.1.8.

Alguém pode ajudar a obter o email encaminhado para "root@my_domain.com"?

Muito obrigado!

    
por Allan Andrade 26.05.2018 / 01:19

0 respostas