Skip Headers
StorageTek Tape Analytics 管理指南
版本 2.0
E53289-01
  转到目录
目录
转到索引
索引

上一页
上一页
 
下一页
下一页
 

A 防止拒绝服务攻击

本章介绍了在 STA 服务器上防止拒绝服务 (Denial of Service, DoS) 攻击的方法。仅在初始磁带库配置成功之后才按照此过程操作。配置 IPTables 后,应确保 STA 仍在成功监视磁带库。


注:

以下过程是可选的,提供该过程仅供参考目的。站点安全性仍由客户负责。

A.1 概述

要保护服务器免受 DoS 攻击,请配置 Linux iptables 软件以建立用于过滤端口和/或 IP 地址的规则。根据 STA 的配置,Oracle 建议将规则附加到 UDP 162 和 STA 受管服务器正在其上运行的端口值。


注:

有关端口信息(包括 STA 使用的默认端口值),请参见《STA 安装和配置指南》的“端口配置”部分。

iptables 脚本样例可用于定义服务器上的输入规则,以便根据下列标准阻止尝试连接的主机:

  • 特定以太网接口

  • 特定端口

  • 特定协议

  • 指定时间段内的请求数量。

如果在该时间段内超过了主机连接次数,在该时间段的剩余部分将阻止该主机再进行连接。

A.2 配置 iptables 规则

配置 iptables 规则:

  1. iptables 脚本样例的源代码复制到文本编辑器中。

  2. 修改以下变量来适应您的环境:

    • INTERFACE

      定义要监视攻击的以太网接口

    • PORT

      定义要监视攻击的端口号

    • PROTO

      定义协议(tcp 或 udp)

    • HITSTIME

      确定在给定时间段(以秒为单位)(TIME) 内用于阻止服务器的合理请求数量值 (HITS)。

  3. 将脚本保存到系统并执行该脚本。

    新规则将添加到 iptables 并立即生效。

A.3 iptables 脚本样例

下面是 iptables 脚本样例。

# The name of the iptable chain
CHAIN=INPUT
# The ethernet interface to watch for attacks
INTERFACE=eth0
# The port number to watch for attacks
PORT=80
# The protocol (tcp or udp)
PROTO=tcp
# A server that sends HITS number of requests within TIME seconds will be blocked
HITS=8
TIME=60
# Log filtered IPs to file
touch /var/log/iptables.log
grep iptables /etc/syslog.conf 1>/dev/null 2>&1
if [$? -ne 0 ]; then
 echo kern.warning /var/log/iptables.log >>
 /etc/syslog.conf
 echo touch /var/log/iptables.log >> /etc/syslog.conf
 /etc/init.d/syslog restart
fi
# Undo any previous chaining for this combination of chain, proto, hits, and time
/sbin/iptables -L $CHAIN |grep $PROTO |grep $HITS |grep $TIME 1>/dev/null 2>&1
if [$? -eq 0 ]; then
 R=0
 while [$R -eq 0 ]; do
 /sbin/iptables -D $CHAIN 1 1>/dev/null 2>&1
 R=$?
 done
fi
# Logging rule
/sbin/iptables --append $CHAIN --jump LOG --log-level 4
# Interface rule
/sbin/iptables --insert $CHAIN --proto $PROTO --dport $PORT --in-interface $INTERFACE --match state --state NEW --match recent --set
# Blocking rule
/sbin/iptables --insert $CHAIN --proto $PROTO --dport $PORT --in-interface $INTERFACE --match state --state NEW --match recent --update --seconds $TIME --hitcount $HITS --jump DROP