Skip to content

Commit 558ab22

Browse files
Merge pull request #11415 from SimonUnge/amqp_client_schema
cuttlefish tls schema for amqp_client
2 parents 0b84acd + 24fb033 commit 558ab22

File tree

2 files changed

+433
-7
lines changed

2 files changed

+433
-7
lines changed

deps/rabbit/priv/schema/rabbit.schema

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2661,6 +2661,218 @@ fun(Conf) ->
26612661
list_to_binary(cuttlefish:conf_get("amqp1_0.default_vhost", Conf))
26622662
end}.
26632663

2664+
%% ----------------------------------------------------------------------------
2665+
%% AMQP client 1.0 TLS options
2666+
%% ----------------------------------------------------------------------------
2667+
2668+
{mapping, "amqp10_client.ssl_options", "amqp10_client.ssl_options", [
2669+
{datatype, {enum, [none]}}
2670+
]}.
2671+
2672+
{translation, "amqp10_client.ssl_options",
2673+
fun(Conf) ->
2674+
case cuttlefish:conf_get("amqp10_client.ssl_options", Conf, undefined) of
2675+
none -> [];
2676+
_ -> cuttlefish:invalid("Invalid amqp10_client.ssl_options")
2677+
end
2678+
end}.
2679+
2680+
{mapping, "amqp10_client.ssl_options.verify", "amqp10_client.ssl_options.verify", [
2681+
{datatype, {enum, [verify_peer, verify_none]}}]}.
2682+
2683+
{mapping, "amqp10_client.ssl_options.cacertfile", "amqp10_client.ssl_options.cacertfile",
2684+
[{datatype, string}, {validators, ["file_accessible"]}]}.
2685+
2686+
{mapping, "amqp10_client.ssl_options.certfile", "amqp10_client.ssl_options.certfile",
2687+
[{datatype, string}, {validators, ["file_accessible"]}]}.
2688+
2689+
{mapping, "amqp10_client.ssl_options.cacerts.$name", "amqp10_client.ssl_options.cacerts",
2690+
[{datatype, string}]}.
2691+
2692+
{translation, "amqp10_client.ssl_options.cacerts",
2693+
fun(Conf) ->
2694+
Settings = cuttlefish_variable:filter_by_prefix("amqp10_client.ssl_options.cacerts", Conf),
2695+
[ list_to_binary(V) || {_, V} <- Settings ]
2696+
end}.
2697+
2698+
{mapping, "amqp10_client.ssl_options.cert", "amqp10_client.ssl_options.cert",
2699+
[{datatype, string}]}.
2700+
2701+
{translation, "amqp10_client.ssl_options.cert",
2702+
fun(Conf) ->
2703+
list_to_binary(cuttlefish:conf_get("amqp10_client.ssl_options.cert", Conf))
2704+
end}.
2705+
2706+
{mapping, "amqp10_client.ssl_options.crl_check", "amqp10_client.ssl_options.crl_check",
2707+
[{datatype, [{enum, [true, false, peer, best_effort]}]}]}.
2708+
2709+
{mapping, "amqp10_client.ssl_options.depth", "amqp10_client.ssl_options.depth",
2710+
[{datatype, integer}, {validators, ["byte"]}]}.
2711+
2712+
{mapping, "amqp10_client.ssl_options.key.RSAPrivateKey", "amqp10_client.ssl_options.key",
2713+
[{datatype, string}]}.
2714+
2715+
{mapping, "amqp10_client.ssl_options.key.DSAPrivateKey", "amqp10_client.ssl_options.key",
2716+
[{datatype, string}]}.
2717+
2718+
{mapping, "amqp10_client.ssl_options.key.PrivateKeyInfo", "amqp10_client.ssl_options.key",
2719+
[{datatype, string}]}.
2720+
2721+
{translation, "amqp10_client.ssl_options.key",
2722+
fun(Conf) ->
2723+
case cuttlefish_variable:filter_by_prefix("amqp10_client.ssl_options.key", Conf) of
2724+
[{[_,_,Key], Val}|_] -> {list_to_atom(Key), list_to_binary(Val)};
2725+
_ -> undefined
2726+
end
2727+
end}.
2728+
2729+
{mapping, "amqp10_client.ssl_options.keyfile", "amqp10_client.ssl_options.keyfile",
2730+
[{datatype, string}, {validators, ["file_accessible"]}]}.
2731+
2732+
{mapping, "amqp10_client.ssl_options.log_alert", "amqp10_client.ssl_options.log_alert",
2733+
[{datatype, {enum, [true, false]}}]}.
2734+
2735+
{mapping, "amqp10_client.ssl_options.password", "amqp10_client.ssl_options.password",
2736+
[{datatype, string}]}.
2737+
2738+
{mapping, "amqp10_client.ssl_options.psk_identity", "amqp10_client.ssl_options.psk_identity",
2739+
[{datatype, string}]}.
2740+
2741+
{mapping, "amqp10_client.ssl_options.reuse_sessions", "amqp10_client.ssl_options.reuse_sessions",
2742+
[{datatype, {enum, [true, false]}}]}.
2743+
2744+
{mapping, "amqp10_client.ssl_options.secure_renegotiate", "amqp10_client.ssl_options.secure_renegotiate",
2745+
[{datatype, {enum, [true, false]}}]}.
2746+
2747+
{mapping, "amqp10_client.ssl_options.versions.$version", "amqp10_client.ssl_options.versions",
2748+
[{datatype, atom}]}.
2749+
2750+
{translation, "amqp10_client.ssl_options.versions",
2751+
fun(Conf) ->
2752+
Settings = cuttlefish_variable:filter_by_prefix("amqp10_client.ssl_options.versions", Conf),
2753+
[ V || {_, V} <- Settings ]
2754+
end}.
2755+
2756+
{mapping, "amqp10_client.ssl_options.sni", "amqp10_client.ssl_options.server_name_indication",
2757+
[{datatype, [{enum, [none]}, string]}]}.
2758+
2759+
{translation, "amqp10_client.ssl_options.server_name_indication",
2760+
fun(Conf) ->
2761+
case cuttlefish:conf_get("amqp10_client.ssl_options.sni", Conf, undefined) of
2762+
undefined -> cuttlefish:unset();
2763+
none -> cuttlefish:unset();
2764+
Hostname -> Hostname
2765+
end
2766+
end}.
2767+
2768+
2769+
% ===============================
2770+
% AMQP 0.9.1
2771+
% ===============================
2772+
2773+
%% ----------------------------------------------------------------------------
2774+
%% AMQP client 0.9.1 TLS options
2775+
%% ----------------------------------------------------------------------------
2776+
2777+
{mapping, "amqp_client.ssl_options", "amqp_client.ssl_options", [
2778+
{datatype, {enum, [none]}}
2779+
]}.
2780+
2781+
{translation, "amqp_client.ssl_options",
2782+
fun(Conf) ->
2783+
case cuttlefish:conf_get("amqp_client.ssl_options", Conf, undefined) of
2784+
none -> [];
2785+
_ -> cuttlefish:invalid("Invalid amqp_client.ssl_options")
2786+
end
2787+
end}.
2788+
2789+
{mapping, "amqp_client.ssl_options.verify", "amqp_client.ssl_options.verify", [
2790+
{datatype, {enum, [verify_peer, verify_none]}}]}.
2791+
2792+
{mapping, "amqp_client.ssl_options.cacertfile", "amqp_client.ssl_options.cacertfile",
2793+
[{datatype, string}, {validators, ["file_accessible"]}]}.
2794+
2795+
{mapping, "amqp_client.ssl_options.certfile", "amqp_client.ssl_options.certfile",
2796+
[{datatype, string}, {validators, ["file_accessible"]}]}.
2797+
2798+
{mapping, "amqp_client.ssl_options.cacerts.$name", "amqp_client.ssl_options.cacerts",
2799+
[{datatype, string}]}.
2800+
2801+
{translation, "amqp_client.ssl_options.cacerts",
2802+
fun(Conf) ->
2803+
Settings = cuttlefish_variable:filter_by_prefix("amqp_client.ssl_options.cacerts", Conf),
2804+
[ list_to_binary(V) || {_, V} <- Settings ]
2805+
end}.
2806+
2807+
{mapping, "amqp_client.ssl_options.cert", "amqp_client.ssl_options.cert",
2808+
[{datatype, string}]}.
2809+
2810+
{translation, "amqp_client.ssl_options.cert",
2811+
fun(Conf) ->
2812+
list_to_binary(cuttlefish:conf_get("amqp_client.ssl_options.cert", Conf))
2813+
end}.
2814+
2815+
{mapping, "amqp_client.ssl_options.crl_check", "amqp_client.ssl_options.crl_check",
2816+
[{datatype, [{enum, [true, false, peer, best_effort]}]}]}.
2817+
2818+
{mapping, "amqp_client.ssl_options.depth", "amqp_client.ssl_options.depth",
2819+
[{datatype, integer}, {validators, ["byte"]}]}.
2820+
2821+
{mapping, "amqp_client.ssl_options.key.RSAPrivateKey", "amqp_client.ssl_options.key",
2822+
[{datatype, string}]}.
2823+
2824+
{mapping, "amqp_client.ssl_options.key.DSAPrivateKey", "amqp_client.ssl_options.key",
2825+
[{datatype, string}]}.
2826+
2827+
{mapping, "amqp_client.ssl_options.key.PrivateKeyInfo", "amqp_client.ssl_options.key",
2828+
[{datatype, string}]}.
2829+
2830+
{translation, "amqp_client.ssl_options.key",
2831+
fun(Conf) ->
2832+
case cuttlefish_variable:filter_by_prefix("amqp_client.ssl_options.key", Conf) of
2833+
[{[_,_,Key], Val}|_] -> {list_to_atom(Key), list_to_binary(Val)};
2834+
_ -> undefined
2835+
end
2836+
end}.
2837+
2838+
{mapping, "amqp_client.ssl_options.keyfile", "amqp_client.ssl_options.keyfile",
2839+
[{datatype, string}, {validators, ["file_accessible"]}]}.
2840+
2841+
{mapping, "amqp_client.ssl_options.log_alert", "amqp_client.ssl_options.log_alert",
2842+
[{datatype, {enum, [true, false]}}]}.
2843+
2844+
{mapping, "amqp_client.ssl_options.password", "amqp_client.ssl_options.password",
2845+
[{datatype, string}]}.
2846+
2847+
{mapping, "amqp_client.ssl_options.psk_identity", "amqp_client.ssl_options.psk_identity",
2848+
[{datatype, string}]}.
2849+
2850+
{mapping, "amqp_client.ssl_options.reuse_sessions", "amqp_client.ssl_options.reuse_sessions",
2851+
[{datatype, {enum, [true, false]}}]}.
2852+
2853+
{mapping, "amqp_client.ssl_options.secure_renegotiate", "amqp_client.ssl_options.secure_renegotiate",
2854+
[{datatype, {enum, [true, false]}}]}.
2855+
2856+
{mapping, "amqp_client.ssl_options.versions.$version", "amqp_client.ssl_options.versions",
2857+
[{datatype, atom}]}.
2858+
2859+
{translation, "amqp_client.ssl_options.versions",
2860+
fun(Conf) ->
2861+
Settings = cuttlefish_variable:filter_by_prefix("amqp_client.ssl_options.versions", Conf),
2862+
[ V || {_, V} <- Settings ]
2863+
end}.
2864+
2865+
{mapping, "amqp_client.ssl_options.sni", "amqp_client.ssl_options.server_name_indication",
2866+
[{datatype, [{enum, [none]}, string]}]}.
2867+
2868+
{translation, "amqp_client.ssl_options.server_name_indication",
2869+
fun(Conf) ->
2870+
case cuttlefish:conf_get("amqp_client.ssl_options.sni", Conf, undefined) of
2871+
undefined -> cuttlefish:unset();
2872+
none -> cuttlefish:unset();
2873+
Hostname -> Hostname
2874+
end
2875+
end}.
26642876

26652877
% ===============================
26662878
% Validators

0 commit comments

Comments
 (0)