Bug #118886 | TLS connections still allowed after dynamically setting tls_version to blank string | ||
---|---|---|---|
Submitted: | 24 Aug 16:58 | Modified: | 8 Oct 15:29 |
Reporter: | Evan Elias | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Connection Handling | Severity: | S3 (Non-critical) |
Version: | 8.0, 8.4 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[24 Aug 16:58]
Evan Elias
[25 Aug 9:15]
MySQL Verification Team
Hi, Thank you for your report.
[8 Oct 11:32]
Georgi Kodinov
Posted by developer: Now, just setting the global variable to a new value doesn't make it effective by itself (see the docs link at the end of this). To activate the new value you need to execute ALTER INSTANCE RELOAD TLS. The issue is that, when you set the TLS version to an empty string and you then execute ALTER INSTANCE RELOAD TLS you get: mysql> alter instance reload tls; ERROR 3888 (HY000): Failed to set up SSL because of the following SSL library error: TLS version is invalid This works only when the --tls-version=' is specified at the command line. You get: 2025-10-08T11:24:38.015202Z 0 [Warning] [MY-013595] [Server] Failed to initialize TLS for channel: mysql_main. See below for the description of exact issue. 2025-10-08T11:24:38.015236Z 0 [Warning] [MY-010069] [Server] Failed to set up SSL because of the following SSL library error: TLS version is invalid And, consequently: mysql> select * from performance_schema.tls_channel_status; ERROR 2013 (HY000): Lost connection to MySQL server during query No connection. Trying to reconnect... Connection id: 9 Current database: *** NONE *** +------------+--------------------------------+-----------------+ | CHANNEL | PROPERTY | VALUE | +------------+--------------------------------+-----------------+ | mysql_main | Enabled | No | .. | mysql_main | Current_tls_version | | One can of course argue that this should also happen when you execute ALTER INSTANCE RELOAD TLS. If you think that specifying the option at the command line is not a good enough workaround, please file a feature request to make this happen: disable the TLS channel if any of the configuration values specified is invalid. Below are some links to the relevant docs: https://dev.mysql.com/doc/refman/8.0/en/using-encrypted-connections.html#using-encrypted-c... says: To reconfigure the TLS context at runtime, use this procedure: Set each TLS context-related system variable that should be changed to its new value. Execute ALTER INSTANCE RELOAD TLS. This statement reconfigures the active TLS context from the current values of the TLS context-related system variables. It also sets the context-related status variables to reflect the new active context values. The statement requires the CONNECTION_ADMIN privilege. New connections established after execution of ALTER INSTANCE RELOAD TLS use the new TLS context. Existing connections remain unaffected. If existing connections should be terminated, use the KILL statement.
[8 Oct 15:29]
Evan Elias
Thank you, Georgi. After reading the manual page for ALTER INSTANCE, it seems my goal is already achievable dynamically at runtime through this relatively obscure syntax that I hadn't ever noticed previously: SET GLOBAL tls_version = ''; ALTER INSTANCE RELOAD TLS NO ROLLBACK ON ERROR; After running that with the NO ROLLBACK ON ERROR clause, I can confirm that new connections with --ssl-mode=required are properly rejected. Just for background context, my use-case here involves integration testing coverage for various combinations with and without TLS between the client and server side. Restarting the server would be problematic due to how my tests are executed on a Dockerized server container with a tmpfs data mount. But separately I've also encountered other situations where doing this dynamically could be useful. So, happily this works as-is, and I agree it is not a server bug, and there's also no need for a feature request. I would however kindly request that the server variable reference for tls_version at https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html#sysvar_tls_version could be clarified to mention ALTER INSTANCE RELOAD TLS. Most of the other SSL/TLS variables on that page specifically mention the ALTER INSTANCE RELOAD TLS syntax, but the entry for tls_version does not mention that syntax directly. From a casual read of that manual entry, I had expected it to work immediately, like any other dynamic variable. If this seems reasonable, please consider converting this to an open documentation bug. Thanks!