Skip to content

Commit 24fb033

Browse files
SimonUngemichaelklishin
authored andcommitted
Add schema duplicate for amqp 1.0
1 parent 145592e commit 24fb033

File tree

2 files changed

+235
-21
lines changed

2 files changed

+235
-21
lines changed

deps/rabbit/priv/schema/rabbit.schema

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2661,9 +2661,117 @@ 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+
% ===============================
26642772

26652773
%% ----------------------------------------------------------------------------
2666-
%% amqp_client TLS options
2774+
%% AMQP client 0.9.1 TLS options
26672775
%% ----------------------------------------------------------------------------
26682776

26692777
{mapping, "amqp_client.ssl_options", "amqp_client.ssl_options", [

deps/rabbit/test/config_schema_SUITE_data/rabbit.snippets

Lines changed: 126 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ cluster_formation.classic_config.nodes.peer2 = rabbit@hostname2",
251251
[{peer_discovery_backend,rabbit_peer_discovery_classic_config}]},
252252
{cluster_nodes,{[rabbit@hostname2,rabbit@hostname1],disc}}]}],
253253
[]},
254-
254+
255255
{cluster_formation_module_dns_alias,
256256
"cluster_formation.peer_discovery_backend = dns
257257
cluster_formation.dns.hostname = discovery.eng.example.local",
@@ -264,7 +264,7 @@ cluster_formation.dns.hostname = discovery.eng.example.local",
264264
]}]}
265265
]}],
266266
[]},
267-
267+
268268
{cluster_formation_disk,
269269
"cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config
270270
cluster_formation.classic_config.nodes.peer1 = rabbit@hostname1
@@ -698,17 +698,17 @@ tcp_listen_options.exit_on_close = false",
698698
{fail_if_no_peer_cert, false},
699699
{honor_ecc_order, true}]}]}],
700700
[]},
701-
701+
702702
{ssl_cert_login_from_cn,
703703
"ssl_cert_login_from = common_name",
704704
[{rabbit,[{ssl_cert_login_from, common_name}]}],
705705
[]},
706-
706+
707707
{ssl_cert_login_from_dn,
708708
"ssl_cert_login_from = distinguished_name",
709709
[{rabbit,[{ssl_cert_login_from, distinguished_name}]}],
710710
[]},
711-
711+
712712
{ssl_cert_login_from_san_dns,
713713
"ssl_cert_login_from = subject_alternative_name
714714
ssl_cert_login_san_type = dns
@@ -719,7 +719,7 @@ tcp_listen_options.exit_on_close = false",
719719
{ssl_cert_login_san_index, 0}
720720
]}],
721721
[]},
722-
722+
723723

