Sorry for the delay but after debugging, I realized that Azure was blocking outgoing port 25 on my VM. I had to move my mail server to another hosting server which involved using Apache reverse proxy with mod_md to get the certificates on the new standalone mail server. So, this part works now, and I reverted to trying to make dovecot/postfix work.
I may have to go on therapy after all this, it is draining my morale completely... ;) All these things were so easy a while back using a control panel.
postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_percent_hack = no
append_dot_mydomain = no
biff = no
default_destination_recipient_limit = 10
inet_interfaces = all
inet_protocols = ipv4
lmtp_sasl_type = dovecot
lmtp_tcp_port = 24
mailbox_size_limit = 100123456
message_size_limit = 50123456
mydestination = mail.site1.com, mail.site2.com, $myhostname, localhost.$mydomain, localhost
mydomain = mail.site1.com
myhostname = mail.site1.com
mynetworks_style = host
myorigin = $mydomain
notify_classes = bounce, 2bounce, delay, policy, protocol, resource, software
readme_directory = no
relay_domains =
relayhost =
smtp_sasl_security_options = noanonymous
smtp_tls_chain_files = /etc/apache2/md-ssl/domains/mail.site1.com/privkey.pem, /etc/apache2/md-ssl/domains/mail.site1.com/pubcert.pem
smtp_tls_security_level = may
smtpd_banner = mail.site1.com ESMTP
smtpd_client_restrictions = permit_mynetworks, reject_unauth_destination, permit_sasl_authenticated
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_delay_reject = yes
smtpd_recipient_limit = 10
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = no
smtpd_sasl_path = inet:srv_dovecot:12345
smtpd_sasl_security_options = noplaintext, noanonymous, nodictionary
smtpd_sasl_tls_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = permit_sasl_authenticated
smtpd_tls_auth_only = yes
smtpd_tls_chain_files = /etc/apache2/md-ssl/domains/mail.site1.com/privkey.pem, /etc/apache2/md-ssl/domains/mail.site1.com/pubcert.pem
smtpd_tls_mandatory_ciphers = high
smtpd_tls_mandatory_protocols = >=TLSv1.2, <=TLSv1.3
smtpd_tls_security_level = may
syslog_name = srv/postfix
tls_server_sni_maps = texthash:/etc/postfix/domain_ssl_map
virtual_alias_maps = texthash:/etc/postfix/virtual
virtual_gid_maps = static:5000
virtual_mailbox_base = /var/mail/web_sites
virtual_mailbox_domains = site2.com site1.com
virtual_mailbox_maps = texthash:/etc/postfix/virtual_mail_boxes
virtual_minimum_uid = 100
virtual_transport = lmtp:inet:srv_dovecot:12344
virtual_uid_maps = static:5000
postconf -M
smtp inet n - y - - smtpd -v
submission inet n - y - - smtpd -o smtpd_sasl_auth_enable=yes
submissions inet n - y - - smtpd -o smtpd_sasl_auth_enable=yes
pickup unix n - y 60 1 pickup
cleanup unix n - y - 0 cleanup
qmgr unix n - n 300 1 qmgr
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 syslog_name=postfix/$service_name
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
postlog unix-dgram n - n - 1 postlogd
maildrop unix - n n - - pipe flags=DRXhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
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=FRX user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}
I tried some of the doveadm examples but got errors: doveadm mailbox list Fatal: USER environment is missing and -u option not used doveadm mailbox status Fatal: USER environment is missing and -u option not used doveadm mailbox status -u * Fatal: Unknown status field: boot doveadm mailbox status -A doveadm mailbox status [-u <user>|-A] [-S <socket_path>] <fields> <mailbox> [...]
Sending an email from gmail to site1, I do receive it. When I try to send an email from site1 to site2, the email works and I see the SASL authentication being performed in the log.
But when I try to send an email to yahoo/gmail, in the log, I see that the email gets rejected even before performing the SASL authentication: postfix/smtpd[86594]: connect from unknown[myIP] postfix/smtpd[86594]: NOQUEUE: reject: RCPT from unknown[myIP]: 554 5.7.1 <an_email@yahoo.com>: Relay access denied; from=<an_email@site1.com> to=<an_email@yahoo.com> proto=ESMTP helo=<[192.168....]>
I tried adding 192.168... to mynetwork just for a test since I don't think this is a good idea but I got this anyway: /usr/sbin/postconf: warning: /etc/postfix/main.cf: unused parameter: mynetwork=127.0.0.0/8 192.168.1.0/8