📄 1369.html
字号:
ingres: root ?? 删除这一行<br>
nobody: root<br>
sys tem: root ?? 删除这一行<br>
toor: root?? 删除这一行<br>
uucp: root ?? 删除这一行<br>
<br>
# Well-known aliases.<br>
manager: root ?? 删除这一行<br>
dumper: root ?? 删除这一行<br>
operator: root ?? 删除这一行<br>
<br>
# trap decode to catch security attacks<br>
decode: root ?? 删除这一行<br>
<br>
# Person who should get root's mail<br>
#root: marc<br>
最后应该运行'/usr/bin/newaliases'程序使改动生效<br>
<br>
3、避免你的Sendmail被未授权的用户滥用<br>
<br>
最新版本的Sendmail (8.9.3)加入了很强的防止欺骗的特性。它们可以防止你的邮件服务器被未授权的用户滥用。编辑你的'/etc/sendmail.cf'文件,修改一下这个配置文件,使你的邮件服务器能够挡住欺骗邮件。<br>
编辑'sendmail.cf'文件(vi /etc/sendmail.cf)并更改下面一行:<br>
O PrivacyOptions=authwarnings<br>
改为:<br>
O PrivacyOptions=authwarnings,noexpn,novrfy<br>
设置'noexpn'使sendmail禁止所有SMTP的'EXPN'命令,它也使sendmail拒绝所有SMTP的'VERB'命令。设置'novrfy'使sendmail禁止所有SMTP的'VRFY '命令。这种更改可以防止欺骗者使用'EXPN'和'VRFY'命令,而这些命令恰恰被那些不守规矩的人所滥用。<br>
<br>
4、SMTP的问候信息<br>
<br>
当 sendmail接受一个SMTP连接的时候,它会向那台机器发送一个问候信息,这些信息作为本台主机的标识,而且它所做的第一件事就是告诉对方它已经准备好了。<br>
编辑'sendmail.cf'文件(vi /etc/sendmail.cf)并更改下面一行:<br>
O SmtpGreetingMessage=j Sendmail v/Z; b<br>
改为:<br>
O SmtpGreetingMessage=j Sendmail v/Z; b NO UCE C=xx L=xx<br>
现在手工重起一下sendmail进程,使刚才所做的更改生效:<br>
[root@deep]# /etc/rc.d/init.d/sendmail restart<br>
以上的更改将影响到Sendmail在接收一个连接时所显示的标志信息。你应该把'`C=xx L=xx'条目中的'xx'换成你所在的国家和地区代码。后面的更改其实不会影响任何东西。但这是'news.admin.net-abuse.email'新闻组的伙伴们推荐的合法做法。<br>
<br>
5、限制可以审核邮件队列内容的人员<br>
<br>
通常情况下,任何人都可以使用'mailq'命令来查看邮件队列的内容。为了限制可以审核邮件队列内容的人员,只需要在'/etc/sendmail.cf'文件中指定'restrictmailq'选项即可。在这种情况下,sendmail只允许与这个队列所在目录的组属主相同的用户可以查看它的内容。这将允许权限为0700的邮件队列目录被完全保护起来,而我们限定的合法用户仍然可以看到它的内容。<br>
编辑'sendmail.cf'文件(vi /etc/sendmail.cf)并更改下面一行:<br>
O PrivacyOptions=authwarnings,noexpn,novrfy<br>
改为:<br>
O PrivacyOptions=authwarnings,noexpn,novrfy,restrictmailq<br>
现在我们更改邮件队列目录的权限使它被完全保护起来:<br>
[root@deep]# chmod 0700 /var/spool/mqueue<br>
注意:我们已经在sendmail.cf中的'PrivacyOptions='行中添加了'noexpn'和'novrfy'选项,现在在这一行中我们接着添加'restrictmailq'选项。<br>
任何一个没有特权的用户如果试图查看邮件队列的内容会收到下面的信息:<br>
[user@deep] /usr/bin/mailq<br>
You are not permitted to see the queue<br>
<br>
6、限制处理邮件队列的权限为'root'<br>
<br>
通常,任何人都可以使用'-q'开关来处理邮件队列,为限制只允许root处理邮件队列,需要在'/etc/sendmail.cf'文件中指定'restrictqrun'。<br>
编辑'sendmail.cf'文件(vi /etc/sendmail.cf)并更改下面一行:<br>
O PrivacyOptions=authwarnings,noexpn,novrfy,restrictmailq<br>
改为:<br>
O PrivacyOptions=authwarnings,noexpn,novrfy,restrictmailq,restrictqrun<br>
任何一个没有特权的用户如果试图处理邮件队列的内容会收到下面的信息:<br>
[user@deep] /usr/好好学习in/sendmail -q<br>
You do not have permission to process the queue<br>
<br>
7、在重要的sendmail文件上设置不可更改位<br>
<br>
可以通过使用'chattr'命令而使重要的Sendmail文件不会被擅自更改,可以提高系统的安全性。具有'+i'属性的文件不能被修改:它不能被删除和改名,不能创建到这个文件的链接,不能向这个文件写入数据。只有超级用户才能设置和清除这个属性。<br>
为'sendmail.cf'文件设置不可更改位:<br>
[root@deep]# chattr +i /etc/sendmail.cf<br>
为'sendmail.cw'文件设置不可更改位:<br>
[root@deep]# chattr +i /etc/sendmail.cw<br>
为'sendmail.mc'文件设置不可更改位:<br>
[root@deep]# chattr +i /etc/sendmail.mc<br>
为'null.mc'文件设置不可更改位:<br>
[root@deep]# chattr +i /etc/null.mc<br>
为'aliases'文件设置不可更改位:<br>
[root@deep]# chattr +i /etc/aliases<br>
为'access'文件设置不可更改位:<br>
[root@deep]# chattr +i /etc/mail/access<br>
<br>
8、Sendmail环境下的防止邮件relay<br>
<br>
从8.9版本开始,缺省的是不允许邮件转发(mail relay)的。最简单的允许邮件转发的方法是在文件/etc/mail/relay-domains中进行设置。该文件中列出的域名内的信件都允许通过本地服务器进行邮件转发。<br>
为了更精确的设置,可以在sendmail.mc中添加如下几个参数允许被用来设置邮件转发:<br>
· FEATURE(relay_hosts_only). 通常情况下,在文件/etc/mail/relay-domains中列出的域名的主机都允许通过本地机转发,而该设置指示指定必须罗列出每个允许通过本机转发邮件的主机。<br>
· FEATURE(relay_entire_domain). 该参数指示允许所有本地域通过本机进行邮件转发。<br>
· FEATURE(access_db). 该参数指定利用哈希数据库/etc/mail/access来决定是否允许某个主机通过本地进行邮件转发。<br>
· FEATURE(blacklist_recipients).若该参数被设置,则在决定是否允许某个主机转发邮件时同时察看邮件发送着地址和邮件接受者地址。<br>
· FEATURE(rbl).允许基于maps.vix.com由黑名单(Realtime Blackhole List)进行邮件拒绝,以防范垃圾邮件。<br>
· FEATURE(accept_unqualified_senders).允许接受发送者地址不包括域名的邮件,例如user,而不是user@B.NET。<br>
· FEATURE(accept_unresolvable_domains).通常来讲,sendmail拒绝接受发送者邮件地址指定的主机通过DNS不能解析的邮件,而该参数允许接收这种邮件。<br>
· FEATURE(relay_based_on_MX).该参数允许转发邮件接受者地址的MX记录指向本地的的邮件,例如,本地接收到一个发送目的地址为user@b.com的邮件,而b.com域名的MX记录指向了本地机器,则本地机器就允许转发该邮件。<br>
下面几个特性可能会有安全漏洞,一般当邮件服务器位于防火墙后时才应该使用,因为这些参数可能导致你的系统易于被垃圾邮件发送者利用。<br>
· FEATURE(relay_local_from). 该参数指定若消息自称源于本地域,则允许转发该邮件。<br>
· FEATURE(promiscuous_relay). 打开对所有的邮件的转发。<br>
宏配置文件'sendmail.mc'设置成功以后,可以用下面的命令创建sendmail的配置文件:<br>
[root@deep]# cd /var/tmp/sendmail-version/cf/cf/<br>
[root@deep]# m4 ../m4/cf.m4 /etc/sendmail.mc > /etc/sendmail.cf<br>
注意:这里'../m4/cf.m4'告诉m4程序的缺省配置文件路径。<br>
<br>
三、qmail安全<br>
<br>
qmail有一个名为rcpthosts(该文件名源于RCPT TO命令)的配置文件,其决定了是否接受一个邮件。只有当一个RCPT TO命令中的接收者地址的域名存在于rcpthosts文件中时,才接受该邮件,否则就拒绝该邮件。若该文件不存在,则所有的邮件将被接受。当一个邮件服务器不管邮件接收者和邮件接收者是谁,而是对所有邮件进行转发(relay),则该邮件服务器就被称为开放转发(open relay)的。当qmail服务器没有rcpthosts时,其是开放转发的。<br>
设置自己服务器为非open relay的最简单的办法就是将你的邮件服务器的所有域名(若DNS的MX记录指向该机器,也应该包括该域名。例如你的机器有三个域名mail.linxuaid.com.cn、mail1.linuxaid.com.cn,而且linuxaid.com.cn的MX指向mail.linuxaid.com.cn,则qmail的rcphosts的应该包括mail.linuxaid.com.cn、mail1.linuxaid.com.cn和linuxaid.com.cn)。<br>
但是这将导致你的本地客户也被拒绝使用你的服务器转发邮件,而要支持客户使用MUA来发送邮件,必须允许客户使用服务器转发邮件。qmail-smtpd支持一种有选择性的忽略rcpthosts文件的方法:若qmail-smtpd的环境变量RELAYCLIENT被设置,则rcpthost文件将被忽略,relay将被允许。但是如何识别一个邮件发送者是否是自己的客户呢?qmail并没有采用密码认证的方法,而是判断发送邮件者的源IP地址,若该IP地址属于本地网络,则认为该发送者为自己的客户。<br>
这里就要使用ucspi-tcp软件包。在这里我们要使用该软件包的tcpserver程序。该程序的功能类似于inetd-监听进入的连接请求,为要启动的服务设置各种环境变量,然后启动指定的服务。<br>
tcpserver的配置文件是/etc/tcp.smtp,该文件定义了是否对某个网络设置RELAYCLIENT环境变量。例如,本地网络是地址为192.168.10.0/24的C类地址,则tcp.smtp的内容应该设置如下:<br>
127.0.0.1:allow,RELAYCLIENT=''<br>
192.168.10.:allow,RELAYCLIENT=''<br>
:allow<br>
这几个规则的含义是指若连接来自127.0.0.1和192.168.10则允许,并且为其设置环境变量RELAYCLIENT,否则允许其他连接,但是不设置RELAYCLIENT环境变量。这样当从其他地方到本地的25号连接将会被允许,但是由于没有被设置环境变量,所以其连接将会被qmail-smptd所拒绝。<br>
但是tcopserver并不直接使用/etc/tcp.smtp文件,而是需要先将该文件转化为cbd文件:<br>
[lix@mail /etc] # tcprules tcp.smtp.cdb tcp.smtp.temp < tcp.smtp<br>
然后再回头看在/service/qmail-smtpd目录下的run文件中有<br>
/usr/local/bin/tcpserver -v -p -x /etc/tcp.smtp.cdb<br>
可以看到,tcpserver利用了/etc/smtp.cbd文件。若本地有多个网络,则需要这些网络都出现在/etc/tcp.smtp文件中。<br>
这样就实现了允许本地客户relay邮件,而防止relay被滥用。<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 + -