1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-05 15:55:58 +03:00

17 Commits

Author SHA1 Message Date
Georg Richter
1287c901dc TLS/SSL changes (major rework)
Peer certificate validation:

Since version 3.4 peer certificate verification is enabled by default.
It can be disabled via `mysql_optionsv`, using option
MYSQL_OPT_SSL_VERIFY_SERVER_CERT:

    my_bool verify= 0;
    mysql_options(mariadb, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &verify);

Self signed certificates

If the client obtained a self signed peer certificate from MariaDB server
the verification will fail, with the following exceptions:

* If the connection between client and server is considered to be secure:, e.g.
  * a unix_socket is used for client server communication
  * hostname is localhost (Windows operating system), 127.0.0.1 or ::1
* a specified fingerprint matches the fingerprint of the peer certificate (see below)
* a client can verify the certificate using account password, it's possible if
  * account has a password
  * authentication plugin is "secure without TLS", that is, one of
    mysql_native_password, ed25519 or parsec.

Fingerprint verification of the peer certificate

A fingerprint is a cryptographic hash (SHA-256, SHA-384 or SHA-512) of the peer
certificate's binary data. Even if the fingerprint matches, an expired or
revoked certificate will not be accepted.

For security reasons support for MD5 and SHA1 has been removed.

Technical details:
==================

- Peer certificate verification call was removed from ma_tls_connect, instead it
  will be called directly after the handshake succeeded (my_auth.c)

- mysql->net.tls_self_signed_error was replaced by mysql->net.tls_verify_status which
  contains the result of the peer certfificate verification:

  The verification status can be obtained with mariadb_get_infov using new parameter
  MARIADB_TLS_VERIFY_STATUS.

  unsigned int tls_verify_status;
  mariadb_get_infov(mysql, MARIADB_TLS_VERIFY_STATUS, &tls_verify_status);

  The result is a combination of the following flags:

  MARIADB_TLS_VERIFY_OK                  0
  MARIADB_TLS_VERIFY_TRUST               1
  MARIADB_TLS_VERIFY_HOST                2
  MARIADB_TLS_VERIFY_PERIOD              4
  MARIADB_TLS_VERIFY_FINGERPRINT         8
  MARIADB_TLS_VERIFY_REVOKED            16
  MARIADB_TLS_VERIFY_UNKNOWN            32

- GnuTLS peer certificate verification callback was removed and replaced by
  gnutls_verify_peers2() api function, so the peer certificate validation
  will happen after handshake.

- OpenSSL implementation will no longer use SSL_verify_result to check the
  validity of the peer certificate. Instead a callback function will be called
  during the handshake, which collects all certificate validation errors.

- If the peer certificate is not trusted, hostname verification will be
  skipped.

- Testing
  Added new test tls, which implements a python based dummy server, which allows
  to set different certificates and TLS options. Please note. that tests are
  expected to fail, since the server doesn't support further steps like user
  authentication etc. after the handshake. Prerequisite for running the tls test
  is Python3.
2024-07-16 13:12:26 +02:00
Georg Richter
6e156a63e3 Fixes for bigendian systems (CONC-252, CONC-265) 2017-06-30 14:00:28 +02:00
Georg Richter
4ab155cf39 Unit test fixes for server integration
- SSL tests require CERT_PATH. Subdirectory certs was removed. If Connector/C is build outside of the server tree, certification path has to be specified manually (-DCERT_PATH=/path/to/certs).
- All tables and users will removed, if the test passed (otherwise mtr will complain).
2017-03-04 17:37:39 +01:00
Georg Richter
b0506f63e9 Instead of mysql_real_connect in tests we call now my_test_connect to apply global options like tls usage 2016-09-08 07:59:34 +02:00
Georg Richter
9f88e25fd6 Compiler warning fixes 2016-09-03 12:46:50 +02:00
Georg Richter
4ca933bb81 Global cleanup:
removed global locks
  removed dead code and files
  removed dbug
2016-02-08 18:43:02 +01:00
Georg Richter
5c8ea9c9c1 More build fixes
Added new option for position independent code: WITH_PIC=ON/OFF
2014-12-23 13:05:13 +01:00
Georg Richter
d5a772de56 Windows build fixes
- use /MT flag instead of /MD
 - add debug libraries to package
2013-10-04 19:09:08 +02:00
Georg Richter
7038dc9280 Removed all internal dependencies from ma_dyncol.
Fixed compiler warnings
2013-10-01 09:53:41 +02:00
holzboote@googlemail.com
bb809b33fc Fix for CONC-46:
cleanup of my_win_init(), removed setlocale and server specific stuff
2013-08-14 16:08:21 +02:00
holzboote@googlemail.com
b5db6c127f Fixed crash/undefined behaviour when running large amount of threads:
replaced select() with poll()
Added conneciton timeout support for windows platforms
2013-08-01 09:56:36 +02:00
holzboote@googlemail.com
077afd8e10 Several test fixes 2013-07-24 07:01:48 +02:00
holzboote@googlemail.com
d6f3bb4c9f DBUG update and fixes
Fixed net_read crash in debug version
2013-07-15 10:47:05 +02:00
holzboote@googlemail.com
dc16f2d32e Reworked compressed and protocol implementation,
including fixes for conc-31 and conc-34
- Added win64 fixes in protocol (changed ulong to size_t)

modified:
  include/my_sys.h
  include/mysql_com.h
  include/violite.h
  libmariadb/libmariadb.c
  libmariadb/my_compress.c
  libmariadb/my_stmt.c
  libmariadb/my_thr_init.c
  libmariadb/net.c
  libmariadb/violite.c
  unittest/libmariadb/basic-t.c
  unittest/libmariadb/charset.c
  unittest/libmariadb/thread.c
unknown:
  xx
  libmariadb/libmariadb.so.1
  mariadb_config/mariadb_config
  mariadb_config/mariadb_config.c
  unittest/libmariadb/basic-t
  unittest/libmariadb/charset
  unittest/libmariadb/connection
  unittest/libmariadb/cursor
  unittest/libmariadb/errors
  unittest/libmariadb/fetch
  unittest/libmariadb/logs
  unittest/libmariadb/misc
  unittest/libmariadb/ps
  unittest/libmariadb/ps_bugs
  unittest/libmariadb/ps_new
  unittest/libmariadb/result
  unittest/libmariadb/sp
  unittest/libmariadb/sqlite3
  unittest/libmariadb/ssl
  unittest/libmariadb/thread
  unittest/libmariadb/view
2013-07-01 05:00:34 +02:00
Georg Richter
71e3fc726f Fix for CONC-27:
Prevent crash if mysql_thread_end was called without prior initialization via mysql_thread_init
2013-06-17 06:58:20 +02:00
Georg Richter
7afc51d9aa more test fixes 2013-03-13 21:43:39 +01:00
Georg Richter
5726b74cbd Fix dbug crash in mysql_server_end 2013-03-07 13:56:14 +01:00