Merge pull request #2988 from hardillb/ALPNProtocols

Add ALPN support to TLS node
This commit is contained in:
Nick O'Leary
2021-05-19 17:39:19 +01:00
committed by GitHub
3 changed files with 14 additions and 3 deletions

View File

@@ -67,6 +67,10 @@
<label style="width: 120px;" for="node-config-input-servername"><i class="fa fa-server"></i> <span data-i18n="tls.label.servername"></span></label>
<input style="width: calc(100% - 170px);" type="text" id="node-config-input-servername" data-i18n="[placeholder]tls.placeholder.servername">
</div>
<div class="form-row">
<label style="width: 120px;" for="node-config-input-alpnprotocol"><i class="fa fa-cogs"></i> <span data-i18n="tls.label.alpnprotocol"></span></label>
<input style="width: calc(100% - 170px);" type="text" id="node-config-input-alpnprotocol" data-i18n="[placeholder]tls.placeholder.alpnprotocol">
</div>
<hr>
<div class="form-row">
<label style="width: 120px;" for="node-config-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
@@ -98,7 +102,8 @@
keyname: {value:""},
caname: {value:""},
servername: {value:""},
verifyservercert: {value: true}
verifyservercert: {value: true},
alpnprotocol: {value: ""}
},
credentials: {
certdata: {type:"text"},

View File

@@ -26,6 +26,7 @@ module.exports = function(RED) {
var keyPath = n.key.trim();
var caPath = n.ca.trim();
this.servername = (n.servername||"").trim();
this.alpnprotocol = (n.alpnprotocol||"").trim();
if ((certPath.length > 0) || (keyPath.length > 0) || (caPath.length > 0)) {
@@ -106,6 +107,9 @@ module.exports = function(RED) {
if (this.servername) {
opts.servername = this.servername;
}
if (this.alpnprotocol) {
opts.ALPNProtocols = [this.alpnprotocol];
}
opts.rejectUnauthorized = this.verifyservercert;
}
return opts;