]> git.proxmox.com Git - pve-manager.git/commitdiff
fix #3426: ui: parser: adapt parseSSHKey to accept "@..." suffix
authorLorenz Stechauner <l.stechauner@proxmox.com>
Mon, 7 Jun 2021 10:44:56 +0000 (12:44 +0200)
committerDominik Csapak <d.csapak@proxmox.com>
Fri, 23 Jul 2021 07:05:33 +0000 (09:05 +0200)
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

index c17f297cbfe8d6cb8d81cec6cbb6c62582ad44de..9f7b2c84ddb72946e20dbd6a67a9cdc2b635064d 100644 (file)
@@ -563,7 +563,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