I have configured my postfix so as users under my server shall send mails through port 587 and port 25 will only be used to receive mails from mail servers.
I am successful to the extent that on connecting to port 25 mails are not allowed outside the mail server and it is being rejected as relay-access denied. whereas on port 587 the clients are able to sent mail to outside mail servers.
To achieve this I have set in my main.cf
smtpd_recipient_restriction=permit_mynetworks, reject_unauth_destination
that is I removed permit_sasl_authenticated.
if I add this condition, the mails are allowed to be sent outside the network and if I am removing the condition, any one can connect to port 25 and since there is no authentication can sent any number of mails to local recipients.
what is way that I can use sasl authentication on port 25, yet prevent it from relaying mails outside my network.
setting in main.cf:
smtpd_recipient_restrictions=
reject_unauth_pipelining,permit_mynetworks,reject_unauth_destination,
reject_invalid_hostname,reject_non_fqdn_hostname,reject_unknown_recipient_domain,
reject_non_fqdn_recipient,reject_unauth_destination,check_sender_access mysql:/etc
/postfix/mysql-virtual_sender.cf,reject_non_fqdn_sender,
reject_unknown_sender_domain,reject_unknown_recipient_domain,reject_rbl_client
cbl.abuseat.org,reject_rbl_client dul.dnsbl.sorbs.net,reject_rbl_client
ix.dnsbl.manitu.net,check_recipient_access mysql:/etc/postfix/mysql-
virtual_recipient.cf,permit
setting in master.cf
submission inet n - - - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject