sendmail 在AS5全新安装

15 篇文章 0 订阅


配置IP地址
[root@localhost ~]# vi /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
/usr/local/apache/bin/apachectl -k start
ifconfig eth0 192.168.5.49 netmask 255.255.255.0
route add default gw 192.168.5.11


sshd
Last login: Thu May 24 12:47:38 2012
[root@localhost ~]# vi /etc/ssh/sshd_config
Port 22
ListenAddress 0.0.0.0
PermitRootLogin yes

[root@localhost ~]# service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
[root@localhost ~]#

使用ssh软件连接上linux服务器
安装过了mysql不过老长时间没用,忘了密码了,老规矩!改!硬改!
mysqld_safe --skip-grant-tables &
shell>mysqladmin -u root flush-privileges password "newpassword"
mysql>update user set password=password('新密码') WHERE User='root';
mysql>flush privileges;


挂载光盘到目录,安装sendmail和dovecot服务
建立文件目录结构
[root@localhost /]# mkdir /a/{1,2,3,4,5,a,b,c,d,e} -p
挂载光盘文件到 /a/a
[root@localhost /]# mount /dev/cdrom /a/a
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost /]#
进入包目录
[root@localhost /]# cd /a/a/Server/
[root@localhost Server]# rpm -ivh sendmail-
然后按tab键盘两下不全命令
sendmail-8.13.8-8.el5.i386.rpm        sendmail-devel-8.13.8-8.el5.i386.rpm
sendmail-cf-8.13.8-8.el5.i386.rpm     sendmail-doc-8.13.8-8.el5.i386.rpm
[root@localhost Server]# rpm -ivh sendmail-

[root@localhost Server]# rpm -ivh sendmail-devel-8.13.8-8.el5.i386.rpm
warning: sendmail-devel-8.13.8-8.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:sendmail-devel         ########################################### [100%]
[root@localhost Server]#
[root@localhost Server]# rpm -ivh sendmail-doc-8.13.8-8.el5.i386.rpm
warning: sendmail-doc-8.13.8-8.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:sendmail-doc           ########################################### [100%]
[root@localhost Server]#
[root@localhost Server]# rpm -ivh sendmail-cf-8.13.8-8.el5.i386.rpm
warning: sendmail-cf-8.13.8-8.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:sendmail-cf            ########################################### [100%]
[root@localhost Server]#
[root@localhost Server]# rpm -ivh sendmail-8.13.8-8.el5.i386.rpm
warning: sendmail-8.13.8-8.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
        package sendmail-8.13.8-8.el5.i386 is already installed
[root@localhost Server]#

这样就完成了sendmail的安装

我们继续安装pop3,imap协议
[root@localhost Server]# rpm -ivh dovecot-1.0.7-7.el5.i386.rpm
warning: dovecot-1.0.7-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        libmysqlclient.so.15 is needed by dovecot-1.0.7-7.el5.i386
        libmysqlclient.so.15(libmysqlclient_15) is needed by dovecot-1.0.7-7.el5.i386
[root@localhost Server]#

[root@localhost Server]# rpm -ivh perl-DBI-1.52-2.el5.i386.rpm
warning: perl-DBI-1.52-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:perl-DBI               ########################################### [100%]
[root@localhost Server]#
[root@localhost Server]# rpm -ivh mysql-5.0.77-4.el5_4.2.i386.rpm
warning: mysql-5.0.77-4.el5_4.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:mysql                  warning: /etc/my.cnf created as /etc/my.cnf.rpmnew
########################################### [100%]
[root@localhost Server]#
[root@localhost Server]# rpm -ivh dovecot-1.0.7-7.el5.i386.rpm
warning: dovecot-1.0.7-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:dovecot                ########################################### [100%]
[root@localhost Server]#
这样我们就安装好了pop3服务

我们设置,sendmail,支持对外即可!
[root@localhost Server]# cd /etc/mail
备份源文件,然后再修改!切记!
[root@localhost mail]# cat sendmail.mc > sendmail.mc.bak
[root@localhost mail]# vi sendmail.mc
define(`UUCP_MAILER_MAX', `2000000')dnl   这个是邮箱的大小
sendmail单独设置每个账户的邮箱大小用quota

sendmail.cf中设置邮件发送的大小!
MaxMessageSize = 1048576
设置监听所有地址的数据
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
设置子进程验证smtp
DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
保存退出
生成cf的配置文件
[root@localhost mail]# m4 sendmail.mc > sendmail.cf
[root@localhost mail]# service sendmail restart
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
Starting sendmail:                                         [  OK  ]
Starting sm-client:                                        [  OK  ]
[root@localhost mail]#
编辑dovecot文件支持pop3和imap服务
[root@localhost etc]# vi /etc/dovecot.conf
protocols = imap imaps pop3 pop3s
[root@localhost etc]# service dovecot restart
Stopping Dovecot Imap:                                     [FAILED]
Starting Dovecot Imap:                                     [  OK  ]
[root@localhost etc]#
查看端口是否开启!
[root@localhost etc]# netstat -ant
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTE
tcp        0      0 :::110                      :::*                        LISTEN     
tcp        0      0 :::143                      :::*                        LISTE
25端口是发送
110,143分别是 pop3,imap协议接收

[root@localhost etc]# useradd b
[root@localhost etc]# passwd b
Changing password for user b.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

使用foxmail测试成功
再使用foxmail测试imap的时候失败主要的原因是验证失败,使用windows自带的outlook可以测试成功!

这样的邮件系统不安全,因为任何人都可以通过这个服务器不需要验证发送邮件
我们加入一个安全验证到sendmail里面,

安装
修改认证方式
vi /usr/lib/sasl2/Sendmail.conf 里面指明了:pwcheck_method=saslauthd,不做修改
vi /etc/sysconfig/saslauthd 找到第7行的:MECH= 改成:MECH=shadow
保存
如下示列:

[root@mail]# cat /usr/lib/sasl2/Sendmail.conf
pwcheck_method:saslauthd
[root@mail]# cat /usr/lib/sasl2/smtpd.conf.rpmsave
log_level: 3
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
[root@mail]# cat /etc/sysconfig/saslauthd
# Directory in which to place saslauthd's listening socket, pid file, and so
# on. This directory must already exist.
SOCKETDIR=/var/run/saslauthd
# Mechanism to use when checking passwords. Run "saslauthd -v" to get a list
# of which mechanism your installation was compiled with the ablity to use.
MECH=shadow
# Additional flags to pass to saslauthd on the command line. See saslauthd(8)
# for the list of accepted flags.
FLAGS=
[root@mail]#testsaslauthd -u test -p 123456 (验证smtp)
0: OK "Success."

 

 


添加邮件用户
[root@localhost named]# groupadd mailuser
[root@localhost named]# adduser -g mailuser -s /sbin/nologin test
这样添加的用户名就没有了shell,只能收发信而不能登录到服务器运行其他程序


设置开机启动
chkconfig sendmail on
chkconfig dovecot on
chkconfig saslauthd on

重启
service sendmail restart
service dovecot restart
service saslauthd restart

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值