### Description
Applies to `db_mysql` built with mariadb-connector-c; TLS is not working
Option 1: configure mariadb server to use TLS (optional)
Option 2: configure mariadb server to use TLS (mandatory)
### Troubleshooting
1. wireshark inspect the pcap dump of traffic to :3306 and look for ClientHello
2. gdb main kamailio process and set breakpoint at `SSL_new`
#### Reproduction
1. Option 1: server advertises SSL, but db_mysql will always choose plain
3. Option 2: server advertises SSL(and requires SSL), connection will fail
### Additional Information
#### Kamailio version
* master
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3735
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3735(a)github.com>
Module: kamailio
Branch: master
Commit: dad7c857eaab613deed27ab687ddd0b1fdf8001b
URL: https://github.com/kamailio/kamailio/commit/dad7c857eaab613deed27ab687ddd0b…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2024-01-30T14:32:10+01:00
modules: readme files regenerated - db_mysql ... [skip ci]
---
Modified: src/modules/db_mysql/README
---
Diff: https://github.com/kamailio/kamailio/commit/dad7c857eaab613deed27ab687ddd0b…
Patch: https://github.com/kamailio/kamailio/commit/dad7c857eaab613deed27ab687ddd0b…
---
diff --git a/src/modules/db_mysql/README b/src/modules/db_mysql/README
index 8d9f526cbe1..8e135cdcbf2 100644
--- a/src/modules/db_mysql/README
+++ b/src/modules/db_mysql/README
@@ -94,7 +94,9 @@ Chapter 1. Admin Guide
The following libraries or applications must be installed before
running Kamailio with this module loaded:
* mysql - the development libraries for the MySQL database. In some
- Linux distributions named "libmysqlclient-dev".
+ Linux distributions named "libmysqlclient-dev". MariaDB - the
+ development libraries for the MariaDB database. In some Linux
+ distributions named "libmariadbclient-dev".
3. Parameters
@@ -199,8 +201,9 @@ modparam("db_mysql", "update_affected_found", 1)
SSL_MODE_DISABLED, any other value is passed to the mysql_options(),
not checking if it is defined.
- Note: this option is supported only by libmysqlclient, not by
- libmariadbclient.
+ MariaDB client configuration uses the following values: 0, 1 use plain,
+ 2/3/4 for MYSQL_OPT_SSL_ENFORCE, 5 for MYSQL_OPT_SSL_VERIFY_SERVER_CERT
+ (see MariaDB Connector/C documentation) Other values are ignored.
Default value is 0 (0 - off).
#### Pre-Submission Checklist
- [X] Commit message has the format required by CONTRIBUTING guide
- [X] Commits are split per component (core, individual modules, libs, utils, ...)
- [X] Each component has a single commit (if not, squash them into one commit)
- [X] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
When db_mysql is built with mariadb-connector-c it does not use TLS and fails if the server requires TLS. It seems to be related to the fact that the MYSQL object needs to have a minimal non-NULL configuration (unlike MySQL Connector/C).
This is a minimal setting to allow TLS. A more full-featured solution would be to enable db_mysql to read from an external configuration file.
@linuxmaniac, kindly take a look
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3734
-- Commit Summary --
* db_mysql: enable TLS when building with mariadb-connector-c
-- File Changes --
M src/modules/db_mysql/km_my_con.c (9)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3734.patchhttps://github.com/kamailio/kamailio/pull/3734.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3734
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3734(a)github.com>
Module: kamailio
Branch: master
Commit: 2bcc32a14e63d895077071715b0321fbdcdb8a33
URL: https://github.com/kamailio/kamailio/commit/2bcc32a14e63d895077071715b0321f…
Author: S-P Chan <shihping.chan(a)gmail.com>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2024-01-30T14:28:26+01:00
db_mysql: update docs for MariaDB Connector/C builds
---
Modified: src/modules/db_mysql/doc/db_mysql_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/2bcc32a14e63d895077071715b0321f…
Patch: https://github.com/kamailio/kamailio/commit/2bcc32a14e63d895077071715b0321f…
---
diff --git a/src/modules/db_mysql/doc/db_mysql_admin.xml b/src/modules/db_mysql/doc/db_mysql_admin.xml
index 51c9b5b728d..f1ff53df0ed 100644
--- a/src/modules/db_mysql/doc/db_mysql_admin.xml
+++ b/src/modules/db_mysql/doc/db_mysql_admin.xml
@@ -46,6 +46,7 @@
<listitem>
<para>
<emphasis>mysql</emphasis> - the development libraries for the MySQL database. In some Linux distributions named "libmysqlclient-dev".
+ <emphasis>MariaDB</emphasis> - the development libraries for the MariaDB database. In some Linux distributions named "libmariadbclient-dev".
</para>
</listitem>
</itemizedlist>
@@ -198,7 +199,10 @@ modparam("db_mysql", "update_affected_found", 1)
defined.
</para>
<para>
- Note: this option is supported only by libmysqlclient, not by libmariadbclient.
+ MariaDB client configuration uses the following values: 0, 1 use plain, 2/3/4 for MYSQL_OPT_SSL_ENFORCE,
+ 5 for MYSQL_OPT_SSL_VERIFY_SERVER_CERT (see MariaDB Connector/C documentation)
+
+ Other values are ignored.
</para>
<para>
<emphasis>
@@ -298,4 +302,3 @@ default-character-set = utf8
</para>
</section>
</chapter>
-
Hello dear developers!
I'm developing a module that can have several sets of similar connections.
I see that some modules allow specifying a sequence of settings in one
parameter through the symbol ";", as sample:
modparam("htable", "htable",
"customer=>size=8;dbtable=customer;cols='dids,description';coldelim=';'")
or my example:
modparam("module", "module",
"connection=>alice;id=aliceid;password=alicepwd;timeout=60;param=123")
modparam("module", "module",
"connection=>bob;id=bobid;password=bobpwd;timeout=90;param=456")
I don't find it user friendly.
Can I offer users blocks with settings that should start with some
parameter, for example "connection", as in the example:
modparam("module", "connection", "alice") # first block of settings
modparam("module", "id", "aliceid")
modparam("module", "password", "alicepwd")
modparam("module", "timeout", 60)
modparam("module", "param", 123)
modparam("module", "connection", "bob") # second block of settings
modparam("module", "id", "bobid")
modparam("module", "password", "bobpwd")
modparam("module", "timeout", 90)
modparam("module", "param", 456)
modparam("module", "connection", "john") # third block of settings
...
If you think that this is not compatible with the kamailio configuration
ideology, I will give up my idea :)