繁体   English   中英

如何将 ZScaler 证书添加到 edgeHub 和 edgeAgent?

[英]How to add ZScaler certificate to edgeHub and edgeAgent?

我在使用 Zscaler 后面的 Azure IoT Edge 时遇到连接问题。 我知道我需要以某种方式在主机和 Docker 容器上安装 ZScaler 证书。 我能够在 Ubuntu 服务器中安装它并且它工作正常,因为现在我得到绿色表示主机可以连接到 azure-devices.net。 但它仍然无法从容器网络连接。 谁能给我详细说明如何做到这一点? 据我了解,我应该向 edgeHub 和 edgeAgent DockerFile 提供信息,我只是找不到它们。 我需要为此构建新图像吗? 因为 edgeAgent 没有与云的连接,所以我无法修改部署清单中的任何内容。

您可以使用绑定将所需的证书挂载到 edgeAgent 和 edgeHub 容器中。 如果您使用的是 Edge 1.1 或 1.2,您安装的内容会有所不同。

对于 Edge 1.1,您需要从容器上的 /etc/ssl/certs 复制 ca-certificates.crt 文件,将 Zscaler 根证书(以 pem 格式)附加到该文件,然后使用绑定为 /etc/ssl/certs/ca-certificates.crt。 您的 config.yaml 应如下所示:

agent:
  name: “edgeAgent”
  type: “docker”
  env:”
    https_proxy: “This should be the URL of your proxy server”
    UpstreamProtocol: “AmqpWs”   # Typically
  config:
    image: “mcr.microsoft.com/azureiotedge-agent:1.1”  # Possibly
    auth: {}   # Typically
    create_options:
# Following lines are added
      host_config:
        binds:
        - /full/path/to/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt

对于 Edge 1.2,您需要生成证书的哈希值,OpenSSL 使用该哈希值来查找正确的根证书。 您可以使用以下命令执行此操作:

ln -s zscalerroot.crt `openssl x509 -hash -noout -in zscalerroot.crt`.0

其中 zscalerroot.crt 是您的 Zscaler 根。 这将创建一个符号链接,其中包含八个十六进制数字,后跟 .0 到您的 zscaler 证书。 然后,您可以将 Zscaler 根证书绑定到 /etc/openssl/certs,但在容器中使用您刚刚生成的名称对其进行命名。 您的 config.toml 应该类似于以下代码段:

[agent.config]
image = “mcr.microsoft.com/azureiotedge-agent:1.1"  # Possibly
# Bind added here
createOptions = { HostConfig = { Binds = [ “/full/path/to/zscaler.crt:/etc/ssl/certs/001122ff.0”] } }

其中 001122ff.0 是 ln 命令生成的名称。

您还需要将绑定添加到部署 JSON 中。 当你使用设置模块功能时,这将在 Azure 门户的运行时设置中。 您需要将其添加到 HostConfig。

以 1.1 下的 edgeAgent 为例:

{
    "HostConfig": {
        "Binds": [
            "/full/path/to/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt"
        ],
    }
}

对于 1.2 以下的 edgeAgent:

{
    "HostConfig": {
        "Binds": [
            "/full/path/to/zscaler.crt:/etc/ssl/certs/001122ff.0"
        ],
    }
}

您还需要将类似的绑定添加到 edgeHub 的运行时设置。

警告:我已经让它与 Edge 1.1 一起使用。 我还没有机会测试 1.2。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM