In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
# postfix#
1.postfix provides smtp protocol for delivering mail.
Default port 25
Default release directory / var/log/maillog # # service log
Mail root @. Send an email
Themes:
Content.
.
Mailq # View message queues
Postqueue-f # reprocess the mail queue
By default, the mail port is only open on 127.0.0.1.
two。
Configuration
Vim / etc/postfix/main.cf
76 myhostname = westos-mail.westos.com # Network excuse for opening port 25
83 mydomain = westos.com # specify the domain name of mta
99 myorigin = westos.com # define the end of the message source (the character content after @)
116 inet_interfaces = all # Network excuse for opening port 25
164For mydestination = $myhostname, $mydomain, localhost # accept the assignment of email characters
Systemctl restart postfix.service
Systemctl stop firewalld
3. Mail alias
[root@westos-mail named] # vim / etc/aliases
97 admin: root # # Mail alias
98 moreuser:: include:/etc/postfix/moreuser # # send email in groups
[root@qq-mail ~] # vim / etc/postfix/moreuser
User1
User2
[root@qq-mail ~] # systemctl restart postfix.service
Mail-u user name
Postsuper-d Delete queued messages
Postqueue-f resend queued messages
Postalias / etc/aliases
4. Send mail through a remote host
[kiosk@foundation75 Desktop] $yum install-y telnet
[root@foundation75 Desktop] # telnet 172.25.254.101 25
Trying 172.25.254.101...
Connected to 172.25.254.101.
Escape character is'^]'.
220 westos-mail.westos.com ESMTP Postfix
Ehlo hello
250-westos-mail.westos.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
Mail from:root@westos.com
250 2.1.0 Ok
Rcpt to:root@qq.com
250 2.1.5 Ok
Data
354 End data with.
Qwdq
Qwdeq
Qeq
.
test
[root@qq-mail ~] # mail
Heirloom Mail version 12.5 7-5-10. Type? For help.
"/ var/spool/mail/root": 2 messages 1 new 2 unread
U 1 root Tue May 23 09:45 25 amp 739 "qq"
N 2 root@westos.com Tue May 23 09:53 15 Compact 494
& 2
Message 2:
From root@westos.com Tue May 23 09:53:48 2017
Return-Path:
X-Original-To: root@qq.com
Delivered-To: root@qq.com
Status: R
Qwdq
Qwdeq
Qeq
5. Access control of mail client
On mta
Postconf-e "smtpd_client_restrictions = check_client_access hash:/etc/postfix/access"
Root@westos-mail named] # vim / etc/postfix/main.cf
681 smtpd_client_restrictions = check_client_access hash:/etc/postfix/acce ss
Root@westos-mail named] # vim / etc/postfix/access
476 172.25.254.95 REJECT
[root@westos-mail named] # postmap / etc/postfix/access
[root@westos-mail named] # ls
Data named.ca named.localhost qq.com.zone westos.com.zone
Dynamic named.empty named.loopback slaves
[root@westos-mail named] # cd / etc/postfix
[root@westos-mail postfix] # ls
Access canonical header_checks master.cf transport
Access.db generic main.cf relocated virtual
test
[root@test Desktop] # telnet 172.25.254.195 25
Trying 172.25.254.195...
Connected to 172.25.254.195.
Escape character is'^]'.
220 westos-mail.westos.com ESMTP Postfix
Mail from:root@westos.com
250 2.1.0 Ok
Rcpt to:root@qq.com
554 5.7.1: Client host rejected: Access denied
# # restrict users from sending messages
[root@westos-mail postfix] # postconf-e "smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender"
[root@westos-mail postfix] # vim / etc/postfix/main.cf
681 smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender
[root@westos-mail postfix] # vim / etc/postfix/sender
Student@westos.com REJECT
[root@westos-mail postfix] # postmap / etc/postfix/sender
[root@westos-mail postfix] # ls
Access canonical header_checks master.cf sender transport
Access.db generic main.cf relocated sender.db virtual
[root@westos-mail postfix] # systemctl restart postfix.service
test
[root@foundation75 Desktop] # telnet 172.25.254.101 25
Trying 172.25.254.101...
Connected to 172.25.254.101.
Escape character is'^]'.
220 westos-mail.westos.com ESMTP Postfix
Mail from:student@westos.com
250 2.1.0 Ok
Rcpt to:root@westos.com
554 5.7.1: Sender address rejected: Access denied
# # restrict users from receiving
[root@westos-mail postfix] # postconf-e "smtpd_sender_restrictions = check_recipient_access hash:/etc/postfix/recip"
[root@westos-mail postfix] # vim / etc/postfix/main.cf
Smtpd_sender_restrictions = check_recipient_access hash:/etc/postfix/recip
[root@westos-mail postfix] # vim / etc/postfix/recip
Westos@westos.com REJECT
[root@westos-mail postfix] # postmap / etc/postfix/recip
[root@westos-mail postfix] # systemctl restart postfix.service
test
[root@foundation75 Desktop] # telnet 172.25.254.101 25
Trying 172.25.254.101...
Connected to 172.25.254.101.
Escape character is'^]'.
220 westos-mail.westos.com ESMTP Postfix
Mail from:root@qq.com
250 2.1.0 Ok
Rcpt to:westos@westos.com
554 5.7.1: Recipient address rejected: Access denied
# outbound address camouflage
Do a good job of dns analysis
[root@westos-mail named] # postconf-e "smtp_generic_maps = hash:/etc/postfix/generic"
[root@westos-mail named] # vim / etc/postfix/main.cf
Smtp_generic_maps = hash:/etc/postfix/generic
[root@westos-mail named] # vim / etc/postfix/generic
Westos@westos.com hello@sb.com
[root@westos-mail named] # postmap / etc/postfix/generic
[root@westos-mail named] # cd / etc/postfix/
[root@westos-mail postfix] # ls
Access canonical generic.db main.cf recip relocated sender.db virtual
Access.db generic header_checks master.cf recip.db sender transport
[root@westos-mail postfix] # id westos
Uid=1001 (westos) gid=1001 (westos) groups=1001 (westos)
test
From hello@sb.com Tue May 23 11:55:08 2017
Return-Path:
X-Original-To: root@qq.com
Delivered-To: root@qq.com
Date: Tue, 23 May 2017 11:55:08-0400
To: root@qq.com
Subject: qdq
User-Agent: Heirloom mailx 12.5 7-5-10
Content-Type: text/plain; charset=us-ascii
From: hello@sb.com
Status: R
# # inbound address Translation
Do a good job of dns analysis
[root@westos-mail postfix] # postconf-e "virtual_alias_maps = hash:/etc/postfix/virtual"
[root@westos-mail postfix] # vim / etc/postfix/virtual
295 hello@sb.com westos@westos.com
[root@westos-mail postfix] # vim / etc/postfix/main.cf
Virtual_alias_maps = hash:/etc/postfix/virtual
[root@westos-mail postfix] # postmap / etc/postfix/virtual
[root@westos-mail postfix] # systemctl restart postfix.service
[root@westos-mail postfix] # mail hello@sb.com
Subject: qwdq
Qwdq
Dq
Wdq
.
EOT
test
[root@westos-mail postfix] # mail-u westos
Heirloom Mail version 12.5 7-5-10. Type? For help.
"/ var/mail/westos": 1 message 1 new
N 1 root Tue May 23 12:10 20 amp 560 "qwdq"
& 1
Message 1:
From root@westos.com Tue May 23 12:10:01 2017
Return-Path:
X-Original-To: hello@sb.com
Delivered-To: westos@westos.com
Date: Tue, 23 May 2017 12:10:00-0400
To: hello@sb.com
Subject: qwdq
User-Agent: Heirloom mailx 12.5 7-5-10
Content-Type: text/plain; charset=us-ascii
From: root@westos.com (root)
Status: R
# #
# dovecot#
1.dovecot is used to provide pickup protocols.
Pop3 110
Imap 143
Imaps 993
Pop3s 995
Given the user name and password, the dovecot program looks at the user's mail file instead of us.
2.yum intsall-y dovecot
3.
[root@westos-mail named] # vim / etc/dovecot/dovecot.conf
24 protocols = imap pop3 lmtp
48 login_trusted_networks = 0.0.0.0amp 0
49 disable_plaintext_auth = no
[root@westos-mail named] # vim / etc/dovecot/conf.d/10-mail.conf
30 mail_location = mbox:~/mail:INBOX=/var/mail/%u
[root@westos-mail ~] # su westos
[westos@westos-mail root] $cd ~
[westos@westos-mail ~] $mkdir / home/westos/mail/.imap-p
[westos@westos-mail ~] $touch / home/westos/mail/.imap/INBOX
[root@westos-mail westos] # passwd westos
Changing password for user westos.
New password:
BAD PASSWORD: The password is a palindrome
Retype new password:
Passwd: all authentication tokens updated successfully.
[root@westos-mail westos] # systemctl restart dovecot.service
[root@westos-mail ~] # mkdir / etc/skel/mail/.imap-p
[root@westos-mail ~] # touch / etc/skel/mail/.imap/INBOX
[root@westos-mail ~] # useradd zhang
[root@westos-mail ~] # passwd zhang
Changing password for user zhang.
New password:
BAD PASSWORD: The password is a palindrome
Retype new password:
Passwd: all authentication tokens updated successfully.
[root@westos-mail ~] # systemctl restart dovecot.service
test
Host installs mutt
[root@foundation75 Desktop] # mutt-f pop://zhang@172.25.254.101
Install Thunderbird
Use the real machine
Rpm-ivh thunderbird-31.2.0-1.el7.x86_64.rpm
Next, do the following
After entering, log in and reply email to westos@westom.com
test
[root@westos-mail ~] # mail
Heirloom Mail version 12.5 7-5-10. Type? For help.
"/ var/spool/mail/root": 2 messages 1 new
1 root Tue May 23 11:22 21max 572 "qwew"
> N 2 westos@westos.com Wed May 24 11:52 32 amp 940 "Re:123"
& 2
Message 2:
From westos@westos.com Wed May 24 11:52:52 2017
Return-Path:
X-Original-To: root@westos.com
Delivered-To: root@westos.com
Date: Wed, 24 May 2017 23:52:52 + 0800
From: "westos@westos.com"
User-Agent: Mozilla/5.0 (X11; Linux x8634; rv:31.0) Gecko/20100101 Thunderbird/
31.2.0
To: root
Subject: Re:123
Content-Type: text/plain; charset=UTF-8; format=flowed
Status: R
# postfix+mariadb#
[root@westos-mail ~] # yum install-y httpd php php-mysql mariadb-server
[root@westos-mail ~] # systemctl start mariadb
[root@westos-mail ~] # vim / etc/my.cnf
[root@westos-mail ~] # systemctl restart postfix.service
[root@westos-mail ~] # systemctl restart mariadb.service
[root@westos-mail ~] # mysql_secure_installation
[root@westos-mail ~] # cd / var/www/html
[root@westos-mail html] # ls
PhpMyAdmin-3.4.0-all-languages.tar.bz2
[root@westos-mail html] # tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2
[root@westos-mail html] # rm-fr * .bz2
[root@westos-mail html] # ls
PhpMyAdmin-3.4.0-all-languages
[root@westos-mail html] # mv phpMyAdmin-3.4.0-all-languages/ myadmin
[root@westos-mail html] # ls
Myadmin
[root@westos-mail html] # cd myadmin
[root@westos-mail myadmin] # cp config.sample.inc.php config.inc.php
[root@westos-mail myadmin] # vim config.inc.php
[root@westos-mail myadmin] # systemctl restart httpd
[root@westos-mail myadmin] # mysql-uroot-p
Enter password:
Welcome to the MariaDB monitor. Commands end with; or\ g.
Your MariaDB connection id is 32
Server version: 5.5.35-MariaDB MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
MariaDB [(none)] > create user postuser@localhost identified by 'postuser'
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)] > grant select,update,insert on email.* to postuser@localhost
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)] > quit
Bye
[root@westos-mail myadmin] # mysql-upostuser-p
Enter password:
Welcome to the MariaDB monitor. Commands end with; or\ g.
Your MariaDB connection id is 33
Server version: 5.5.35-MariaDB MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
MariaDB [(none)] > select * from email.emailuser
+-+
| | username | password | domain | maildir | |
+-+
| | lee@lee.com | lee | lee.com | / mnt/lee.com/lee/ | |
+-+
[root@westos-mail ~] # cd / etc/postfix/
[root@westos-mail postfix] # vim mailuser.cf # user name query
1 hosts = localhost # # the host where the database is located
2 user = postuser # # users who log in to the database
3 password = postuser # # password for logging into the database
4 dbname = email # # the name of the postfix to query
5 table = emailuser # # postfix the name of the table to be queried
6 select_field = username # # fields to be queried by postfix
7 where_field = username # # query conditions for the postfix given by the user
[root@westos-mail postfix] # postmap-Q "lee@lee.com" mysql:/etc/postfix/mailuser.cf
Lee@lee.com
[root@westos-mail postfix] # vim maildomain.cf # user domain name query
1 hosts = localhost
2 user = postuser
3 password = postuser
4 dbname = email
5 table = emailuser
6 select_field = domain
7 where_field = domain
[root@westos-mail postfix] # postmap-Q "lee.com" mysql:/etc/postfix/maildomain.cf
Lee.com
[root@westos-mail postfix] # vim mailbox.cf # query the location of user's mailbox
1 hosts = localhost
2 user = postuser
3 password = postuser
4 dbname = email
5 table = emailuser
6 select_field = maildir
7 where_field = username
[root@westos-mail postfix] # postmap-Q "lee@lee.com" mysql:/etc/postfix/mailbox.cf
/ mnt/lee.com/lee/
Attached picture
# configure postfix
[root@westos-mail] # groupadd-g 666 vmail
[root@westos-mail ~] # id vmail
Uid=666 (vmail) gid=666 (vmail) groups=666 (vmail)
[root@westos-mail ~] # postconf-d | grep virtual
[root@westos-mail ~] # postconf-e "virtual_mailbox_base = / home/vmail"
[root@westos-mail ~] # postconf-e "virtual_uid_maps = static:666"
[root@westos-mail ~] # postconf-e "virtual_gid_maps = static:666"
[root@westos-mail ~] # postconf-e "virtual_alias_maps = mysql:/etc/postfix/mailuser.cf"
[root@westos-mail ~] # postconf-e "virtual_mailbox_maps = mysql:/etc/postfix/mailbox.cf"
[root@westos-mail ~] # postconf-e "virtual_mailbox_domain = mysql:/etc/postfi/maildomain.cf"
Systemctl restart postfix.service
test
The mail to lee@lee.com can be found in / home/vmail/lee.com/new/.
Attached picture
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.