]> git.proxmox.com Git - pmg-api.git/blobdiff - PMG/ClusterConfig.pm
fix #1881: increase limit for ids in spam quarantine
[pmg-api.git] / PMG / ClusterConfig.pm
index 27d04a8a0e62244a2b56eac141f0d38a5c670e65..af58d76573f41357d98ec3d204df4fa8411906c4 100644 (file)
@@ -60,10 +60,17 @@ sub properties {
        hostrsapubkey => {
            description => "Public SSH RSA key for the host.",
            type => 'string',
+           pattern => '^[A-Za-z0-9\.\/\+]{200,}$',
        },
        rootrsapubkey => {
            description => "Public SSH RSA key for the root user.",
            type => 'string',
+           pattern => '^[A-Za-z0-9\.\/\+]{200,}$',
+       },
+       fingerprint => {
+           description => "SSL certificate fingerprint.",
+           type => 'string',
+           pattern => '^(:?[A-Z0-9][A-Z0-9]:){31}[A-Z0-9][A-Z0-9]$',
        },
     };
 }
@@ -74,6 +81,7 @@ sub options {
        name => { fixed => 1 },
        hostrsapubkey => {},
        rootrsapubkey => {},
+       fingerprint => {},
     };
 }
 
@@ -105,6 +113,7 @@ sub options {
        name => { fixed => 1 },
        hostrsapubkey => {},
        rootrsapubkey => {},
+       fingerprint => {},
     };
 }
 
@@ -146,10 +155,11 @@ my $lockfile = "/var/lock/pmgcluster.lck";
 sub lock_config {
     my ($code, $errmsg) = @_;
 
-    my $p = PVE::Tools::lock_file($lockfile, undef, $code);
+    my $res = PVE::Tools::lock_file($lockfile, undef, $code);
     if (my $err = $@) {
        $errmsg ? die "$errmsg: $err" : die $err;
     }
+    return $res;
 }
 
 sub read_cluster_conf {
@@ -165,8 +175,6 @@ sub read_cluster_conf {
     my $localip = PMG::Utils::lookup_node_ip($localname);
 
     $cinfo->{remnodes} = [];
-    $cinfo->{configport}->{0} = 83;
-    $cinfo->{dbport}->{0} = 5432;
 
     $cinfo->{local} = {
        cid => 0,
@@ -198,15 +206,9 @@ sub read_cluster_conf {
        $cinfo->{master}->{maxcid} = $maxcid;
     }
 
-    my $ind = 0;
+    my $local_cid = $cinfo->{local}->{cid};
     foreach my $cid (sort keys %{$cinfo->{ids}}) {
-       if ($cinfo->{'local'}->{cid} == $cid) { # local CID
-           $cinfo->{configport}->{$cid} = 83;
-           $cinfo->{dbport}->{$cid} = 5432;
-       } else {
-           my $portid = $ind++;
-           $cinfo->{configport}->{$cid} = 50000 + $portid;
-           $cinfo->{dbport}->{$cid} = 50100 + $portid;
+       if ($local_cid != $cid) {
            push @{$cinfo->{remnodes}}, $cid;
        }
     }