CHX-I防火墙官方教程-附带翻译

更新时间:2023-11-27 16:56:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

CHX-I Documentation

Introduction 介绍

In its default configuration the packet/payload filter does not impose any security restrictions on any type of traffic.

默认配置下,包过滤器和负载过滤器没有任何规则,可以允许任何数据包通过。

The CHX suite of tools is not a personal firewall and should not be used by those expecting out-of-the box security configurations or unfamiliar with TCP/IP networking and IP security in general. Several configuration templates are provided to assist first time users in grasping CHX-I filtering concepts. These templates can be obtained in the idrci.net download area.

CHX不是防火墙软件,如果你对TCP/IP协议和IP安全方面的知识不了解,而且希望CHX是傻瓜型的防火墙—经过简单配置就可以使用—的话,那我们建议你还是不要使用CHX了。我们在idrci.net网站的下载中心提供了几个配置模板,初学者可以通过研究这些模板来搞清CHX-I的过滤思想。

First time users are encouraged to make extensive use of the available logging features (and the GoTo Related Filter feature) when debugging their CHX IP security policies.

首次使用CHX的用户,在编辑和调试自己的IP过滤策略之前,建议您认真研究一下CHX的日志(利用日志的跳转功能,查找对应的过滤器规则,并研究他)。

The packet filter cannot facilitate address/port translation in gateway environments. The CHX-I NAT module was designed to provide this functionality as either a stand alone or add-on to the packet filter management console.

对于通过在网关模式下上网的用户要注意:包过滤器没有地址/端口转换功能。但是,CHX-I的NAT模块可以完成这个功能,而且不管是单独使用该模块,还是把它添加到包过滤器的管理单元内。

The payload filter extends the functionality of the packet filter by inspecting and editing TCP/UDP/ICMP data. The payload filter can trigger permissive or prohibitive packet filter rules as

-1-

well as other payload rules (chained payload rule sets).

负载过滤器负责检查和编辑TCP/UDP/ICMP数据,从而扩展了包过滤器的功能。一个负载过滤器规则能够触发其他负载过滤器规则(可设置成链式过滤器规则),也能触发包过滤器规则,从而达到禁止或允许数据包通过的目的。

The CHX suite of network and security tools can be deployed on gateways (e.g. bridge, router, NAT) or distributed on servers/workstations.

CHX网络和安全软件包可以被配置在网关模式下(如:桥接、路由、NAT模式),也可以在服务器/工作站上使用。 Upgrades From 2.x Notes

General upgrade(from 2.x) notes: 升级到3.0的注意事项:

- prior to installing CHX 3.0 please un-install any previous versions of the packet filter.

- 请先卸载原来版本的包过滤器,再直接安装CHX3.0即可

- you can import 2.x filter sets (.sfd or .cff files)

- 可以直接把2.x版的过滤规则导入到3.0中(从2.x中导出的*.sfd或者*.cff文件)

- If Allow or Deny All was used in the previous version's policies then an additional packet filter rule MUST be added allowing ARP traffic.

- 如果Allow All或者Deny All这两个规则在早期版本中被使用了,那么在3.0中,必须增加一个allow ARP的过滤规则。

- A Dial-up or VPN node was created with a public node for dial-up interfaces (e.g. modems) and a private node for VPN

- 通过拨号上网的用户,CHX将创建一个public node,对于VPN为private node。

- The CHX RMC is now part of the main management console

- CHX 的 RMC现在是主管理单元的一部分

Packet Filter Module Overview 包过滤器模块总览

The Packet Filter module offers a simple, flexible, high performance IP filtering mechanism. The CHX stateful implementation is fully documented and all internal state table details can be viewed via the CHX State Table application.

包过滤器模块提供了一个简单、灵活、高性能的IP过滤机制。CHX可以完整记录运行状态,并且所有运行状态的细节可以通过CHX的状态表程序(CHX State Table application)来查看。

-2-

Must Read 必读

Several rules of thumb that should be understood when creating packet filter policies:

几则在创建过滤策略时需要注意理解的概念

1. All traffic is first checked against static packet filter rules. If allowed - the traffic is then analyzed by the stateful inspection engine provided the state analysis options are enabled.

1.所有的数据首先要被静态包过滤规则检测。如果设置成“允许”,且状态分析选项被打开,那么CHX的“状态检测引擎”SPI就会对数据包进行分析。

2. \dropped.

2. 默认情况下“Allow”规则是被禁止的。这就意味着,任何未在“Allow”规则内指定的数据包都将被丢弃。

3. If the UDP \option is enabled a Force Allow must be used when running UDP servers (e.g. DNS).

3. 如果 UDP的“伪状态”选项被打开,而且你的机器上需要运行UDP协议的服务器软件(如:DNS服务器软件),那么,你必须建立一条“强制允许”的规则,否则你的UDP服务器将不能正常运行。

4. If the ICMP \traffic is allowed.

4、如果ICMP的“伪状态”选项被打开,而且你需要允许任意ICMP通信,那么你也需要建立一条“强制允许”的规则。

5. A Force Allow acts as a trump card only within the same priority context.

5、“强制允许”规则在相同优先级的情况下是张王牌(可以破例,可以打破前面的禁止规则)。

6. With no static rules loaded TCP stateful inspection and UDP/ICMP pseudo state analysis is performed (if the state options are enabled)

6、如果没有静态规则,那么CHX将调用TCP状态检测(SPI)和UDP/ICMP伪状态分析(如果状态分析选项被打开的话)

7. TCP stateful inspection does not prevent new TCP sessions from being created.

7、TCP状态检测并不能够阻止创建新的TCP会话。

-3-

8. UDP/ICMP pseudo-states will discard \

8、UDP/ICMP伪状态下,会丢弃未经许可的UDP/ICMP数据报。

9. Any datagram discarded by the packet filter driver will have a corresponding entry in the log files(unless logging is explicitly disabled).

9、任意被包过滤器规则丢弃的数据报,在日志中都有相应的记载(除非日志功能被关闭)

Packet Filter Basics 包过滤基础知识

Generally speaking there are two approaches when defining an IP filter policy for a host or network:

通常情况下,为主机或者网络定义的IP过滤策略,只有两种处理办法:

? PROHIBITIVE - That which is not expressly allowed is prohibited

? 禁止-没有明确指出“允许”的,就被禁止

? PERMISSIVE - That which is not expressly prohibited is allowed

? 允许-没有明确指出“禁止”的,就被允许。

The CHX Packet Filter architecture incorporates four \that can be performed within the same priority level:

在相同优先级下,CHX包过滤体系对数据包有4种可能的处理行为: 1. Allow 允许 2. Deny 丢弃

3. Force Allow 强制允许 4. Log Only 仅记录

The Following holds true within the same priority context:

1) If only one or more Allow-rules are used, all the rest is prohibited. 2) If only one or more Deny-rules are used, all the rest is allowed.

3) If there are Allow-rules and Deny-rules, all traffic NOT specified in the Allow rules is dropped as well as traffic specified in the Deny rules. (Deny rules can overlap a space permitted by an Allow rule).

4) To allow something or part of something which has been prohibited by an Allow or Deny-rule, a Force-Allow-rule must be used. 在相同优先级下,以下结论正确:

1)如果仅有1个或多个“允许”规则起作用,那么其他所有行为都是禁止的 2)如果仅有1个或多个“禁止”规则起作用,那么其他所有行为都是允许的

3)如果既有“允许”规则也有“禁止”规则,所有没在“允许”规则里面定义的数据包都会被丢弃,就像在“禁止”规则里面定义一样(“禁止”规则可以覆盖“允许”规则)。

4)对于某个已经被“禁止”规则禁止的数据包,如果想允许其通过或者部分允许通过,可以通过设定“强制允许”规则来达到目的。

There are two possible approaches when defining prohibitive rule sets:

有2种可行的方法来定义“禁止”规则:

a) Enter a Deny ALL rule then specify permitted traffic with Force Allow rules. OR

b) Define permitted traffic with a combination of Allow rules. (everything not specified in the Allow rules will be Blocked)

a) 建立一条“禁止所有”的规则,然后用“强制允许”规则来排除某些特定的数据包。 或者

b) 在“允许”规则中允许特定的数据通过。(没在“允许”规则中定义的,全部被禁止)

-4-

Permissive policies should be avoided in general, but they are accomplished by making exclusive use of Deny filters.

一般来说,最好不要用允许策略,而是在禁止规则里排除。

Filter Priorities 过滤器属性

The priority context allows - among other things - cascading of Deny/Force Allow combinations to achieve a greater flexibility.

通过优先级功能,可以实现“禁止”和“强制允许”在功能上的重叠,从而提供了非常大的灵活性。

Within the same priority context an Allow rule can be negated with a Deny rule, and a Deny rule can be negated by a Force Allow rule. However, this approach is now extended to allow a higher priority Deny to negate a Force Allow.

在相同优先级的情况下,被“允许”规则放行的数据包能被“禁止”规则阻止,而被“禁止”规则阻止的数据包又能被“强制允许规则”放行。但是,如果“禁止”规则的优先级较高的话,优先级低的“强制允许”规则就失去作用了。所以,在设置“强制允许”规则时,要注意优先级。

4 Allow rule rule Deny rule 3 Allow rule rule Deny rule Allow rule 2 rule Deny rule Allow rule 1 rule Deny rule 0 Allow rule rule Deny rule Force Allow Force Allow Force Allow Force Allow Force Allow “禁止”/“允许”/“强制允许”规则与优先级关系的示意图

图中,粉色带箭头直线表示数据包的走向。

在没有设定CHX过滤规则的情况下,数据包应该从左侧流入,一直到右侧流出。即最上面一条粉色直线所指的流向。

如果设定了CHX规则,则有可能会按照朝下方的粉色箭头所指方向流动。 5个方框代表5种优先级。分别对应:

4——Highest 3——High 2——Normal 1——Low 0——Lowest

Consider the example of a DNS server CHX-I policy that makes use of a Force Allow rule to allow ANY incoming DNS queries over TCP/UDP port 53. Prior to version 2.5 the Force Allow action represented the \IP or range of IPs that should be prohibited from accessing the same public server. This can be now achieved by creating a Deny rule with a higher priority than the Force Allow rule.

以DNS服务器为例,建立一个策略,利用“强制允许”规则来允许任何入站DNS请求(TCP/UDP的53号端口)。在CHX2.5版本以前,“强制允许”行为代表着“特权”,牺牲了灵活性,因为他是在所有访问同一个服务器的用户中指定应该禁止的IP或IP范围(如果

-5-

被禁止的IP很多,且这些IP还有可能发生变化的话,那简直不是人干的活)。而在CHX3.0中,可以通过建立一条优先级高于“强制允许”规则的“禁止”规则来实现。

这里有个问题,如果有入侵者通过53端口入侵,怎么办?呵呵,后面的负载过滤可以对每个协议进行过滤,从而可以区分开哪些数据包是正常的,哪些数据包是不正常的(通过建立标准数据包的模板pattern)。

据本人理解:CHX的包过滤是面向连接的,即对连接(协议+端口)设置过滤规则,从而确定哪些协议、哪些端口的数据可以通行。而负载过滤则是面向协议的,针对不同的协议,设置不同的数据包模板,某个数据包即使通过了包过滤,但有可能因为注入了邪恶的数据,而造成与标准数据包模板不匹配,就会被负载过滤阻止。有人说负载过滤是应用层的,其实本人感觉还是包过滤,跟应用层无关,应用层的数据归根结底还要变成数据包进行传输。

Another critical factor in designing priority based rule sets is the \are applied. If a Deny rule is set with the highest priority, and there are no Force Allows within the same context - then any packet matching the Deny rule is automatically dropped and the remaining rules are ignored. Conversely, if a rule has the \flag set then any incoming packets matching the Force Allow rule will be automatically passed and the remaining rules discarded.

在基于优先级的规则集中,另一个影响规则作用的重要因素是规则被应用的“顺序”。如果一个“禁止”规则被定义成最高优先级,且同一规则集内没有其他不低于该优先级的“强制允许”规则,那么当一个数据包匹配了这条“禁止”规则后,该数据包即被丢弃,就不再用后面的规则检测了。反之,如果一个“强制允许”规则拥有最高优先级,那么任何入站数据包在匹配这条“强制允许”规则后,就会自动进入系统,而不会再继续匹配其后的规则。(可以参看前一页的示意图)

总结一下,规则的应用顺序是: 先看优先级,先高后低;

同一优先级中,“强制允许”>“禁止”>“允许”。 跟定义规则的先后顺序无关。

Filter Action Priority 过滤规则中的处理方法及其优先级

Four actions can be performed upon a packet matching the filter description: ? Deny - The action drops silently the packet

? Allow - The action passes the packet and drops everything else not specified by the Allow rule(s)

? Log Only - The packet is passed and the event logged

? Force Allow - Overrides any other action stating the contrary

数据包匹配规则后,在规则定义中有4种可选处理方法: ? 禁止 – 该数据包悄无声息地被丢弃

? 允许 – 该数据包顺利通过,但没在此规则中定义的其他内容全部被丢弃 ? 记录 – 该数据包顺利通过,仅在事件日志中留下痕迹 ? 强制允许 – 无视禁止规则

Within the same priority level every packet is inspected as follows:

1. If the packet matches one or more Force Allow rules it is passed regardless of any other filters.

2. If the packet matches one or more Allow rules it is then checked against any existing Deny rules. If there are no Deny rules, the packet is passed.

3. If the packet matches one or more Deny rules it is dropped.

在相同优先级下,每个数据包都将按下述顺序进行检测:

-6-

1. 如果数据包匹配了一个或多个“强制允许”规则,就不会再去匹配其他任何规则。 2. 如果数据包匹配了一条或多条“允许”规则,还要继续被其他“禁止”规则检查。如果没有“禁止”规则,则该数据包通过。

3. 如果数据包匹配一条或多条“禁止”规则,则该数据包被丢弃。

Taking a practical example we create an Allow(deny everything except) filter: ALLOW Incoming TCP dstPort=80

At this point all other incoming traffic is blocked. Within the Allowed space we add the following Deny filter:

DENY Incoming TCP srcAddress=10.0.0.0/8 dstPort=80

The above filter overrides the Allow and blocks packets from the 10.0.0.0 range. To override the Deny filter we create the following Force Allow: FORCE ALLOW Incoming TCP srcAddress=10.0.0.100 dstPort=80

作为例子,我们创建一条“允许”过滤规则(在“禁止”规则中进行排除,即“强制允许”):

第一步:在“允许”规则中加入:入站TCP数据包,目标端口80

在这条规则后,所有其他的入站通信均被阻止。

第二步:在这条“允许”规则后,增加一条“禁止”规则:

禁止入站TCP数据包,源地址10.0.0.0/8(即A类地址),目标端口80

后面的过滤规则覆盖了前面的允许规则,阻止了从10.0.0.0网段发来的数据。

第三步:为了覆盖这条“禁止”规则,我们再创建如下的“强制允许”规则:

