RHEL5 installs Postfix + CyrusSASL + dovecot -- Linux Enterprise Application-Linux server application information. For details, see the following. RHEL5 is installed by default. No type of server is selected (such as WEB server, development server, and virtual server)
Install postfix
[Root @ rhel5 ~] #/Etc/rc. d/init. d/sendmail stop
Close sm-client: [OK]
Disable sendmail: [OK]
[Root @ rhel5 ~] # Chkconfig sendmail off
[Root @ rhel5 Server] # rpm-ivh postfix-2.3.3-2.i386.rpm
[Root @ rhel5 Server] # vi/etc/postfix/main. cf
Myhostname = mail.mailidc.cn # Set the Host Name and domain name of the email host running the postfix Service
Mydomain = mailidc.cn
Myorigin = $ mydomain # Set the domain name or Host Name of the mail sent by the Local Machine
Inet_interfaces = all # Set the network interface of the postfix service listener
Mydestination = $ myhostname, $ mydomain, localhost. $ mydomain, localhost # Set the host name or domain name for receiving emails
Mynetworks = 127.0.0.1 # sets which network mails can be forwarded
Relay_domains = $ mydestination # sets which domains can forward emails
Save the file.
Check the postfix Configuration:
[Root @ rhel5 Server] # postconf? N
[Root @ rhel5 ~] # Chkconfig postfix on
?? Add ostfix to the root group:
# Usermod-G root postfix
SMTP authentication Configuration
Install cyrus-sasl
1. Check whether cyrus-sasl is installed.
[Root @ rhel5 Server] # rpm-qa | grep cyrus
Cyrus-sasl-plain-2.1.22-4
Cyrus-sasl-lib-2.1.22-4
Cyrus-sasl-2.1.22-4
Password Verification Mechanism Of Cyrus-SASL V2
[Root @ rhel5 ~] # Saslauthd-v
Saslauthd 2.1.22
Authentication mechanisms: getpwent implements os5 pam rimap shadow ldap
---------------------------------------------------------------------------------
We are going to use the password verification mechanism of shadow.
Vi/etc/sysconfig/saslauthd
MECH = shadow
Start daemon of sasl and test:
# Service saslauthd start
#/Usr/sbin/testsaslauthd-u account-p 'Password'
0: OK "Success." => the account has been verified successfully.
[Root @ rhel5 ~] # Chkconfig saslauthd on
Set postfix to enable SMTP authentication
[Root @ rhel5 Server] # vi/etc/postfix/main. cf
Smtpd_sasl_auth_enable = yes
Smtpd_sasl_local_domain =''
Smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated,
Reject_unauth_destination
Broken_sasl_auth_clients = yes
Smtpd_client_restrictions = permit_sasl_authenticated
Smtpd_sasl_security_options = noanonymous
Wq! Save
In addition, when postfix requires SMTP authentication, it will read/usr/lib/sasl2/smtpd. the content of the conf file is used to determine the authentication method used. Therefore, the/usr/lib/sasl2/smtpd must be ensured. the content of the conf file is:
Pwcheck_method: saslauthd
Install and set dovecot (imap, pop3 ):
1. Check whether dovecot is installed:
[Root @ rhel5 ~] # Rpm-qa | grep dovecot
Dovecot-1.0-1.2.rc15.el5
2. Set pop3 to collect mail:
# Vi/etc/dovecot. conf
Protocols = pop3 # functions supported by imap imaps pop3 pop3s
3. Start and test:
# Service dovecot start
# Telnet to localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
------------------------------------------------------------------------
+ OK dovecot ready.
User Account
+ OK
Pass password
+ OK Logged in.
[Root @ rhel5 ~] # Chkconfig dovecot on
Here, postfix, Cyrus SASL, and dovecot can work normally.
Make postfix support mailtoken, spamassassin, and f-prot
A. Install F-PROT (F-PROT Antivirus for Linux)
Download f-prot from http://files.f-prot.com/files/linux-x86/fp-linux-ws.rpm
[Root @ rhel5 ~] # Rpm-ivh fp-linux-ws.rpm
B. Install mailbench
Download http://www.mailscanner.info/file... 4.60.8-1.rpm.tar.gz
2017.rpm.tar.gz
(There may be fewer perl kits and an error message! Install the rpm according to the error message !)
# Tar zxvf MailScanner-4.60.8-1.rpm.tar.gz
# Cd MailScanner-4.60.8-1
#./Install. sh
C. Install spamassassin
1. Check whether spamassassin is installed:
# Rpm-qa | grep spam
Install the package if it is not installed.
[Root @ rhel5 Server] # rpm-ivh spamassassin-3.1.7-4.el5.i386.rpm
2. Create the directory required by maillists to support spamassassin:
# Mkdir/var/spool/mail.pdf/spamassassin
# Chmod 700/var/spool/mailool/spamassassin
# Chown postfix. postfix/var/spool/mailtip/spamassassin
3. Modify the spamassassin Configuration File local. cf
Go to the site http://www.yrex.com/spam/spamconfig.php to automatically generate the content of local.cf.
# Vi/etc/mail/spamassassin/local. cf
# How many hits before a message is considered spam.
Required_hits 5.0
--------------------------------------------------------------------
# Whether to change the subject of suspected spam
Rewrite_subject 1
# Text to prepend to subject if rewrite_subject is used
Subject_tag ***** SPAM *****
# Encapsulate spam in an attachment
Report_safe 1
# Use terse version of the spam report
Use_terse_report 0
# Enable the Bayes system
Use_bayes 1
# Enable Bayes auto-learning
Auto_learn 1
# Enable or disable network checks
Skip_rbl_checks 1
Use_razor2 0
Use_dcc 0
Use_pyzor 0
# Mail using administration ages used in these country codes will not be marked
# As being possibly spam in a foreign language.
OK _ages all
# Mail using locales used in these country codes will not be marked
# As being possibly spam in a foreign language.
OK _locales all
4. Start spamassassin
# Service spamassassin start
Mailtoken settings
1. Modify mailproducer. conf.
# Vi/etc/mailconsumer. conf
Run As User = postfix
Run As Group = postfix
Incoming Queue Dir =/var/spool/postfix/hold
Outgoing Queue Dir =/var/spool/postfix/incoming
MTA = postfix
Virus Scanners = f-prot
Always Include SpamAssassin Report = yes
Use SpamAssassin = yes
Required SpamAssassin Score = 4
SpamAssassin User State Dir =/var/spool/mailool/spamassassin
SpamAssassin Install Prefix =/usr/bin
SpamAssassin Local Rules Dir =/etc/mailtasks
2. Modify postfix to support mailfix
# Vi/etc/postfix/main. cf
Change the following values
Header_checks = regexp:/etc/postfix/header_checks
# Vi/etc/postfix/header_checks
/^ Stored ed:/HOLD
Note: No blank space is allowed before!
3. Change directory permissions
# Chown postfix. postfix/var/spool/mailfix/incoming
# Chown postfix. postfix/var/spool/mail#/ quarantine
Stop postfix execution and start mailfix
# Service postfix stop
# Chkconfig postfix off
# Service mail1_start
Set mailfix. When MTA = postfix, the postfix will be started by yourself. If you have set to start postfix, stop it first.
4. Regularly update the virus definition file
# Crontab-e
0 4 ***/usr/local/f-prot/tools/check-updates.pl
Delete the original file in/etc/cron. hourly/update_virus_scanners.
Test SpamAssassin
Send an email with the following content. After receiving the email, the title should be marked:
XJS * C4JDBQADN1. NSBN3 * 2IDNEN * GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL * C.34X
In this way, we have set up a basic email system.
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.