本附录介绍了在 STA 服务器上防止拒绝服务 (Denial of Service, DoS) 攻击的方法。仅在初始磁带库配置成功之后才按照这些过程操作。配置 IPTables 后,应确保 STA 仍在成功监视磁带库。
本附录包括以下几节:
注:
本附录中的过程是可选的,在此处提供仅供参考。站点安全性仍由客户负责。要保护服务器免受 DoS 攻击,请配置 Linux iptables 软件以建立用于过滤端口和/或 IP 地址的规则。根据 STA 的配置,Oracle 建议将规则附加到 UDP 162 和 STA 受管服务器正在其上运行的端口值。
注:
有关端口信息(包括 STA 使用的默认端口值),请参见《STA 安装和配置指南》。iptables 脚本样例 可用于定义服务器上的输入规则,以便根据下列标准阻止尝试连接的主机:
特定以太网接口
特定端口
特定协议
指定时间段内的请求数量。
如果在该时间段内超过了主机连接次数,在该时间段的剩余部分将阻止该主机再进行连接。
配置 iptables 规则:
将 iptables 脚本样例 的源代码复制到文本编辑器中。
修改以下变量来适应您的环境:
INTERFACE-定义要监视攻击的以太网接口
PORT-定义要监视攻击的端口号
PROTO-定义协议(TCP 或 UDP)
HITS 和 TIME-决定给定时间段(TIME,以秒为单位)内阻止服务器的请求数量 (HITS) 的合理值。
将脚本保存到系统并执行该脚本。
新规则将添加到 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