tr069 协议中何时使用 basic auth 或者 http digest auth

发布时间: 2023-04-29 20:39:11 作者: 大象笔记

由于没有在 TeamsACS 的 tr069 server 部分代码中没有找到 HTTP Digest Auth Middleware 的逻辑。 我开始怀疑我对 tr069 协议的 auth 部分理解有问题。所以查询了 tr069 协议文档。

参考:

里面有两个小结是讲述 Auth 的:

Authentication

逐段翻译一下吧,边翻译,边理解:

If the CPE is not authenticated using TLS, the ACS MUST authenticate the CPE using HTTP. If TLS is being used for encryption, the ACS SHOULD use basic authentication 7. If TLS is not being used, then the ACS MUST use digest authentication.

后面两条比较好理解,第一条得继续查一下 TLS 认证的原理。再就是,TeamsACS 是否是因为启用 TLS 认证,所以 ACS 才没有使用 http digest 认证,而且还是用了一个残废版的 basic auth。

The CPE MUST support both HTTP basic and digest authentication. The ACS chooses the authentication scheme by virtue of providing a basic or digest authentication challenge. If TLS is being used for encryption, the CPE SHOULD preemptively send basic authentication credentials as defined in Section 2 of 7.

这样看,CPE 模拟器不支持 digest auth 似乎也不是个问题。

Note – use of an authentication challenge requires the initial message (usually an Inform RPC method request) to be sent; use of preemptive basic authentication with TLS is secure and avoids the need for an additional request.

If the CPE has received an authentication challenge from the ACS (either basic or digest), the CPE SHOULD send an Authorization header in all subsequent HTTP requests for the duration of the TCP connection. Whether or not the CPE does this, the ACS MAY issue subsequent authentication challenges at any stage of the Session within a single or multiple TCP connections

如果 CPE 收到了来自 ACS 的 auth challenge, 无论是 basic auth 还是 digest auth, 在接下来的 http 请求中 CPE 要在请求头中加上 Authentication 信息。无论 CPE 是否这样做,ACS 都有可能在任何状态下发起 auth challenge.

CPE username/userid 和密码

这个 username 需要是唯一的,具体来说,推荐两种格式:

格式1:<OUI> "-" <ProductClass> "-" <SerialNumber>
格式2:<OUI> "-" <SerialNumber>

OUI 是 Organizationally unique identifier (OUI) “组织唯一标识符” 的缩写。

当然,这个格式不是强制的,我看国产的系统就有直接用随机字符串来作为 username 的。

密码必须每个 CPE 都不同。

我是一名山东烟台的开发者,联系作者