mirror of
https://github.com/openwrt/luci.git
synced 2025-12-21 17:04:35 +04:00
luci-app-statistics: Adds ability to configure encrypted connections in the MQTT package
Updates mqtt.js to add user interface to configure a path to a CA Cert file to be used by MQTT to verify the servers certificate, and adds a setting to configure the TLS verison to be used for the conneciton. Also updates stat-genconfig to then copy these settings into the generated collectd.conf Signed-off-by: Nat Gist <nat.gist@gmail.com>
This commit is contained in:
@@ -68,6 +68,19 @@ return baseclass.extend({
|
||||
o.value('false', _('False'));
|
||||
o.modalonly = true;
|
||||
o.optional = true;
|
||||
|
||||
o = ss.option(form.ListValue, 'TLSProtocol', _('TLSProtocol'));
|
||||
o.depends('blocktype', 'Publish');
|
||||
o.value('tlsv1.2', _('TLS 1.2'));
|
||||
o.value('tlsv1.3', _('TLS 1.3'));
|
||||
o.modalonly = true;
|
||||
o.optional = true;
|
||||
|
||||
o = ss.option(form.Value, 'CACert', _('CACert'));
|
||||
o.depends({'TLSProtocol': 'tls', '!contains': true });
|
||||
o.optional = true;
|
||||
o.modalonly = true;
|
||||
o.default = '/etc/ssl/certs/ca-certificates.crt';
|
||||
|
||||
o = ss.option(form.ListValue, 'CleanSession', _('CleanSession'));
|
||||
o.depends('blocktype', 'Subscribe');
|
||||
|
||||
@@ -260,6 +260,8 @@ function config_mqtt(c) {
|
||||
str += s['StoreRates'] ? `\t\tRetain ${s.StoreRates}\n` : '';
|
||||
str += s['CleanSession'] ? `\t\tRetain ${s.CleanSession}\n` : '';
|
||||
str += s['Topic'] ? `\t\tTopic "${s.Topic}"\n` : '';
|
||||
str += s['CACert'] ? `\t\tCACert "${s.CACert}"\n` : '';
|
||||
str += s['TLSProtocol'] ? `\t\tTLSProtocol "${s.TLSProtocol}"\n` : '';
|
||||
|
||||
str += isPublish ? `\t</Publish>\n` : `\t</Subscribe>\n`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user