724724
{ssl_options_bypass_pem_cache,
725725
"ssl_options.bypass_pem_cache = true",
@@ -1063,20 +1063,21 @@ credential_validator.regexp = ^abc\\d+",
10631063
%% AMQP TLS options
10641064
%%
10651065

1066-
{ssl_options,
1066+
{amqp_client_ssl_options,
10671067
"amqp_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
10681068
amqp_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
10691069
amqp_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
10701070
amqp_client.ssl_options.verify = verify_peer",
1071-
[{amqp_client, [
1072-
{ssl_options,
1073-
[{cacertfile, "test/config_schema_SUITE_data/certs/cacert.pem"},
1074-
{certfile, "test/config_schema_SUITE_data/certs/cert.pem"},
1075-
{keyfile, "test/config_schema_SUITE_data/certs/key.pem"},
1076-
{verify, verify_peer}]}
1077-
]}],
1071+
[{amqp_client,
1072+
[
1073+
{ssl_options,
1074+
[{cacertfile, "test/config_schema_SUITE_data/certs/cacert.pem"},
1075+
{certfile, "test/config_schema_SUITE_data/certs/cert.pem"},
1076+
{keyfile, "test/config_schema_SUITE_data/certs/key.pem"},
1077+
{verify, verify_peer}]}
1078+
]}],
10781079
[amqp_client]},
1079-
{ssl_options_verify_peer,
1080+
{amqp_client_ssl_options_verify_peer,
10801081
"amqp_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
10811082
amqp_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
10821083
amqp_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
@@ -1089,7 +1090,7 @@ credential_validator.regexp = ^abc\\d+",
10891090
{keyfile,"test/config_schema_SUITE_data/certs/key.pem"},
10901091
{verify,verify_peer}]}]}],
10911092
[]},
1092-
{ssl_options_password,
1093+
{amqp_client_ssl_options_password,
10931094
"amqp_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
10941095
amqp_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
10951096
amqp_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
@@ -1102,7 +1103,7 @@ credential_validator.regexp = ^abc\\d+",
11021103
{keyfile,"test/config_schema_SUITE_data/certs/key.pem"},
11031104
{password,"t0p$3kRe7"}]}]}],
11041105
[]},
1105-
{ssl_options_tls_versions,
1106+
{amqp_client_ssl_options_tls_versions,
11061107
"amqp_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
11071108
amqp_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
11081109
amqp_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
@@ -1117,7 +1118,7 @@ credential_validator.regexp = ^abc\\d+",
11171118
{versions,['tlsv1.2','tlsv1.1']}]}
11181119
]}],
11191120
[]},
1120-
{ssl_options_depth,
1121+
{amqp_client_ssl_options_depth,
11211122
"amqp_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
11221123
amqp_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
11231124
amqp_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
@@ -1131,7 +1132,7 @@ credential_validator.regexp = ^abc\\d+",
11311132
{depth,2},
11321133
{verify,verify_peer}]}]}],
11331134
[]},
1134-
{ssl_options_sni_disabled,
1135+
{amqp_client_ssl_options_sni_disabled,
11351136
"amqp_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
11361137
amqp_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
11371138
amqp_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
@@ -1148,7 +1149,7 @@ credential_validator.regexp = ^abc\\d+",
11481149
}]
11491150
}],
11501151
[]},
1151-
{ssl_options_sni_hostname,
1152+
{amqp_client_ssl_options_sni_hostname,
11521153
"amqp_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
11531154
amqp_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
11541155
amqp_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
@@ -1165,6 +1166,111 @@ credential_validator.regexp = ^abc\\d+",
11651166
{server_name_indication, "hostname.dev"}
11661167
]}
11671168
]}],
1169+
[]},
1170+
1171+
{amqp10_client_ssl_options,
1172+
"amqp10_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
1173+
amqp10_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
1174+
amqp10_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
1175+
amqp10_client.ssl_options.verify = verify_peer",
1176+
[{amqp10_client,
1177+
[
1178+
{ssl_options,
1179+
[{cacertfile, "test/config_schema_SUITE_data/certs/cacert.pem"},
1180+
{certfile, "test/config_schema_SUITE_data/certs/cert.pem"},
1181+
{keyfile, "test/config_schema_SUITE_data/certs/key.pem"},
1182+
{verify, verify_peer}]}
1183+
]}],
1184+
[amqp10_client]},
1185+
{amqp10_client_ssl_options_verify_peer,
1186+
"amqp10_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
1187+
amqp10_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
1188+
amqp10_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
1189+
amqp10_client.ssl_options.verify = verify_peer",
1190+
[{amqp10_client,
1191+
[
1192+
{ssl_options,
1193+
[{cacertfile,"test/config_schema_SUITE_data/certs/cacert.pem"},
1194+
{certfile,"test/config_schema_SUITE_data/certs/cert.pem"},
1195+
{keyfile,"test/config_schema_SUITE_data/certs/key.pem"},
1196+
{verify,verify_peer}]}]}],
1197+
[]},
1198+
{amqp10_client_ssl_options_password,
1199+
"amqp10_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
1200+
amqp10_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
1201+
amqp10_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
1202+
amqp10_client.ssl_options.password = t0p$3kRe7",
1203+
[{amqp10_client,
1204+
[
1205+
{ssl_options,
1206+
[{cacertfile,"test/config_schema_SUITE_data/certs/cacert.pem"},
1207+
{certfile,"test/config_schema_SUITE_data/certs/cert.pem"},
1208+
{keyfile,"test/config_schema_SUITE_data/certs/key.pem"},
1209+
{password,"t0p$3kRe7"}]}]}],
1210+
[]},
1211+
{amqp10_client_ssl_options_tls_versions,
1212+
"amqp10_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
1213+
amqp10_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
1214+
amqp10_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
1215+
amqp10_client.ssl_options.versions.tls1_2 = tlsv1.2
1216+
amqp10_client.ssl_options.versions.tls1_1 = tlsv1.1",
1217+
[],
1218+
[{amqp10_client,
1219+
[{ssl_options,
1220+
[{cacertfile,"test/config_schema_SUITE_data/certs/cacert.pem"},
1221+
{certfile,"test/config_schema_SUITE_data/certs/cert.pem"},
1222+
{keyfile,"test/config_schema_SUITE_data/certs/key.pem"},
1223+
{versions,['tlsv1.2','tlsv1.1']}]}
1224+
]}],
1225+
[]},
1226+
{amqp10_client_ssl_options_depth,
1227+
"amqp10_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
1228+
amqp10_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
1229+
amqp10_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
1230+
amqp10_client.ssl_options.depth = 2
1231+
amqp10_client.ssl_options.verify = verify_peer",
1232+
[{amqp10_client,
1233+
[{ssl_options,
1234+
[{cacertfile,"test/config_schema_SUITE_data/certs/cacert.pem"},
1235+
{certfile,"test/config_schema_SUITE_data/certs/cert.pem"},
1236+
{keyfile,"test/config_schema_SUITE_data/certs/key.pem"},
1237+
{depth,2},
1238+
{verify,verify_peer}]}]}],
1239+
[]},
1240+
{amqp10_client_ssl_options_sni_disabled,
1241+
"amqp10_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
1242+
amqp10_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
1243+
amqp10_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
1244+
amqp10_client.ssl_options.versions.tls1_2 = tlsv1.2
1245+
amqp10_client.ssl_options.versions.tls1_1 = tlsv1.1
1246+
amqp10_client.ssl_options.sni = none",
1247+
[],
1248+
[{amqp10_client,
1249+
[{ssl_options,
1250+
[{cacertfile,"test/config_schema_SUITE_data/certs/cacert.pem"},
1251+
{certfile,"test/config_schema_SUITE_data/certs/cert.pem"},
1252+
{keyfile,"test/config_schema_SUITE_data/certs/key.pem"},
1253+
{versions,['tlsv1.2','tlsv1.1']}]
1254+
}]
1255+
}],
1256+
[]},
1257+
{amqp10_client_ssl_options_sni_hostname,
1258+
"amqp10_client.ssl_options.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem
1259+
amqp10_client.ssl_options.certfile = test/config_schema_SUITE_data/certs/cert.pem
1260+
amqp10_client.ssl_options.keyfile = test/config_schema_SUITE_data/certs/key.pem
1261+
amqp10_client.ssl_options.versions.tls1_2 = tlsv1.2
1262+
amqp10_client.ssl_options.versions.tls1_1 = tlsv1.1
1263+
amqp10_client.ssl_options.sni = hostname.dev",
1264+
[],
1265+
[{amqp10_client,
1266+
[{ssl_options,
1267+
[{cacertfile,"test/config_schema_SUITE_data/certs/cacert.pem"},
1268+
{certfile,"test/config_schema_SUITE_data/certs/cert.pem"},
1269+
{keyfile,"test/config_schema_SUITE_data/certs/key.pem"},
1270+
{versions,['tlsv1.2','tlsv1.1']},
1271+
{server_name_indication, "hostname.dev"}
1272+
]}
1273+
]}],
11681274
[]}
11691275

11701276
].

0 commit comments

Comments
 (0)