The closest thing I tried was to add reject_unlisted_sender
to main.conf but that also disables receiving any email to that mailbox. I want only deny sending but still allow receiving.
EDIT
Here's output of postfinger.
If that really isn't what you want @UsersUser, here's output of requested commands
As @masegaloeh suggested, here's what I did :
In main.cf
This tells postfix to perform the
check_sender_access
restriction on every sender before mail is sent.mysql:/etc/postfix/mysql-virtual_sender.cf
contains the necessary SQL query to perform the check. If the result of the query is"REJECT"
then postfix will deny sending the mail from that sender. So what we want is to create a database, add an access table, and for every sender we want to ban we'll insert a line with a "REJECT" value. To lift the ban, we update that value to "PERMIT". The other possible value is "DEFER". (see postfix documentation)I am administering a server that was apparently configured using ISPConfig, so I already found a database, table and configuration file ready. I just inserted a new row.
In /etc/postfix/mysql-virtual_sender.cf
This gives postfix the necessary information to perform the query. The database is
dbispconfig
, the table to query ismail_access
, and the field to query, the one that will be holding the"REJECT"
value is"access".
Postfix will provide the sender's email and it will be matched against the"source"
field (theWHERE
clause).In the
dbispconfig.mail_access
table, here's what I have addedThe values for the other fields (other than access) were borrowed from other tables, they are specific to ISPConfig and have nothing to do with postfix. The important fields here are really source, access, type and active. These fields are in the
/etc/posftix/mysql-virtual_sender.cf
configuration file that we instructed postfix to use withcheck_sender_access
.