GreatSQL社区

搜索

[已解决] 国密版本

192 6 2026-1-21 10:00
本帖最后由 gu0ke 于 2026-1-28 08:28 编辑

按照用户手册中的步骤,下载了支持国密的版本(在4. 支持国密特性二进制包下方下载),能正常启动。
安装tongsuo  openssl ciphers -v | grep -i sm4
TLS_SM4_GCM_SM3                TLSv1.3 Kx=any      Au=any   Enc=SM4-GCM(128)           Mac=AEAD
TLS_SM4_CCM_SM3                TLSv1.3 Kx=any      Au=any   Enc=SM4-CCM(128)           Mac=AEAD
但在my.cnf中添加了
[mysqld]#enable openssl & SMrequire_secure_transport = ONtls_ciphersuites = "TLS_SM4_GCM_SM3:TLS_SM4_CCM_SM3"tls_version = 'TLSv1.3'
之后,报错
2026-01-21T09:57:37.285513+08:00 0 [Note] [MY-013930] [Server] systemd notify: STATUS=Server startup in progress
2026-01-21T09:57:37.286751+08:00 0 [System] [MY-015015] [Server] MySQL Server - start.
2026-01-21T09:57:37.713527+08:00 0 [ERROR] [MY-015104] [Server] Value for option 'tls_ciphersuites' contains cipher 'TLS_SM4_GCM_SM3' that is blocked. Please refer to the documentation for allowed ciphers.
2026-01-21T09:57:37.713554+08:00 0 [ERROR] [MY-015104] [Server] Value for option 'tls_ciphersuites' contains cipher 'TLS_SM4_CCM_SM3' that is blocked. Please refer to the documentation for allowed ciphers.
2026-01-21T09:57:37.713804+08:00 0 [ERROR] [MY-010119] [Server] Aborting
2026-01-21T09:57:37.713916+08:00 0 [Note] [MY-010120] [Server] Binlog end
2026-01-21T09:57:37.714106+08:00 0 [Note] [MY-015021] [Server] MySQL Server: Components Shutdown - start.
2026-01-21T09:57:37.714118+08:00 0 [Note] [MY-013930] [Server] systemd notify: Shutdown of components in progress
2026-01-21T09:57:37.714411+08:00 0 [Note] [MY-015022] [Server] MySQL Server: Components Shutdown - end (with return value = 0).
2026-01-21T09:57:37.714426+08:00 0 [Note] [MY-013930] [Server] systemd notify: Shutdown of components successful
2026-01-21T09:57:37.714582+08:00 0 [Note] [MY-013930] [Server] systemd notify: STATUS=Server shutdown complete (with return value = 1)
2026-01-21T09:57:37.714634+08:00 0 [System] [MY-010910] [Server] /usr/local/GreatSQL-8.4.4-4-Linux-glibc2.28-x86_64/bin/mysqld: Shutdown complete (mysqld 8.4.4-4)  GreatSQL, Release 4, Revision d73de75905d-gmssl.
2026-01-21T09:57:37.714643+08:00 0 [System] [MY-015016] [Server] MySQL Server - end.

请问,支持国密版本的是必须要自行编译么?

全部回复(6)
yejr 2026-1-21 10:43:20
请参考手册 https://greatsql.cn/docs/8.4.4-4 ... ypt-with-gmssl.html

其中提到:

如果是采用 systemd 启动 GreatSQL,则修改服务文件:

$ vim /lib/systemd/system/greatsql.service

...
Environment=LD_LIBRARY_PATH=/usr/local/lib64

如果是直接在命令行下手动方式启动GreatSQL,则确保BabaSSL已经启用的情况下,再次重启GreatSQL服务。

也就是启动GreatSQL前,要先加载tongsuo lib库,不知道这个步骤你是否漏了。
gu0ke 2026-1-21 12:07:51
yejr 发表于 2026-1-21 10:43
请参考手册 https://greatsql.cn/docs/8.4.4-4/5-enhance/5-4-security-encrypt-with-gmssl.html

其中提到 ...

