[pve-devel] [PATCH manager] fix #3426: ui: parser: adapt parseSSHKey to accept "@..." suffix

Lorenz Stechauner l.stechauner at proxmox.com
Mon Jun 7 12:44:56 CEST 2021


also rearranged the regex groups to allow sk-ecdsa-sha2-...

note: FIDO keys are now parsable, the backend only supports it with
OpenSSH >= 8.2. This may be achieved with upgrading to PVE 7 or
using a back port.
---
 www/manager6/Parser.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/manager6/Parser.js b/www/manager6/Parser.js
index bb6a9a33..23236dac 100644
--- a/www/manager6/Parser.js
+++ b/www/manager6/Parser.js
@@ -565,7 +565,7 @@ Ext.define('PVE.Parser', {
     parseSSHKey: function(key) {
 	//                |--- options can have quotes--|     type    key        comment
 	let keyre = /^(?:((?:[^\s"]|"(?:\\.|[^"\\])*")+)\s+)?(\S+)\s+(\S+)(?:\s+(.*))?$/;
-	let typere = /^(?:(?:sk-)?ssh-(?:dss|rsa|ed25519)|ecdsa-sha2-nistp\d+)$/;
+	let typere = /^(?:(?:sk-)?(?:ssh-(?:dss|rsa|ed25519)|ecdsa-sha2-nistp\d+)(?:@(?:[a-z0-9_-]+\.)+[a-z]{2,})?)$/;
 
 	let m = key.match(keyre);
 	if (!m || m.length < 3 || !m[2]) { // [2] is always either type or key
-- 
2.20.1






More information about the pve-devel mailing list