Skip to content

Commit c9ba104

Browse files
committed
fix: ssh key validation
Allow more types than just rsa, anchor regexp more tightly and be more lenient about the comment part. Closes #40
1 parent ec8c9f3 commit c9ba104

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

modules/servers/upCloudVps/lib/configOptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private function createLocationFields($groupId, $zones, $currencyId){
178178
private function ensureCustomFields($product)
179179
{
180180
$customFields = [
181-
['fieldname' => 'ssh_key|SSH Public Key', 'fieldtype' => 'textarea', 'description' => $this->_LANG["sshRsa"], 'regexpr' => "#ssh-rsa AAAA[0-9A-Za-z+/]+[=]{0,3}( [^@]+@[^@]+)?#", "showorder" => "on"],
181+
['fieldname' => 'ssh_key|SSH Public Key', 'fieldtype' => 'textarea', 'description' => $this->_LANG["sshRsa"], 'regexpr' => "#^(ssh-(rsa|dss|ed25519)|ecdsa-sha2-nistp(256|384|521)|sk-(ssh-ed25519|ecdsa-sha2-nistp256)@openssh\.com) AAAA[0-9A-Za-z+/]+[=]{0,3}( .*)?$#", "showorder" => "on"],
182182
['fieldname' => 'instanceId|instance Id', 'fieldtype' => 'text', 'adminonly' => 'on'],
183183
['fieldname' => 'userData|User Data', 'fieldtype' => 'textarea', 'description' => $this->_LANG["userData"], "showorder" => "on"]
184184
];

0 commit comments

Comments
 (0)