0

I am using ubuntu server with postfix, ispconfig as control panel.

I am using a mail relay server from mailjet. I am getting notification from them like

Emails sent from this sender will not be sent until you validate this address in your account. Messages will remain in our processing queue for a few days and will be sent as soon as the sender becomes valid.

Now when checking I find that many users are not in my domain list, how come they are able to send mails from my server. the contents of my postfix/main.cf is like this

# 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 = /usr/share/doc/postfix

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.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.

myhostname = server1.mywebsolutions.co.in
alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
alias_database = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
myorigin = /etc/mailname
mydestination = server1.mywebsolutions.co.in, localhost, localhost.localdomain
relayhost = in-v3.mailjet.com
#mynetworks = 127.0.0.0/8 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = 
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
virtual_alias_domains = 
virtual_alias_maps = hash:/var/lib/mailman/data/virtual-mailman, proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /var/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
#smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, #reject_unauth_destination



smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, reject_rbl_client zen.spamhaus.org

smtpd_tls_security_level = may

transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
relay_recipient_maps = mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks
smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf, reject_unknown_sender_domain
smtpd_client_restrictions = check_client_access mysql:/etc/postfix/mysql-virtual_client.cf

# /etc/postfix/main.cf
# HELO restrictions:
#smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions =
    permit_mynetworks,
    reject_non_fqdn_helo_hostname,
    reject_invalid_helo_hostname,
    permit

smtpd_client_message_rate_limit = 100
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = dovecot
header_checks = regexp:/etc/postfix/header_checks
mime_header_checks = regexp:/etc/postfix/mime_header_checks
nested_header_checks = regexp:/etc/postfix/nested_header_checks
body_checks = regexp:/etc/postfix/body_checks
owner_request_special = no
dovecot_destination_recipient_limit = 1
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings
message_size_limit = 20971520
inet_protocols = all

smtp_tls_security_level = may
smtpd_relay_restrictions = check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_protocols = !SSLv2,!SSLv3
smtp_tls_protocols = !SSLv2,!SSLv3
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = 

and example mail log for unauthorized user is like this:

Mar 20 18:37:36 server1 postfix/qmgr[3743]: D121D601882: from=<bingwmc@microsoft.com>, size=3606, nrcpt=1 (queue active)
Mar 20 18:37:37 server1 postfix/smtpd[15274]: disconnect from co1gmehub02.msn.com[65.55.52.230]
Mar 20 18:37:44 server1 postfix/smtpd[15287]: connect from localhost.localdomain[127.0.0.1]
Mar 20 18:37:44 server1 postfix/smtpd[15287]: CF7DD601CB8: client=localhost.localdomain[127.0.0.1]
Mar 20 18:37:44 server1 postfix/cleanup[15281]: CF7DD601CB8: message-id=<4e07e1c2-03ff-4c83-9680-28080ed476a1@CO1GMEHUB02.gme.gbl>
Mar 20 18:37:44 server1 postfix/smtpd[15287]: disconnect from localhost.localdomain[127.0.0.1]
Mar 20 18:37:44 server1 postfix/qmgr[3743]: CF7DD601CB8: from=<bingwmc@microsoft.com>, size=4556, nrcpt=1 (queue active)
Mar 20 18:37:44 server1 amavis[6293]: (06293-04) Passed CLEAN, [65.55.52.230] [65.55.52.230] <bingwmc@microsoft.com> -> <info@utkalcontinental.com>, Message-ID: <4e07e1c2-03ff-4c83-9680-28080ed476a1@CO1GMEHUB02.gme.gbl>, mail_id: Nsb3mNP03fix, Hits: 2.231, size: 3606, queued_as: CF7DD601CB8, dkim_id=@microsoft.com, 8124 ms
Mar 20 18:37:44 server1 postfix/smtp[15283]: D121D601882: to=<info@utkalcontinental.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=10, delays=2/0.01/0/8.1, dsn=2.0.0, status=sent (250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as CF7DD601CB8)
Mar 20 18:37:44 server1 postfix/qmgr[3743]: D121D601882: removed
Mar 20 18:37:45 server1 postfix/pickup[13305]: 3A69C601CE5: uid=5000 from=<bingwmc@microsoft.com>
Mar 20 18:37:45 server1 dovecot: lda(info@utkalcontinental.com): sieve: msgid=<4e07e1c2-03ff-4c83-9680-28080ed476a1@CO1GMEHUB02.gme.gbl>: forwarded to <ashis376@gmail.com>
Mar 20 18:37:45 server1 postfix/cleanup[15281]: 3A69C601CE5: message-id=<4e07e1c2-03ff-4c83-9680-28080ed476a1@CO1GMEHUB02.gme.gbl>
Mar 20 18:37:45 server1 postfix/qmgr[3743]: 3A69C601CE5: from=<bingwmc@microsoft.com>, size=4809, nrcpt=1 (queue active)
Mar 20 18:37:45 server1 dovecot: lda(info@utkalcontinental.com): sieve: msgid=<4e07e1c2-03ff-4c83-9680-28080ed476a1@CO1GMEHUB02.gme.gbl>: stored mail into mailbox 'INBOX'
Mar 20 18:37:45 server1 postfix/pipe[15288]: CF7DD601CB8: to=<info@utkalcontinental.com>, relay=dovecot, delay=0.54, delays=0.06/0.01/0/0.48, dsn=2.0.0, status=sent (delivered via dovecot service)
Mar 20 18:37:45 server1 postfix/qmgr[3743]: CF7DD601CB8: removed
Mar 20 18:37:45 server1 postfix/smtpd[15287]: connect from localhost.localdomain[127.0.0.1]
Mar 20 18:37:45 server1 postfix/smtpd[15287]: 737A2601882: client=localhost.localdomain[127.0.0.1]
Mar 20 18:37:45 server1 postfix/cleanup[15281]: 737A2601882: message-id=<4e07e1c2-03ff-4c83-9680-28080ed476a1@CO1GMEHUB02.gme.gbl>
Mar 20 18:37:45 server1 postfix/smtpd[15287]: disconnect from localhost.localdomain[127.0.0.1]
Mar 20 18:37:45 server1 postfix/qmgr[3743]: 737A2601882: from=<bingwmc@microsoft.com>, size=4883, nrcpt=1 (queue active)
Mar 20 18:37:45 server1 amavis[7178]: (07178-04) Passed CLEAN, [127.0.0.1] [65.55.52.230]

