I have a Postfix mail server.
The problem is it is sending spam. The logs showed the following:
538ED2BF7F2: client=unknown[103.214.xxx.xx]
538ED2BF7F2: message-id=<>
538ED2BF7F2: from=<[email protected]>, size=786, nrcpt=1 (queue active)
538ED2BF7F2: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[74.125.204.27]:25, delay=4, delays=2.1/0.02/0.8/1, dsn=2.0.0, status=sent (250 2.0.0 OK 1501439317 91si6880315ply.391 - gsmtp)
538ED2BF7F2: removed
I have a wrapper for PHP & Apache and checked whether it was from a form or script on a website, but it wasn't: it was not being logged. And I checked HTTP logs for possible logins/post from the specific IP address, but nothing comes up.
Also I changed the password. The server is not open relay.
Any other ideas?
UPDATED XXX_Reject
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination check_sender_access hash:/etc/postfix/sender_access reject_rbl_client zen.spamhaus.org reject_rbl_client bl.spamcop.net reject_rbl_client cbl.abuseat.org permit
smtpd_sender_restrictions =
permit_mynetworks,
reject_non_fqdn_sender,
reject_unknown_sender_domain,
permit
smtpd_client_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination reject_rbl_client zen.spamhaus.org reject_unknown_reverse_client_hostname permit
Are you sure your server isn't an open relay?
For a start the restrictions should be comma separated, which is probably the main problem.
Also I generally prefer to end with an explicit
reject
rather thanpermit
. Anything that doesn't happen to match a deny rule is going to end up permitted. (Yourreject_unauth_destination
should stop any mail to domains you don't specifically allow relay to, but still it's better to just reject by default)Edit to extend answer: Based on the logs, the client is connecting remotely and sending an email from the
mydomain.com
domain togmail.com
successfully, so once you've sorted out the format of the restrictions you just need to identify why it's getting a permit action.I personally would go with a configuration similar to the following. Note that I don't know your full environment or configuration so I provide no guarantee that you can just use this without modification or full testing (as I haven't tested it at all either). It's entirely possible something else in your config is broken and causing the original issue