[php-src] Issue #8769: ext-mysqlnd: can't set SSL server hostname verification independent of general certificate validation

From: Date: Mon, 13 Jun 2022 21:26:38 +0000
Subject: [php-src] Issue #8769: ext-mysqlnd: can't set SSL server hostname verification independent of general certificate validation
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241722@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8769 Author: hartmut-mariadb ### 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

« previous php.bugs (#241722) next »