服务器 频道

Solaris基本安全配置规范

  5. 开放的服务(inetd)
  5.1 禁止所有不需要的服务
  在/etc/inetd.conf中注释掉左右不需要的服务,比如
  name ,   shell ,   login,    exec,   comsat,   talk
  rusersd   printer  finger    uucp   所有以“r”开头的服务
  对必须提供的服务采用tcpwapper来保护

  5.2 编译安装Tcp wapper
  安装tcpd,编辑inetd.conf中的服务为:
  ftp stream tcp nowait root /usr/local/bin/tcpd in.ftpd
  telnet stream tcp nowait root /usr/local/bin/tcpd in.telnetd

  5.3 定义限制的地址
  检查hosts.allow和hosts.deny
  /etc/hosts.deny 为
  ALL:ALL
  提供的服务在/etc/hosts.allow定义
  <service>:<source-ip>

  5.4 使用xinetd替代
  xinetd中可以限制特殊的inetd服务到特定的端口

  6. 启动时提供的服务(rc.x)
  6.1 禁止所有不需要的服务
  在rc.x目录中将不需要的服务改名,比如
  Example: mv /etc/rc3.d/S92volmgt /etc/rc3.d/KS92volmgt
  以下服务应该禁止(根据需要自己决定):
  snmpdx
  autofs (Automounter)
  volmgt (Volume Deamon)
  lpsched (LP print service)
  nscd (Name Service Cache Daemon)
  Sendmail
  keyserv (Keyserv Deamon is only used if NIS+ or NFS are installed, if used start with
  –d option so that the defaults “nobody” key is not allowed)
  rpcbind提供远程呼叫,依靠远程系统的ip地址和远程用户的ID进行验证,这样很容易伪造和改变

  6.2 禁止所有DMI服务
  禁止所有DMI服务: mv /etc/rc3.d/S??dmi /etc/rc3.d/K??dmi
  /etc/init.d/init.dmi中启动的dmi服务有:
  /usr/lib/dmi/dmispd
  /usr/lib/dmi/snmpXdmid
  /etc/dmi/ciagent/ciinvoke

  6.3 去掉mount系统的suid位
  在/etc/rmmount.conf中加上
  mount hsfs -o nosuid
  mount ufs -o nosuid

  6.4 检查所有的.rhosts文件
  .rhosts允许不要密码远程访问,
  预先生成 $HOME/.rhosts文件,并且设置为0000,防止被写入”+ +”。(攻击者经常使用类似符号链接或者利用ROOTSHELL写入)。
  注:这种情况会导致一些如SSH的RCP命令无法使用(需要使用 $HOME/.rhosts文件的一些命令)
  touch /.rhosts ;chmod 0 /.rhosts 

  .rhosts可以被普通用户所创建在个人目录下。推荐使用脚本来发现.rhosts文件。并且利用cron自动检查,报告给特定用户。
  Script for Find.rhost:
  #!/bin/sh
  /usr/bin/find /home -name .rhosts | (cat <<EOF
  this only find .rhost:
  EOF
  cat
  ) | /bin/mailx -s "Content of .rhosts file audit report" yourmailbox

  6.5 禁止使用.rhosts认证
  在/etc/pam.conf中删除
  rlogin auth sufficient /usr/lib/security/pam_rhosts_auth.so.1
  将rsh的行改为:
  rsh auth required /usr/lib/security/pam_unix.so.1

  6.6 检查信任关系
  检查/etc/hosts.equiv文件,确保为空

  7.网络接口调整和安全优化
  7.1 /etc/rc2.d/S??inet参数调整
  在/etc/rc2.d/S??inet中做如下参数调整:
  缩短ARP的cache保存时间:
  ndd -set /dev/arp arp_cleanup_interval 60000 /* 1 min (default is 5 min*/
  缩短ARP表中特定条目的保持时间:
  ndd -set /dev/ip ip_ire_flush_interval 60000 /* 1 min (default is 20 min*/
  关闭echo广播来防止ping攻击
  ndd -set /dev/ip ip_respond_to_echo_broadcast 0 # default is 1
  关闭原路由寻址
  ndd -set /dev/ip ip_forward_src_routed 0 # default is 1
  禁止系统转发IP包
  ndd -set /dev/ip ip_forwarding 0 # default is 1
  禁止系统转发定向广播包
  ndd -set /dev/ip ip_forward_directed_broadcasts 0 # default is 1
  使系统忽略重定向IP包
  ndd -set /dev/ip ip_ignore_redirect 1 # default is 0
  使系统限制多宿主机
  ndd -set /dev/ip ip_strict_dst_multihoming 1 # default is 0
  再次确保系统关闭ICMP广播响应
  ndd -set /dev/ip ip_respond_to_address_mask_broadcast=0 # default is 1
  关闭系统对ICMP时戳请求的响应
  ndd -set /dev/ip ip_ip_respond_to_timestamp=0 # default is 1
  关闭系统对ICMP时戳广播的响应
  ndd -set /dev/ip ip_ip_respond_to_timestamp_broadcast=0 # default is 1
  禁止系统发送ICMP重定向包
  ndd -set /dev/ip ip_send_redirects=0 # default is 1

  7.2 改变TCP序列号产生参数
  在/etc/default/inetinit中改变
  TCP_STRONG_ISS=2

  7.3 设置in.routed运行在静态路由模式
  创建文件/usr/sbin/in.routed为以下内容:
  #! /bin/sh
  /usr/sbin/in.routed.orig –q
  改变文件属性:
  chmod 0755 /usr/sbin/in.routed
  # 动态路由可能会收到错误的路由信息,所以建议使用静态路由
  Consider to use static routes (routes added via the route commands in startup files)
  rather than the routing daemons

  7.4 禁止路由功能
  创建空文件notrouter: touch /etc/notrouter

  7.5 利用ip-filter
  ip-filter是Solaris系统的内核模块,可以完成简单包过滤

0
相关文章