[MDEV-19341] Make reloadable TLS system variables dynamic Created: 2019-04-26 Updated: 2023-01-13 Resolved: 2019-04-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | SSL, Variables |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Major |
| Reporter: | Geoff Montee (Inactive) | Assignee: | Vladislav Vaintroub |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | need_feedback | ||
| Issue Links: |
|
||||||||||||
| Description |
|
With It looks like FLUSH SSL uses the following variables to reload the TLS context:
https://github.com/MariaDB/server/blob/mariadb-10.4.4/sql/mysqld.cc#L4735 https://github.com/MariaDB/server/blob/mariadb-10.4.4//vio/viosslfactories.c#L334 Can all of these variables be made dynamic in 10.4, as long as the system supports FLUSH SSL? |
| Comments |
| Comment by Vladislav Vaintroub [ 2019-04-26 ] |
|
I'm not sure it is a very good idea. I think that the user expectation is that setting a variable has immediate effect - in the given case the SSL context would be reloaded, as result of SET GLOBAL (rather than delayed until FLUSH SSL). However, this will not really work for all ssl variables in all cases, some of the parameters are dependent on each other, for example ssl_key cannot be changed without also changing ssl_cert. |
| Comment by Geoff Montee (Inactive) [ 2019-04-26 ] |
|
Hi wlad,
It would be a bit counter-intuitive for users. However, it's not unprecedented to delay the effect of a changed dynamic variable until some other command is executed. For example, if you change one of the dynamic replication filters (replicate_do_db, replicate_do_table, etc.), then the change won't go into effect until the slave threads are restarted. https://mariadb.com/kb/en/library/replication-filters/#replicate_do_db If you set the global variable to enable semi-synchronous replication on a slave, then that change also doesn't go into effect until the slave's I/O thread is restarted. There might be other variables that are similar, but these are the first that I thought of. In my opinion, I think it might work alright, as long as the behavior is documented well enough.
Would it be possible to validate that the files defined by ssl_key and ssl_cert do actually match before calling new_VioSSLAcceptorFd() in reinit_ssl(), so that the server knows that it isn't reloading the TLS context with mismatched files? |
| Comment by Vladislav Vaintroub [ 2019-04-26 ] |
|
Maybe some variables have delayed effect, but not for FLUSH so far. Anyway, I do not see a big problem with how it is implemented right now, or a need for a change, given that it is now also well documented in the KB. The might be a confusion that variables are not dynamic (which they never were). But if variables are dynamic, there will be a confusion that changing them has no immediate effect.
I think the best validation of parameters is a call to new_VioSSLAcceptorFd() |
| Comment by Sergei Golubchik [ 2019-04-26 ] |
|
I tend to agree that it wouldn't be a particularly useful feature. Few more considerations, in addition to what was already said:
|
| Comment by Vladislav Vaintroub [ 2019-04-30 ] |
|
Based on feedback, it does not seem to be needed |
| Comment by Nuno [ 2021-02-04 ] |
|
wlad serg GeoffMontee This is really cool! Thank you for implementing this. If the variables aren't touched (same file paths), but we do renew the certificates (e.g. Certbot), will FLUSH SSL actually get the new files, even though the values of the variables didn't change? This is what I understand from the documentation: https://mariadb.com/kb/en/flush/#flush-ssl But I just want to clarify that my understanding is correct. Thank you very much! |
| Comment by Vladislav Vaintroub [ 2021-02-04 ] |
|
Variables do not change, but files are reloaded. That is you'd need to replace already existing certificate files in the relevant paths, then FLUSH SSL |
| Comment by Nuno [ 2021-02-04 ] |
|
wlad Thanks! That's exactly what I was hoping for. That's perfect. |