Merge remote-tracking branch 'origin/main' into fix-gpg-expiry-date-calculation
* origin/main: Implement warning thresholds for OpenPGP
This commit is contained in:
commit
f794fd9e8b
1 changed files with 11 additions and 4 deletions
|
@ -40,6 +40,9 @@ my $paranoid=1;
|
|||
|
||||
my $debug=0;
|
||||
|
||||
# number of attempts before giving up
|
||||
my $warn_threshold = 3;
|
||||
|
||||
my $signer_openpgp_key_id = "D2BB0D0165D0FD58";
|
||||
|
||||
my $serialport="/dev/ttyUSB0";
|
||||
|
@ -735,7 +738,9 @@ sub HandleCerts($$)
|
|||
|
||||
SysLog "HandleCerts $table\n";
|
||||
|
||||
my $sth = $dbh->prepare("select * from $table where crt_name='' and csr_name!='' and warning<3");
|
||||
my $sth = $dbh->prepare(sprintf(
|
||||
"select * from %s where crt_name='' and csr_name!='' and warning<%d", $table, $warn_threshold
|
||||
));
|
||||
$sth->execute();
|
||||
#$rowdata;
|
||||
while ( my $rowdata = $sth->fetchrow_hashref() )
|
||||
|
@ -905,7 +910,7 @@ sub HandleCerts($$)
|
|||
else
|
||||
{
|
||||
SysLog("Could not find the issued certificate. $crtname ".$row{"id"}."\n");
|
||||
$dbh->do("update `$table` set warning=warning+1 where `id`='".$row{'id'}."'");
|
||||
$dbh->do(sprintf("update %s set warning=warning+1 where id=%d", $table, $row{'id'}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1079,7 +1084,9 @@ sub sendRevokeMail()
|
|||
|
||||
sub HandleGPG()
|
||||
{
|
||||
my $sth = $dbh->prepare("select * from gpg where crt='' and csr!='' ");
|
||||
my $sth = $dbh->prepare(sprintf(
|
||||
"select * from gpg where crt='' and csr!='' and warning<%d", $warn_threshold
|
||||
));
|
||||
$sth->execute();
|
||||
my $rowdata;
|
||||
while ( $rowdata = $sth->fetchrow_hashref() )
|
||||
|
@ -1149,7 +1156,7 @@ sub HandleGPG()
|
|||
}
|
||||
} else {
|
||||
SysLog("Could not find the issued gpg key. ".$row{"id"}."\n");
|
||||
#$dbh->do("delete from `gpg` where `id`='".$row{'id'}."'");
|
||||
$dbh->do(sprintf("update gpg set warning=warning+1 where id=%d", $row{'id'}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue