ext-mysqlnd: can't set SSL server hostname verification independent of general certificate validation
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C
- Estrellas
- 40.4k
- Forks
- 8.1k
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 96
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Lee ext/mysqlnd/mysqlnd_vio.c alrededor de las líneas 555–557, donde verify_peer y verify_peer_name se establecen conjuntamente, y revisa el flag MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT. El cambio estará completo cuando la verificación del nombre de host pueda controlarse de forma independiente mediante una opción adicional, mientras que la validación general del certificado siga siendo controlable por separado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- c, mysql
- Área
- databases, security
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100