当主机系统上有支持的 OpenSSL 库和 FIPS 对象模块时,MySQL 支持 FIPS 模式。MySQL supports FIPS mode when a supported OpenSSL library and FIPS Object Module are available on the host system.
服务器端的 FIPS 模式适用于服务器执行的加密操作。这包括在服务器内运行的复制(源/副本和组复制)和 X 插件。FIPS 模式也适用于客户端尝试连接到服务器的情况。FIPS mode on the server side applies to cryptographic operations performed by the server. This includes replication (source/replica and Group Replication) and X Plugin, which run within the server. FIPS mode also applies to attempts by clients to connect to the server.
以下各节描述了 FIPS 模式及如何在 MySQL 中利用它:The following sections describe FIPS mode and how to take advantage of it within MySQL:
联邦信息处理标准 140-2 (FIPS 140-2) 描述了一项安全标准,美国联邦政府机构可能会要求加密模块遵守该标准,以保护敏感或有价值的信息。为了被认为适合联邦使用,加密模块必须获得 FIPS 140-2 认证。如果一个用于保护敏感数据的系统缺乏适当的 FIPS 140-2 证书,联邦机构将无法购买它。Federal Information Processing Standards 140-2 (FIPS 140-2) describes a security standard that can be required by Federal (US Government) agencies for cryptographic modules used to protect sensitive or valuable information. To be considered acceptable for such Federal use, a cryptographic module must be certified for FIPS 140-2. If a system intended to protect sensitive data lacks the proper FIPS 140-2 certificate, Federal agencies cannot purchase it.
诸如 OpenSSL 之类的产品可以在 FIPS 模式下使用,尽管 OpenSSL 库本身未通过 FIPS 验证。相反,OpenSSL 库是与 OpenSSL FIPS 对象模块一起使用,以使基于 OpenSSL 的应用程序能够在 FIPS 模式下运行。Products such as OpenSSL can be used in FIPS mode, although the OpenSSL library itself is not validated for FIPS. Instead, the OpenSSL library is used with the OpenSSL FIPS Object Module to enable OpenSSL-based applications to operate in FIPS mode.
关于 FIPS 及其在 OpenSSL 中的实现的一般信息,以下参考资料可能会有帮助:For general information about FIPS and its implementation in OpenSSL, these references may be helpful:
FIPS 模式对加密操作施加条件,例如对可接受的加密算法的限制或对更长密钥长度的要求。对于 OpenSSL,具体的 FIPS 行为取决于 OpenSSL 的版本。FIPS mode imposes conditions on cryptographic operations such as restrictions on acceptable encryption algorithms or requirements for longer key lengths. For OpenSSL, the exact FIPS behavior depends on the OpenSSL version.
为了让 MySQL 支持 FIPS 模式,必须满足以下系统要求:For MySQL to support FIPS mode, these system requirements must be satisfied:
MySQL 必须使用经过 FIPS 认证的 OpenSSL 版本编译。OpenSSL 1.0.2 和 OpenSSL 3.0 已获得认证,但 OpenSSL 1.1.1 尚未认证。最近版本的 MySQL 二进制发行版在某些平台上使用 OpenSSL 3.0 编译,这意味着它们未获得 FIPS 认证。根据系统和 MySQL 配置,你有以下选择:MySQL must be compiled with an OpenSSL version that is certified for use with FIPS. OpenSSL 1.0.2 and OpenSSL 3.0 are certified, but OpenSSL 1.1.1 is not. Binary distributions for recent versions of MySQL are compiled using OpenSSL 3.0 on some platforms, which means they are not certified for FIPS. This means you have the following options, depending on system and MySQL configuration:
使用具有 OpenSSL 3.0 和所需 FIPS 对象模块的系统。在这种情况下,如果使用使用 OpenSSL 3.0 编译的二进制发行版,或者使用 OpenSSL 3.0 从源代码编译 MySQL,则可以为 MySQL 启用 FIPS 模式。Use a system that has OpenSSL 3.0 and the required FIPS object module. In this case, you can enable FIPS mode for MySQL if you use a binary distribution compiled using OpenSSL 3.0, or compile MySQL from source using OpenSSL 3.0.
有关升级到 OpenSSL 3.0 的一般信息,请参阅 OpenSSL 3.0 迁移指南。For general information about upgrading to OpenSSL 3.0, see OpenSSL 3.0 Migration Guide.
使用安装了 OpenSSL 1.1.1 或更高版本的系统。在这种情况下,您可以使用二进制包安装 MySQL,并且可以使用 TLS v1.3 协议和密码套件,以及其他已支持的 TLS 协议。但是,您无法为 MySQL 启用 FIPS 模式。Use a system that has OpenSSL 1.1.1 or higher. In this case, you can install MySQL using binary packages, and you can use the TLS v1.3 protocol and ciphersuites, in addition to other already supported TLS protocols. However, you cannot enable FIPS mode for MySQL.
使用安装了 OpenSSL 1.0.2 及所需 FIPS 对象模块的系统。在这种情况下,如果您使用二进制分发版(使用 OpenSSL 1.0.2 编译)或者从源代码使用 OpenSSL 1.0.2 编译 MySQL,则可以为 MySQL 启用 FIPS 模式。在这种情况下,您无法使用 TLS v1.3 协议或密码套件,这些需要 OpenSSL 1.1.1 或 3.0。此外,您应注意 OpenSSL 1.0.2 已于 2019 年结束生命周期,而嵌入 OpenSSL 1.1.1 的所有操作平台将在 2024 年结束生命周期。Use a system that has OpenSSL 1.0.2 and the required FIPS Object Module. In this case, you can enable FIPS mode for MySQL if you use a binary distribution compiled using OpenSSL 1.0.2, or compile MySQL from source using OpenSSL 1.0.2. In this case, you cannot use the TLS v1.3 protocol or ciphersuites, which require OpenSSL 1.1.1 or 3.0. In addition, you should be aware that OpenSSL 1.0.2 reached end of life status in 2019, and that all operating platforms embedding OpenSSL 1.1.1 reach their end of life in 2024.
在运行时,OpenSSL 库和 OpenSSL FIPS 对象模块必须作为共享(动态链接)对象可用。At runtime, the OpenSSL library and OpenSSL FIPS Object Module must be available as shared (dynamically linked) objects.
要确定 MySQL 是否在启用了 FIPS 模式的系统上运行,请使用 SQL 语句检查 ssl_fips_mode 服务器系统变量的值,例如 SHOW VARIABLES
LIKE '%fips%' 或 SELECT
@@ssl_fips_mode。如果该变量的值为 1 (ON) 或 2 (STRICT),则 FIPS 模式对 OpenSSL 已启用;如果该值为 0 (OFF),则 FIPS 模式不可用。To determine whether MySQL is running on a system with FIPS mode
enabled, check the value of the
ssl_fips_mode server system
variable using an SQL statement such as
SHOW VARIABLES
LIKE '%fips%' or
SELECT
@@ssl_fips_mode. If the value of this variable is 1
(ON) or 2 (STRICT), FIPS
mode is enabled for OpenSSL; if it is 0
(OFF), FIPS mode is not available.
一般来说,STRICT 比 ON 强加更多的限制,但 MySQL 本身除了将 FIPS 模式值指定给 OpenSSL 外,没有任何特定于 FIPS 的代码。ON 或 STRICT 的 FIPS 模式的具体行为取决于 OpenSSL 的版本。有关详细信息,请参阅 fips_module 手册页(参见 FIPS 概述)。In general, STRICT imposes more
restrictions than ON, but MySQL itself has
no FIPS-specific code other than to specify the FIPS mode
value to OpenSSL. The exact behavior of FIPS mode for
ON or STRICT depends on
the OpenSSL version. For details, refer to the
fips_module manpage (see
FIPS Overview).
服务器端的 FIPS 模式适用于服务器执行的加密操作,包括由 MySQL 复制(包括组复制)和 X 插件执行的操作,这些操作在服务器内部运行。FIPS mode on the server side applies to cryptographic operations performed by the server, including those performed by MySQL Replication (including Group Replication) and X Plugin, which run within the server.
FIPS 模式同样适用于客户端尝试连接服务器的情况。当在客户端或服务器端启用时,它会限制可选择的支持的加密算法。然而,启用 FIPS 模式并不要求必须使用加密连接,也不要求用户凭证必须加密。例如,如果启用 FIPS 模式,则需使用更强的加密算法。特别是,MD5 受到限制,因此尝试使用诸如 RC4-MD5 的加密算法建立加密连接将无法成功。但 FIPS 模式并不阻止建立未加密连接。(要实现这一点,你可以对特定用户账户使用 CREATE USER 或 ALTER USER 的 REQUIRE 子句,或者设置 require_secure_transport 系统变量以影响所有账户。)FIPS mode also applies to attempts by clients to connect to the
server. When enabled, on either the client or server side, it
restricts which of the supported encryption ciphers can be
chosen. However, enabling FIPS mode does not require that an
encrypted connection must be used, or that user credentials must
be encrypted. For example, if FIPS mode is enabled, stronger
cryptographic algorithms are required. In particular, MD5 is
restricted, so trying to establish an encrypted connection using
an encryption cipher such as RC4-MD5 does not
work. But there is nothing about FIPS mode that prevents
establishing an unencrypted connection. (To do that, you can use
the REQUIRE clause for
CREATE USER or
ALTER USER for specific user
accounts, or set the
require_secure_transport system
variable to affect all accounts.)
如果需要 FIPS 模式,建议使用包含该模式的操作平台;如果有,您可以(并且应该)使用它。如果您的平台不包含 FIPS,您有两个选项:If FIPS mode is required, it is recommended to use an operating platforms that includes it; if it does, you can (and should) use it. If your platform does not include FIPS, you have two options:
迁移到支持 FIPS OpenSSL 的平台。Migrate to a platform which has FIPS OpenSSL support.
根据
fips_module手册页中的说明(参见 FIPS 概览),从源码构建 OpenSSL 库和 FIPS 对象模块。Build the OpenSSL library and FIPS object module from source, using the instructions from thefips_modulemanpage (see FIPS Overview).
如果 OpenSSL FIPS 对象模块不可用,则 ssl_fips_mode 和 --ssl-fips-mode 唯一允许的值是 OFF。尝试将 FIPS 模式设置为其他值时会发生错误。If the OpenSSL FIPS Object Module is not available, the only
permitted value for
ssl_fips_mode and
--ssl-fips-mode is
OFF. An error occurs for attempts to set
the FIPS mode to a different value.
如果需要 FIPS 模式,建议使用包含该模式的操作平台;如果包含,您可以(并且应该)使用它。如果您的平台不包含 FIPS,您有两个选项:If FIPS mode is required, it is recommended to use an operating platform that includes it; if it does, you can (and should) use it. If your platform does not include FIPS, you have two options:
迁移到支持 FIPS OpenSSL 的平台。Migrate to a platform which has FIPS OpenSSL support.
根据
fips_module手册页中的说明(参见 FIPS 概览),从源码构建 OpenSSL 库和 FIPS 对象模块。Build the OpenSSL library and FIPS object module from source, using the instructions from thefips_modulemanpage (see FIPS Overview).