|
当上面的选项生效后,snort将记录与tcpdump文件匹配的数据包并将其保存到警告文件中,这样就允许你更容易地判断哪个警告是需要担心的哪个警告是错误的警告,你可以象下面这样来阅读它们:
# tcpdump -r /var/log/snort/tcpdump.log.1161106015 reading from file /var/log/snort/ ↪tcpdump.log.1161106015, link-type EN10MB (Ethernet) 06:37:50.839942 IP 10.0.0.82.1410 > 10.10.218.95.www: P 2352360050:2352360119(69) ack 1723804156 win 65535 06:53:07.792492 IP 10.0.0.82.1421 > 10.10.218.95.www: P 2124589760:2124589829(69) ack 2684875377 win 65535 ...
如果你象查看数据包的内容,使用-X参数,tcpdump –X –r /var/log/snort/tcpdump.log.1161106015,snort也有一些功能来中断基于规则匹配(灵活的响应)的连接,也有许多第三方的规则,可以在http://www.bleedingthreats.net/找到。
5、Iptables
iptables是一款状态防火墙几乎集成到所有Linux发行版中了,这就意味着你可以使用它基于ip地址的规则来控制远程机器访问你的服务器,以及连接请求的类型。(旧的无状态的防火墙让你只能根据数据包的内容来做出判断,因此你被端口号限制,不能跟踪会话的存在,如FTP数据流),Debian用户可以通过apt-get install iptables conntrack来获取它。
当你从终端登陆到机器上时请完成你的初始化测试,用一个错误的规则将你自己锁在外面,然后你亲自恢复,当所有数据包被允许通过,因此这如果不被接受,观察iptables-save和iptables-restore命令,这里有一个加上注释的例子脚本,它非常基础,但是基本上它可以告诉你iptables是如何工作的:
#!/bin/bash # example iptables script # flush the old rules iptables -F # set the default policy of the chain to accept iptables -P INPUT ACCEPT # create a new table for logging and discarding # unwanted packets iptables -N LOGDROP # use rate limiting on the logging, and # add a prefix of ’filter: ’ iptables -A LOGDROP -m limit -j LOG ↪--log-prefix "filter: " # drop unwanted TCP connections with a # TCP ReSeT packet iptables -A LOGDROP -p tcp -j REJECT ↪--reject-with tcp-reset # drop other packets by sending an ICMP # port unreachable in response iptables -A LOGDROP -j REJECT ↪--reject-with icmp-port-unreachable # now drop the packet iptables -A LOGDROP -j DROP #allow anything on the local interface iptables -A INPUT -i lo -j RETURN # allow packets that are related to # an on-going conversation iptables -A INPUT -p tcp -m conntrack ↪--ctstate RELATED,ESTABLISHED -j RETURN iptables -A INPUT -p udp -m conntrack ↪--ctstate RELATED,ESTABLISHED -j RETURN # allow SSH traffic iptables -A INPUT -p tcp -m tcp ↪--dport 22 -j RETURN # allow HTTP and HTTPS traffic iptables -A INPUT -p tcp -m tcp ↪--dport 443 -j RETURN iptables -A INPUT -p tcp -m tcp ↪--dport 80 -j RETURN # accept the following ICMP types - # echo, echo reply, source quench, ttl exceeded, # destination unreachable - and drop the rest iptables -A INPUT -p icmp -m icmp ↪--icmp-type 0 -j RETURN iptables -A INPUT -p icmp -m icmp ↪--icmp-type 3 -j RETURN iptables -A INPUT -p icmp -m icmp ↪--icmp-type 4 -j RETURN iptables -A INPUT -p icmp -m icmp ↪--icmp-type 8 -j RETURN iptables -A INPUT -p icmp -m icmp ↪--icmp-type 11 -j RETURN # if we haven’t accepted it, drop and log it. iptables -A INPUT -j LOGDROP
上一页 [1] [2] [3] [4] [5] 下一页 |