diff --git a/ChangeLog b/ChangeLog index b0d4732d..a9e0513a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ 12/11/2017 Oleg Moskalenko Version 4.5.0.8 'dan Eider': - Spelling fixes. - + - Add a warning if --lt-cred-mech and --use-auth-secret both presents. + 12/10/2017 Oleg Moskalenko Version 4.5.0.7 'dan Eider': - Misc security improvements. diff --git a/src/apps/relay/mainrelay.c b/src/apps/relay/mainrelay.c index 9089b263..3106dbe0 100644 --- a/src/apps/relay/mainrelay.c +++ b/src/apps/relay/mainrelay.c @@ -39,6 +39,10 @@ static int use_lt_credentials = 0; static int anon_credentials = 0; +//long term credential +static int use_ltc = 0; +//timelimited long term credential +static int use_tltc = 0; ////// ALPN ////////// @@ -1162,6 +1166,7 @@ static void set_option(int c, char *value) if (get_bool_value(value)) { turn_params.ct = TURN_CREDENTIALS_LONG_TERM; use_lt_credentials=1; + use_ltc=1; } else { turn_params.ct = TURN_CREDENTIALS_UNDEFINED; use_lt_credentials=0; @@ -1223,12 +1228,14 @@ static void set_option(int c, char *value) #endif case AUTH_SECRET_OPT: turn_params.use_auth_secret_with_timestamp = 1; + use_tltc = 1; turn_params.ct = TURN_CREDENTIALS_LONG_TERM; use_lt_credentials = 1; break; case STATIC_AUTH_SECRET_VAL_OPT: add_to_secrets_list(&turn_params.default_users_db.ram_db.static_auth_secrets,value); turn_params.use_auth_secret_with_timestamp = 1; + use_tltc = 1; turn_params.ct = TURN_CREDENTIALS_LONG_TERM; use_lt_credentials = 1; break; @@ -1989,6 +1996,12 @@ int main(int argc, char **argv) exit(-1); } + if(use_ltc && use_tltc) { + TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "\nCONFIGURATION ALERT: You specified --lt-cred-mech and --use-auth-secret in the same time.\n" + "Be aware that you could not mix the username/password and the shared secret based auth methohds. \n" + "Shared secret overrides username/password based auth method. Check your configuration!\n"); + } + if(!use_lt_credentials && !anon_credentials) { if(turn_params.default_users_db.ram_db.users_number) { TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "\nCONFIGURATION ALERT: you specified long-term user accounts, (-u option) \n but you did not specify the long-term credentials option\n (-a or --lt-cred-mech option).\n I am turning --lt-cred-mech ON for you, but double-check your configuration.\n");