Postfix mail system

Source: Internet
Author: User
Tags md5 digest dovecot

First, experimental Steps and Results

First Stage

Deploying the Postfix messaging System

Hostname

OS

Ip

Software

Www.benet.com

CentOS-6.5

10.0.0.2

Yum install-y CYRUS-SASL Cyrus-sasl-devel

Postfix-2.9.4.tar.gz/dovecot-2.1.10.tar.gz

Shut down firewall: Service iptables stop

Pre-compilation configuration, uninstalling SendMail, installing the Cyrus package

[email protected]/]# Yum remove-y sendmail

[email protected]/]# Yum install-y CYRUS-SASL cyrus-sasl-devel

Compiling and installing Postfix

[Email protected]/]# tar zxvf postfix-2.9.4.tar.gz-c/usr/src/

[Email protected]/]# cd/usr/src/postfix-2.9.4/

Use the Make makefiles command to adjust parameters before compiling so that Postfix supports SASL authentication and querying the MySQL database

[[email protected] postfix-2.9.4]# make makefiles ' CCARGS=-DUSE_SASL_AUTH-DUSE_CYRUS_SASL-I/USR/INCLUDE/SASL ' AUXLIBS=-L/USR/LIB/SASL2-LSASL2 '

[[email protected] postfix-2.9.4]# make && make install

Postconf–a View Supported authentication methods

Postconf–n display items that differ from the default configuration

Postfix Start Open Postfix

Postfix Check Configuration

Postfixreload Reload

Simplify configuration files

[Email protected] ~]# postconf-n > tmp

[Email protected] ~]# cd/etc/postfix/

[Email protected] postfix]# MV MAIN.CF Main.cf.bak

[Email protected] postfix]# mv ~/tmp./main.cf

[Email protected] postfix]# vim MAIN.CF

Inet_interfaces = 10.0.0.2, 127.0.0.1

Myhostname = www.benet.com

MyDomain = benet.com

Myorigin = $mydomain

Mydestination = $mydomain, $myhostname

Home_mailbox = maildir/

[[email protected] ~]# postfix start

Postfix/postfix-script:starting the Postfix mail system

Create a mail user, user group

[Email protected] ~]# Groupadd mailusers

[Email protected] ~]# useradd-s/sbin/nologin-g mailusers mail1

[Email protected] ~]# useradd-s/sbin/nologin-g mailusers mail2

[Email protected] ~]# passwd mail1

[Email protected] ~]# passwd MAIL2

[[Email protected] ~]# Telnet www.benet.com 25

Trying 10.0.0.2 ...

Connected to www.benet.com.

Escape character is ' ^] '.

Mail.benet.com ESMTP Postfix

HELO www.benet.com Client Host Address

Mail.benet.com

Mail From:[email protected] Sender address

2.1.0 Ok

RCPT To:[email protected] recipient address

2.1.5 Ok

Data to be transferred

354 END data with <CR><LF>.<CR><LF>

Subjec:a Test Mail Set right-click Topic

T323-y2

. Point number is over.

2.0.0 ok:queued as 5624662052F

QUIT

221 2.0.0 Bye

Connection closed by foreign host.

Phase II

Compiling and installing Dovecot

[Email protected]/]# useradd-m-s/sbin/nologin dovecot

[Email protected]/]# useradd-m-s/sbin/nologin dovenull

[Email protected]/]# tar zxvf dovecot-2.1.10.tar.gz-c/usr/src/

[Email protected] dovecot-2.1.10]#/configure--sysconfdir=/etc/

[[email protected] dovecot-2.1.10]# make && make install

[Email protected]/]# Cp/usr/src/dovecot-2.1.10/doc/dovecot-initd.sh/etc/init.d/dovecot

[Email protected]/]# chmod +x/etc/init.d/dovecot

[Email protected]/]# chkconfig--add dovecot

[Email protected]/]# cp-r/usr/local/share/doc/dovecot/example-config/*/etc/dovecot/

[Email protected]/]# vim/etc/dovecot/dovecot.conf

!include conf.d/10-auth.conf

SSL = no disable SSL mechanism

Disable_plaintext_auth = no allow plaintext password

Mail_location = Maildir:~/maildir Set the message storage format and location

Create a PAM Certification file

[Email protected]/]# Vim/etc/pam.d/dovecot

Auth Required pam_nologin.so

Auth include System-auth

Account include System-auth

Session include System-auth

[[email protected]/]#/etc/init.d/dovecot start

Starting Dovecot.

[[Email protected]/]# Telnet www.benet.com 110

Trying 10.0.0.2 ...

Connected to www.benet.com.

Escape character is ' ^] '.

+ok Dovecot ready.

User MAIL2 username

+ok

Pass Aptech Password

+ok logged in.

List Mailing Lists

+ok 1 messages:

1 427

.

RETR 1 Read the first message

+ok 427 octets

Return-path: <[email protected]>

x-original-to: [Email protected]

delivered-to: [Email protected]

Received:from www.benet.com (www.benet.com [10.0.0.2])

by Mail.benet.com (Postfix) with SMTP ID 5624662052F

For <[email protected]>; Wed, 08:26:32 +0800 (CST)

Subjec:a Test Mail

Message-id: <[email protected]>

date:wed, 08:26:32 +0800 (CST)

From: [Email protected]

T323-y2 Mail Content

.

Quit

+ok Logging out.

Connection closed by foreign host.

Phase III

Set up SMTP Authentication Service

[Email protected] ~]# vim/usr/lib64/sasl2/smtpd.conf

Pwcheck_method:saslauth

[[email protected] ~]#/ETC/INIT.D/SASLAUTHD start

Starting SASLAUTHD: [OK]

[Email protected] ~]# chkconfig--level SASLAUTHD on

Modify the main.conf configuration file, add SMTP authentication-related configuration parameters, and reload the configuration

[Email protected] ~]# VIM/ETC/POSTFIX/MAIN.CF

Smtpd_sasl_auth_enable = yes

Smtpd_sasl_security_options = noanonymous

Mynetworks = 127.0.0.1

Smtpd_recipient_restrictions =

Permit_mynetworks,

Permit_sasl_authenticated,

Reject_unauth_destination

[Email protected] ~]# Postfix Reload

Postfix/postfix-script:refreshing the Postfix mail system

Test SMTP Authentication

Authentication requires a user password, the encrypted string character encoding format is BASE64

Get password: printf "Zhangsan" | OpenSSL base64 (user name Zhangsan)

printf "Aptech" | OpenSSL base64 (password Aptech)

[[Email protected] ~]# Telnet www.benet.com 25

Trying 10.0.0.2 ...

Connected to www.benet.com.

Escape character is ' ^] '.

Mail.benet.com ESMTP Postfix

EHLO www.benet.com

250-mail.benet.com

250-pipelining

250-size 10240000

250-vrfy

250-etrn

250-auth PLAIN LOGIN cram-md5 digest-md5

250-enhancedstatuscodes

250-8bitmime

DSN

AUTH LOGIN

334 Vxnlcm5hbwu6

Bwfpbde=

334 Ugfzc3dvcmq6

Yxb0zwno

235 2.7.0 Authentication Successful

MAIL From:[email protected]

2.1.0 Ok

RCPT To:[email protected]

2.1.5 Ok

DATA

354 END data with <CR><LF>.<CR><LF>

Postfix

.

2.0.0 ok:queued as b0b69620537

QUIT

221 2.0.0 Bye

Connection closed by foreign host.

Postfix mail system

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.