service文件是在etc下, /etc/systemd/system/greatsql.service 这个文件是添加了的。
yejr 2026-1-21 23:09:12
gu0ke 发表于 2026-1-21 12:07
service文件是在etc下, /etc/systemd/system/greatsql.service 这个文件是添加了的。

启动GreatSQL后,执行 lsof -p `pidof mysqld` | grep ssl 确认是否生效
另外,建议把你的完整的、详细的操作过程及相应的屏幕输出结果都贴上来,看看过程是否有遗漏
gu0ke 2026-1-22 10:09:51
yejr 发表于 2026-1-21 23:09
启动GreatSQL后,执行 lsof -p `pidof mysqld` | grep ssl 确认是否生效
另外,建议把你的完整的、详细的 ...

1.下载支持国密的二进制文件(https://product.greatdb.com/Grea ... c2.28-x86_64.tar.xz),按照常规安装步骤,使用systemctl start greatsql 能正常启动
2.下载安装tognsuo,执行命令如下
        tar -zvxf 8.4.0.tar.gz
    61  cd Tongsuo-8.4.0/
        63  ./config --prefix=/usr/local/tongsuo --openssldir=/usr/local/tongsuo/ssl no-shared
        64  make -j $(nproc)
    65  make install
    77  cd /usr/local/tongsuo/
    80  echo "export PATH=/usr/local/tongsuo/bin:\$PATH" >> /etc/profile
    81  echo "export LD_LIBRARY_PATH=/usr/local/tongsuo/lib:\$LD_LIBRARY_PATH" >> /etc/profile
    82  echo "export PKG_CONFIG_PATH=/usr/local/tongsuo/lib/pkgconfig:\$PKG_CONFIG_PATH" >> /etc/profile
        83  source /etc/profile

        使用openssl version验证
        Tongsuo: Tongsuo 8.4.0 (Library: Tongsuo 8.4.0)
        OpenSSL 3.0.3 3 May 2022 (Library: OpenSSL 3.0.3 3 May 2022)

        执行openssl ciphers|grep SM4
        TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:TLS_SM4_GCM_SM3:TLS_SM4_CCM_SM3:……………………
       
3.修改my.cnf
        在 mysqld下  增加
        require_secure_transport = ON
        tls_ciphersuites = "TLS_SM4_GCM_SM3:TLS_SM4_CCM_SM3"
        tls_version = 'TLSv1.3'
4.修改service文件
        /etc/systemd/system/greatsql.service在最后 增加
        Environment=LD_LIBRARY_PATH=/usr/local/tongsuo/lib
        或Environment=LD_LIBRARY_PATH=/usr/local/tongsuo/lib64  都试过
5.再次启动的时候就会报错


在未增加国密配置的时候,执行 lsof -p `pidof mysqld` | grep ssl
mysqld  475631 mysql  mem       REG              253,0   4732776     586135 /data/GreatSQL-8.4.4-4-Linux-glibc2.28-x86_64/lib/private/libssl.so.1.1
yejr 2026-1-23 15:32:40

我自己也照着测试了一遍,这个版本确实是有问题,麻烦先换成8.0系列版本,例如GreatSQL 8.0.32-27就可以支持了,实在抱歉。
该问题在下个版本中我会推进修复。
yejr 2026-1-27 17:04:33
yejr 发表于 2026-1-23 15:32
我自己也照着测试了一遍,这个版本确实是有问题,麻烦先换成8.0系列版本,例如GreatSQL 8.0.32-27就可以支 ...

GreatSQL 8.4.4-4国密版本使用方法已更新到用户手册中,请参考新方法重试:https://greatsql.cn/docs/8.4.4-4 ... ypt-with-gmssl.html

我之前关于GreatSQL 8.4.4-4不支持国密的说法是错的,而是使用方法发生变化了。
gu0ke

1

主题

0

博客

8

贡献

新手上路

Rank: 1

积分
11

合作电话:010-64087828

社区邮箱:greatsql@greatdb.com

社区公众号
社区小助手
QQ群
GMT+8, 2026-2-15 16:02 , Processed in 0.022298 second(s), 15 queries , Redis On.
快速回复 返回顶部 返回列表