Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db_mysql: built with mariadb-connector-c does not use TLS #3735

Closed
space88man opened this issue Jan 30, 2024 · 1 comment
Closed

db_mysql: built with mariadb-connector-c does not use TLS #3735

space88man opened this issue Jan 30, 2024 · 1 comment

Comments

@space88man
Copy link
Contributor

space88man commented Jan 30, 2024

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)

RHEL RPMs of db_mysql are using mariadb-connector-c so do not work with TLS.

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
  2. Option 2: server advertises SSL(and requires SSL), connection will fail

Additional Information

  • db_unixodbc + mariadb-connector-odbc CAN work with TLS so it is inconsistent that the native driver fails with TLS

Kamailio version

  • master
@space88man
Copy link
Contributor Author

Current WIP to enable TLS on #3734.

Use existing opt_ssl_mode and map as follows.:

  1. 0(off), 1(SSL_MODE_DISABLED): mariadb-connector-c defaults
  2. 2(SSL_MODE_PREFERRED) 3(SSL_MODE_REQUIRED) 4(SSL_MODE_VERIFY_CA): MYSQL_OPT_SSL_ENFORCE
  3. 5(SSL_MODE_VERIFY_IDENTITY): MYSQL_OTP_SSL_VERIFY_SERVER_CERT

space88man added a commit to space88man/kamailio that referenced this issue Feb 3, 2024
Addresses kamailio#3735 - squashed from:
- d772b4c
  - mariadb-connector-c requires at least one non-NULL configuration
    value to use TLS
  - emulate MySQL SSL_MODE_XXXX options
- 0833a72
  proper macro to check mysql version id
- f0e73ea
  fix build for older releases
space88man added a commit to space88man/kamailio that referenced this issue Feb 4, 2024
- GH kamailio#3735
- includes compilation and stretch fixes
- emulate SSL_MODE_XXX from MySQL
- opt_ssl_mode:
  - 0|1(off)
  - 2|3|4(MYSQL_OPT_SSL_ENFORCE)
  - 5(MYSQL_OPT_SSL_VERIFY_SERVER_CERT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant