频道直达:新闻 - 组网 - 安全 - 服务器 - 存储 - 系统 - 应用 - 开发 - 数据库 - 前沿 - 技术人 - 培训 - 求职 - 读书 - 教程 - 专题 - 产品 - 案例 - 技术圈 - 博客 - BBS
51CTO.COM_中国领先的IT技术网站
找资料:

Linux操作系统网络服务器配置基础(上)(2)

作者: kid 出处:赛迪网 2007-09-03 16:04    砖    好    评论   进入论坛
阅读提示:要建立一个安全Linux服务器就首先要了解Linux环境下和网络服务相关的配置文件的含义及如何进行安全的配置。在Linux系统中,TCP/IP网络是通过若干个文本文件进行配置的,也许你需要编辑这些文件来完成联网工作。
* /etc/inetd.conf 文件
众所周知,作为服务器来说,服务端口开放越多,系统安全稳定性越难以保证。所以提供特定服务的服务器应该尽可能开放提供服务必不可少的端口,而将与服务器服务无关的服务关闭,比如:一台作为www和ftp服务器的机器,应该只开放80 和25端口,而将其他无关的服务如:finger auth等服务关掉,以减少系统漏洞。
而inetd,也叫作“超级服务器”,就是监视一些网络请求的守护进程,其根据网络请求来调用相应的服务进程来处理连接请求。inetd.conf则是inetd的配置文件。inetd.conf文件告诉inetd监听哪些网络端口,为每个端口启动哪个服务。在任何的网络环境中使用Linux系统,第一件要做的事就是了解一下服务器到底要提供哪些服务。不需要的那些服务应该被禁止掉,最好卸载掉,这样黑客就少了一些攻击系统的机会。查看“/etc/inetd.conf”文件,了解一下inetd提供哪些服务。用加上注释的方法(在一行的开头加上#号),禁止任何不需要的服务,再给inetd进程发一个SIGHUP信号。
第一步:把文件的许可权限改成600。
[root@deep]# chmod 600 /etc/inetd.conf
第二步:确信文件的所有者是root。
[root@deep]# stat /etc/inetd.conf
第三步:编辑“inetd.conf”文件(vi /etc/inetd.conf),禁止所有不需要的服务,如:ftp、 telnet、 shell、 login、 exec、talk、ntalk、 imap、 pop-2、pop-3、finger、auth,等等。如果你觉得某些服务有用,可以不禁止这些服务。但是,把这些服务禁止掉,系统受攻击的可能性就会小很多。改变后的“inetd.conf”文件的内容如下面所示:

# To re-read this file after changes, just do a 'killall -HUP inetd' 
#
#echo stream tcp nowait root internal
#echo dgram udp wait root internal
#discard stream tcp nowait root internal
#discard dgram udp wait root internal
#daytime stream tcp nowait root internal
#daytime dgram udp wait root internal
#chargen stream tcp nowait root internal
#chargen dgram udp wait root internal
#time stream tcp nowait root internal
#time dgram udp wait root internal
#
# These are standard services.
#
#ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a
#telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd
#
# Shell, login, exec, comsat and talk are BSD protocols.
#
#shell stream tcp nowait root /usr/sbin/tcpd in.rshd
#login stream tcp nowait root /usr/sbin/tcpd in.rlogind
#exec stream tcp nowait root /usr/sbin/tcpd in.rexecd
#comsat dgram udp wait root /usr/sbin/tcpd in.comsat
#talk dgram udp wait root /usr/sbin/tcpd in.talkd
#ntalk dgram udp wait root /usr/sbin/tcpd in.ntalkd
#dtalk stream tcp wait nobody /usr/sbin/tcpd in.dtalkd
#
# Pop and imap mail services et al
#
#pop-2 stream tcp nowait root /usr/sbin/tcpd ipop2d
#pop-3 stream tcp nowait root /usr/sbin/tcpd ipop3d
#imap stream tcp nowait root /usr/sbin/tcpd imapd
#
# The Internet UUCP service.
#
#uucp stream tcp nowait uucp /usr/sbin/tcpd /usr/lib/uucp/uucico -l
#
# Tftp service is provided primarily for booting. Most sites
# run this only on machines acting as "boot servers." Do not uncomment
# this unless you *need* it.
#
#tftp dgram udp wait root /usr/sbin/tcpd in.tftpd
#bootps dgram udp wait root /usr/sbin/tcpd bootpd
#
# Finger, systat and netstat give out user information which may be
# valuable to potential "system crackers." Many sites choose to disable
# some or all of these services to improve security.
#
#finger stream tcp nowait root /usr/sbin/tcpd in.fingerd
#cfinger stream tcp nowait root /usr/sbin/tcpd in.cfingerd
#systat stream tcp nowait guest /usr/sbin/tcpd /bin/ps -auwwx
#netstat stream tcp nowait guest /usr/sbin/tcpd /bin/netstat -f inet
#
# Authentication
#
#auth stream tcp nowait nobody /usr/sbin/in.identd in.identd -l -e -o
#
# End of inetd.conf

注意:改变了“inetd.conf”文件之后,别忘了给inetd进程发一个SIGHUP信号(killall –HUP inetd)。

[root@deep /root]# killall -HUP inetd

第四步:

为了保证“inetd.conf”文件的安全,可以用chattr命令把它设成不可改变。把文件设成不可改变的只要用下面的命令:

[root@deep]# chattr +i /etc/inetd.conf

这样可以避免“inetd.conf”文件的任何改变(意外或是别的原因)。一个有“i”属性的文件是不能被改动的:不能删除或重命名,不能创建这个文件的链接,不能往这个文件里写数据。只有系统管理员才能设置和清除这个属性。如果要改变inetd.conf文件,你必须先清除这个不允许改变的标志:

[root@deep]# chattr -i /etc/inetd.conf

但是对于诸如sendmail,named,www等服务,由于它们不象finger,telnet等服务,在请求到来时由inet守护进程启动相应的进程提供服务,而是在系统启动时,作为守护进程运行的。而对于redhat linux,提供了一个linuxconfig命令,可以通过它在图形界面下交互式地设置是否在启动时运行相关服务。也可以通过命令来设置是否启动时启动某个服务,如:[root@deep]# chkconfig –level 35 named off

具体命令可以参考man chkconfig的说明。

【相关文章】

【责任编辑:绝对无奈 TEL:(010)68476606-8003】


共2页: 上一页 [1] 2
【内容导航】
专题
Linux——从菜鸟到高手
IP多播技术及其应用
RIP路由协议专栏
开源框架Eclipse发展历程
SIP协议融合语音视频通信
我也说两句

匿名发表

(如果看不清请点击图片进行更换)


中 国 领 先 的 IT 技 术 网 站 ·
技 术 成 就 梦 想
·Windows XP远程桌面连接图解(.. (查看56377次)
·Solaris基础知识入门 (查看47764次)
·Windows操作系统安装 (查看34661次)
·设置远程桌面连接 (查看34190次)
·Linux的安装 (查看31196次)
订阅技术快讯
电子杂志下载
名称:SQL Server数据库管理精品黄皮书
简介:书中文章经过精挑细选,便于用户能根据自己的实际工作和学习,快速在本书寻找到相关资料。内容涵盖了SQL Server的安装与升级、语句查询、数据备份和恢复、自动化任务、数据同步、数据字典、安全和预防、性能和优化、集群等各方面应用信息,以及DBA管理人员在数据库管理工作中
名称:2007路由技术大全
简介:《2007路由技术大全》由51CTO.com网站特别策划制作,该书包括路由器技术、路由器产品、路由器配置、安全设置、路由器故障处理、路由器密码恢复,以及广大网友在实践使用中的心得经验和技巧文章,内容注重实用性,适用于初学者入门,也适合多年从业者提高,是一本实践和理论完
名称:网络安全精品应用黄皮书
简介:《2007精品网络安全黄皮书》包括了9个大类24个小类, 800余篇文章,内容包含了熊猫烧香病毒、DDOS攻击、ARP病等热点问题的介绍及解决方案。从病毒查杀、防范、系统、数据等各方面的安全设置到黑客技术的了解、防范,涉及到了安全应用的全部领域, 由浅至深内容全面。