Skip to content

Commit 44e7198

Browse files
committed
Use config_entry_decoder key for config encryption
Fixes #979
1 parent fc20fa9 commit 44e7198

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/rabbit.app.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
%% see rabbitmq-server#248
101101
%% and rabbitmq-server#667
102102
{channel_operation_timeout, 15000},
103-
{decoder_config, [
103+
{config_entry_decoder, [
104104
{cipher, aes_cbc256},
105105
{hash, sha512},
106106
{iterations, 1000},

src/rabbit.erl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -443,13 +443,13 @@ stop_and_halt() ->
443443
start_apps(Apps) ->
444444
app_utils:load_applications(Apps),
445445

446-
DecoderConfig = case application:get_env(rabbit, decoder_config) of
446+
ConfigEntryDecoder = case application:get_env(rabbit, config_entry_decoder) of
447447
undefined ->
448448
[];
449449
{ok, Val} ->
450450
Val
451451
end,
452-
PassPhrase = case proplists:get_value(passphrase, DecoderConfig) of
452+
PassPhrase = case proplists:get_value(passphrase, ConfigEntryDecoder) of
453453
prompt ->
454454
IoDevice = get_input_iodevice(),
455455
io:setopts(IoDevice, [{echo, false}]),
@@ -467,9 +467,9 @@ start_apps(Apps) ->
467467
PP
468468
end,
469469
Algo = {
470-
proplists:get_value(cipher, DecoderConfig, rabbit_pbe:default_cipher()),
471-
proplists:get_value(hash, DecoderConfig, rabbit_pbe:default_hash()),
472-
proplists:get_value(iterations, DecoderConfig, rabbit_pbe:default_iterations()),
470+
proplists:get_value(cipher, ConfigEntryDecoder, rabbit_pbe:default_cipher()),
471+
proplists:get_value(hash, ConfigEntryDecoder, rabbit_pbe:default_hash()),
472+
proplists:get_value(iterations, ConfigEntryDecoder, rabbit_pbe:default_iterations()),
473473
PassPhrase
474474
},
475475
decrypt_config(Apps, Algo),
@@ -527,16 +527,16 @@ decrypt_app(App, [{Key, Value}|Tail], Algo) ->
527527
end
528528
end
529529
catch
530-
exit:{bad_configuration, decoder_config} ->
531-
exit({bad_configuration, decoder_config});
530+
exit:{bad_configuration, config_entry_decoder} ->
531+
exit({bad_configuration, config_entry_decoder});
532532
_:Msg ->
533533
rabbit_log:info("Error while decrypting key '~p'. Please check encrypted value, passphrase, and encryption configuration~n", [Key]),
534534
exit({decryption_error, {key, Key}, Msg})
535535
end,
536536
decrypt_app(App, Tail, Algo).
537537

538538
decrypt({encrypted, _}, {_, _, _, undefined}) ->
539-
exit({bad_configuration, decoder_config});
539+
exit({bad_configuration, config_entry_decoder});
540540
decrypt({encrypted, EncValue}, {Cipher, Hash, Iterations, Password}) ->
541541
rabbit_pbe:decrypt_term(Cipher, Hash, Iterations, Password, EncValue);
542542
decrypt(List, Algo) when is_list(List) ->

test/unit_SUITE.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ decrypt_start_app_file(Config) ->
366366

367367
do_decrypt_start_app(Config, Passphrase) ->
368368
%% Configure rabbit for decrypting configuration.
369-
application:set_env(rabbit, decoder_config, [
369+
application:set_env(rabbit, config_entry_decoder, [
370370
{cipher, aes_cbc256},
371371
{hash, sha512},
372372
{iterations, 1000},
@@ -393,7 +393,7 @@ do_decrypt_start_app(Config, Passphrase) ->
393393

394394
decrypt_start_app_undefined(Config) ->
395395
%% Configure rabbit for decrypting configuration.
396-
application:set_env(rabbit, decoder_config, [
396+
application:set_env(rabbit, config_entry_decoder, [
397397
{cipher, aes_cbc256},
398398
{hash, sha512},
399399
{iterations, 1000}
@@ -407,13 +407,13 @@ decrypt_start_app_undefined(Config) ->
407407
try
408408
rabbit:start_apps([rabbit_shovel_test])
409409
catch
410-
exit:{bad_configuration,decoder_config} -> ok;
410+
exit:{bad_configuration, config_entry_decoder} -> ok;
411411
_:_ -> exit(unexpected_exception)
412412
end.
413413

414414
decrypt_start_app_wrong_passphrase(Config) ->
415415
%% Configure rabbit for decrypting configuration.
416-
application:set_env(rabbit, decoder_config, [
416+
application:set_env(rabbit, config_entry_decoder, [
417417
{cipher, aes_cbc256},
418418
{hash, sha512},
419419
{iterations, 1000},

0 commit comments

Comments
 (0)