"SMTP Patch"

Source: Internet
Author: User
Tags imap dovecot vmail

[STMPFill in the record]

One.
1) "Prohibit specified IP remote stmp operation to Me"
cd/etc/postfix/

Vim access [add as follows in the last line]
172.25.254.60 REJECT

Postmap access [Refresh file] "At this point, there will be more than one access.db file" "postconf-d in this directory | grep client, you can view the parameters "
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/8B/40/wKioL1hILyWRpYLfAABRbRiQTjg046.png "title=" 1.png " alt= "Wkiol1hilywrpylfaabrbriqtjg046.png"/>postconf-e "smtpd_client_restrictions = check_client_access hash:/etc /postfix/access "" Under the/etc/postfix
MIAN.CF (master configuration file) Last added parameter directive "to retrieve Access file"

Systemctl restart Postfix [Restart]

"Test" sends mail with 172.25.254.60, mail from:[email protected] rcpt To:[email protected]; "554 5.7.1 <unknown[172.25.254.60]&" appears gt;: Client Hostrejected:access denied (no permissions) "indicates success.
"Undo prohibit, delete access file add something, refresh file, restart service"

2) "Prohibit specified IP remote STMP send operation to specified user"
Vim Sender [Create this directory under/etc/postfix/]
[Email protected] REJECT

Postconf-e "smtpd_sender_restrictions = Check_sender_accesshash:/etc/postfix/sender" "Under/etc/postfix
MIAN.CF (master configuration file) Last added parameter instruction "to retrieve sender file"

Systemctl restart Postfix [Restart]
"Test" in Telnet, the sender sent with student, the error is "sender address rejected:access denied"

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/8B/40/wKioL1hIL1XxRrm1AABSkTQLWHY711.png "style=" float: none; "title=" 2.png "alt=" Wkiol1hil1xxrrm1aabsktqlwhy711.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/8B/40/wKioL1hIL1XiWM64AAAkRZ_Z4zQ633.png "style=" float: none; "title=" 3.png "alt=" Wkiol1hil1xiwm64aaakrz_z4zq633.png "/>


3) "Prohibit specified IP remote access to the specified user's Stmp collection operation"
Vim Recip
[Email protected] REJECT

Postmap Recip

Postconf-e "smtpd_recipient_restrictions = Check_recipient_accesshash:/etc/postfix/recip"

Systemctl restart Postfix

Test
<[email Protected]>: Recipient address rejected:access denied [normal]


Two.
1.) "Dovecot mail server, which serves these mail ports, imap143,pop3 110,imaps 993 and Pop3s 995. Can cat/etc/services | grep imap/pop View "

Yum Install Dovecot-y

vim/etc/dovecot/dovecot.conf [Modify config file]
protocols = IMAP POP3 LMTP [Allow service interface]
Disable_plaintext_auth = no [allow plaintext password verification]

Vim/etc/dovecot/conf.d/10-mail.conf
Mail_location =mbox:~/mail:inbox=/var/mail/%u

Netstat-antlpe | grep Dovecot [see 993,995,110,143 Port Open]

Yum install mutt-y [download an email program] "This operation is done on another host to see if you can receive mail with the Dovecot service installed"

Mutt-f pop3://[email protected] [Enter operation A] "in this operation, you should first establish several files in the Stdent directory"
"Detailed File Establishment operation"
(1) mkdir/home/student/mail/.imap/-P
(2) Touch/home/student/mail/.imap/inbox
"When creating a new user, the user's home directory file by default is the copy root of the/etc/skel/, if you need a lot of users have these files, write it here, once and for all." 】
[Complete, now execute mutt can see student received mail]

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/8B/43/wKiom1hIL6uTP8WkAADrmf8QTts555.png "style=" float: none; "title=" 5.png "alt=" Wkiom1hil6utp8wkaadrmf8qtts555.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/8B/40/wKioL1hIL6zCnLNfAADq6gRg5UM409.png "style=" float: none; "title=" 6.png "alt=" Wkiol1hil6zcnlnfaadq6grg5um409.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/8B/40/wKioL1hIL6zBl-fpAAENn1RQgGA664.png "style=" float: none; "title=" 7.png "alt=" Wkiol1hil6zbl-fpaaenn1rqgga664.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/8B/43/wKiom1hIL63B78DMAAC1ArOhABg888.png "style=" float: none; "title=" 8.png "alt=" Wkiom1hil63b78dmaac1arohabg888.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/8B/43/wKiom1hIL62R2JlYAAA3Ympn_m8850.png "style=" float: none; "title=" 9.png "alt=" Wkiom1hil62r2jlyaaa3ympn_m8850.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/8B/40/wKioL1hIL63Dc8MEAACgs0NKoYA624.png "style=" float: none; "title=" 10.png "alt=" Wkiol1hil63dc8meaacgs0nkoya624.png "/>


2.) "Use e-mail applications for remote messaging"
"Front: In the difference from the above two host download and install the good thunderbird-31.4.0.tar.bz2, this is a usable directory, tar jxf ~ after decompression, in the thunderbird/directory,./thunderbird execute, follow the prompts, Query the installation package (yumwhatprovides ~) and install, this has more than 10, slowly installed, installed, there is a graphical interface tool

vim/etc/dovecot/dovecot.conf [Modify config file]
login_trusted_networks= 0.0.0.0/0 [messages that allow accepted IP segments]