“强制允许”入站TCP数据包 源地址为10.0.0.100 目标端口80

Conditional Filters 条件过滤

Certain network applications require communications on different channels. As an example - an MTA might implement IDENT verification by sending a SYN to the host initiating the SMTP transaction. If an RST or SYN-ACK is received the initial session handshake will quickly complete. If no response is received from the SYN to the IDENT port (113) then the initial session handshake completion will be delayed.

一些网络应用需要在不同的通道上进行通信。比如:一个MTA(邮件传输代理,MTA 从其他服务器接受邮件、读取地址并将送到通往用户邮箱过程中的下一个服务器)需要实现IDENT验证,MTA会发送SYN到主机来初始化这次SMTP事务。如果接收到RST或者SYN-ACK信号,那么初始化握手过程就会很快结束。如果从SYN发送到认证端口(113号端口)后没有应答,那么初始化握手过程就要产生延迟滞后。

-7-

Scheduled Filters 定时过滤

Any static filter can have a schedule (or lists of schedules) associated. Traffic can be denied or permitted according to a set schedule.

静态过滤器可以跟一个定时器或定时器列表关联。根据定时器的设定的时间段来决定采用允许规则还是禁止规则,从而决定数据包是通过还是被阻止。

定时器的设置很灵活,可以为某个时刻,也可以为某段时间,也可以定义周期时间。 这个功能对某些服务器很管用。可以在某个时间段允许某项服务,在另外的时间段允许另外的服务,灵活性很强。

Triggers 触发器

Triggers are dormant static filters activated by a payload event. Traffic can be denied or allowed based on the presence of predefined payload conditions. A trigger can have a

-8-

predefined timeout value set in the parent payload rule.

触发器也是一种静态过滤器,不过他需要被负载过滤事件激活才能发挥作用。在正常情况下,他是“休眠的”,呵呵。通过创建负载过滤器也可以阻止或允许数据包通过。在触发该触发器的负载过滤规则中,可以给该触发器定义超时时间,超过此时间,触发器继续休眠。

To create a trigger right-click on the desired interface node and select \the payload rule properties \timeout value and related options.

创建触发器的步骤:

1. 右键单击需要创建触发器的节点,选择“New Trigger”。

2. 在负载过滤规则属性“次要动作(Secondary Action)”中选择该触发器,然后设定超时的时间和相关选项。 Lists 列表

The following lists are supported: - IP addresses - Ports

- MAC addresses - Conditions - Schedules - Patterns

支持如下列表: IP地址列表 端口列表 MAC地址列表 条件列表 定时器列表 模式列表

定义好列表后,可以在创建规则时直接调用,方便了创建规则。

IP Fragmentation analysis and related logs IP碎片分析及相关日志

The default installation of the packet filter enables a series of checks on fragmented packets - and drops packet occurrences with the following characteristics:

在安装CHX后,包过滤器默认打开了一系列碎片包检查功能,如果数据包满足下述特征,则被丢弃:

? Invalid fragmentation flags/offset - this event is triggered when either the DF and MF

flags in the IP header are set to 1 OR if a header contains the DF flag set to 1 and an Offset value different than 0.

?非法碎片标志/偏移 - 如果发现此类数据包,则说明要么IP头中的DF和MF标志位被设置成1,要么是DF被设置成1且偏移量不等于0(这两种情况的数据包是不正常的,或者说是错误的数据包)。在此情况下,碎片检查功能就会被触发而执行。

小知识:IP数据格式中,MF和DF是关于数据是否被分片和是否最后一个分片的标志位,

-9-

MF(More Fragment)

