📄 1344.html
字号:
<DIV align=center>
<FORM action="search.html" tppabs="http://www.linuxhero.com/docs/search.html" method=get>
</FORM>
<TABLE cellSpacing=0 cellPadding=0 width="95%"
border=0><TBODY>
<TR>
<TD background="images/bgi.gif" tppabs="http://www.linuxhero.com/docs/images/bgi.gif"
height=30></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=3 width="95%"
align=center border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top>
<p><FONT class=normalfont><B><font color=blue>redhat7.2中sendmail的smtp配置问题</font></B></FONT><BR><FONT class=smallfont color=#ff9900>2004-04-23 15:18 pm</FONT><BR><FONT class=normalfont>作者:作者<br>来自:Linux知识宝库<br>联系方式:无名<br><br>大家好,我在redhat7.2中配置sendmail 已经成功了,我打算继续配置smtp的功能,但是我根据如下配置7。1的方式配置之后,发现,我同时可以使用认证smtp或不认证smtp的方式发信,等于没有意义的实现了smtp认证,请问高手,我该怎么处理?才好。<br>
<br>
1. 选择‘服务器系统’安装Redhat 7.1<br>
2. 进入目录 /usr/share/sendmail-cf/cf 。<br>
如果你没有该目录,说明你还没有安装sendmail-cf-8.11.2-14 RPM包,从你的安装CD中安装它。<br>
3. 修改文件redhat.mc如下<br>
divert(-1)<br>
dnl This is the sendmail macro config file. If you make changes to this file,<br>
dnl you need the sendmail-cf rpm installed and then have to generate a<br>
dnl new /etc/sendmail.cf by running the following command:<br>
dnl<br>
dnl m4 /etc/mail/sendmail.mc > /etc/sendmail.cf<br>
dnl<br>
include(`../m4/cf.m4)<br>
VERSIONID(`linux setup for Red Hat linux)dnl<br>
OSTYPE(`linux)<br>
define(`confDEF_USER_ID,``8:12)dnl<br>
undefine(`UUCP_RELAY)dnl<br>
undefine(`BITNET_RELAY)dnl<br>
define(`confAUTO_REBUILD)dnl<br>
define(`confTO_CONNECT, `1m)dnl<br>
define(`confTRY_NULL_MX_LIST,true)dnl<br>
define(`confDONT_PROBE_INTERFACES,true)dnl<br>
define(`PROCMAIL_MAILER_PATH,`/usr/bin/procmail)dnl<br>
define(`ALIAS_FILE, `/etc/aliases)dnl<br>
define(`STATUS_FILE, `/var/log/sendmail.st)dnl<br>
define(`UUCP_MAILER_MAX, `2000000)dnl<br>
define(`confUSERDB_SPEC, `/etc/mail/userdb.db)dnl<br>
define(`confPRIVACY_FLAGS, `authwarnings,novrfy,noexpn,restrictqrun)dnl<br>
define(`confAUTH_OPTIONS, `A)dnl<br>
define(QUEUE_DIR,`/var/spool/mqueue/q*)<br>
TRUST_AUTH_MECH(`DIGEST-MD5 CRAM-MD5 LOGIN PLAIN)dnl<br>
define(`confAUTH_MECHANISMS, `DIGEST-MD5 CRAM-MD5 LOGIN PLAIN)dnl<br>
DAEMON_OPTIONS(`Port=25,Name=MTA)dnl<br>
DAEMON_OPTIONS(`Port=587,Name=MSA,M=Ea)dnl<br>
dnl define(`confTO_QUEUEWARN, `4h)dnl<br>
dnl define(`confTO_QUEUERETURN, `5d)dnl<br>
dnl define(`confQUEUE_LA, `12)dnl<br>
dnl define(`confREFUSE_LA, `18)dnl<br>
dnl FEATURE(delay_checks)dnl<br>
FEATURE(`no_default_msa,`dnl)dnl<br>
FEATURE(`smrsh,`/usr/sbin/smrsh)dnl<br>
FEATURE(`mailertable,`hash -o /etc/mail/mailertable)dnl<br>
FEATURE(`virtusertable,`hash -o /etc/mail/virtusertable)dnl<br>
FEATURE(redirect)dnl<br>
FEATURE(always_add_domain)dnl<br>
FEATURE(use_cw_file)dnl<br>
FEATURE(use_ct_file)dnl<br>
FEATURE(local_procmail)dnl<br>
FEATURE(`access_db)dnl<br>
FEATURE(`blacklist_recipients)dnl<br>
EXPOSED_USER(`root)dnl<br>
dnl This changes sendmail to only listen on the loopback device 127.0.0.1<br>
dnl and not on any other network devices. Comment this out if you want<br>
dnl to accept email over the network.<br>
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA)<br>
dnl We strongly recommend to comment this one out if you want to protect<br>
dnl yourself from spam. However, the laptop and users on computers that do<br>
dnl not have 24x7 DNS do need this.<br>
dnl FEATURE(`accept_unresolvable_domains)dnl<br>
dnl FEATURE(`relay_based_on_MX)dnl<br>
MAILER(smtp)dnl<br>
MAILER(procmail)dnl<br>
其中,我加了下面的行:<br>
1. define(QUEUE_DIR,`/var/spool/mqueue/q*)<br>
2. TRUST_AUTH_MECH(`DIGEST-MD5 CRAM-MD5 LOGIN PLAIN)dnl<br>
3. define(`confAUTH_MECHANISMS, `DIGEST-MD5 CRAM-MD5 LOGIN PLAIN)dnl<br>
4. DAEMON_OPTIONS(`Port=25,Name=MTA)dnl<br>
5. DAEMON_OPTIONS(`Port=587,Name=MSA,M=Ea)dnl<br>
注:<br>
第1行 我启动了多个邮件队列,希望得到更好的队列处理和性能改进。<br>
第2,3行 移走前面的注释,打开相应的各种认证机制。<br>
第4,5行 设置相应的MTA和MSA所在的端口号。<br>
且注释出了<br>
1. dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA)<br>
2. dnl FEATURE(`accept_unresolvable_domains)dnl<br>
第1行 允许通过网络连接Sendmail。<br>
第2行 禁止不可解析的域名relay邮件<br>
最后运行<br>
#m4 /etc/mail/sendmail.mc > /etc/sendmail.cf<br>
写到/etc/sendmail.cf文件中<br>
既然我们打开了多个队列,现在我们在/var/spool/mqueue/下创建任意多个队列目录如<br>
#cd /var/spool/mqueue<br>
#mkdir q1 q2 q3 q4 q5 q6<br>
这样Sendmail将会使用这六个目录做为队列目录,增加了性能。<br>
五: 设置SASL认证方案<br>
1. 运行下面的命令,确保SASL被编译进Sendmail.<br>
#/usr/sbin/sendmail -d0.1 -bv root |grep SASL<br>
输出应该类似如下面:<br>
NETUNIX NEWDB QUEUE SASL SCANF SMTP USERDB XDEBUG<br>
确保你能看见上面的文本中的 SASL<br>
2. 测试端口25,确保输出AUTH提示行。<br>
#telnet localhost 25<br>
Trying 127.0.0.1...<br>
Connected to smtp.domain.com.<br>
Escape character is ^].<br>
220 smtp.domain.com ESMTP Sendmail 8.11.2/8.11.2; Sun, 1 July 2001 17:56:54 -0800<br>
EHLO localhost<br>
250-smtp.domain.com Hello IDENT:root@smtp.domain.com [127.0.0.1], pleased to meet you<br>
250-ENHANCEDSTATUSCODES<br>
250-EXPN<br>
250-VERB<br>
250-8BITMIME<br>
250-SIZE<br>
250-DSN<br>
250-ONEX<br>
250-ETRN<br>
250-XUSR<br>
250-AUTH LOGIN PLAIN DIGEST-MD5 CRAM-MD5<br>
250 HELP<br>
quit<br>
221 2.0.0 smtp.domain.com closing connection<br>
Connection closed by foreign host.<br>
你需要至少看见AUTH行中有LOGIN PLAIN在那里,否则不能relay mail。<br>
3. 增加SASL用户且更改密码<br>
#/usr/sbin/saslpasswd jephe<br>
Password: *******<br>
Again (for verification): *******<br>
#/usr/sbin/sasldblistusers<br>
user: jephe realm: smtp.domain.com mech: DIGEST-MD5<br>
user: jephe realm: smtp.domain.com mech: PLAIN<br>
user: jephe realm: smtp.domain.com mech: CRAM-MD5<br>
用户的密码DB文件在/etc/sasldb,用下面的命令确保正确的许可权设置。<br>
特别注意: 在下面的windows的Outlook Express中设置用户名和密码时并不是简单地使用用户名jephe,而是用象“user@realm”的用户名,在这里是 jephe@smtp.domain.com作为用户名。<br>
#chmod 400 /etc/sasldb<br>
可以用/usr/sbin/saslpasswd加更多的用户,用/usr/sbin/sasldblistusers检查用户已经加入。<br>
4. 更改默认的Redhat 7.1密码认证方法<br>
默认地,Redhat 7.1中的Sendmail用PAM方法检查密码,这意味着用户必须是系统用户,为了<br>
增强安全性,我们改用/etc/sasldb中的用户,改下面的文件中的pam为sasldb。<br>
#vi /usr/lib/sasl/Sendmail.conf 更改pwcheck_method行象下面<br>
pwcheck_method:sasldb<br>
5. 最后,运行/etc/rc.d/init.d/sendmail restart重新启动Sendmail。<br>
六: 设置Windows的Outlook Express。<br>
1. Outlook Express仅仅使用 PLAIN LOGIN 认证机制,确保上面的telnet localhost 25中的AUTH行<br>
输出PLAIN LOGIN即可。<br>
2. 在‘工具’-‘帐号’-‘属性’-‘服务器‘-<br>
’发送邮件服务器’中选中‘我的服务器需要认证’<br>
然后在‘登录用户帐号’上填上<br>
“你的用户名@你的realm冒号后面的服务器全称域名”<br>
如:本文的情况是 jephe@smtp.domain.com<br>
密码为你在前面输入的密码。<br>
注意: 用户名绝不是简单地 jephe,必须跟上realm:后面的域名。<br>
3. 现在测试,发一封信给自己,检查tail -f /var/log/maillog有无任何错误<br>
然后在收到自己发出的信之后检查邮件头,你能发现被服务器接收后有个(authenticated)在后面表示是通过允许的认证机制relay的邮件。<br>
<br>
我按上面的方法做了,但测试端口25时,AUTH行中没有出现LOGIN PLAIN,如何解决,谢谢 <br>
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -