了解数据包包含 LLS 数据块时的 OSPFv2 MD5 身份验证

网络工程 ospf
2022-02-08 01:40:10

当 OSPFv2 数据包不包含 LLS 数据块时,计算的 MD5 散列应该在“Auth Crypt Data”字段中。例如,这是一条LS Update不包含 LLS 数据块的消息:

使用 MD5 身份验证的 OSPFv2 LS 更新

但是,如果存在 LLS 数据块,我是否正确,然后计算两个哈希?一个用于 LLS 部分,第二个用于消息的其余部分?Hello当我检查 OSPFv2或DB Description使用 MD5 身份验证 时,似乎确实如此:OSPFv2 Hello 与 MD5 身份验证

带有 MD5 身份验证的 OSPFv2 数据库描述

2个回答

你是对的。让我们用几个事实来说明它。

RFC2328 的 D 部分明确指出所有 OSPF 协议交换都经过身份验证。AuType 字段包含在所有 OSPF 数据包类型中(这很重要):

All OSPF protocol exchanges are authenticated.  The OSPF packet
header (see Section A.3.1) includes an authentication type field,
and 64-bits of data for use by the appropriate authentication scheme
(determined by the type field).

它还列出了身份验证的类型,即使“空身份验证”意味着没有身份验证,它仍然会向邻居发出信号。

AuType       Description
___________________________________________
0            Null authentication
1            Simple password
2            Cryptographic authentication
All others   Reserved for assignment by the
             IANA (iana@ISI.EDU)


    Table 20: OSPF authentication types.

RFC5613 规定 L 位只能在 Hello 和 DD 数据包中设置,而不能在其他数据包类型中设置...

The LLS block MAY be attached to OSPF Hello and Database Description
(DD) packets.  The LLS block MUST NOT be attached to any other OSPF
packet types on generation and MUST be ignored on reception.

...如果启用“加密身份验证”(AuType 2):

This TLV MUST only be
included in the LLS block when cryptographic authentication is
enabled on the corresponding interface.

此外,它还说明了应如何处理身份验证。

Note that if the OSPF packet is cryptographically authenticated, the
LLS data block MUST also be cryptographically authenticated. 

是的,您是正确的,根据 RFC 5613,特殊 TLV 用于 LLS 数据块的加密身份验证 (CA-TLV)。您可以在最后一个屏幕截图的底部看到。只有在相应接口上启用加密认证时,该 TLV 才会包含在 LLS 块中。 LLS 块的消息摘要使用与 OSPFv2 数据包其余部分相同的密钥和身份验证算法计算。 加密序列号包含在 TLV 中,并且必须与 OSPFv2 身份验证数据中的序列号相同,以便 LLS 块被认为是真实的。

https://www.rfc-editor.org/rfc/rfc5613#section-2.5