Avatar of sabecs
sabecs

asked on 

Need to modify a new cpanel exim mail filter

Hi,
I am modifying a new exim mail filter as per below, all works well but.

1. wondering how to log the output to logfile /var/log/filter.log which has been created with permission 0644?

2. How would I just fail the message and not send a reply back to the spammer?

3. is there a $header_to option to stop mail sent to a specific addresses

Thanks in advance.

/etc/cpanel_exim_system_filter_new


# Filters all incoming an outgoing mail logfile /var/log/filter.log 0644
# reject spam based on email body
# logfile /var/log/filter.log 0644 

if
    $message_body contains "Good Day" or
    $message_body contains "Hello PayPal" or
    $message_body contains "Dear valued PayPal" or
    $message_body contains "forward to your positive reply"
then
    fail text "This message has been rejected because it looks like you are spamming us."
endif

if
    $header_from contains "rezult" or 
    $header_from contains "secret"  
then
    fail text "Your email has been rejected because it looks like you are spamming us."
endif

Open in new window

Email ServersApache Web ServerLinux

Avatar of undefined
Last Comment
sabecs
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of sabecs
sabecs

ASKER

Thanks for you help Arnold, much appreciated.

The below code now works except for the logwrite, how do I make sure make sure that the exim user is the owner of the file.

Do I specify the  logfile /var/log/filter.log 0644 at the top of the code or do I have to code it just above every logwrite  command?
# Filters all incoming an outgoing mail logfile /var/log/filter.log 0644
# reject spam based on email body
    logfile /var/log/filter.log 0644 

if
    $message_body contains "Good Day" or
    $message_body contains "Hello PayPal" or
    $message_body contains "Dear valued PayPal" or
    $message_body contains "forward to your positive reply"
then
    logwrite "$tod_log $message_id processed"
    seen finish
#   fail text "This message has been rejected because it looks like you are spamming us."
endif

Open in new window

SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of sabecs
sabecs

ASKER

Thanks Arnold, much appreciated.
All working now, just had to chown cpaneleximfilter.cpaneleximfilter /var/log/filter.log
Linux
Linux

Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.

71K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo