From 1906139d6c4c03bb511bddc8487586968e115b0f Mon Sep 17 00:00:00 2001 From: Erdem Duman Date: Mon, 3 Sep 2018 12:25:04 +0300 Subject: [PATCH] Co-authored-by: mustafabingul Co-authored-by: mashary --- src/apps/relay/dbdrivers/dbd_mysql.c | 8 +++++--- src/apps/relay/mainrelay.c | 20 ++++---------------- src/apps/relay/mainrelay.h | 1 - 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/apps/relay/dbdrivers/dbd_mysql.c b/src/apps/relay/dbdrivers/dbd_mysql.c index 39537966..6b6bd6fd 100644 --- a/src/apps/relay/dbdrivers/dbd_mysql.c +++ b/src/apps/relay/dbdrivers/dbd_mysql.c @@ -263,7 +263,7 @@ static MYSQL *get_mydb_connection(void) { mysql_ssl_set(mydbconnection, co->key, co->cert, co->ca, co->capath, co->cipher); } - if(turn_params.allow_encoding){ + if(turn_params.secret_key_file[0]){ co->password = decryptPassword(co->password, turn_params.secret_key); } @@ -278,8 +278,10 @@ static MYSQL *get_mydb_connection(void) { mydbconnection=NULL; } else if(!donot_print_connection_success) { TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "MySQL DB connection success: %s\n",pud->userdb); - if(turn_params.allow_encoding) - TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Connection is secure.\n"); + if(turn_params.secret_key_file[0]) { + TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Encryption with AES is activated.\n"); + TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Connection is secure.\n"); + } else TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Connection is not secure.\n"); donot_print_connection_success = 1; diff --git a/src/apps/relay/mainrelay.c b/src/apps/relay/mainrelay.c index df34ad7e..6562b2cc 100644 --- a/src/apps/relay/mainrelay.c +++ b/src/apps/relay/mainrelay.c @@ -154,8 +154,7 @@ TURN_CREDENTIALS_NONE, /* ct */ DEFAULT_CPUS_NUMBER, ///////// Encryption ///////// "", /* secret_key_file */ -"", /* secret_key */ -0 /* allow_encoding */ +"" /* secret_key */ }; //////////////// OpenSSL Init ////////////////////// @@ -498,11 +497,8 @@ static char Usage[] = "Usage: turnserver [options]\n" " command options description).\n\n" " All connection-string parameters are optional.\n\n" "--secret-key-file If you want to use password as encrpyted in the mysql connection string MySQL encrypted connection, this is key path.\n" -" This is the file path which contain secret key of aes encryption while using password encryption.\n" -" This attribute should be use if allow-encoding-with-aes set to 1.\n" -"--allow-encoding-with-aes <1/0> If you want to use password as encrpyted in the mysql connection string. Set allow-encoding-with-aes to 1.\n" -" If you want to use clearteaxt password in the mysql connection string. Set allow-encoding-with-aes to 0.\n" -" You have to enable secret-key-file attribute above as a key location.\n" +" This is the file path which contains secret key of aes encryption while using password encryption.\n" + #endif #if !defined(TURN_NO_MONGO) " -J, --mongo-userdb MongoDB connection string, if used (default - empty, no MongoDB used).\n" @@ -767,8 +763,7 @@ enum EXTRA_OPTS { OAUTH_OPT, PROD_OPT, NO_HTTP_OPT, - SECRET_KEY_OPT, - ALLOW_ENCODING_OPT + SECRET_KEY_OPT }; struct myoption { @@ -888,7 +883,6 @@ static const struct myoption long_options[] = { { "no-tlsv1_1", optional_argument, NULL, NO_TLSV1_1_OPT }, { "no-tlsv1_2", optional_argument, NULL, NO_TLSV1_2_OPT }, { "secret-key-file", required_argument, NULL, SECRET_KEY_OPT }, - { "allow-encoding-with-aes", required_argument, NULL, ALLOW_ENCODING_OPT}, { NULL, no_argument, NULL, 0 } }; @@ -1467,9 +1461,6 @@ static void set_option(int c, char *value) case SECRET_KEY_OPT: STRCPY(turn_params.secret_key_file,value); break; - case ALLOW_ENCODING_OPT: - turn_params.allow_encoding = atoi(value); - break; case PKEY_FILE_OPT: STRCPY(turn_params.pkey_file,value); break; @@ -2147,9 +2138,6 @@ int main(int argc, char **argv) TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Domain name: %s\n",turn_params.domain); TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Default realm: %s\n",get_realm(NULL)->options.name); - if(turn_params.allow_encoding){ - TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "allow-encoding-with-aes activated.\n"); - } if(turn_params.oauth && turn_params.oauth_server_name[0]) { TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "oAuth server name: %s\n",turn_params.oauth_server_name); diff --git a/src/apps/relay/mainrelay.h b/src/apps/relay/mainrelay.h index 406bea89..e67303cb 100644 --- a/src/apps/relay/mainrelay.h +++ b/src/apps/relay/mainrelay.h @@ -317,7 +317,6 @@ typedef struct _turn_params_ { ///////// Encryption ///////// char secret_key_file[1025]; unsigned char secret_key[1025]; - int allow_encoding; } turn_params_t;