Add ALPN support to TLS node

This commit is contained in:
Ben Hardill 2021-05-18 13:13:32 +01:00
parent be9521f659
commit 8c95067ec4
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7
3 changed files with 13 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=""></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

@ -106,6 +106,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;

View File

@ -170,14 +170,16 @@
"passphrase": "Passphrase",
"ca": "CA Certificate",
"verify-server-cert":"Verify server certificate",
"servername": "Server Name"
"servername": "Server Name",
"alpnprotocol": "ALPN Protocol"
},
"placeholder": {
"cert":"path to certificate (PEM format)",
"key":"path to private key (PEM format)",
"ca":"path to CA certificate (PEM format)",
"passphrase":"private key passphrase (optional)",
"servername":"for use with SNI"
"servername":"for use with SNI",
"alpnprotocol":"for use with ALPN"
},
"error": {
"missing-file": "No certificate/key file provided"