MF=1,后面还有分片的数据包 MF=0,分片数据包的最后一个 DF(Don't Fragment) DF=1,不允许分片 DF=0,允许分片

偏移:分片后的分组在原分组中的相对位置

? First fragment too small - event triggered when a packet with the MF flag set to 1, the

Offset value is at 0 and has total length smaller than 120 bytes. (maximum combined header length)

??第一个碎片太小 - 当MF=1,偏移量=0,且总长度小于120字节(头部长度最大120字节),这说明数据包虽然给分组了,但每个数据包都太小,会触发碎片检查功能。

? IP fragment out of boundary - event occurs if the value of the Offset flag combined

with the total packet length exceeds the maximum datagram length of 65535 bytes.

??IP碎片越界 – 偏移量+整个数据包长度超过最大数据报长度(64K),触发碎片检查。

? IP fragment offset too small - a non zero Offset flag with a value that is smaller than

60 bytes.

? IP碎片偏移量太小 – 非零偏移量的值小于60字节,触发碎片检查

If the \dropped with the following log entry:

如果“禁止所有入站碎片包”选项打开,所有碎片包都会被丢弃,且在日志中做如下记载:

? IP fragmented packet. IP碎片包

One exception to the above rule is the presence of a packet with a total length smaller than the IP header length , in which case the packet is silently discarded.

上述所有规则没有考虑一个特殊情况:当前的数据包总长度小于IP头中指定的长度,在这种情况下,该包被悄无声息地消灭掉。

Import-Export rules 导入/导出规则

Highlight the desired filters, right-click and select the desired export option:

导出:选择需要导出的过滤器,右键单击,选择需要导出的选项,如图:

Importing a filter set is achieved by right-clicking on the desired network interface node followed by selecting \

-10-

导入:右键单击需要导入规则的节点,选择“Import Filters From File”

Copy And Paste Filters 复制/粘贴过滤器

You can copy and/or paste selected filters by right clicking the selected filter(s) and choosing copy or paste from the menu. Alternatively you can drag and drop on or more selected filters(holding the CTRL key while performing a drag and drop operation to achieve the copy effect).

These operations can be performed across any nodes and across any active remote hosts.

过滤规则是可以被复制和粘贴的,只需右键单击相应的规则,选择复制/粘贴即可。甚至,你还可以拖动规则到指定的节点下,拖动时要按住Ctrl键,否则为移动。

复制/粘贴可以在节点之间,甚至在在线的远程主机之间进行。

Stateful Options 状态检测选项

As opposed to the classic static packet filtering methodology where each packet is inspected on an individual basis, the CHX-I stateful mechanism tries to analyze each packet in the context of traffic history, correctness of IP/TCP header values and TCP connection state transitions. In the case of stateless protocols (e.g. UDP) a pseudo-stateful mechanism is implemented based on historical traffic analysis.

以前的包过滤方法仅检查每个数据包的独立的基本信息。与此对比,CHX-I使用状态检测机制(SPI),在数据包的上下文或数据包传输历史中,分析每个数据包的IP/TCP头信息的正确性和TCP连接状态的变化。对于没有状态信息的协议(如UDP协议),可以采用“伪状态”机制-基于分析历史数据包而产生的“状态”-伪状态。

While an exhaustive analysis of TCP state transitions and behavior correctness is beyond the scope of this manual, the CHX-I stateful mechanism generally acts the following way:

至于如何详尽分析TCP状态转换和行为正确性的问题,不是本手册需要探讨的。CHX-I状态检测机制(SPI)通常通过如下渠道实现:

- A packet is passed through the stateful routine if it is explicitly allowed via static filters. - The packet is examined if it belongs to an existing connection by checking the CHX-I connection table for matching end points

- The TCP header is examined for correctness (e.g. sequence numbers, flag combination) Once enabled, the stateful engine is applied to all traffic traversing the interface.

- 除非在静态过滤规则中明确被允许,否则,数据包就要被SPI例程检测。 - 一个数据包在CHX-I的历史连接表(一个记载数据包历史连接的表)中没有找到相应的匹配项,那么该数据包就要被检测。

- 一旦“允许”检查TCP 头信息的正确性(如检查顺序号、标志组合等),那么所有

-11-

通过该接口的数据全部都要经过SPI引擎的检查。

The UDP pseudo-stateful mechanism - by default - simply rejects any incoming \UDP packets. If the packet filter operator is running a legit UDP server, she MUST explicitly allow (via static filters) traffic to that particular service. For instance, in a non-prohibitive IP policy, if there is a DNS server running, a \traffic to port 53 is required.

UDP“伪状态”机制 – 默认情况下,SPI只是简单地丢弃一些入站的“未经请求”的UDP包。如果安装CHX的机器需要运行合法使用UDP协议的服务器软件(如:DNS服务器),那么务必在静态过滤规则中,明确对这项服务建立“允许”规则。例如:在一个“非禁止”(允许或强制允许)IP规则中,如果该机是DNS 服务器,就需要建立一条在53端口允许UDP服务的“强制允许”规则。

The ICMP pseudo-stateful mechanism - by default - simply rejects any incoming \ICMP request-reply and error type packets. A Force Allow must be explicitly defined for any unsolicited ICMP packet to be allowed. All other ICMP (non request-reply or error type) packets are dropped unless explicitly allowed with static filters.

ICMP伪状态机制 – 默认情况下 – SPI只是简单地丢弃一些入站的“未经请求”的ICMP包 - 应答和错误类型数据包。对于一些虽然未经请求,但允许通过的ICMP数据包,必须要建立“强制允许”规则。剩下其他的ICMP(非请求-应答或错误类型)数据包都会被丢弃(除非在静态过滤规则中明确允许)

小知识:SPI=Stateful Packet Inspection=全状态数据包检测

是指通过对每个连接信息(包括套接字对(socket pairs):源地址、目的地址、源端口和目的端口;协议类型、TCP协议连接状态和超时时间等)进行检测从而判断是否过滤数据包的防火墙。它除了能够完成简单包过滤防火墙的包过滤工作外,还在自己的内存中维护一个跟踪连接状态的表,比简单包过滤防火墙具有更大的安全性。

目前最为先进的状态数据包检查(SPI) 防火墙提供最高级别的安全性。它在默认情况下拒绝所有来自外网的请求,并且对通过防火墙的发自内网请求的连接动态地维护所有通信的状态(连接),只有是对内网请求回复的连接并符合已建立的状态数据库的包才能通过防火墙进入内网。这种方案不仅可使网络用户访问Internet 资源,同时又能防止Internet 上的黑客访问内部网络资源。 “状态检查”一词是指防火墙记忆连接状态和在其内存中为每个数据流建立上下文的能力。凭借这些信息,该防火墙能够比不支持SPI的防火墙作出更有根据的策略决策。

只有具有基于硬件的采用目前最为先进的状态数据包检查(SPI)技术的防火墙才是真正意义上的防火墙。

——以上内容摘自“百度百科”—SPI防火墙(http://baike.http://www.wodefanwen.com//view/1203322.htm)

注:以后凡是涉及状态包检测,一概用SPI代替。

Enable/Disable Stateful Mechanism 打开/关闭 状态检测机制(SPI)

The CHX-I stateful mechanism can be applied on a per interface basis. This becomes useful in multi homed environments where we can disable stateful inspection on the internal (LAN) interface.

CHX-I的SPI可以在每一个接口上应用。这样对于一机多网环境是非常方便的,比如,可以在连接内部网(LAN)的网卡上禁用SPI。

By default the stateful mechanism is disabled on each interface present in the system. To access the stateful options right click on the desired interface and select properties.

-12-

默认情况下,所有接口的SPI功能是关闭的。右键单击相应的接口,选择属性(如图):

General Stateful Options SPI选项

RFC 3168 defines two of the six bits from the Reserved field to be used for ECN, as follows:

Bit 8 to 15 CWR-ECN-URG-ACK-PSH-RST-SYN-FIN TCP Header Flags Bit Name Reference:

8 CWR (Congestion Window Reduced) [RFC3168] 9 ECE (ECN-Echo) [RFC3168]

RFC 3168标准规定:在TCP/IP包头中,有未使用的保留字段共6位,通过定义其中的2位来支持ECN。具体格式如下所述:

第8位至第15位分别是:CWR-ECN-URG-ACK-PSH-RST-SYN-FIN TCP头中,标志位的名称:

第8位:CWR=Congestion Windows Reduced, 源端?接受端,拥塞窗口已减小 第9位:ECE=ECN Echo ECN应答

小知识1:ECN= Explicit Congestion Notification,显式拥塞通告。

是为了解决在交互式应用量比较大的网络中出现的TCP包丢失问题而提出的一种解决办法,即在TCP/IP头中保留的未使用的6位中的2位来支持ECN。)。

小知识2:TCP报头格式

-13-

\

\Static Filter Logs)

