ext-mysqlnd: can't set SSL server hostname verification independent of general certificate validation
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C
- Star
- 40.4k
- Fork
- 8.2k
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 96
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Đọc ext/mysqlnd/mysqlnd_vio.c quanh các dòng 555–557, nơi verify_peer và verify_peer_name được thiết lập cùng nhau, và xem xét flag MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT. Thay đổi được hoàn tất khi việc xác minh tên máy chủ có thể được điều khiển độc lập thông qua một tùy chọn bổ sung, trong khi việc xác thực chứng chỉ nói chung vẫn có thể được điều khiển riêng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- c, mysql
- Lĩnh vực
- databases, security
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100