November 25, 2024, 01:13:24 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: Junk Mails Control  (Read 4702 times)

Offline rajesh.bahl

  • Linux Learner
  • ***
  • Posts: 86
Junk Mails Control
« on: May 26, 2008, 07:24:42 AM »

Dear Experts,

Need your help in sorting out this issue:-

WE get lot of mails from different domains which are basically advertisements/promotions. The requirement is that these mails should get rejected at the server itself. We are using Postfix running on CentOS 4.6.
The configuration files are as follows:-

main.cf

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
default_privs = nobody
myhostname = xxxx.xxxxxx.net
mydomain = xxxxxx.net
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, $mydomain
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_recipient_restrictions =    check_client_access
            hash:/etc/postfix/access
            permit_mynetworks
            reject_unauth_destination
            reject_non_fqdn_sender
            reject_unknown_sender_domain
            reject_unknown_recipient_domain
            check_helo_access
            pcre:/etc/postfix/helo_checks
            reject_unauth_pipelining
            permit
smtpd_soft_error_limit = 3
smtpd_hard_errors_limit = 6
smtpd_helo_restrictions = permit_mynetworks,
   reject_rbl_client  =   sbl.spamhaus.org
   reject_rbl_client  =   proxies.relays.monkeys.com
   reject_rbl_client  =   opm.blitzed.org
   reject_rbl_client  =   dnsbl.njabl.org
   reject_rbl_client  =   blackholes.wirehub.net
   reject_rbl_client  =   list.dsbl.org
mynetworks = 192.168.0.0/24, 127.0.0.0/8
append_at_myorigin = yes
masquerade_classes = envelope_sender, header_sender, header_recipient
masquerade_domains = $mydomain
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
always_bcc = backup@paceinfosys.net
mail_spool_directory = /var/spool/mail
mailbox_command = /usr/bin/procmail
header_checks = regexp:/etc/postfix/header_checks
body_checks = regexp:/etc/postfix/mbl-body-deny
mime_header_checks = pcre:/etc/postfix/mime_header_checks
debug_peer_level = 2
debugger_command =
    PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
    xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.2.10/samples
readme_directory = /usr/share/doc/postfix-2.2.10/README_FILES
alias_database = hash:/etc/postfix/aliases
mailbox_size_limit = 1000000000
content_filter = smtp-amavis:[127.0.0.1]:10024
unknown_local_recipient_reject_code = 450
html_directory = no

master.cf

smtp      inet  n       -       n       -       -       smtpd
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr     fifo  n       -       n       300     1        qmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
smtp      unix  -       -       n       -       -       smtp
relay     unix  -       -       n       -       -       smtp
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
old-cyrus unix  -       n       n       -       -       pipe
  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
cyrus     unix  -       n       n       -       -       pipe
  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
smtp-amavis   unix     -     -        y       -       2       smtp
   -o smtp_data_done_timeout=1200
   -o disable_dns_lookups=yes
127.0.0.1:10025 inet   n       -       n      -     -    smtpd
   -o content_filter=
   -o local_recipient_maps=
   -o smtpd_client_restrictions=
   -o smtpd_helo_restrictions=
   -o smtpd_sender_restrictions=
   -o smtpd_recipient_restrictions=permit_mynetworks,reject_unauth_destination
   -o mynetworks=127.0.0.0/8
   -o strict_rfc821_envelope=yes
   -o smtpd_error_sleep_time=0
   -o smtpd_soft_error_limit=1001
   -o smtpd_hard_error_limit=1000   
#   -o receive_override_options=no_header_body_checks
trace     unix   -   -   n   -   0   bounce
verify     unix   -   -   n   -   1   verify
anvil     unix   -   -   n   -   1   anvil
scache     unix   -   -   n   -   1   scache
discard     unix   -   -   n   -   -   discard
tlsmgr    unix  -       -       n       1000?   1       tlsmgr

Can we reject such mails coming from particular domains at the server itself so that these do not propagate into the network ?

rajesh.bahl