📄 1117.html
字号:
#echo "Kernel $(uname -r) on $a $(uname -m)" >> /etc/issue<br>
#<br>
#cp -f /etc/issue /etc/issue.net<br>
#echo >> /etc/issue<br>
-- <br>
然后,做下面的事情:<br>
[root@deep]# rm -f /etc/issue<br>
[root@deep]# rm -f /etc/issue.net<br>
[root@deep]# touch /etc/issue<br>
[root@deep]# touch /etc/issue.net<br>
<br>
21. 被root拥有的程序的位。<br>
移走那些被root拥有程序的s位标志,当然有些程序需要这个,用命令‘chmod a-s’完成这个。<br>
注:前面带(*)号的那些程序一般不需要拥有s位标志。<br>
<br>
[root@deep]# find / -type f ( -perm -04000 -o -perm -02000 ) -exec ls –lg {} ;<br>
-rwsr-xr-x 1 root root 33120 Mar 21 1999 /usr/bin/at<br>
*-rwsr-xr-x 1 root root 30560 Apr 15 20:03 /usr/bin/chage<br>
*-rwsr-xr-x 1 root root 29492 Apr 15 20:03 /usr/bin/gpasswd<br>
-rwsr-xr-x 1 root root 3208 Mar 22 1999 /usr/bin/disable-paste<br>
-rwxr-sr-x 1 root man 32320 Apr 9 1999 /usr/bin/man<br>
-r-s--x--x 1 root root 10704 Apr 14 17:21 /usr/bin/passwd<br>
-rws--x--x 2 root root 517916 Apr 6 1999 /usr/bin/suidperl<br>
-rws--x--x 2 root root 517916 Apr 6 1999 /usr/bin/sperl5.00503<br>
-rwxr-sr-x 1 root mail 11432 Apr 6 1999 /usr/bin/lockfile<br>
-rwsr-sr-x 1 root mail 64468 Apr 6 1999 /usr/bin/procmail<br>
-rwsr-xr-x 1 root root 21848 Aug 27 11:06 /usr/bin/crontab<br>
-rwxr-sr-x 1 root slocate 15032 Apr 19 14:55 /usr/bin/slocate<br>
*-r-xr-sr-x 1 root tty 6212 Apr 17 11:29 /usr/bin/wall<br>
*-rws--x--x 1 root root 14088 Apr 17 12:57 /usr/bin/chfn<br>
*-rws--x--x 1 root root 13800 Apr 17 12:57 /usr/bin/chsh<br>
*-rws--x--x 1 root root 5576 Apr 17 12:57 /usr/bin/newgrp<br>
*-rwxr-sr-x 1 root tty 8392 Apr 17 12:57 /usr/bin/write<br>
-rwsr-x--- 1 root squid 14076 Oct 7 14:48 /usr/lib/squid/pinger<br>
-rwxr-sr-x 1 root utmp 15587 Jun 9 09:30 /usr/sbin/utempter<br>
*-rwsr-xr-x 1 root root 5736 Apr 19 15:39 /usr/sbin/usernetctl<br>
*-rwsr-xr-x 1 root bin 16488 Jul 6 09:35 /usr/sbin/traceroute<br>
-rwsr-sr-x 1 root root 299364 Apr 19 16:38 /usr/sbin/sendmail<br>
-rwsr-xr-x 1 root root 34131 Apr 16 18:49 /usr/libexec/pt_chown<br>
-rwsr-xr-x 1 root root 13208 Apr 13 14:58 /bin/su<br>
*-rwsr-xr-x 1 root root 52788 Apr 17 15:16 /bin/mount<br>
*-rwsr-xr-x 1 root root 26508 Apr 17 20:26 /bin/umount<br>
*-rwsr-xr-x 1 root root 17652 Jul 6 09:33 /bin/ping<br>
-rwsr-xr-x 1 root root 20164 Apr 17 12:57 /bin/login<br>
*-rwxr-sr-x 1 root root 3860 Apr 19 15:39 /sbin/netreport<br>
-r-sr-xr-x 1 root root 46472 Apr 17 16:26 /sbin/pwdb_chkpwd<br>
[root@deep]# chmod a-s /usr/bin/chage<br>
[root@deep]# chmod a-s /usr/bin/gpasswd<br>
[root@deep]# chmod a-s /usr/bin/wall<br>
[root@deep]# chmod a-s /usr/bin/chfn<br>
[root@deep]# chmod a-s /usr/bin/chsh<br>
[root@deep]# chmod a-s /usr/bin/newgrp<br>
[root@deep]# chmod a-s /usr/bin/write<br>
[root@deep]# chmod a-s /usr/sbin/usernetctl<br>
[root@deep]# chmod a-s /usr/sbin/traceroute<br>
[root@deep]# chmod a-s /bin/mount<br>
[root@deep]# chmod a-s /bin/umount<br>
[root@deep]# chmod a-s /bin/ping<br>
[root@deep]# chmod a-s /sbin/netreport<br>
<br>
你可以用下面的命令查找所有带s位标志的程序:<br>
[root@deep]# find / -type f ( -perm -04000 -o -perm -02000 ) -exec ls -lg {} ;<br>
> suid-sgid-results<br>
把结果输出到文件suid-sgid-results中。<br>
<br>
为了查找所有可写的文件和目录,用下面的命令:<br>
[root@deep]# find / -type f ( -perm -2 -o -perm -20 ) -exec ls -lg {} ; > ww-files-results<br>
[root@deep]# find / -type d ( -perm -2 -o -perm -20 ) -exec ls -ldg {} ; > ww-directories-results<br>
<br>
用下面的命令查找没有拥有者的文件:<br>
[root@deep]# find / -nouser -o -nogroup > unowed-results<br>
<br>
用下面的命令查找所有的.rhosts文件:<br>
[root@deep]# find /home -name .rhosts > rhost-results<br>
<br>
<br>
建议替换的常见网络服务应用程序<br>
<br>
WuFTPD<br>
WuFTD从1994年就开始就不断地出现安全漏洞,黑客很容易就可以获得远程root访问(Remote Root Access)的权限,而且很多安全漏洞甚至不需要在FTP服务器上有一个有效的帐号。最近,WuFTP也是频频出现安全漏洞。<br>
它的最好的替代程序是ProFTPD。ProFTPD很容易配置,在多数情况下速度也比较快,而且它的源代码也比较干净(缓冲溢出的错误比较少)。有许多重要的站点使用ProFTPD。sourceforge.net就是一个很好的例子(这个站点共有3,000个开放源代码的项目,其负荷并不小啊!)。一些Linux的发行商在它们的主FTP站点上使用的也是ProFTPD,只有两个主要Linux的发行商(SuSE和Caldera)使用WuFTPD。<br>
ProFTPD的另一个优点就是既可以从inetd运行又可以作为单独的daemon运行。这样就可以很容易解决inetd带来的一些问题,如:拒绝服务的攻击(denial of service attack),等等。系统越简单,就越容易保证系统的安全。WuFTPD要么重新审核一遍全部的源代码(非常困难),要么完全重写一遍代码,否则 WuFTPD必然要被ProFTPD代替。<br>
<br>
Telnet<br>
Telnet是非常非常不安全的,它用明文来传送密码。它的安全的替代程序是OpenSSH。<br>
OpenSSH在Linux上已经非常成熟和稳定了,而且在Windows平台上也有很多免费的客户端软件。Linux的发行商应该采用OpenBSD的策略:安装OpenSSH并把它设置为默认的,安装Telnet但是不把它设置成默认的。对于不在美国的Linux发行商,很容易就可以在Linux的发行版中加上OpenSSH。美国的Linux发行商就要想一些别的办法了(例如:Red Hat在德国的FTP服务器上(ftp.redhat.de)就有最新的OpenSSH的rpm软件包)。<br>
Telnet是无可救药的程序。要保证系统的安全必须用OpenSSH这样的软件来替代它。<br>
<br>
Sendmail<br>
最近这些年,Sendmail的安全性已经提高很多了(以前它通常是黑客重点攻击的程序)。然而,Sendmail还是有一个很严重的问题。一旦出现了安全漏洞(例如:最近出现的Linux内核错误),Sendmail就是被黑客重点攻击的程序,因为Sendmail是以root权限运行而且代码很庞大容易出问题。<br>
几乎所有的Linux发行商都把Sendmail作为默认的配置,只有少数几个把Postfix或Qmail作为可选的软件包。但是,很少有Linux的发行商在自己的邮件服务器上使用Sendmail。SuSE和Red Hat都使用基于Qmail的系统。<br>
Sendmail并不一定会被别的程序完全替代。但是它的两个替代程序Qmail和Postfix都比它安全、速度快,而且特别是Postfix比它容易配置和维护。<br>
<br>
su<br>
su是用来改变当前用户的ID,转换成别的用户。你可以以普通用户登录,当需要以root身份做一些事的时候,只要执行“su”命令,然后输入root的密码。su本身是没有问题的,但是它会让人养成不好的习惯。如果一个系统有多个管理员,必须都给他们root的口令。<br>
su的一个替代程序是sudo。Red Hat 6.2中包含这个软件。sudo允许你设置哪个用户哪个组可以以root身份执行哪些程序。你还可以根据用户登录的位置对他们加以限制(如果有人“破”了一个用户的口令,并用这个帐号从远程计算机登录,你可以限制他使用sudo)。Debian也有一个类似的程序叫super,与sudo比较各有优缺点。<br>
让用户养成良好的习惯。使用root帐号并让多个人知道root的密码并不是一个好的习惯。这就是www.apache.org被入侵的原因,因为它有多个系统管理员他们都有root的特权。一个乱成一团的系统是很容易被入侵的。<br>
<br>
named<br>
大部分Linux的发行商都解决了这个问题。named以前是以root运行的,因此当named出现新的漏洞的时候,很容易就可以入侵一些很重要的计算机并获得root权限。现在只要用命令行的一些参数就能让named以非root的用户运行。而且,现在绝大多数Linux的发行商都让 named以普通用户的权限运行。命令格式通常为:named -u <user name> -g <group name><br>
<br>
INN<br>
在INN的文档中已经明确地指出:“禁止这项功能(verifycancels),这项功能是没有用的而且将被除掉”。大约在一个月前,一个黑客发布了当 “verifycancels”生效的时候入侵INN的方法。Red Hat是把“verifycancels”设为有效的。任何setuid/setgid的程序或网络服务程序都要正确地安装并且进行检查以保证尽量没有安全漏洞。<br>
<br>
<br>
<br>
<br>
<br>
安全守则<br>
<br>
1. 废除系统所有默认的帐号和密码。<br>
2. 在用户合法性得到验证前不要显示公司题头、在线帮助以及其它信息。<br>
3. 废除“黑客”可以攻击系统的网络服务。<br>
4. 使用6到8位的字母数字式密码。<br>
5. 限制用户尝试登录到系统的次数。<br>
6. 记录违反安全性的情况并对安全记录进行复查。<br>
7. 对于重要信息,上网传输前要先进行加密。<br>
8. 重视专家提出的建议,安装他们推荐的系统“补丁”。<br>
9. 限制不需密码即可访问的主机文件。<br>
10.修改网络配置文件,以便将来自外部的TCP连接限制到最少数量的端口。不允许诸如tftp,sunrpc,printer,rlogin或rexec之类的协议。<br>
11.用upas代替sendmail。sendmail有太多已知漏洞,很难修补完全。<br>
12.去掉对操作并非至关重要又极少使用的程序。<br>
13.使用chmod将所有系统目录变更为711模式。这样,攻击者们将无法看到它们当中有什么东西,而用户仍可执行。<br>
14.只要可能,就将磁盘安装为只读模式。其实,仅有少数目录需读写状态。
15.将系统软件升级为最新版本。老版本可能已被研究并被成功攻击,最新版本一般包括了这些问题的补救。
</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 + -