\ \

“Enable TCP stateful inspection”- 打开/关闭TCP的SPI功能 “Enable TCP Stateful Logging” – 是否记录SPI活动日志

“Allow Incoming/outgoing Active FTP” – 打开/关闭主动FTP式 “Allow Incoming/outgoing Passive FTP” – 打开/关闭被动FTP模式

\the number of incoming connections from a single host to\- If the state table reaches the limit specified for \entries, subsequent TCP packets from that specific host and not belonging to existing connections will be dropped until one or more state entries are removed.

\ – 限制同一台主机进站连接的数目。如果SPI状态表(用来记录连接状态的表)中记录与某台主机“已建立”的连接数目达到了上限值,那么从该主机发来的后续TCP数据包,如果不属于状态表中已建立的连接,就会被丢弃,直到状态表中某个连接结束,腾出状态表空间后,才可以继续连接。

\the limit specified for SYN-SENT(remote) entries, subsequent TCP packets from that specific host will be dropped.

\– 限制与某一主机的半开连接数目。如果状态表中,远程某台主机向本机请求连接(SYN-SENT)的数目达到记录的上限值,那么该远程主机向本机发送的后续TCP数据包都会被丢弃。

\

\– 打开/关闭UDP的SPI功能

\

\– 是否记录UDP SPI活动日志

The UDP pseudo-stateful mechanism drops incoming \UDP packets. For every outgoing UDP packet the packet filter creates or updates its UDP \allow a UDP response with a default timeout value of 60 seconds.

-14-

UDP的SPI会丢弃一些入站的“未经允许”的UDP数据包。对每一个出站的UDP数据包,该机制会创建或者更新该包的UDP“状态表”,并且会在60秒内允许一个UDP数据包应答,超出60秒则视为超时。

ICMP pair types supported: Type 0 & 8, 13 & 14, 15 & 16, 17 & 18.

支持的ICMP报文对儿的类型有:Type 0 & 8, 13 & 14, 15 & 16, 17 & 18.

小知识:ICMP报文对儿:ICMP=Internet Control Message Protocol,Internet控制信息协议,该协议不传输用户数据,主要用来传输主机-主机、主机-网络设备之间的控制信息,如:网络是否通畅?能否到达主机?路由是否可用?等等控制消息。由此可以看出,ICMP传输的基本上都是请求-应答类数据包,所以很多数据包是成对出现的,故称ICMP报文对儿。

Type 0 — Ping应答 Type 8 — Ping请求 Type 13 — 时间戳请求 Type 14 — 时间戳应答

Type 15 — 信息请求 Type 16 — 信息应答 (这对儿好像已经不用了) Type 17 — 地址掩码请求 Type 18 — 地址掩码应答

