本文へスキップ
ecdsa.com
OpenSSL (client side)OpenSSL CLI

エラーメッセージ

SSL routines:ssl3_read_bytes:tlsv1 unrecognized name

別の表記

  • error:0A000458:SSL routines::tlsv1 unrecognized name
  • SSL alert number 112

OpenSSL 3.x は「error:0A000458:SSL routines:ssl3_read_bytes:tlsv1 unrecognized name:…:SSL alert number 112」と出力します。Java のクライアントは、同じアラートを「javax.net.ssl.SSLHandshakeException: Received fatal alert: unrecognized_name」として報告します。

OpenSSL (client side) — TLS alert 112 (unrecognized_name) sent by a server that does not serve the requested SNI name

このエラーの意味

クライアントがサーバーの提供していないサーバー名(SNI)を送信し、サーバーは TLS アラート 112(unrecognized_name)を致命的アラートとして返しました。RFC 6066 では、サーバーはこのアラートを警告として送ることも、致命的アラートとして送ることもできます。厳格なサーバー(および一部のアプライアンス)は不明な名前を致命的なものとして扱うため、証明書が提示される前にハンドシェイクが終了します。

発生する理由

修正方法

  1. 1.

    サーバーが受け付ける名前を確認する

    候補となる名前ごとにハンドシェイクを試してください。成功した名前が、サーバーに設定されている名前です。

    bash
    # Which names does the server accept?
    for n in example.com www.example.com api.example.com; do
      printf '%-20s ' "$n"
      echo | openssl s_client -connect 203.0.113.10:443 -servername "$n" -brief 2>&1 | grep -m1 -E 'Protocol version|error' || echo fail
    done
  2. 2.

    足りない名前をサーバーに設定する

    その名前をカバーする証明書と一緒に、名前をサーバーブロック(または CDN やプラットフォームのドメインリスト)に追加してください。

    text
    # nginx: a server block (and certificate) for every name clients use
    server {
        listen 443 ssl;
        server_name api.example.com legacy-api.example.com;
        ssl_certificate     /etc/nginx/tls/api.fullchain.pem;
        ssl_certificate_key /etc/nginx/tls/api.key;
    }
  3. 3.

    クライアントに正しい名前を送信させる

    URL には本来のホスト名を残し、アドレスだけを上書きしてください(curl --resolve、ライブラリの servername オプション)。

    bash
    # Send the server's real name as SNI when connecting by address
    curl --resolve api.example.com:443:203.0.113.10 https://api.example.com/
    openssl s_client -connect 203.0.113.10:443 -servername api.example.com </dev/null

関連するエラー

署名エラーデータベースをすべて見る