mirror of
https://github.com/openwrt/luci.git
synced 2025-12-22 01:44: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:
@@ -69,6 +69,19 @@ return baseclass.extend({
|
|||||||
o.modalonly = true;
|
o.modalonly = true;
|
||||||
o.optional = 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 = ss.option(form.ListValue, 'CleanSession', _('CleanSession'));
|
||||||
o.depends('blocktype', 'Subscribe');
|
o.depends('blocktype', 'Subscribe');
|
||||||
o.value('true', _('True'));
|
o.value('true', _('True'));
|
||||||
|
|||||||
@@ -260,6 +260,8 @@ function config_mqtt(c) {
|
|||||||
str += s['StoreRates'] ? `\t\tRetain ${s.StoreRates}\n` : '';
|
str += s['StoreRates'] ? `\t\tRetain ${s.StoreRates}\n` : '';
|
||||||
str += s['CleanSession'] ? `\t\tRetain ${s.CleanSession}\n` : '';
|
str += s['CleanSession'] ? `\t\tRetain ${s.CleanSession}\n` : '';
|
||||||
str += s['Topic'] ? `\t\tTopic "${s.Topic}"\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`;
|
str += isPublish ? `\t</Publish>\n` : `\t</Subscribe>\n`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user