Anti-Spam for the first Mail server on the Internet

Source: Internet
Author: User
Tags qmail
Article Title: Anti-Spam for the first Mail server on the Internet. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
   1. Ip address
For some spam senders with fixed ip addresses or fixed ip segments, We can restrict their smtp connections.
  
Vi tcp. smtp
  
218.61.128.61: deny
Restrict any smtp connections between machines 218.61.128.61 and my qmail server
Or:
  
218.61.128.: deny
Disable any smtp connection between machines in the 218.61.128 network segment and my qmail.
Then
  
Tcprules tcp. smtp. cdb tcp. smtp. tmp <tcp. smtp
Generate a New tcp. smtp. cdb
  
You can also use iptables to restrict connections to smtp ports.
  
   2. Seal an account
Mainly for some more formal spam senders
  
Vi/var/qmail/control/badmailfrom
  
Edit the/var/qmail/control/badmailfrom file (if no new one can be created) and write the rejected email address. Each record is a row, for example:
      
123@123.com
  
In this way, all emails FROM the 123@123.com will be rejected by the mail server.
  
You can also reject a domain by adding @ test.com to the badmailfrom file, so that all emails from any address of test.com will be rejected by the server.
  
   3. Set the. qmail-default file
Vi/var/qmail/alias/. qmail-default
  
/Var/vpopmail/bin/vdelivermail ''bounce-no-mailbox
In this way, the spam is sent. If it is a non-existing email address, the email will be automatically sent back and no this mailbox will be notified.
  
   4. Using third-party rbl services is actually using dns anti-query, which can prevent some people from sending spam messages on their own server.
I am using the real-time blacklist technology of the CDL + DNS anti-query method of the anti-spam alliance of China. This service is free of charge. However, after applying for the service, add/usr/local/bin/rblsmtpd to your smtp startup script, as shown below:
  
#! /Bin/sh
QMAILDUID = qmaild
NOFILESGID = nofiles
  
/Usr/local/bin/tcpserver-H-R-l 0-t 1-v-p-x/var/vpopmail/etc/tcp. smtp. cdb-u $ QMAILDUID-g $ NOFILESGID 0 smtp/usr/local/bin/rblsmtpd-r restart hostname/var/vpopmail/bin/vchkpw/bin/true/bin/reject 5checkpw/ bin/true 2> & 1 |/var/qmail/bin/splogger smtpd 3 &
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.