@@ -121,18 +121,139 @@ end}.
121121% % Definition import
122122% %
123123
124- % % Load definitions from a JSON file or directory of files. See
124+ % % Original key for definition loading from a JSON file or directory of files. See
125125% % https://www.rabbitmq.com/management.html#load-definitions
126- % %
127- % % {load_definitions, "/path/to/schema.json"},
128- % % {load_definitions, "/path/to/schemas"},
129126{mapping , " load_definitions" , " rabbit.load_definitions" ,
130127 [{datatype , string },
131128 {validators , [" file_accessible" ]}]}.
132129
130+ % % Newer syntax for definition loading from a JSON file or directory of files. See
131+ % % https://www.rabbitmq.com/management.html#load-definitions
132+ {mapping , " definitions.local.path" , " rabbit.definitions.local_path" ,
133+ [{datatype , string },
134+ {validators , [" file_accessible" ]}]}.
135+
136+ % % Extensive mechanism for loading definitions from a remote source
137+ {mapping , " definitions.import_backend" , " rabbit.definitions.import_backend" , [
138+ {datatype , atom }
139+ ]}.
140+
141+ {translation , " rabbit.definitions.import_backend" ,
142+ fun (Conf ) ->
143+ case cuttlefish :conf_get (" definitions.import_backend" , Conf , rabbit_definitions_import_local_filesystem ) of
144+ % % short aliases for known backends
145+ local_filesystem -> rabbit_definitions_import_local_filesystem ;
146+ local -> rabbit_definitions_import_local_filesystem ;
147+ https -> rabbit_definitions_import_https ;
148+ http -> rabbit_definitions_import_https ;
149+ % % accept both rabbitmq_ and rabbit_ (typical core module prefix)
150+ rabbitmq_definitions_import_local_filesystem -> rabbit_definitions_import_local_filesystem ;
151+ rabbitmq_definitions_import_local_filesystem -> rabbit_definitions_import_https ;
152+ % % any other value is used as is
153+ Module -> Module
154+ end
155+ end }.
156+
157+ % % Load definitions from a remote URL over HTTPS. See
158+ % % https://www.rabbitmq.com/management.html#load-definitions
159+ {mapping , " definitions.https.url" , " rabbit.definitions.url" ,
160+ [{datatype , string }]}.
161+
162+ % % Client-side TLS settings used by e.g. HTTPS definition loading mechanism.
163+ % % These can be reused by other clients.
164+
165+ {mapping , " definitions.tls.verify" , " rabbit.definitions.ssl_options.verify" , [
166+ {datatype , {enum , [verify_peer , verify_none ]}}]}.
167+
168+ {mapping , " definitions.tls.fail_if_no_peer_cert" , " rabbit.definitions.ssl_options.fail_if_no_peer_cert" , [
169+ {datatype , {enum , [true , false ]}}]}.
170+
171+ {mapping , " definitions.tls.cacertfile" , " rabbit.definitions.ssl_options.cacertfile" ,
172+ [{datatype , string }, {validators , [" file_accessible" ]}]}.
173+
174+ {mapping , " definitions.tls.certfile" , " rabbit.definitions.ssl_options.certfile" ,
175+ [{datatype , string }, {validators , [" file_accessible" ]}]}.
176+
177+ {mapping , " definitions.tls.cacerts.$name" , " rabbit.definitions.ssl_options.cacerts" ,
178+ [{datatype , string }]}.
179+
180+ {translation , " rabbit.definitions.ssl_options.cacerts" ,
181+ fun (Conf ) ->
182+ Settings = cuttlefish_variable :filter_by_prefix (" definitions.tls.cacerts" , Conf ),
183+ [ list_to_binary (V ) || {_ , V } <- Settings ]
184+ end }.
185+
186+ {mapping , " definitions.tls.cert" , " rabbit.definitions.ssl_options.cert" ,
187+ [{datatype , string }]}.
188+
189+ {translation , " rabbit.definitions.ssl_options.cert" ,
190+ fun (Conf ) ->
191+ list_to_binary (cuttlefish :conf_get (" definitions.tls.cert" , Conf ))
192+ end }.
193+
194+ {mapping , " definitions.tls.reuse_session" , " rabbit.definitions.ssl_options.reuse_session" ,
195+ [{datatype , {enum , [true , false ]}}]}.
196+
197+ {mapping , " definitions.tls.crl_check" , " rabbit.definitions.ssl_options.crl_check" ,
198+ [{datatype , [{enum , [true , false , peer , best_effort ]}]}]}.
199+
200+ {mapping , " definitions.tls.depth" , " rabbit.definitions.ssl_options.depth" ,
201+ [{datatype , integer }, {validators , [" byte" ]}]}.
202+
203+ {mapping , " definitions.tls.dh" , " rabbit.definitions.ssl_options.dh" ,
204+ [{datatype , string }]}.
205+
206+ {translation , " rabbit.definitions.ssl_options.dh" ,
207+ fun (Conf ) ->
208+ list_to_binary (cuttlefish :conf_get (" definitions.tls.dh" , Conf ))
209+ end }.
210+
211+ {translation , " rabbit.definitions.ssl_options.key" ,
212+ fun (Conf ) ->
213+ case cuttlefish_variable :filter_by_prefix (" definitions.tls.key" , Conf ) of
214+ [{[_ ,_ ,Key ], Val }|_ ] -> {list_to_atom (Key ), list_to_binary (Val )};
215+ _ -> cuttlefish :unset ()
216+ end
217+ end }.
218+
219+ {mapping , " definitions.tls.keyfile" , " rabbit.definitions.ssl_options.keyfile" ,
220+ [{datatype , string }, {validators , [" file_accessible" ]}]}.
221+
222+ {mapping , " definitions.tls.log_alert" , " rabbit.definitions.ssl_options.log_alert" ,
223+ [{datatype , {enum , [true , false ]}}]}.
224+
225+ {mapping , " definitions.tls.password" , " rabbit.definitions.ssl_options.password" ,
226+ [{datatype , string }]}.
227+
228+ {mapping , " definitions.tls.secure_renegotiate" , " rabbit.definitions.ssl_options.secure_renegotiate" ,
229+ [{datatype , {enum , [true , false ]}}]}.
230+
231+ {mapping , " definitions.tls.reuse_sessions" , " rabbit.definitions.ssl_options.reuse_sessions" ,
232+ [{datatype , {enum , [true , false ]}}]}.
233+
234+ {mapping , " definitions.tls.versions.$version" , " rabbit.definitions.ssl_options.versions" ,
235+ [{datatype , atom }]}.
236+
237+ {translation , " rabbit.definitions.ssl_options.versions" ,
238+ fun (Conf ) ->
239+ Settings = cuttlefish_variable :filter_by_prefix (" definitions.tls.versions" , Conf ),
240+ [V || {_ , V } <- Settings ]
241+ end }.
242+
243+ {mapping , " definitions.tls.ciphers.$cipher" , " rabbit.definitions.ssl_options.ciphers" ,
244+ [{datatype , string }]}.
245+
246+ {translation , " rabbit.definitions.ssl_options.ciphers" ,
247+ fun (Conf ) ->
248+ Settings = cuttlefish_variable :filter_by_prefix (" definitions.tls.ciphers" , Conf ),
249+ lists :reverse ([V || {_ , V } <- Settings ])
250+ end }.
251+
252+ {mapping , " definitions.tls.log_level" , " rabbit.definitions.ssl_options.log_level" ,
253+ [{datatype , {enum , [emergency , alert , critical , error , warning , notice , info , debug ]}}]}.
254+
133255% %
134- % % Security / AAA
135- % % ==============
256+ % % Seed User, Authentication, Access Control
136257% %
137258
138259% % The default "guest" user is only permitted to access the server
@@ -254,13 +375,16 @@ end}.
254375fun (Conf ) ->
255376 case cuttlefish_variable :filter_by_prefix (" ssl_options.key" , Conf ) of
256377 [{[_ ,_ ,Key ], Val }|_ ] -> {list_to_atom (Key ), list_to_binary (Val )};
257- _ -> undefined
378+ _ -> cuttlefish : unset ()
258379 end
259380end }.
260381
261382{mapping , " ssl_options.keyfile" , " rabbit.ssl_options.keyfile" ,
262383 [{datatype , string }, {validators , [" file_accessible" ]}]}.
263384
385+ {mapping , " ssl_options.log_level" , " rabbit.ssl_options.log_level" ,
386+ [{datatype , {enum , [emergency , alert , critical , error , warning , notice , info , debug ]}}]}.
387+
264388{mapping , " ssl_options.log_alert" , " rabbit.ssl_options.log_alert" ,
265389 [{datatype , {enum , [true , false ]}}]}.
266390
0 commit comments