Custom reject message for one address?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom reject message for one address?

Dan Mahoney (Gushi)
Hey there all,

At the dayjob, we're getting enough spam to webmaster@ that we've decided
to reroute it to a different address.

We'd like to have the bounce messgge let people know about this address.
We don't want to send them another message, but we'd like their bounce
message to give them a clue -- IF they read it.

So something like REJECT "Sorry this address has been overrun, please
email [hidden email]"

If I just delete the address, I get "user unknown in virtual alias table".
If I try putting the reject in my virtual alias, this seems not to be
parsed at that point in the process.

How can one do this?

-Dan

--

--------Dan Mahoney--------
Techie,  Sysadmin,  WebGeek
Gushi on efnet/undernet IRC
FB:  fb.com/DanielMahoneyIV
LI:   linkedin.com/in/gushi
Site:  http://www.gushi.org
---------------------------

Reply | Threaded
Open this post in threaded view
|

RE: Custom reject message for one address?

Koga Hayashi
Dan,

> -----Original Message-----
> From: [hidden email] <[hidden email]> On
> Behalf Of Dan Mahoney (Gushi)
> Sent: Monday, September 21, 2020 10:29 AM
> To: [hidden email]
> Subject: Custom reject message for one address?
>
> Hey there all,
>
> At the dayjob, we're getting enough spam to webmaster@ that we've decided to
> reroute it to a different address.
>
> We'd like to have the bounce messgge let people know about this address.
> We don't want to send them another message, but we'd like their bounce message
> to give them a clue -- IF they read it.
>
> So something like REJECT "Sorry this address has been overrun, please email
> [hidden email]"
>
> If I just delete the address, I get "user unknown in virtual alias table".
> If I try putting the reject in my virtual alias, this seems not to be parsed at that
> point in the process.
>
> How can one do this?

If my understandings are collect, steps below should do the trick.

1. Create a mapping file like below
  /etc/postfix/custom_reject:
        [hidden email] REJECT Sorry this address has been overrun, please email [hidden email]

2. sudo postmap /etc/postfix/custom_reject

3. Edit the main.cf like below.
  smtpd_recipient_restrictions:
        check_recipient_access hash:/etc/postfix/custom_reject

4. reload postfix


Kouga


>
> -Dan
>
> --
>
> --------Dan Mahoney--------
> Techie,  Sysadmin,  WebGeek
> Gushi on efnet/undernet IRC
> FB:  fb.com/DanielMahoneyIV
> LI:   linkedin.com/in/gushi
> Site:  http://www.gushi.org
> ---------------------------

Reply | Threaded
Open this post in threaded view
|

RE: Custom reject message for one address?

Dan Mahoney (Gushi)
On Mon, 21 Sep 2020, Koga Hayashi wrote:

> Dan,
>
>> -----Original Message-----
>> From: [hidden email] <[hidden email]> On
>> Behalf Of Dan Mahoney (Gushi)
>> Sent: Monday, September 21, 2020 10:29 AM
>> To: [hidden email]
>> Subject: Custom reject message for one address?
>>
>> Hey there all,
>>
>> At the dayjob, we're getting enough spam to webmaster@ that we've decided to
>> reroute it to a different address.
>>
>> We'd like to have the bounce messgge let people know about this address.
>> We don't want to send them another message, but we'd like their bounce message
>> to give them a clue -- IF they read it.
>>
>> So something like REJECT "Sorry this address has been overrun, please email
>> [hidden email]"
>>
>> If I just delete the address, I get "user unknown in virtual alias table".
>> If I try putting the reject in my virtual alias, this seems not to be parsed at that
>> point in the process.
>>
>> How can one do this?
>
> If my understandings are collect, steps below should do the trick.
>
> 1. Create a mapping file like below
>  /etc/postfix/custom_reject:
> [hidden email] REJECT Sorry this address has been overrun, please email [hidden email]
>
> 2. sudo postmap /etc/postfix/custom_reject
>
> 3. Edit the main.cf like below.
>  smtpd_recipient_restrictions:
> check_recipient_access hash:/etc/postfix/custom_reject

I have these things in place already.  This is also a virtual domain:

# Insert text from sample-virtual.cf if you need virtual domain support.

virtual_maps =  hash:$config_directory/delivery_maps/final_delivery_foo,

where [hidden email] [hidden email]

If I have an entry in the recipient map, the mail goes through to its
final destination and I do not get a bounce..  If I do
not, I get this error:


    ----- The following addresses had permanent fatal errors -----
<[hidden email]>
     (reason: 550 5.1.1 <[hidden email]>: Recipient address rejected:
User unknown in virtual alias table)

In neither case do I get the error specified in my
whitelist_recipients map:

[hidden email]               REJECT Sorry this has been abused please
contact [hidden email]

Here are the relevant bits of main.cf:

local_recipient_maps =
         $relocated_maps,
         $alias_maps,
         unix:passwd.byname,
         $virtual_maps

virtual_maps =  hash:$config_directory/delivery_maps/final_delivery_foo,
                 hash:$config_directory/delivery_maps/mail2news,
                 regexp:$config_directory/delivery_maps/regex_aliases

smtpd_recipient_restrictions =
         permit_mynetworks,
         reject_unknown_sender_domain,
         reject_unknown_recipient_domain,
         reject_unauth_destination,
         reject_invalid_hostname,
         reject_non_fqdn_hostname,
         check_client_access cidr:$config_directory/access/spammers,
         check_client_access cidr:$config_directory/access/whitelist,
         check_sender_access hash:$config_directory/access/sender_access,
         check_recipient_access hash:$config_directory/access/whitelist_recipients,
         reject_rbl_client zen.spamhaus.org


>
> 4. reload postfix
>
>
> Kouga
>
>
>>
>> -Dan
>>
>> --
>>
>> --------Dan Mahoney--------
>> Techie,  Sysadmin,  WebGeek
>> Gushi on efnet/undernet IRC
>> FB:  fb.com/DanielMahoneyIV
>> LI:   linkedin.com/in/gushi
>> Site:  http://www.gushi.org
>> ---------------------------
>
>

--

"Blargy Frap!"

-mtreal, efnet #macintosh channel, 8.10.98, Approx 3AM


--------Dan Mahoney--------
Techie,  Sysadmin,  WebGeek
Gushi on efnet/undernet IRC
FB:  fb.com/DanielMahoneyIV
LI:   linkedin.com/in/gushi
Site:  http://www.gushi.org
---------------------------

Reply | Threaded
Open this post in threaded view
|

RE: Custom reject message for one address?

Dan Mahoney (Gushi)
On Mon, 21 Sep 2020, Dan Mahoney (Gushi) wrote:

Figured it out.

Turns out with a virtual domain, you still need to point it somwhere, and
the reject map needs to match the RIGHT HAND SIDE of that map, not the
left.

In my case, I pointed it at webmaster@localhost, and updated the
recipient_map to have a left hand side of webmaster@localhost, and
then started getting the right message.

-Dan

> I have these things in place already.  This is also a virtual domain:
>
> # Insert text from sample-virtual.cf if you need virtual domain support.
>
> virtual_maps =  hash:$config_directory/delivery_maps/final_delivery_foo,
>
> where [hidden email] [hidden email]
>
> If I have an entry in the recipient map, the mail goes through to its final
> destination and I do not get a bounce..  If I do not, I get this error:
>
>
>   ----- The following addresses had permanent fatal errors -----
> <[hidden email]>
>    (reason: 550 5.1.1 <[hidden email]>: Recipient address rejected: User
> unknown in virtual alias table)
>
> In neither case do I get the error specified in my whitelist_recipients map:
>
> [hidden email]               REJECT Sorry this has been abused please
> contact [hidden email]
>
> Here are the relevant bits of main.cf:
>
> local_recipient_maps =
>        $relocated_maps,
>        $alias_maps,
>        unix:passwd.byname,
>        $virtual_maps
>
> virtual_maps =  hash:$config_directory/delivery_maps/final_delivery_foo,
>                hash:$config_directory/delivery_maps/mail2news,
>                regexp:$config_directory/delivery_maps/regex_aliases
>
> smtpd_recipient_restrictions =
>        permit_mynetworks,
>        reject_unknown_sender_domain,
>        reject_unknown_recipient_domain,
>        reject_unauth_destination,
>        reject_invalid_hostname,
>        reject_non_fqdn_hostname,
>        check_client_access cidr:$config_directory/access/spammers,
>        check_client_access cidr:$config_directory/access/whitelist,
>        check_sender_access hash:$config_directory/access/sender_access,
>        check_recipient_access
> hash:$config_directory/access/whitelist_recipients,
>        reject_rbl_client zen.spamhaus.org
>
>
>>
>> 4. reload postfix
>>
>>
>> Kouga
>>
>>
>>>
>>> -Dan
>>>
>>> --
>>>
>>> --------Dan Mahoney--------
>>> Techie,  Sysadmin,  WebGeek
>>> Gushi on efnet/undernet IRC
>>> FB:  fb.com/DanielMahoneyIV
>>> LI:   linkedin.com/in/gushi
>>> Site:  http://www.gushi.org
>>> ---------------------------
>>
>>
>
>

--

"Hitler, Satan, those Hanson kids, anything.  Just not the curious
anteater."

-Peter Scolari, as Wayne Szalinki in "Honey, I Shrunk The Kids--The
Series"


--------Dan Mahoney--------
Techie,  Sysadmin,  WebGeek
Gushi on efnet/undernet IRC
FB:  fb.com/DanielMahoneyIV
LI:   linkedin.com/in/gushi
Site:  http://www.gushi.org
---------------------------