0

I'm being taught to use PostFix to make a personal, cross-domain mail service.

I've been stuck on this for a while, but... here's what happens. In this case, the DNS and mail servers, as well as destinations, are the same location. Two virtual machines, connected through a local network, that solve their DIG/nslookup names.

If i try to send to the same domain/machine

Feb 11 12:32:58 mx1 postfix/cleanup[3109]: A94C7C8BF9: message-id=<20190211113258.A94C7C8BF9@mx1.mailantonio.com>
Feb 11 12:32:58 mx1 postfix/qmgr[1176]: A94C7C8BF9: from=<test2@mx1>, size=346, nrcpt=1 (queue active)
Feb 11 12:32:58 mx1 postfix/local[3111]: A94C7C8BF9: to=<test3@mailantonio.com>, relay=local, delay=0.2, delays=0.19/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox)
Feb 11 12:32:58 mx1 postfix/qmgr[1176]: A94C7C8BF9: removed

Email received, but none shows on their Maildir

When i try to send to the other domain

Feb 11 12:33:32 mx1 postfix/pickup[1175]: 368FDC8BFC: uid=1001 from=<test2@mx1>
Feb 11 12:33:32 mx1 postfix/cleanup[3109]: 368FDC8BFC: message-id=<20190211113332.368FDC8BFC@mx1.mailantonio.com>
Feb 11 12:33:32 mx1 postfix/qmgr[1176]: 368FDC8BFC: from=<test2@mx1>, size=334, nrcpt=1 (queue active)
Feb 11 12:33:32 mx1 postfix/local[3111]: 368FDC8BFC: to=<test@mailgarcia.com>, relay=local, delay=0.13, delays=0.1/0/0/0.03, dsn=5.1.1, status=bounced (unknown user: "test")
Feb 11 12:33:32 mx1 postfix/cleanup[3109]: 4039EC8BFA: message-id=<20190211113332.4039EC8BFA@mx1.mailantonio.com>
Feb 11 12:33:32 mx1 postfix/qmgr[1176]: 4039EC8BFA: from=<>, size=2204, nrcpt=1 (queue active)
Feb 11 12:33:32 mx1 postfix/bounce[3128]: 368FDC8BFC: sender non-delivery notification: 4039EC8BFA
Feb 11 12:33:32 mx1 postfix/qmgr[1176]: 368FDC8BFC: removed
Feb 11 12:33:32 mx1 postfix/smtpd[3131]: connect from localhost[127.0.0.1]
Feb 11 12:33:32 mx1 postfix/smtp[3130]: warning: host mx1[127.0.1.1]:25 greeted me with my own hostname mx1.mailantonio.com
Feb 11 12:33:32 mx1 postfix/smtp[3130]: warning: host mx1[127.0.1.1]:25 replied to HELO/EHLO with my own hostname mx1.mailantonio.com
Feb 11 12:33:32 mx1 postfix/smtp[3130]: 4039EC8BFA: to=<test2@mx1>, relay=mx1[127.0.1.1]:25, delay=0.04, delays=0.01/0.01/0.03/0, dsn=5.4.6, status=bounced (mail for mx1 loops back to myself)
Feb 11 12:33:32 mx1 postfix/qmgr[1176]: 4039EC8BFA: removed
Feb 11 12:33:32 mx1 postfix/smtpd[3131]: disconnect from localhost[127.0.0.1] ehlo=1 quit=1 commands=2

Mail doesn't send, because it gets redirected to its own FQDN?

They're both in the same local network. Machine Mx1 is 10.0.0.1-> mailantonio.com domain. Machine Mx2 is 10.0.0.2-> mailgarcia.com

Here are the postfix config files. Im honestly at a loss and i've been looking for a while at what could be wrong.... MX1

# 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 2 on
# fresh installs.
compatibility_level = 2

# 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_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mx1.mailantonio.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.$mydomain, localhost $mydomain, mx2,mailgarcia.com, mailgarcia.com, mx2
relayhost = 
mynetworks = 10.0.0.0/24
mailbox_size_limit = 0
recipient_delimiter = 
default_transport = smtp
relay_transport = smtp
relay_domains =  mailgarcia.com
inet_interfaces = all
inet_protocols = ipv4

MX2

 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 2 on
# fresh installs.
compatibility_level = 2

# 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_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mx2.mailgarcia.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mx1.mailantonio.com, mailantonio.com, mx1 
relayhost = 
mynetworks = 10.0.0.0/24
mailbox_size_limit = 0
recipient_delimiter = 
default_transport = smtp
relay_transport = smtp
relay_domains = mailantonio.com
inet_interfaces = all
inet_protocols = ipv4
home_mailbox = Maildir/

Maildir directories are made, containing cur, new, and tmp per user... Im using linux mint, which is based on Ubuntu. The configurations should be the same, as far as im aware. Courier IMAP and POP are installed.


Response to answer.

MX1 Config

mydomain = mailantonio.com
myorigin = $mydomain
mydestination = $myhostname, mx1.$mydomain, $mydomain, mx2.mailgarcia.com, mailgarcia.com, mx2

MX2 Config

mydomain = mailgarcia.com
myorigin = $mydomain
mydestination = $myhostname, mx2.$mydomain, $mydomain, mx1.mailantonio.com, mailantonio.com, mx1 

Sending it to itself works now. However, cross domain is still iffy.

LOG Postfix

Feb 11 16:03:51 mx1 postfix/smtp[3007]: 6AF41C8BC8: to=<test2@mx1>, relay=none, delay=0.03, delays=0/0.01/0.01/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=mx1 type=MX: Host not found, try again)

Sending a message as test3, from machine mx1.mailantonio.com, to test@mailgarcia.com , Do i have to remove the self-referring destinations on configs?

Forsyte
  • 3
  • 2
  • 1
    Forgot to specify: The local network has both domains. Each mail server is their own bind server, as well. And they're forwarding to eachother so they can resolve the other domain's name. Issue happens in both directions. – Forsyte Feb 11 '19 at 11:49
  • As the author you can always [edit](https://serverfault.com/posts/953342/edit) your own questions to add/update new details – HBruijn Feb 11 '19 at 11:52
  • They don't arrive to the Mailbox, however? In neither case. – Forsyte Feb 11 '19 at 12:24
  • What on the 127.0.1.1:25, is that some kind of spam filters service (SpamAssassin)? – ALex_hha Feb 11 '19 at 12:52
  • That's the SMTP port , #25. It has no security measures: I've yet to get it work normally, security comes after it works. So no SpamAssassin or anything that'd block mail. Im sending via the mail -s "subject" command, as well. – Forsyte Feb 11 '19 at 12:59
  • @ALex_hha 127.0.1.1 is just a Debianism that was supposedly to fix some problem but actually causes problems. – Michael Hampton Feb 11 '19 at 15:08

1 Answers1

0

You are using mydestination = localhost.$mydomain . That's not good. Use mx2./mx1. instead of localhost.

There is no mydomain in the configs you posted. That may also be problematic. You should add mydomain = yournames.com in both configs.

If myhostname, mydomain and mydestination are not correct you can get the loopback problem.

Overmind
  • 3,076
  • 2
  • 16
  • 25
  • EDIT: Left response on original post so i can format it properly. Apologies, but thanks for the help! – Forsyte Feb 11 '19 at 14:48
  • That fixed it, nevermind! The mail files were just hidden..... I had to , well, unhide them, and the mail command does show them. Thanks. Now is just to get to send it between domains... – Forsyte Feb 11 '19 at 15:02