高级许可/拒绝过滤器

手册/FAQ (472) 2011-08-09 15:46:26

    在/etc/csf.allow和/etc/csf.deny里,您可以通过以下格式添加更复杂的端口和ip过滤器(您需要
    指定一个端口和一个IP地址):
    tcp/udp|in/out|s/d=port|s/d=ip|u=uid
    说明:
    tcp/udp : tcp 或 udp 或 icmp protocol
    in/out : 进入或传出连接
    s/d=port : 源或目标端口编号(或 ICMP类型)
(用_符号表示端口范围, e.g. 2000_3000)
    s/d=ip : 源或目标IP地址
    u/g=UID : 源数据包的UID或GID,反映传出连接 ,
    s/d=IP值忽略
    注意:ICMP过滤用"port"表示 s/d=port来设置ICMP类型。无论您用s还是d都一样,二者都使用iptables --icmp-type选项。"iptables -p icmp -h"表示有效ICMP类型。每个过滤器只支持一种类型。
    Examples: 例如:
    # TCP connections inbound to port 3306 from IP 11.22.33.44
    tcp|in|d=3306|s=11.22.33.44
    # TCP connections outbound to port 22 on IP 11.22.33.44
    tcp|out|d=22|d=11.22.33.44
    注意|如果省略,默认协议设置为"tcp", 默认连接方向为"in",所以
    # TCP connections inbound to port 22 from IP 44.33.22.11
    d=22|s=44.33.22.11
    # TCP connections outbound to port 80 from UID 99
    tcp|out|d=80||u=99
    # ICMP connections inbound for type ping from 44.33.22.11
    icmp|in|d=ping|s=44.33.22.11
    # TCP connections inbound to port 22 from Dynamic DNS address
    # www.configserver.com (for use in csf.dyndns only)
    tcp|in|d=22|s=www.configserver.com

THE END

上一篇