【问题标题】:Send an HTTPS request to TLS1.0-only server in Alpine linux向 Alpine linux 中的 TLS1.0-only 服务器发送 HTTPS 请求
【发布时间】:2019-09-24 05:10:06
【问题描述】:

我正在 Docker Alpine 映像中编写一个简单的网络爬虫。但是,我无法将 HTTPS 请求发送到仅支持 TLS1.0 的服务器。如何配置 Alpine linux 以允许过时的 TLS 版本?

我尝试将MinProtocol 添加到/etc/ssl/openssl.cnf,但没有成功。

示例 Dockerfile:

FROM node:12.0-alpine

RUN printf "[system_default_sect]\nMinProtocol = TLSv1.0\nCipherString = DEFAULT@SECLEVEL=1" >> /etc/ssl/openssl.cnf

CMD ["/usr/bin/wget", "https://www.restauracesalanda.cz/"]

当我构建并运行这个容器时,我得到了

Connecting to www.restauracesalanda.cz (93.185.102.124:443)
ssl_client: www.restauracesalanda.cz: handshake failed: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
wget: error getting response: Connection reset by peer

【问题讨论】:

    标签: https openssl alpine tls1.0


    【解决方案1】:

    将这个神奇的 1 衬垫放入我的 dockerfile 解决了我的问题,我能够使用 TLS 1.0:

    RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/' /etc/ssl/openssl.cnf \ && sed -i 's/CipherString = DEFAULT@SECLEVEL=2/CipherString = DEFAULT@SECLEVEL=1/' /etc/ssl/openssl.cnf
    

    感谢这个家伙:http://blog.travisgosselin.com/tls-1-0-1-1-docker-container-support/

    【讨论】:

      【解决方案2】:

      我可以使用 builtin-busybox-wget 重现您的问题。但是,使用“常规” wget 可以:

      root@a:~# docker run --rm -it node:12.0-alpine /bin/ash
      / # wget -q https://www.restauracesalanda.cz/; echo $?
      ssl_client: www.restauracesalanda.cz: handshake failed: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
      wget: error getting response: Connection reset by peer
      1
      / # apk add wget
      fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
      fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
      (1/1) Installing wget (1.20.3-r0)
      Executing busybox-1.29.3-r10.trigger
      OK: 7 MiB in 17 packages
      / # wget -q https://www.restauracesalanda.cz/; echo $?
      0
      / #
      

      我不确定,但也许你应该在https://bugs.alpinelinux.org 发布问题

      【讨论】:

      • 谢谢,安装“常规”wget 有帮助。我也不确定这是否是一个问题,我认为默认禁用 TLS1.0 是合法的。我只是还没有找到启用它的方法,而且我在 linux 管理方面做得不够好,无法说 wget 是否应该尊重我添加到 openssl 配置中的内容。无论如何,即使没有配置 openssl,这个常规 wget 也可以工作。
      • @amik 也许您可以使用sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1.0/g' /etc/ssl/openssl.cnf 启用 TLS 1.0
      • 内置busybox-wget不支持openssl.cnf,所以设置MinProtocol没有效果。设置是固定的并在编译时设置
      猜你喜欢
      • 2018-10-04
      • 2012-12-12
      • 1970-01-01
      • 2020-07-15
      • 1970-01-01
      • 1970-01-01
      • 2021-11-09
      • 2012-12-20
      • 1970-01-01
      相关资源
      最近更新 更多