11// SPDX-License-Identifier: AGPL-3.0-or-later, OR GPL-2.0-or-later WITH linking exception
2- // SPDX-FileCopyrightText: 2021–2024 grommunio GmbH
2+ // SPDX-FileCopyrightText: 2021–2025 grommunio GmbH
33// This file is part of Gromox.
44#ifdef HAVE_CONFIG_H
55# include " config.h"
@@ -144,6 +144,10 @@ MYSQL *mysql_plugin::sql_make_conn()
144144 mysql_options (conn, MYSQL_OPT_READ_TIMEOUT, &g_parm.timeout );
145145 mysql_options (conn, MYSQL_OPT_WRITE_TIMEOUT, &g_parm.timeout );
146146 }
147+ if (!g_parm.certfile .empty ())
148+ mysql_options (conn, MYSQL_OPT_SSL_CERT, g_parm.certfile .c_str ());
149+ if (!g_parm.keyfile .empty ())
150+ mysql_options (conn, MYSQL_OPT_SSL_KEY, g_parm.keyfile .c_str ());
147151 if (mysql_real_connect (conn, g_parm.host .c_str (), g_parm.user .c_str (),
148152 g_parm.pass .size () != 0 ? g_parm.pass .c_str () : nullptr ,
149153 g_parm.dbname .c_str (), g_parm.port , nullptr , 0 ) == nullptr ) {
@@ -526,6 +530,8 @@ static constexpr cfg_directive mysql_adaptor_cfg_defaults[] = {
526530 {" mysql_password" , " " },
527531 {" mysql_port" , " 3306" },
528532 {" mysql_rdwr_timeout" , " 0" , CFG_TIME},
533+ {" mysql_tls_cert" , " " },
534+ {" mysql_tls_key" , " " },
529535 {" mysql_username" , " root" },
530536 CFG_TABLE_END,
531537};
@@ -546,6 +552,8 @@ bool mysql_plugin::reload_config(std::shared_ptr<config_file> &&cfg)
546552 par.port = cfg->get_ll (" mysql_port" );
547553 par.user = cfg->get_value (" mysql_username" );
548554 par.pass = cfg->get_value (" mysql_password" );
555+ par.certfile = cfg->get_value (" mysql_tls_cert" );
556+ par.keyfile = cfg->get_value (" mysql_tls_key" );
549557 auto p2 = cfg->get_value (" mysql_password_mode_id107" );
550558 if (p2 != nullptr )
551559 par.pass = zstd_decompress (base64_decode (p2));
0 commit comments