快捷搜索:   服务器  安全  linux 安全  MYSQL  dedecms

redhat 7.1中的网络服务配置


  redhat 7.1和以往的版本有一个明显的区别,就是用xinetd.conf代替原来的inetd.conf,并且直接使用了
  firewall服务。出于系统整体安全性增强的考虑,7.1在默认安装时没有启动老版本中大家比较熟悉的ftp,
  telnet等服务,并且由于ipchains的严格限制,给许多用户的配置带来了麻烦。
  为了方便大家的配置和使用,我在这里将我摸索的配置过程介绍给大家。
  xinetd(eXtended InterNET services daemon)对inetd功能进行了扩展,有关它的背景和其他内容在这里就
  不多讲了,有兴趣的可以去www.xinetd.org或其他相关网站查询,我具体说一下如何使你的网络服务转起来。
  
  xinetd的默认配置文件是/etc/xinetd.conf,它看起来尽管和老版本的/etc/inetd.conf完全不同,其实只是
  以一个脚本的形式将inetd中每一行指定的服务扩展为一个/etc/xinetd.d/下的配置文件。其格式为:
  
  service service-name
  {
   Socket_type = xxx; //TCP/IP socket type,such as stream,dgram,raw,....
  protocol = xxx; //服务使用的协议
  Server = xxx; //服务daemon的完整路径
  Server_args = xxx; //服务的参数
  Port = xxx; //指定服务的端口号
  Wait = xxx; //是否阻塞服务,即单线程或多线程
  User = xxx; //服务进程的uid
  Group = xxx; //gid
  REUSE = xxx; //可重用标志
  Disabled = yes/no; //是否禁用
  ......
  
  }
  
  我们以ftp和telnet为例,说明配置过程。
  在/etc/xinetd.d目录下,编辑ftp和telnet
  ftp如下:
  service proftpd
  {
  disable = no
  port = 21
  socket_type = stream
  protocol = tcp
  user = root
  server = /usr/local/sbin/in.proftpd
  wait = no
  }
  
  
  telnet如下:
  Service telnetd
  {
  disable = no
  port = 23
  Socket_type=stream
  protocol=tcp
  wait=tcp
  user=root
  server=/usr/sbin/in.telnetd
  }
  
  
  然后,重新启动服务
  #/etc/rc.d/init.d/xinetd restart 或:#killall -HUP xinetd
  
  这时候,telnet localhost和ftp localhost都应该没有问题了。
  但是,从局域网内的其他机器仍然可能使用不了ftp和telnet服务。原来还有一个地方需要设置,
  就是ipchains,它具有firewall和路由的功能。
  #vi /etc/sysconfig/ipchains,大家发现什么了?
  
  # Firewall configuration written by lokkit
  # Manual customization of this file is not recommended.
  # Note: ifup-post will punch the current nameservers through the
  # firewall; such entries will *not* be listed here.
  :input ACCEPT
  :forward ACCEPT
  :output ACCEPT
  -A input -s 0/0 -d 0/0 -i lo -j ACCEPT
  -A input -p tcp -s 0/0 -d 0/0 0:1023 -y -j REJECT //********
  -A input -p tcp -s 0/0 -d 0/0 2049 -y -j REJECT
  -A input -p udp -s 0/0 -d 0/0 0:1023 -j REJECT //********
  -A input -p udp -s 0/0 -d 0/0 2049 -j REJECT
  -A input -p tcp -s 0/0 -d 0/0 6000:6009 -y -j REJECT
  -A input -p tcp -s 0/0 -d 0/0 7100 -y -j REJECT
  
  没错,出于安全,ipchains把0-1023端口的入口全部封闭了。所以必须将它们打开。
  
  将其中我加
顶(0)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论