php / php/php-src

ext-mysqlnd: can't set SSL server hostname verification independent of general certificate validation

オープン
#8,769 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Extension: mysqlnd Feature
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

The mysql command line client and related tools verify SSL certificates, but by default do not verify that the server name used to connect matches the Subject CN, or one of the SAN extension entries, of the server certificate.

This additional verification needs to be requested using the --ssl-verify-server-cert option (which was not the best name for this, -ssl-verify-server-cert-hostname would have been a better choice, bu that is a different story); or when using encrypted replication: the MASTER_SSL_VERIFY_SERVER_CERT=1 option to CHANGE MASTER.

With mysqlnd though both verification aspects are tightly coupled, and can only be both on, or both off, controlled by the single MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT flag.

See also: ext/mysqlnd/mysqlnd_vio.c:

555                 ZVAL_BOOL(&verify_peer_zval, verify);
556                 php_stream_context_set_option(context, "ssl", "verify_peer", &verify_peer_zval);
557                 php_stream_context_set_option(context, "ssl", "verify_peer_name", &verify_peer_zval);

https://github.com/php/php-src/blob/master/ext/mysqlnd/mysqlnd_vio.c#L555

There needs to be an extra option like MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_HOSTNAME to control hostname verification independent of general certificate verification.

PHP Version

PHP 8.1.2

Operating System

Ubuntu 22.04

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

verify_peer と verify_peer_name が同時に設定されている ext/mysqlnd/mysqlnd_vio.c の 555–557 行付近を読み、MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT フラグを確認してください。追加のオプションによってホスト名検証を独立して制御でき、一般的な証明書検証は別途制御可能なままとなれば、変更は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, mysql
領域
databases, security
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。