设为首页 收藏本站
查看: 1492|回复: 0

[经验分享] sendmail 在AS5全新安装

[复制链接]

尚未签到

发表于 2015-11-25 13:22:01 | 显示全部楼层 |阅读模式
  
配置IP地址
[iyunv@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
[iyunv@localhost ~]# vi /etc/ssh/sshd_config
Port 22
ListenAddress 0.0.0.0
PermitRootLogin yes
  [iyunv@localhost ~]# service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
[iyunv@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服务
建立文件目录结构
[iyunv@localhost /]# mkdir /a/{1,2,3,4,5,a,b,c,d,e} -p
挂载光盘文件到 /a/a
[iyunv@localhost /]# mount /dev/cdrom /a/a
mount: block device /dev/cdrom is write-protected, mounting read-only
[iyunv@localhost /]#
进入包目录
[iyunv@localhost /]# cd /a/a/Server/
[iyunv@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
[iyunv@localhost Server]# rpm -ivh sendmail-
  [iyunv@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%]
[iyunv@localhost Server]#
[iyunv@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%]
[iyunv@localhost Server]#
[iyunv@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%]
[iyunv@localhost Server]#
[iyunv@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
[iyunv@localhost Server]#
  这样就完成了sendmail的安装
  我们继续安装pop3,imap协议
[iyunv@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
[iyunv@localhost Server]#
  [iyunv@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%]
[iyunv@localhost Server]#
[iyunv@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%]
[iyunv@localhost Server]#
[iyunv@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%]
[iyunv@localhost Server]#
这样我们就安装好了pop3服务
  我们设置,sendmail,支持对外即可!
[iyunv@localhost Server]# cd /etc/mail
备份源文件,然后再修改!切记!
[iyunv@localhost mail]# cat sendmail.mc > sendmail.mc.bak
[iyunv@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的配置文件
[iyunv@localhost mail]# m4 sendmail.mc > sendmail.cf
[iyunv@localhost mail]# service sendmail restart
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
Starting sendmail:                                         [  OK  ]
Starting sm-client:                                        [  OK  ]
[iyunv@localhost mail]#
编辑dovecot文件支持pop3和imap服务
[iyunv@localhost etc]# vi /etc/dovecot.conf
protocols = imap imaps pop3 pop3s
[iyunv@localhost etc]# service dovecot restart
Stopping Dovecot Imap:                                     [FAILED]
Starting Dovecot Imap:                                     [  OK  ]
[iyunv@localhost etc]#
查看端口是否开启!
[iyunv@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协议接收
  [iyunv@localhost etc]# useradd b
[iyunv@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
保存
如下示列:
  [iyunv@mail]# cat /usr/lib/sasl2/Sendmail.conf
pwcheck_method:saslauthd
[iyunv@mail]# cat /usr/lib/sasl2/smtpd.conf.rpmsave
log_level: 3
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
[iyunv@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=
[iyunv@mail]#testsaslauthd -u test -p 123456 (验证smtp)
0: OK "Success."
  
  
  
添加邮件用户
[iyunv@localhost named]# groupadd mailuser
[iyunv@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
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-143434-1-1.html 上篇帖子: sendmail后续-安装webopenmail 下篇帖子: CentOS安装sendmail及设置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表