TeamsACS 在处理 BootStrap 事件时, 如何生成的密码

更新日期: 2023-05-07 阅读次数: 808 字数: 395 分类: 物联网

TeamsACS 是一个开源的 tr069 ACS 实现。其在处理 CPE 发送的 BootStrap 事件时,逻辑有点绕。

BootStrap 处理逻辑

  1. 判断 CPE 请求的 body 非空时,如果是 BootStrap 事件,生成连接用的账号/密码。注意,这里没有直接返回给 CPE,而是通过 golang channel 缓存了起来。
  2. 判断 CPE 请求的 body 为空时,不再判断事项类型,从 golang channel 中获取之前生成的账号/密码,以 soap 格式返回给了 CPE

我不太理解 tr069 协议为何要这样设计。为何要多走一步?

返回的 SOAP XML 数据格式

通过使用 CPE 模拟器发送 BootStrap 事件 Inform 消息,我终于看到了 response 数据格式。

第一次 body 非空的请求,得到的返回格式:

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cwmp="urn:dslforum-org:cwmp-1-0">
  <soap-env:Header>
    <cwmp:ID soap-env:mustUnderstand="1">oujgew5h</cwmp:ID>
    <cwmp:NoMoreRequests>0</cwmp:NoMoreRequests>
  </soap-env:Header>
  <soap-env:Body>
    <cwmp:InformResponse>
      <MaxEnvelopes>1</MaxEnvelopes>
    </cwmp:InformResponse>
  </soap-env:Body>
</soap-env:Envelope>

第二次 body 为空的请求,得到的返回,即包含账号/密码的返回:

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cwmp="urn:dslforum-org:cwmp-1-0">
  <soap-env:Header>
    <cwmp:ID soap-env:mustUnderstand="1">bootstrap-session-64575c9a-a8ad-9dfd-6b86-7fa1-c7cb8da5</cwmp:ID>
    <cwmp:NoMoreRequests>0</cwmp:NoMoreRequests>
  </soap-env:Header>
  <soap-env:Body>
    <cwmp:SetParameterValues>
      <ParameterList soap-enc:arrayType="cwmp:ParameterValueStruct[2]">
        <ParameterValueStruct>
          <Name>Device.ManagementServer.ConnectionRequestUsername</Name>
          <Value xsi:type="xsd:string">000000</Value>
        </ParameterValueStruct>
        <ParameterValueStruct>
          <Name>Device.ManagementServer.ConnectionRequestPassword</Name>
          <Value xsi:type="xsd:string">teamsacscpepassword</Value>
        </ParameterValueStruct>
      </ParameterList>
      <ParameterKey/>
    </cwmp:SetParameterValues>
  </soap-env:Body>
</soap-env:Envelope>

写死的密码

从返回的账号及密码看,TeamsACS 都没有遵循 tr069 的标准协议

  • 账号不规范
  • 密码为所有 CPE 一样的密码,tr069 里明确说明不可以这样

这个密码实际保持在数据库中,可以在 web 管理后台里配置:

数据库截图

TeamsACS 管理后台截图

注意这里的描述是:

tr069 The authentication password used when the server connects to cpe

而我的理解一直是反的。。。

tags: tr069

关于作者 🌱

我是来自山东烟台的一名开发者,有敢兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式