From: Jo-Philipp Wich Date: Wed, 29 Mar 2023 13:32:44 +0000 (+0200) Subject: luci-proto-openconnect: relax key checking X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=230ba69c5192ff4474e628f8bbbfa09fff3071ab;p=project%2Fluci.git luci-proto-openconnect: relax key checking Valid keys may begin/end with `-----BEGIN PRIVATE KEY-----` and `-----END PRIVATE KEY-----` so make the `RSA` keyword optional. Fixes: #6319 Signed-off-by: Jo-Philipp Wich (cherry picked from commit b8ee30589bd3e9037e7c7a8a5a1e8c1048afaf2f) --- diff --git a/protocols/luci-proto-openconnect/htdocs/luci-static/resources/protocol/openconnect.js b/protocols/luci-proto-openconnect/htdocs/luci-static/resources/protocol/openconnect.js index e38afdc201..929d50f063 100644 --- a/protocols/luci-proto-openconnect/htdocs/luci-static/resources/protocol/openconnect.js +++ b/protocols/luci-proto-openconnect/htdocs/luci-static/resources/protocol/openconnect.js @@ -38,8 +38,8 @@ function sanitizeCert(s) { } function validateCert(priv, section_id, value) { - var beg = priv ? /^-----BEGIN RSA PRIVATE KEY-----$/ : /^-----BEGIN CERTIFICATE-----$/, - end = priv ? /^-----END RSA PRIVATE KEY-----$/ : /^-----END CERTIFICATE-----$/, + var beg = priv ? /^-----BEGIN (RSA )?PRIVATE KEY-----$/ : /^-----BEGIN CERTIFICATE-----$/, + end = priv ? /^-----END (RSA )?PRIVATE KEY-----$/ : /^-----END CERTIFICATE-----$/, lines = value.trim().split(/[\r\n]/), start = false, i;