[MDEV-20260] Port the ssl_fips_mode system variable from MySQL Created: 2019-08-05 Updated: 2024-01-18 Resolved: 2024-01-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Configuration, SSL, Variables |
| Fix Version/s: | N/A |
| Type: | New Feature | Priority: | Major |
| Reporter: | Geoff Montee (Inactive) | Assignee: | Sergei Golubchik |
| Resolution: | Won't Fix | Votes: | 3 |
| Labels: | beginner-friendly | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
MySQL 8.0 added the ssl_fips_mode system variable, which allows MySQL to run in FIPS mode:
https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_fips_mode https://dev.mysql.com/doc/refman/8.0/en/fips-mode.html Currently, to use FIPS mode in MariaDB, you have to enable it at the kernel level by following a process like the ones listed here: Should we port ssl_fips_mode from MySQL, so our users can enable FIPS mode without changing kernel parameters? Relevant MySQL commits: https://github.com/mysql/mysql-server/commit/bc4036a6bb148c340aa37b583be5ef3b696f8d9c https://github.com/mysql/mysql-server/commit/72ea3f61675033e16a0d13651b67695b85d88824 |
| Comments |
| Comment by Geoff Montee (Inactive) [ 2019-08-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
The name "ssl_fips_mode" that MySQL uses for the system variable would seem to imply that it is only relevant for SSL (i.e. TLS). However, I think that FIPS mode would also affect things like hash functions, encryption functions, and encryption plugins (the equivalent of keyring plugins from MySQL). If we port this implementation or if we implement something similar, would we want to use the same name as MySQL, even if it is kind of a misnomer? | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2019-08-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
I've documented the current state of support for FIPS mode here: https://mariadb.com/kb/en/library/tls-and-cryptography-libraries-used-by-mariadb/#fips-certification | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Yassine Ilmi [ 2021-07-22 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, Goeff's comment was correct, enabling FIPS mode would affect more than just TLS related usage of cryptographic functions. When dynamically linked with a fips OpenSSL and if FIPS is also enabled at the kernel level, low level API calls with fail. Please find below an example of this issue:
The line referenced from the sha_locl.h header, indicates that the message was thrown while calling openssl/crypto/sha/sha_locl.h:128 → fips_md_init_ctx(SHA1, SHA). This is based on the currently FIPS supported branch of OpenSSL (OpenSSL_1_0_2_stable) This function has an implementation through the following a macro in openssl/crypto/crypto.h:605
Looking at the OpenSSL User Guide 2.0 - https://www.openssl.org/docs/fips/UserGuide-2.0.pdf the following is stated in 2.6.2
So basically, if we want to be work properly in FIPS mode, we need to move to EVP_* APIs which allow for the OpenSSL FIPS library to call lower level APIs with FIPS compliant parameters. The MySQL project has more details regarding the impact of such a change (not exhaustive), if you look at their WorkLog item 8102, in the High Level Architecture tab, section Impacted functionalities/codes Some more references: I would like to suggest in the meantime to clarify the documentation, I initially assumed that the project was FIPS compliant, which is probably also the case of other users. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2022-02-01 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
ralf.gebhardt@mariadb.com Are you working on this or do you plan to work on this? If not, then unassign yourself from the issue so somebody else can see that it is "free" and perhaps pick it up. I might know somebody who is interested in FIPS and security certification stuff for MariaDB. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ralf Gebhardt [ 2022-02-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Hi otto, thanks for your comment. I am not looking at it currently, so I have removed me as an assignee. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-02-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Yass, MariaDB used to work in the FIPS mode, as can be seen from numerous fips related bugs that were fixed in the past. Unfortunately, it seems like it was broken again, as we don't set FIPS mode in CI yet. So, the first step should be to start testing FIPS mode in CI, everything else is pointless until we do that. I've created The documentation isn't exactly correct claiming that FIPS has to be enabled at the kernel level, it can be enabled specifically in MariaDB by starting the server with a MariaDB specific openssl.conf file, as documented here. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Yassine Ilmi [ 2022-02-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Hi @Sergei Golubchik, thanks for the follow-up. I think there is a confusion around the scope of changes required to be considered FIPS compliant, the bugs you reference are not all related to FIPS and do cover a very small part of the work to be done. I agree on the kernel level enablement, the kernel level enablement is checked by the openSSL library to enable FIPS Mode (wether or not MariaDB started in FIPS mode). MariaDB could also enable it through a specific call to the library, through a user exposed configuration or argument. Looking at the code, I don't see many references to EVP_ functions or fips in general, I think the best two resources to start with are those I mentioned earlier The MySQL project has more details regarding the impact of such a change (not exhaustive), if you look at their WorkLog item 8102, in the High Level Architecture tab, section Impacted functionalities/codes
I'm happy to discuss that in further details asynchronously and even help with this work. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-02-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Fixes for bugs like First we need to make sure that FIPS bugs, once fixed, stay fixed. Meaning, we need Can you advise whether we need to test FIPS mode both with OpenSSL 1.0.2 and 3.0? Is it significantly different, can one have one working and the other failing? If they either both fail or both succeed, then we can just test one. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Yassine Ilmi [ 2022-02-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
I agree with the priority of having testing available to avoid regressions. My point was that we should use Approved Security Functions (SP 800-140C) for the usages specified. As far as I remember, on of the problem is that the OpenSSL library cannot determine the usage we make of a cryptographic function as it lacks the application context. Moreover, we probably want to cover cases where the user initially configures MariaDB without fips mode but would then enable it with an incompatible configuration. She should then receive a proper error message to allow her to understand what configuration makes enabling fips impossible. Regarding the use of OpenSSL 1.0.2 or OpenSSL 3.0, OpenSSL 1.0.2 is not supported anymore, see release strategy from the OpenSSL project. And OpenSSL 1.1.1 doesn't support the validated fips cryptographic modules (see https://wiki.openssl.org/index.php/FIPS_modules). The OpenSSL team has a CMVP submission (see post - https://www.openssl.org/blog/blog/2021/09/22/OpenSSL3-fips-submission/) but it doesn't seem to have been validated yet. (see https://csrc.nist.gov/projects/cryptographic-module-validation-program/modules-in-process/modules-in-process-list). | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-02-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||
Correct. This was for example,
What do you mean by that? What is an incompatible configuration? | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Yassine Ilmi [ 2022-02-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Both these points are kind of covered in the OpenSSL FIPS User guide, in Section 2.6 - FIPS Mode of Operation: https://www.openssl.org/docs/fips/UserGuide-2.0.pdf When I say the OpenSSL library is lacking context, I was referring to this part of the OpenSSL UserGuide:
For my second point I was referring to the following:
To make up an example, let's say that
Now I should state that I'm not a FIPS expert, what I'm sharing is based on previous reading and research and I haven't looked that the whole MariaDB code base to provide more an thorough analysis. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-02-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks! That was enough guidance for us to take from there. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2022-02-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Please note that OpenSSL 3.0 has now been released in September 2021. It is no longer plagued by the "OpenSSL license exception" thing, but is pure Apache Licence 2.0 and can be used freely with in MariaDB. OpenSSL 3.0 has been submitted for FIPS 140-2 certification: https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program/details?product=14433 MariaDB should start using OpenSSL 3.0 and have the fips_mode variable implemented so that it requires OpenSSL 3.0 + the FIPS module in it. This way it would last time and be a modern FIPS 140-2 version that also has TLS 1.3 support. It is however not yet FIPS 140-3, so it isn't the most modern one.. but would meet the needs of most users who are interested in FIPS. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-02-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
MariaDB uses OpenSSL 3.0 since | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2022-02-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks for pointing out
| ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-02-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Yes. It's disabled before 10.8 because these builds crash (see numerous linked bug reports). It is quite possible that we'll backport 10.8 OpenSSL 3.0 patches to earlier versions eventually. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2022-03-03 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Backporting has already been done in CentOS and Debian, so submitted that patch for 10.6 in https://github.com/MariaDB/server/pull/2036 | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2022-04-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
serg What are the next steps on this? If somebody had extra time on their hands, what should they do? Do you want to have a design/planning meeting or is the implementation basically just to copy the flag from MySQL, and make it so that ssl-fips-mode=on errors out if the server detects that MariaDB was not compiled with OpenSSL 3.0? | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-04-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
At the moment we have fips tests running in buildbot, with openssl-1.0.2 and with openssl-3.0, see As for the ssl-fips-mode, I'm not sure it'll be very helpful. There're lots of OpenSSL aspects one can configure, they all can be configured in a config file and with OPENSSL_CONF one can use a dedicated config file that will only apply to MariaDB. One can enable fips mode that way (our tests do that), but also everything else OpenSSL related. Singling out just one particular openssl setting and creating a MariaDB option for it doesn't look very logical to me. Why not to create an option for the security level, for example? or for protocols? or for tsl1.3 ciphers? I think it's reasonable to be able to configure anything OpenSSL related, and do it in a separate file using the well known and documented syntax. And not to duplicate arbitrary selected small bits of OpenSSL config in the my.cnf file. | ||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2024-01-16 ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
MySQL has actually deprecated ssl_fips_mode in favor of OpenSSL side configuration starting with MySQL 8.0.34 |