postfix+squirrelmail - rhat 5.451CTO博客 - 牛牛娱乐

postfix+squirrelmail - rhat 5.451CTO博客

2019年04月06日10时51分46秒 | 作者: 新曦 | 标签: 修正,邮件,输入 | 浏览: 2040

体系环境:

装置邮件服务器,postfix+squirrelmail+rhat 5.4下测验,本试验意图是,在服务器与客户端之间彼此收发邮件和转发邮件;

 

 

系  统

域  名

服务器

客户端

RedHat 5.4

mail.163.com

172.16.1.253

172.16.1.10

所需装置包:

bind  (DNS)

postfix(邮件服务器)

Dovecot(POP/IMAP协议,用于承受邮件)

Saslauthd(安全认证包)

Squirrelmail(根据web的邮件客户端)

1、装备IP

2、装备主机名:mail.163.com

[root@localhost ~]# vim /etc/sysconfig/network

HOSTNAME=mail.163.com

:wq  保存

[root@localhost ~]# hostname mail.163.com

断开终端,再次衔接,这样就需要从头发动体系:ctrl+d

[root@mail ~]#

 

3、装备DNS文件

[root@mail ~]# vim /etc/resolv.conf

nameserver 172.16.1.253

 

4、装备hosts文件

[root@mail ~]# vim /etc/hosts 

127.0.0.1       mail.163.com

 

5、装备YUM

参照:

6、装置DNS(bind)

[root@mail ~]# cd /mnt/Server/

[root@mail Server]# rpm -ivh bind-9.3.6-4.P1.el5.i386.rpm     

Preparing...                # [100%]

   1:bind                   # [100%]

[root@mail Server]# rpm -ivh bind-chroot-9.3.6-4.P1.el5.i386.rpm

Preparing...                # [100%]

   1:bind-chroot            # [100%]     

[root@mail Server]# rpm -ivh caching-nameserver-9.3.6-4.P1.el5.i386.rpm

Preparing...                # [100%]

   1:caching-nameserver     # [100%]  

 

[root@mail Server]# cd /var/named/chroot/etc/

[root@mail etc]# ll

total 32

-rw-rr 1 root root   405 Dec 18 05:13 localtime

-rw-r- 1 root named 1230 Jul 30  2009 named.caching-nameserver.conf

-rw-r- 1 root named  955 Jul 30  2009 named.rfc1912.zones

-rw-r- 1 root named  113 Dec 18 05:48 rndc.key

 

[root@mail etc]# cp -p named.caching-nameserver.conf named.conf

[root@mail etc]# vim named.conf    

修正:

 15         listen-on port 53 { any; };

 27         allow-query     { any; };

 28         allow-query-cache { any; };

 37         match-clients      { any; };

 38         match-destinations { any; };

:wq

 

[root@mail etc]# vim named.rfc1912.zones  

 27 zone "163.com" IN {

 28         type master;

 29         file "163.com.zone";

 30         allow-update { none; };

 31 };

:wq

 

[root@mail etc]# cd ../var/named/

[root@mail named]# pwd

/var/named/chroot/var/named

[root@mail named]# cp -p localhost.zone 163.com.zone

[root@mail named]# vim 163.com.zone

$TTL    86400

@               IN SOA  ns.163.com.       root (

                                        42              ; serial (d. adams)

                                        3H              ; refresh

                                        15M             ; retry

                                        1W              ; expiry

                                        1D )            ; minimum

                IN NS           ns.163.com.

ns              IN A            172.16.1.253

mail            IN A            172.16.1.253

pop3            IN CNAME        mail

smtp            IN CNAME        mail

@               IN MX 10        mail

:wq

 

[root@mail named]# service named start

Starting named:                                            [  OK  ]

[root@mail named]# service named restart

Stopping named:                                            [  OK  ]

Starting named:                                            [  OK  ]

[root@mail named]#

 

[root@mail named]# rndc reload

server reload successful

[root@mail named]# dig -t mx 163.com

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 <<>> -t mx 163.com

;; global options:  printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10922

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; QUESTION SECTION:

;163.com.                       IN      MX

;; ANSWER SECTION:

163.com.                86400   IN      MX      10 mail.163.com.