"User add to configure graphical interface";
Because it is a local user, the name is local user name: student; email [email protected];
Inbox: IMAP 172.25.254.161; Port: 143;ssl: none; authentication: ordinary password;
Shipment: SMTP 172.25.254.161; Port: 25;ssl: none; authentication: ordinary password;
User name: Student
[Re-measured, confirmed; Now you can get it.]

3.*) "Use a database, set up a virtual user, specify the recipient address of all users as/home/vmail/, and send and receive messages"
"Front: Yum install Mariadb-server-y;yum install HTTPD;TARJXF phpmyadmin-~.tar.bz2, change the name to MyAdmin, put it under/var/www/html/, Enter this directory, CP config.sample.inc.php Config.inc.php,vim the file, add a cookie any value; Initial database information (mysql_secure_installation); in/etc/ The hosts to add the initial IP and corresponding domain name "

1. Create a table of information in the database
Create a database in a graphics application: email, data structure item: Username,password,domain,maildir. Types are: varchar, Length: 50 50 50 100;
Build table: Muser table. (example) Username:[email protected];p assword:123;domain:hxl.org;mkdir:/hxl.org/admin/

2. Create a user (character interface) in the database and authorize
CREATE USER [email protected] by ' postfix ';
GRANT insert,update,select on Email.*to [email protected];

3. Fill in the configuration file for filtering information (cd/etc/pistfix/)
* Vim MYSQL-USERS.CF
1.host = localhost
2.user = Postfix
3.password = Postfix
4.dbname = Email
5.table = Muser
6.select_field = Username
7.where_field = Username
Test
Postmap-q "[email protected]" MYSQL:/ETC/POSTFIX/MYSQL-USERS.CF
[Email protected]

* Vim MYSQL-DOMAIN.CF
1.host = localhost
2.user = Postfix
3.password = Postfix
4.dbname = Email
5.table = Muser
6.select_field = Domain
7.where_field = Domain
Test
Postmap-q "hxl.org" mysql:/etc/postfix/mysql-domain.cf
hxl.org,hxl.org

* Vim MYSQL-MAILDIR.CF
1.host = localhost
2.user = Postfix
3.password = Postfix
4.dbname = Email
5.table = Muser
6.select_field = Maildir
7.where_field = Username
Test
Postmap-q "[email protected]" MYSQL:/ETC/POSTFIX/MYSQL-MAILDIR.CF
hxl.org/admin/

4. Add a virtual user to the main profile and the above information
Establish local user vmail, specify UIP 888,GIP 888, and non-interactive mode
Groupadd-g 888 Vmail
Useradd-g 888-u 888-s/sbin/nologin Vmail
[Add information to the Master profile (/ETC/POSTFIX/MAIN.CF)]
Postconf-e "Virtual_gid_maps =static:888"
Postconf-e "Virtual_uid_maps =static:888"
Postconf-e "Virtual_mailbox_base=/home/vmail"
Postconf-e "Virtual_alias_maps =mysql:/etc/postfix/mysql-users.cf"
Postconf-e "Virtual_alias_maps =mysql:/etc/postfix/mysql-domain.cf"
Postconf-e "Virtual_alias_maps =mysql:/etc/postfix/mysql-maildir.cf"

Test
mail [email protected] [send an e-mail to this IP]
Enter/home/vmail/admin, and view the file with the new directory, and see if the file in new is the message you sent, which indicates success
5. Configure Dovecot Mail acceptance service
Vim auth-sql.conf.ext [View sample file/usr/share/doc/dovecot-2.2.10/example-config]

CP dovecot-sql.conf.ext/etc/dovecot/

vim/etc/dovecot/dovecot-sql.conf.ext[configuration file, modify as follows]
# Database Driver:mysql, Pgsql,sqlite
Driver = MySQL
Connect = Host=localhost Dbname=emailuser=postfix password=postfix
Default_pass_scheme = PLAIN
107 password_query = \
108 SELECT username, domain, password \
109 from Muser WHERE username = '%u ' and domain = '%d '
User_query = SELECT Maildir, 888 as uid,888 as GID from Muser WHERE usernam e= '%u '

Vim/etc/dovecot/conf.d/10-mail.conf1
Mail_location =maildir:/home/vmail/%d/%n
168 First_valid_uid = 888
175 First_valid_gid = 888

Systemctl restart Dovecot.service [Restart service]

Yum Install Dovecot-mysql

Test
Remote telnet172.25.254.161
[Email protected]
Pass 123
The remote test can be successfully tested with a service application,
Because it is a virtual user in the database, the name is the local user name: [email protected]; email [email protected];
Inbox: IMAP 172.25.254.161; Port: 143;ssl: none; authentication: ordinary password;
Shipment: SMTP 172.25.254.161; Port: 25;ssl: None; authentication common password;
User name: [email protected] "You can build a few more users in the database, and then send each other, successfully accept the OK"

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/8B/40/wKioL1hIMAHjd3DdAAENA3rQeZk001.png "style=" float: none; "title=" 11.png "alt=" Wkiol1himahjd3ddaaena3rqezk001.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/8B/44/wKiom1hIMAKy-B43AAEPuKTmNEw244.png "style=" float: none; "title=" 12.png "alt=" Wkiom1himaky-b43aaepuktmnew244.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/8B/40/wKioL1hIMALThmD5AAEnDJxuZsU982.png "style=" float: none; "title=" 13.png "alt=" Wkiol1himalthmd5aaendjxuzsu982.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/8B/40/wKioL1hIMAPztdiGAADmuVHvJio076.png "style=" float: none; "title=" 14.png "alt=" Wkiol1himapztdigaadmuvhvjio076.png "/>




"SMTP Patch"

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.