luci-proto-openconnect: relax key checking
authorJo-Philipp Wich <jo@mein.io>
Wed, 29 Mar 2023 13:32:44 +0000 (15:32 +0200)
committerJo-Philipp Wich <jo@mein.io>
Mon, 3 Apr 2023 11:51:44 +0000 (13:51 +0200)
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 <jo@mein.io>
(cherry picked from commit b8ee30589bd3e9037e7c7a8a5a1e8c1048afaf2f)

protocols/luci-proto-openconnect/htdocs/luci-static/resources/protocol/openconnect.js

index e38afdc201c17eaeb7f90c0b6a5a202bd1e66ce7..929d50f0634e43a08b0be70db920c9bcff57f8b2 100644 (file)
@@ -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;