;; AUTHORITY SECTION:

163.com.                86400   IN      NS      ns.163.com.

;; ADDITIONAL SECTION:

mail.163.com.           86400   IN      A       172.16.1.253

ns.163.com.             86400   IN      A       172.16.1.253

 

;; Query time: 5 msec

;; SERVER: 172.16.1.253#53(172.16.1.253)

;; WHEN: Tue Dec 18 06:12:41 2012

;; MSG SIZE  rcvd: 95

 

[root@mail named]# chkconfig named on

 

承认sendmail是否已封闭,并不随机发动或许卸载

[root@mail named]# service sendmail status

sendmail (pid  2754) is running...

[root@mail named]# service sendmail stop

Shutting down sm-client:                                   [  OK  ]

Shutting down sendmail:                                    [  OK  ]

[root@mail named]# chkconfig sendmail off

[root@mail named]#

 

7、装置postfix

[root@mail named]# cd /mnt/Server/

[root@mail Server]# ll postfix*

-rrr 278 root root 3734257 Aug 14  2008 postfix-2.3.3-2.1.el5_2.i386.rpm

-rrr 278 root root   51012 Aug 14  2008 postfix-pflogsumm-2.3.3-2.1.el5_2.i386.rpm

[root@mail Server]# rpm -ivh postfix-2.3.3-2.1.el5_2.i386.rpm

Preparing...                # [100%]

   1:postfix                # [100%]

[root@mail Server]# vim /etc/postfix/main.cf

69 #myhostname = host.domain.tld

修正

69 myhostname = mail.163.com  #本机名

 

77 #mydomain = domain.tld   

修正:

77 mydomain = 163.com         #域名

 

93 #myorigin = $mydomain

修正为

93 myorigin = $mydomain

 

107 #inet_interfaces = all

修正为

107 inet_interfaces = all

 

110 inet_interfaces = localhost

修正为

110 #inet_interfaces = localhost

 

155 mydestination = $myhostname, localhost.$mydomain, localhost

修正为

155 #mydestination = $myhostname, localhost.$mydomain, localhost

 

156 #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

修正为

156 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

 

255 #mynetworks = 168.100.189.0/28, 127.0.0.0/8

修正为

255 mynetworks = 127.0.0.0/8     #供给邮件转发功用的网段

 

在255 mynetworks = 127.0.0.0/8上面增加如下:#运用SMTP认证

broken_sasl_auth_clients = yes

smtpd_sasl_auth_enable = yes

smtpd_sasl_security_options = noanonymous

smtpd_sasl_application_name = smtpd

smtpd_client_restrictions = permit_sasl_authenticated,reject

#smtpd_clietn_restrictions = permit_sasl_authenticated

smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated, reject_unauth_destination

262 mynetworks = 127.0.0.0/8

:wq

 

[root@mail Server]# service saslauthd start

Starting saslauthd:                                        [  OK  ]

[root@mail Server]# chkconfig saslauthd  on

[root@mail Server]# service postfix start

Starting postfix:                                          [  OK  ]

[root@mail Server]# service postfix restart

Shutting down postfix:                                     [  OK  ]

Starting postfix:                                          [  OK  ]

 

[root@mail Server]# netstat -tupln |less

tcp    0   0 0.0.0.0:25    0.0.0.0:*   LISTEN    4235/master

 

8、创立用户

[root@mail Server]# useradd user1

[root@mail Server]# useradd user2

[root@mail Server]# useradd user3

[root@mail Server]# passwd user1

Changing password for user user1.

New UNIX password:

BAD PASSWORD: it does not contain enough DIFFERENT characters

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

[root@mail Server]# passwd user2

Changing password for user user2.

New UNIX password:

BAD PASSWORD: it does not contain enough DIFFERENT characters

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

[root@mail Server]# passwd user3

Changing password for user user3.

New UNIX password:

BAD PASSWORD: it does not contain enough DIFFERENT characters

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

 

9、装置squirrelmail(图形化邮件客户端)

[root@mail Server]# yum install squirrelmail

 

[root@mail Server]# service httpd restart

Stopping httpd:                                            [  OK  ]

Starting httpd: httpd: Could not reliably determine the servers fully qualified domain name, using mail.163.com for ServerName

                                                           [  OK  ]

