You need to enable JavaScript to run this app. 查找缺失的TLS密码套件:Traefik代理下Gitea的git操作握手失败问题
优惠活动
大模型
产品
解决方案
定价
更多

查找缺失的TLS密码套件:Traefik代理下Gitea的git操作握手失败问题

问题背景

Traefik代理后部署了Gitea服务,除对该Git服务器执行git push/pull操作外其余功能均正常,HTTP网页前端也可正常访问。尝试克隆仓库时,会收到gnutls_handshake()报错,但修改密码套件或切换到TLS 1.1版本则可正常使用。

环境信息
  • 客户端(Debian Bullseye系统)OpenSSL版本:OpenSSL 1.1.1k 25 Mar 2021
  • Traefik使用的TLS配置如下:
tls:
  options:
    default:
      minVersion: VersionTLS12
      cipherSuites:
        - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
        - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
        - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
        - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
        - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
        - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
      preferServerCipherSuites: true
      curvePreferences:
        - CurveP521
        - CurveP384
      sniStrict: true
  • gnutls-cli-debug输出如下:
gnutls-cli-debug git.server.de
GnuTLS debug client 3.7.1
Checking git.server.de:443
whether the server accepts default record size (512 bytes)... yes
                  whether %ALLOW_SMALL_RECORDS is required... no
                        whether we need to disable TLS 1.2... no
                        whether we need to disable TLS 1.1... no
                        whether we need to disable TLS 1.0... no
                        whether %NO_EXTENSIONS is required... no
                             for TLS 1.0 (RFC2246) support... no
 for TLS 1.0 (RFC2246) support with TLS 1.0 record version... no
                             for TLS 1.1 (RFC4346) support... no
                                  fallback from TLS 1.1 to... failed
                             for TLS 1.2 (RFC5246) support... yes
                             for TLS 1.3 (RFC8446) support... no
                    for known TLS or SSL protocols support... yes
                       TLS1.2 neg fallback from TLS 1.6 to... failed (server requires fallback dance)
                                     for HTTPS server name... unknown
                               for certificate chain order... sorted
                  for safe renegotiation (RFC5746) support... yes
                    for encrypt-then-MAC (RFC7366) support... no
                   for ext master secret (RFC7627) support... no
                           for heartbeat (RFC6520) support... no
                       for version rollback bug in RSA PMS... yes
            whether the server ignores the RSA PMS version... yes
whether small records (512 bytes) are tolerated on handshake... yes
    whether cipher suites not in SSL 3.0 spec are accepted... yes
whether a bogus TLS record version in the client hello is accepted... yes
         whether the server understands TLS closure alerts... yes
            whether the server supports session resumption... yes
                      for anonymous authentication support... no
                              for RSA key exchange support... no
                      for ephemeral Diffie-Hellman support... no
                        for RFC7919 Diffie-Hellman support... no
                   for ephemeral EC Diffie-Hellman support... yes
for VKO GOST-2012 (draft-smyshlyaev-tls12-gost-suites) support... no
                             for curve SECP256r1 (RFC4492)... no
                             for curve SECP384r1 (RFC4492)... yes
                             for curve SECP521r1 (RFC4492)... yes
                                for curve X25519 (RFC8422)... no
                      for AES-GCM cipher (RFC5288) support... yes
                      for AES-CCM cipher (RFC6655) support... no
                    for AES-CCM-8 cipher (RFC6655) support... no
                      for AES-CBC cipher (RFC3268) support... no
                 for CAMELLIA-GCM cipher (RFC6367) support... no
                 for CAMELLIA-CBC cipher (RFC5932) support... no
                     for 3DES-CBC cipher (RFC2246) support... no
                  for ARCFOUR 128 cipher (RFC2246) support... no
            for CHACHA20-POLY1305 cipher (RFC7905) support... yes
for GOST28147-CNT cipher (draft-smyshlyaev-tls12-gost-suites) support... no
                                       for MD5 MAC support... no
                                      for SHA1 MAC support... no
                                    for SHA256 MAC support... no
for GOST28147-IMIT MAC (draft-smyshlyaev-tls12-gost-suites) support... no
                     for max record size (RFC6066) support... no
                for OCSP status response (RFC6066) support... no
操作步骤

1. 查询git 2.30.2期望的密码套件

git本身不独立维护密码套件列表,会直接调用系统底层绑定的TLS库能力,Debian Bullseye官方源提供的git 2.30.2默认绑定GnuTLS库,执行以下命令即可获取客户端支持的全部密码套件:
gnutls-cli -l
如果你的git是自行编译指定绑定OpenSSL的版本,可执行以下命令查询:
openssl ciphers -v

2. 定位本次握手失败根因

从提供的调试输出可以确认,本次报错并非密码套件不匹配导致,根因是Traefik的TLS配置仅开放了CurveP384、CurveP521两种椭圆曲线,但Debian Bullseye默认GnuTLS配置优先使用SECP256r1(prime256v1)曲线做密钥交换,客户端提交的首选曲线不在服务端允许列表内,最终导致TLS协商失败。

3. 修复配置

无需降级TLS版本或调整密码套件,仅需要修改Traefik的TLS配置,在curvePreferences中增加SECP256r1曲线支持即可:

curvePreferences:
  - CurveP521
  - CurveP384
  - CurveP256

重载Traefik配置后即可正常执行git push/pull操作。

内容的提问来源于stack exchange,提问作者br0ken.pipe

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.18 04:45:02