\ \

\– 打开/关闭 ICMP的SPI功能 \– 是否记录SPI活动日志

The ICMP pseudo-stateful mechanism drops incoming \packets. For every outgoing ICMP packet the packet filter creates or updates its ICMP \will allow an ICMP response with a default timeout value of 60 seconds.

ICMP伪状态检测机制会丢弃一些入站的“未经允许”的ICMP数据包。对每一个出站的ICMP数据包,该机制会创建或者更新其ICMP“状态表”,并且会在60秒内允许一个ICMP数据包应答,超出60秒则视为超时。(与UDP协议类似)

Advanced Stateful Options 高级SPI选项

Depending on the network environment such as OS-es and network speed, the CHX-I stateful engine can be adjusted to tighten the overall performance and security.

Several values can be adjusted by creating a corresponding registry key with the desired values. These keys represent various TCP states and their default timeout values. The timeout value represents the amount of time CHX-I will keep an associated connection in its state table in the ABSENCE of any other traffic pertaining to that specific connection.

During the creation and life of a connection, the CHX-I stateful engine will synchronize itself to the various states of the connection (e.g. SYN-SENT, Last-Ack, etc). While in any of the available states, if no additional packets are seen for the corresponding timeout values the CHX-I stateful engine erases the connection information from its table.

根据网络环境的变化(如操作系统或者网速等),CHX-I的SPI引擎会及时进行自我调整,以期在最大程度上既保证高安全又保持高性能。

通过创建和修改相应的注册表键值,可以修改TCP的状态或者超时时间。Timeout键值表示:对于一个已经建立且已在CHX-I状态表中记载状态的连接,该连接可能因为缺乏其他相关连接而处于等待状态,那么CHX-I状态表就要保留这个连接的状态信息,但不能无限期保留,这个时间限制的长短,就是Timeout键的值。

在一个连接的整个声明周期中,CHX-I的SPI引擎都要在状态表和具体连接的状态之间保持同步(如:SYN-SENT,Last-Ack等)。

-15-

All timeout keys can be created as DWORD values in:

所有有关超时的键值都是DWORD类型,在注册表中位置如下:

HKEY_LOCAL_MACHINE\\SOFTWARE\\Third Brigade\\ChxMpld\\Version 1.0\\Globals] The default values and corresponding keys are:

键值及默认值:

\已关闭超时 \请求连接超时 \应答连接超时 \结束会话超时 \创建会话超时 \关闭等待 \正在关闭超时 \最后关闭确认 \热启动超时 \冷启动超时 \UDP超时

UDP Stateful Options UDP 的SPI选项

The UDP protocol is connectionless, hence the different approach in trying to maintain a pseudo state table of UDP communications.

If the UDP stateful option is enabled ANY unsolicited incoming UDP packet is dropped. If - for instance - a DNS server is running then a Force Allow Incoming UDP dstPort=53 will be needed (in addition to TCP dstPort=53).

By default, the \changed by accessing the \

UDP协议是面向无连接的,因此需要用一些其他的方法来创建和维护UDP通信的状态表。 如果UDP的SPI功能打开了,那么任何未经请求的UDP数据包都会被丢弃。如果本机为DNS服务器,就必须建立一条“强制允许”规则:允许入站UDP,目标端口53(还要建立一条TCP的“强制允许”规则,允许入站TCP,目标端口53) 。

默认的UDP状态表超时值=60秒。该值对应注册表中的TimeoutUDP值,位置如下: HKEY_LOCAL_MACHINE\\SOFTWARE\\Third Brigade\\ChxMpld\\Version 1.0\\Globals

ICMP Stateful Options ICMP 的SPI选项

Similar to the UDP pseudo-stateful implementation, the ICMP protocol allows for flow tracking with specific query-response types, such as Echo and Echo Reply or ICMP error messages such as destination host unreachable.

If the ICMP stateful option is enabled a Force Allow will be required for unsolicited ICMP traffic to be allowed.

类似于UDP的SPI实现方法,ICMP协议通过使用特定的请求-应带类型来跟踪数据流,例如:请求回应和回应应答,或者ICMP的错误信息如:destination host unreachable(目标主机无法到达)。

如果ICMP的SPI功能被打开,同样也要建立一条“强制允许”规则来允许那些未经请求而入站的ICMP数据包。

Stateful Logs SPI日志

If Stateful logging is enabled four log descriptions can occur in the \

如果SPI日志功能打开,在日志的“原因”列,有7种情况:

-16-

1. \a particular timeout value has caused the tear down of a connection. The same applies to an unsolicited UDP/ICMP packet.

1. \– 这表示2种情况:1、无SYN的扫描数据包,2、在数据包到来之前,连接已经因为超时而被彻底断开。

2. \Flags\- This condition occurs when a packet arrives with a delay beyond its corresponding state timeout values.

2. \– 这种情况发生在当一个数据包因为延迟到达而超出了相应的状态表超时时间。

3. \ 非法顺序号

4. \ 非法确认号

5. \ 达到入站连接数量上限 6. \ 达到出站连接数量上限 7. \ 达到半开连接数量上限

It is up to the packet filter operator to decide the level of logging needed, although with stateful logs enabled considerable disk space will be quickly used in heavy traffic environments.

在网络通信量很大的情况下,打开SPI日志功能会占用大量的磁盘空间。所以,设置包过滤的管理员要慎重选择SPI日志功能。

State table details 查看详细的状态表信息

For each session the details of its corresponding state entry can be viewed via the CHXStateEntries application:

每次会话对应的状态表详细信息,可通过CHXStateEntries程序(在开始菜单中)来查看。

Sample Rules 样板规则

You can obtain sample rule sets in the CHX download area. Follow the instructions in the Import-export section of this manual.

你可以到CHX官方网站的download区去下载一些现成的规则,然后用导入/导出规则来使用他们。

Command Line 命令行工具

-17-

The CHX-I Packet Filter command line tool - chxpfcon.exe has two purposes: to offer command line configuration of the packet filter and to introduce the possibility of adding filters with arbitrary time-out values.

As a side effect, chxpfcon.exe can provide an \and the CHX-I Packet Filter Driver.

CHX-I命令行工具是chxpfcon.exe,运行它即可。设计这个命令行工具有2个目的:1、提供命令行的方式来配置过滤器;2、可能有时需要用命令行方式添加任意超时时间的值。

作为一个附加作用,chxpfcon.exe可以给第三方应用程序与CHX过滤器之间提供一个接口。

Command line syntax: 命令行语法规则:

fltcon Ver. 3.0.0

Copyright (C) Third Brigade 2004-2005

Add or delete hidden filters and import *.sfd files for CHX-I Packet Filter fltcon /ADD /T Timeout /F FltType /PY Priority /DIR Direction /I Interface Index | /MAC Mac Address /SA SrcAddr(From) /SM SrcMask(To) /SR /!SA

/DA DstAddr(From) /DM DstMask(To) /DR /!DA /P Protocol /SP SrcPort /!SP /DP DstPort /!DP /A Action /L | /DEL /ID (FilterID)

| /IMPORT /FILE Import filter file /F Import FltType /I Import Interface Index | /MAC Import Mac Address /IP Import IP /PW password ADD Add new filter

T Timeout timeout in sec. (default - INFINITE)

F FltType filter type: 0-Global; 1-Interface; 3-IP (default-0)

PY Priority 0-Lowest;1-Low;2-Normal;3-High;4-Highest (default-Normal) DIR Direction 0 - Incoming; 1 - Outgoing (default - 0) I Interface Index decimal format (default - Any)

MAC InterfaceMac hex format (Ex: 00-50-DA-63-BD-E5) (default - Any) Dial-up or VPN Public: 00-53-45-00-00-00 Dial-up or VPN Private: 00-53-45-00-00-01

ET EthType ethernet type hex format (Ex: 0800) (default - IP, 0 - fo r any)

!ET not ethernet type

MS SrcMac hex format (Ex: 00-50-DA-63-BD-E5) (default - Any) !MS not source Mac

MD DstMac hex format (Ex: 00-50-DA-63-BD-E5) (default - Any) !MD not destination Mac

SA SrcAddr(From) x.x.x.x format (default - Any) SM SrcMask(To) x.x.x.x format (default - Any) SR Source address range !SA Not source address

DA DstAddr(From) x.x.x.x format (default - Any) DM DstMask(To) x.x.x.x format (default - Any)

-18-

DR Destination address range !DA Not destination address P Protocol 0-255 (default - Any) SP SrcPort 0-65535 (default - Any) !SP Not source port

DP DstPort 0-65535 (default - Any) !DP Not destination port

A Action 0 - Force Allow; 1 - Deny; 2 - Allow (def - Force Allow) L Log (default - No) DEL Delete a filter by ID

ID (FilterID) Filter ID returned by ADD (Ex: /ID (-12345678) )

For interface filters (type 1): the interface index (or MAC address) of the interface on which the filter(s) are to be applied must be specified For IP filters (type 2): both the IP and the corresponding interface index (or MAC address) on which the filter(s) are to be applied must be specified

Logs 日志

General Options 常规选项

Right-click on the Packet Filter Log node and select properties: 右键单击包过滤日志节点,选择properties:

Display Options 显示选项

Right-click on the packet filter log and select the desired view options. 右键单击packet filter log,选择desired view options(显示选项)

-19-

You can select which columns you want displayed by selecting \then \Columns\

你可以选择哪些列可以显示在日志中,哪些列不显示。

Payload Filter Module 负载过滤模块

The Payload Filter module allows for TCP/UDP/ICMP data inspection and editing. The TCP normalization engine is responsible for maintaining TCP session end-to-end semantics after TCP payload length is altered. Traffic can also be dropped if the intent is to provide classic intrusion prevention.

设置负载过滤器模块是为了编辑和检测TCP/UDP/ICMP数据。TCP标准化引擎负责在TCP负载长度被改变时,继续保持TCP会话的完整语义。按照以前的入侵防范方法,这种通信流也会被丢弃。

-20-

本文来源:https://www.bwwdw.com/article/wvet.html

Top