[root@mail Server]# chkconfig httpd on

[root@mail Server]# rpm -ql squirrelmail

[root@mail Server]# cd /var/www/html/

[root@mail html]# ln -s /usr/share/squirrelmail/ mail

[root@mail html]# ll

total 4

lrwxrwxrwx 1 root root 24 Dec 18 06:46 mail -> /usr/share/squirrelmail/

[root@mail html]# cd mail/

[root@mail mail]# ll

total 88

drwxr-xr-x  5 root root 4096 Dec 18 06:42 class

drwxr-xr-x  2 root root 4096 Dec 18 06:42 config

drwxr-xr-x  4 root root 4096 Dec 18 06:42 functions

drwxr-xr-x 30 root root 4096 Dec 18 06:42 help

drwxr-xr-x  2 root root 4096 Dec 18 06:42 images

drwxr-xr-x  3 root root 4096 Dec 18 06:42 include

-rw-rr  1 root root  684 May 21  2009 index.php

drwxr-xr-x 47 root root 4096 Dec 18 06:42 locale

drwxr-xr-x 18 root root 4096 Dec 18 06:42 plugins

drwxr-xr-x  2 root root 4096 Dec 18 06:42 src

drwxr-xr-x  3 root root 4096 Dec 18 06:42 themes

[root@mail mail]# cd config/

[root@mail config]# ll

total 204

-rw-rr 1 root root  29548 May 21  2009 config_default.php

lrwxrwxrwx 1 root root     45 Dec 18 06:42 config_local.php -> ../../../../etc/squirrelmail/config_local.php

lrwxrwxrwx 1 root root     39 Dec 18 06:42 config.php -> ../../../../etc/squirrelmail/config.php

-rwxr-xr-x 1 root root 145648 May 21  2009 conf.pl

-rw-rr 1 root root    492 May 21  2009 index.php

 

翻开squirrelmail装备东西

[root@mail config]# ./conf.pl 或[root@mail ~]# /usr/share/squirrelmail/config/conf.pl

SquirrelMail Configuration : Read: config.php (1.4.0)

-

Main Menu

1.  Organization Preferences

2.  Server Settings

3.  Folder Defaults

4.  General Options

5.  Themes

6.  Address Books

7.  Message of the Day (MOTD)

8.  Plugins

9.  Database

10. Languages

 

D.  Set pre-defined settings for specific IMAP servers

C   Turn color off

S   Save data

Q   Quit

 

Command >> 10

 

      输入d,然后输入cyrus(指定IMAP服务器类型)

      输入2.  挑选Server Settings然后输入1修正Domain为mail.163.com

                                         3修正Sendmail or SMTP为选2SMTP

      输入4.  挑选General Options然后输入5修正Usernames in Lowercase :为 true

      输入10  挑选Languages然后输入1修正Default Language :为 zh_CN

                                   2修正Default charset  :为 GB2312  

                                   R回来上一层    

      最终输入s保存以上修正,再输入q退出(修正的文件一起保存)

 

[root@mail config]# vim /etc/httpd/conf/httpd.conf

747 AddDefaultCharset UTF-8

修正为:

747 #AddDefaultCharset UTF-8

:wq

[root@mail config]# service httpd restart

 

10、网页拜访:http://172.16.1.253/mail

用户登陆报错

体系犯错

衔接IMAP服务器呈现过错:localhost。

111 : 鎷掔粷杩炴帴

解决方法

[root@mail config]# yum install dovecot    #用于承受邮件

[root@mail config]# service dovecot restart

从头登录:OK

 

发邮件报错

体系犯错:

Transaction failed

Server replied: 554 5.7.1 <localhost.localdomain[127.0.0.1]>: Client host rejected: Access denied

解决方法:

[root@mail config]# vim /etc/postfix/main.cf

smtpd_client_restrictions = permit_sasl_authenticated,reject

修正为

#smtpd_client_restrictions = permit_sasl_authenticated,reject

:wq

[root@mail config]# service postfix restart

 

11、检查收发邮件日志

[root@mail config]# tail -f /var/log/maillog

 

收发邮件成功!

版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表牛牛娱乐立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章