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

New mtls connection #51

Merged
merged 4 commits into from
Jan 7, 2022
Merged

Conversation

AryJpl
Copy link

@AryJpl AryJpl commented Jan 5, 2022

New functionality supports both TLS & mTLS to mariaDB.
In order to test:

build project with "cmake -DDEBUG=ON -DMYSQL=ON . "
make clean all build
You mariaDB must be pre-configured for encrypted connections.
a) For TLS, run (Note this will fail without a proper password for usertest1)
./build/bin/ut_mysql_tls_connection
b) For mTLS, run (No password is required)
./build/bin/ut_mysql_m_tls_connection

user added 2 commits January 5, 2022 23:29
1) util/src_util/ut_mysql_tls_connection.c - the unitest for a TLS connection. Note password is needed.
2) util/src_util/ut_mysql_m_tls_connection.c - the unitest for a mTLS connection. Note password is MOT needed.
3) src/src_mysql/sadb_routine_mariadb.template.c - midified sadb_init() to support TLS,mTLS, and regular non-encrypted connection.
4) crypto.h - modified Crypto_Config_MariaDB() to support extra parameters related to TLS and/or mTLS encrypted connection.
5) crypto_config.c - modified
6) crypto_config_structs.h - modified SadbMariaDBConfig_t to support parameters related to tLS/mTLS
1) util/src_util/ut_mysql_tls_connection.c - the unitest for a TLS connection. Note password is needed.
2) util/src_util/ut_mysql_m_tls_connection.c - the unitest for a mTLS connection. Note password is MOT needed.
3) src/src_mysql/sadb_routine_mariadb.template.c - midified sadb_init() to support TLS,mTLS, and regular non-encrypted connection.
4) crypto.h - modified Crypto_Config_MariaDB() to support extra parameters related to TLS and/or mTLS encrypted connection.
5) crypto_config.c - modified
6) crypto_config_structs.h - modified SadbMariaDBConfig_t to support parameters related to tLS/mTLS
Copy link
Contributor

@IbraheemYSaleh IbraheemYSaleh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only difference between:

    if (sadb_mariadb_config->encrypted_connection == 1) {

&&
if (sadb_mariadb_config->encrypted_connection == 2) {

is that you pass in NULL or a password for the mysql_password field. They are both mTLS.

Remove the second if block and rely on the configuration to be set or default to NULL for mysql_password.

Also, you don’t need a separate unit test file for each test… just combine them into one.

1) util/src_util/ut_mysql_tls_connection.c - removed
2) util/src_util/ut_mysql_m_tls_connection.c - combined TLS with mTLS test
3) src/src_mysql/sadb_routine_mariadb.template.c - removed extra if statement
@AryJpl
Copy link
Author

AryJpl commented Jan 6, 2022

@IbraheemYSaleh, The 2 changes you requested are committed, please do a pull. If you cant see them I can create a new pull request on my side. Tests are successful:
image


You will need to manually add the password to run the test (The pass is in an email from last week).

1) util/src_util/ut_mysql_m_tls_connection.c - removed password
@codecov-commenter
Copy link

Codecov Report

Merging #51 (d746aac) into collab_main (71a47e5) will decrease coverage by 1.82%.
The diff coverage is 6.59%.

Impacted file tree graph

@@               Coverage Diff               @@
##           collab_main      #51      +/-   ##
===============================================
- Coverage        60.76%   58.93%   -1.83%     
===============================================
  Files               20       22       +2     
  Lines             3362     3395      +33     
===============================================
- Hits              2043     2001      -42     
- Misses            1319     1394      +75     
Impacted Files Coverage Δ
util/src_util/ut_mysql_m_tls_connection.c 0.00% <0.00%> (ø)
util/src_util/ut_mysql_tls_connection.c 0.00% <0.00%> (ø)
src/src_main/crypto_config.c 73.33% <27.27%> (-1.90%) ⬇️
util/include/utest.h 12.98% <0.00%> (-31.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 71a47e5...d746aac. Read the comment docs.

@dccutrig dccutrig merged commit c67b581 into nasa:collab_main Jan 7, 2022
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

Successfully merging this pull request may close these issues.

4 participants