That is bingwmc@microsoft.com that microsoft.com is not in my domain list, how this user is able to send mail. What configuration I am doing wrong?

Here I am adding the output as suggested.

pawan@server1:~$ grep D121D601882 /var/log/mail.log
Mar 20 18:37:35 server1 postfix/smtpd[15274]: D121D601882: client=co1gmehub02.msn.com[65.55.52.230]
Mar 20 18:37:36 server1 postfix/cleanup[15281]: D121D601882: message-id=<4e07e1c2-03ff-4c83-9680-28080ed476a1@CO1GMEHUB02.gme.gbl>
Mar 20 18:37:36 server1 postfix/qmgr[3743]: D121D601882: from=<bingwmc@microsoft.com>, size=3606, nrcpt=1 (queue active)
Mar 20 18:37:44 server1 postfix/smtp[15283]: D121D601882: to=<info@utkalcontinental.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=10, delays=2/0.01/0/8.1, dsn=2.0.0, status=sent (250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as CF7DD601CB8)
Mar 20 18:37:44 server1 postfix/qmgr[3743]: D121D601882: removed
Joshi
  • 97
  • 4

1 Answers1

0

Because you have commented mynetworks option

#mynetworks = 127.0.0.0/8 [::1]/128

it doesn't mean that the option has no value. Actually it does - the default one

# postconf -d mynetworks
mynetworks = 127.0.0.0/8 192.168.88.0/24 10.0.2.0/24
ALex_hha
  • 7,193
  • 1
  • 25
  • 40
  • Hi Alex - Do you mean that if that is commented, it allows users outside mynetworks to send mail? – Joshi Mar 22 '16 at 16:57
  • Not from outside but allow to send from localhost, as I can see from the mail log – ALex_hha Mar 22 '16 at 16:59
  • Hi Alex - So how I can prevent prevent domains that are not on my server from sending even from localhost. There must be some way to block them, I have given just one example, there many such instances. – Joshi Mar 22 '16 at 17:36
  • Hi Alex - What do you interpret from the mail log, the mail was send from localhost, or it was from outside? – Joshi Mar 22 '16 at 17:47
  • Could you add to the question output of the 'grep D121D601882 /var/log/maillog' ? – ALex_hha Mar 22 '16 at 17:55
  • Ok I have added the output in question. – Joshi Mar 22 '16 at 18:07
  • Is utkalcontinental.com it your domain ? – ALex_hha Mar 22 '16 at 18:36
  • Yes It is one of my domain. – Joshi Mar 22 '16 at 18:46
  • Hmm, so what do you mean by 'that microsoft.com is not in my domain list' ? – ALex_hha Mar 22 '16 at 19:21
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/37360/discussion-between-joshi-and-alex-hha). – Joshi Mar 22 '16 at 19:24
  • Mail is being sent from `bingwmc@microsoft.com` this address and it is not on my domain list. That is my server is not receiving email from `bingwmc@microsoft.com` but it is a sender. How this becomes possible? – Joshi Mar 22 '16 at 19:29
  • There are even instances where there is nothing in the mail.log but I am receiving alerts of new sender from my server. which is much more headache. – Joshi Mar 22 '16 at 19:37