管理邮件
?
{**郵件的發(fā)送與接收**}
[拒絕某ip發(fā)送]
useradd westos
passwd westos
[root@westos ~]# cd /etc/postfix/
[root@westos postfix]# ls
access ????generic ???????main.cf ???relocated ?virtual
canonical ?header_checks ?master.cf ?transport
?
[root@westos postfix]# vim access ?
172.25.254.149 REJECT ?最后一行添加要禁止的
[root@westos postfix]# postmap access ?執(zhí)行完會(huì)出現(xiàn)新的db文件
[root@westos postfix]# ls
access ????canonical ?header_checks ?master.cf ?transport
access.db ?generic ???main.cf ???????relocated ?virtual
[root@westos postfix]# postconf -d | grep client
?postconf -e "smtpd_client_restrictions = check_client_access hash:/etc/postfix/access" ???????????????
systemctl restart postfix.service ????重啟服務(wù)
測(cè)試
[root@westos postfix]# telnet 172.25.254.249?25
Trying 172.25.254.249...
Connected to 172.25.254.249.
Escape character is '^]'.
220 westos.com ESMTP Postfix
mail from:root@westos.com ?
250 2.1.0 Ok
rcpt to:root@westos.com
554 5.7.1 <unknown[172.25.254.249]>: Client host rejected: ACCESS(5)
(ip被拒絕發(fā)送)
?
[拒絕某一用戶發(fā)送]
?vim sender ???????????????(文件名任意)
student@westos.com ??????REJECT ???????拒絕用戶的全稱
?postmap sender ????????????刷新(必須要做)
?postconf -e "smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender" ???????????????
systemctl restart postfix.service ??????重啟服務(wù)
測(cè)試
[root@westos postfix]# telnet 172.25.254.249 25Trying 172.25.254.249...
Connected to 172.25.254.249.
Escape character is '^]'.
220 westos.com ESMTP Postfix
mail from:student@westos.com
250 2.1.0 Ok
rcpt to:root:westos.com
554 5.7.1 <student@westos.com>: Sender address rejected: Access denied?????(該用戶被拒絕發(fā)送)
?
[拒絕某一用戶接收文件]
?vim recip ???????????????
student@westos.com ?????REJECT ?????????拒絕用戶的全稱
?postmap recip ????????????????????????刷新
?postconf -e "smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recip" ???????????
systemctl restart postfix.service ??????重啟服務(wù)
測(cè)試
[root@westos postfix]# telnet 172.25.254.249?25
Trying 172.25.254.249...
Connected to 172.25.254.249.
Escape character is '^]'.
220 westos.com ESMTP Postfix
mail from:root@westos.com
250 2.1.0 Ok
rcpt to:student@westos.com
554 5.7.1 <student@westos.com>: Recipient address rejected: Access denied????(該用戶被拒絕接收)
?
?
[遠(yuǎn)程訪問郵箱]
主機(jī)
yum install dovecot -y ????????????安裝服務(wù)
(所用端口 imap 143 pop3 110 imaps 993 pop3 995)
cd /etc/dovecot
vim dovecot.conf
?24 ?protocols = imap pop3 lmtp ???????開放協(xié)議
?49 ?disable_plaintext_auth = no ???允許不加密
cd conf.d
vim 10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u ???郵件存放地點(diǎn)
systemctl start dovecot ???????????開啟服務(wù)
su ?- ?student ????????????????切換至用戶
mkdir /home/student/mail/.imap -p ???建立需要的目錄和文件
touch /home/student/mail/.imap/INBOX ???
?
client機(jī)
yum install mutt -y ???????????安裝服務(wù)
muut -f pop://student@172.25.254.249
?
?
?
?
?
圖形界面
主機(jī)
vim /etc/dovect/dovecot.conf ???????修改配置文件
?48 login_trusted_networks = 0.0.0.0/0 ???
systemctl restart dovect ???????重啟服務(wù)
?
client機(jī)
?lftp 172.25.254.250 -X ???????????
?tar jxf thunderbird-31.4.0.tar.bz2 ????解壓
?cd thunderbird/
?./thunderbird ???????????????執(zhí)行文件(安裝依賴文件)
?yum whatprovides /lib/ld-linux.so.2
?yum install glibc-2.17-55.el7.i686 ?-y
?./thunderbird
?yum whatprovides libstdc++.so.6
?yum install libstdc++-4.8.2-16.el7.i686 -y
?./thunderbird
?yum whatprovides libXrender.so.1
?yum install libXrender-0.9.8-2.1.el7.i686 -y
?./thunderbird
?yum whatprovides libasound.so.2
?yum install alsa-lib-1.0.27.2-3.el7.i686 -y
?./thunderbird
?yum whatprovides libdbus-glib-1.so.2
?yum install dbus-glib-0.100-7.el7.i686 -y
?./thunderbird
?yum whatprovides libgtk-x11-2.0.so.0
?yum install gtk2-2.24.22-5.el7.i686 ??-y
?./thunderbird
?yum whatprovides libXt.so.6
?yum install libXt-1.1.4-6.1.el7.i686 -y
?
?./thunderbird ???????????????????運(yùn)行
?
[虛擬賬戶的郵件管理]
配置數(shù)據(jù)庫
yum install ?mariadb-server.x86_64 ???????????安裝服務(wù)
yum install httpd php php-mysql -y
cd /var/www/html ???????????????
fltp 172.25.254.250 ?????????????????????????????**下載安裝包
tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2 ???????**解壓
mv phpMyAdmin-3.4.0-all-languages/ myadmin ??????**重命名
cd myadmin/
cp config.sample.inc.php config.inc.php ?????????
vim config.inc.php ????????????????????修改文件
$cfg['blowfish_secret'] = 'westos'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
systemctl start mariadb ???????????????????
systemctl start httpd
mysql_secure_installation ????????????????數(shù)據(jù)庫安全設(shè)置
systemctl restart mariadb.service ????????????重啟服務(wù)
mysql -u root -pwetsos ???????????????????進(jìn)入數(shù)據(jù)庫
MariaDB [(none)]> CREATE USER postfix@localhost identified by 'postfix' ;
Query OK, 0 rows affected (0.00 sec) ???????????創(chuàng)建用戶postfx
MariaDB [(none)]> GRANT INSERT,UPDATE,SELECT on email.* to postfix@localhost ;
Query OK, 0 rows affected (0.00 sec) ???????????賦予權(quán)限
?
vim mysql-users.cf ???????????????????
host = localhost
user = postfix
password = postfix
dbname = email
table = muser
select_field = username
where_field = username
?
vim mysql-domain.cf ????????????????????
host = localhost
user = postfix
password = postfix
dbname = email
table = muser
select_field = domain
where_field = domain
?
vim mysql-maildir.cf ???????????????????
host = localhost
user = postfix
password = postfix
dbname = email
table = muser
select_field = maildir
where_field = username
?
groupadd -g 111?vmail ???????????????????創(chuàng)建用戶組
useradd -g 111?-u 111?-s /sbin/nologin vmail ???????該用戶不能用shell(非交互式)
postconf -e "virtual_gid_maps = static:111"
postconf -e "virtual_uid_maps = static:111"
postconf -e "virtual_mailbox_base = /home/vmail"
postconf -e "virtual_alias_maps = mysql:/etc/postfix/mysql-users.cf"
postconf -e "virtual_mailbox_domains = mysql:/etc/postfix/mysql-domain.cf"
postconf -e "virtual_mailbox_maps = mysql:/etc/postfix/mysql-maildir.cf"
systemctl restart postfix.service ???????????
????
cd /etc/dovecot/c.conf
?vim 10-auth.conf
122 !include auth-system.conf.ext
123 !include auth-sql.conf.ext ???????
124 #!include auth-ldap.conf.ext
125 #!include auth-passwdfile.conf.ext
126 #!include auth-checkpassword.conf.ext
127 #!include auth-vpopmail.conf.ext
128 #!include auth-static.conf.ext
?
?vim 10-mail.conf
30 mail_location =maildir:/home/vmail/%d/%n
169 first_valid_uid = 111
176 first_valid_gid = 111
?
cd /usr/share/doc/dovecot-2.2.10/
cd example-config/
cp dovecot-sql.conf.ext /etc/dovecot/
vim dovecot-sql.conf.ext
31 # Database driver: mysql, pgsql, sqlite
32 driver = mysql
71 connect = host=localhost dbname=mail user=postfix password=postfix
73 # Default password scheme.
75 # List of supported schemes is in
76 # http://wiki2.dovecot.org/Authentication/PasswordSchemes
78 default_pass_scheme = PLAIN
107 password_query = \
108 ??SELECT username, domain, password \
109 ??FROM users WHERE username = '%U' AND domain = '%d'
125 user_query = SELECT maildir, 600 AS uid, 600 AS gid FROM muser WHERE username = '%u'
?
yum install dovecot-mysql.x86_64 -y ???????????安裝服務(wù)
systemctl restart dovecot ???????????????
?
[郵件空殼](實(shí)際不處理信息,只負(fù)責(zé)將信息轉(zhuǎn)發(fā))
client機(jī):
配置基礎(chǔ)dns
vim /etc/named.rfc1912.zones
zone "westos.org" IN {
????????type master;
????????file "westos.org.zone";
????????allow-update { none; };
};
cd /var/named/
cp -p named.localhost westos.org.zone
vim westos.org.zone
$TTL 1D
@ ??????IN SOA ?dns.westos.org rname.invalid. (
????????????????????????????????????????0 ??????; serial
????????????????????????????????????????1D ?????; refresh
????????????????????????????????????????1H ?????; retry
????????????????????????????????????????1W ?????; expire
????????????????????????????????????????3H ) ???; minimum
????????????????NS ?????dns.westos.org.
dns ????????????A ??????172.25.49.100
westos.org. ????MX 1 ???172.25.49.10.
vim /etc/postfix/main.cf ???????
75 myhostname = westos.com ???????真實(shí)主機(jī)名
83 mydomain = westos.com ?????????域名
98myorigin = westos.org ????????????空殼名
113 inet_interfaces = all
140 local_transport = error:local delivery disabled
164 mydestination =
313 relayhost = 172.25.49.10 ???????真實(shí)的服務(wù)端
systemctl restart postfix ??????????重啟服務(wù)
?
主機(jī)
?vim /etc/postfix/main.cf
264 mynetworks = 172.25.49.100 ???誰是空殼(172.25.49.100)
systemctl restart postfix.service ????重啟服務(wù)
?
轉(zhuǎn)載于:https://blog.51cto.com/12116768/1880977
總結(jié)
- 上一篇: easyui点击搜索的时候获取不要文本框
- 下一篇: 写代码有什么该注意的