$hostrsapubkey =~ s/^.*ssh-rsa\s+//i;
$hostrsapubkey =~ s/\s+root\@\S+\s*$//i;
+ my $sshpubkeypattern = PMG::ClusterConfig::Node::valid_ssh_pubkey();
die "unable to parse ${hostrsapubkey_fn}\n"
- if $hostrsapubkey !~ m/^[A-Za-z0-9\.\/\+]{200,}$/;
+ if $hostrsapubkey !~ m/$sshpubkeypattern/;
my $nodename = PVE::INotify::nodename();
$rootrsapubkey =~ s/\s+root\@\S+\s*$//i;
die "unable to parse ${rootrsapubkey_fn}\n"
- if $rootrsapubkey !~ m/^[A-Za-z0-9\.\/\+]{200,}$/;
+ if $rootrsapubkey !~ m/$sshpubkeypattern/;
$res->{rootrsapubkey} = $rootrsapubkey;
use base qw(PMG::ClusterConfig::Base);
+sub valid_ssh_pubkey {
+ return'^[A-Za-z0-9\.\/\+]{200,}$';
+}
+
sub type {
return 'node';
}
hostrsapubkey => {
description => "Public SSH RSA key for the host.",
type => 'string',
- pattern => '^[A-Za-z0-9\.\/\+]{200,}$',
+ pattern => valid_ssh_pubkey(),
},
rootrsapubkey => {
description => "Public SSH RSA key for the root user.",
type => 'string',
- pattern => '^[A-Za-z0-9\.\/\+]{200,}$',
+ pattern => valid_ssh_pubkey(),
},
fingerprint => {
description => "SSL certificate fingerprint.",