More logging cleanup in expire.php. Some Mail updates.
This commit is contained in:
parent
fdce46d15f
commit
5e55fdc7f3
|
@ -1670,6 +1670,9 @@ function write_access_log() {
|
|||
|
||||
function verify_gpg_signature($res, $signed_text) {
|
||||
$result = gnupg_verify($res,$signed_text,false);
|
||||
if ($result == false) {
|
||||
return false;
|
||||
}
|
||||
if ((($result[0]['summary'] > 3)) || $result[0]['validity'] == 2){
|
||||
return false; // Bad signature
|
||||
} else {
|
||||
|
|
|
@ -42,8 +42,10 @@
|
|||
$showme = date('d M, Y', $expireme);
|
||||
|
||||
echo "Expire $group articles before $showme\n";
|
||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name." ".$group." Expiring: articles before ".$showme, FILE_APPEND);
|
||||
|
||||
echo "Expiring overview database...\n";
|
||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name." ".$group." Expiring overview database...", FILE_APPEND);
|
||||
$database = $spooldir.'/articles-overview.db3';
|
||||
$dbh = rslight_db_open($database);
|
||||
$query = $dbh->prepare('DELETE FROM overview WHERE newsgroup=:newsgroup AND date<:expireme');
|
||||
|
@ -52,6 +54,7 @@ echo "Expiring overview database...\n";
|
|||
|
||||
if($CONFIG['article_database'] == '1') {
|
||||
echo "Expiring article database...\n";
|
||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name." ".$group." Expiring article database...", FILE_APPEND);
|
||||
$database = $spooldir.'/'.$group.'-articles.db3';
|
||||
if(is_file($database)) {
|
||||
$articles_dbh = article_db_open($database);
|
||||
|
@ -62,6 +65,7 @@ echo "Expiring article database...\n";
|
|||
}
|
||||
|
||||
echo "Expiring group overview file...\n";
|
||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name." ".$group." Expiring group overview file...", FILE_APPEND);
|
||||
$grouppath = preg_replace('/\./', '/', $group);
|
||||
$this_overview=$spooldir.'/'.$group.'-overview';
|
||||
$out_overview=$this_overview.'.new';
|
||||
|
@ -71,7 +75,7 @@ echo "Expiring group overview file...\n";
|
|||
$break=explode("\t", $line);
|
||||
if(strtotime($break[3]) < $expireme) {
|
||||
echo "Expiring: ".$break[4]." IN: ".$group." #".$break[0]."\r\n";
|
||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Expiring: ".$break[4]." IN: ".$group." #".$break[0], FILE_APPEND);
|
||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name." ".$group." Expiring: ".$break[4], FILE_APPEND);
|
||||
// Remove article from tradspool:
|
||||
unlink($spooldir.'/articles/'.$grouppath.'/'.$break[0]);
|
||||
thread_cache_removearticle($group,$break[4]);
|
||||
|
|
|
@ -28,6 +28,29 @@ if(!is_dir($bbsmail_path.'out')) {
|
|||
putenv("GNUPGHOME=".$rslight_gpg['gnupghome']);
|
||||
$res = gnupg_init();
|
||||
|
||||
$gnupg_summary = array(
|
||||
"1" => "The signature is fully valid",
|
||||
"2" => "The signature is good",
|
||||
"4" => "The signature is bad",
|
||||
"16" => "One key has been revoked",
|
||||
"32" => "One key has expired",
|
||||
"64" => "The signature has expired",
|
||||
"128" => "Can't verify: key missing",
|
||||
"256" => "CRL not available",
|
||||
"512" => "Available CRL is too old",
|
||||
"1024" => "A policy was not met",
|
||||
"2048" => "A system error occured"
|
||||
);
|
||||
|
||||
$gnupg_validity = array(
|
||||
"0" => "Validity: UNKNOWN",
|
||||
"1" => "Validity: UNDEFINED",
|
||||
"2" => "Validity: NEVER",
|
||||
"3" => "Validity: MARGINAL",
|
||||
"4" => "Validity: FULL",
|
||||
"5" => "Validity: ULTIMATE"
|
||||
);
|
||||
|
||||
/***** Send mail *****/
|
||||
// $messages=scandir($bbsmail_path.'/out/');
|
||||
|
||||
|
@ -53,22 +76,30 @@ $res = gnupg_init();
|
|||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name.' Key not found in keyring for: '.$inspect['mailkey_domain'], FILE_APPEND);
|
||||
}
|
||||
} else {
|
||||
echo 'BAD signature in: "'.$filename.'"'."\n";
|
||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name.' BAD signature in: "'.$filename.'"', FILE_APPEND);
|
||||
echo 'BAD or UNKNOWN signature in: "'.$filename.'"'."\n";
|
||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name.' BAD or UNKNOWN signature in: "'.$filename.'"', FILE_APPEND);
|
||||
}
|
||||
}
|
||||
if($inspect['type'] == 'bbsmail') {
|
||||
$info = gnupg_decryptverify($res,$inspect['body'],$plaintext);
|
||||
echo "\n".$plaintext."\n";
|
||||
if($info !== false) {
|
||||
echo 'GOOD signature in: "'.$filename.'"'."\n";
|
||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name.' GOOD signature in: "'.$filename.'"', FILE_APPEND);
|
||||
if($info[0]['summary'] > 3) {
|
||||
echo $gnupg_summary[$info[0]['summary']]." in: ".$filename."\n";
|
||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name." ".$gnupg_summary[$info[0]['summary']]." in: ".$filename, FILE_APPEND);
|
||||
} else {
|
||||
echo 'GOOD signature in: "'.$filename.'"'."\n";
|
||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name.' GOOD signature in: "'.$filename.'"', FILE_APPEND);
|
||||
}
|
||||
} else {
|
||||
$error = gnupg_geterror($res);
|
||||
echo 'BAD signature in: "'.$filename.'"'."\n";
|
||||
echo $error."\n";
|
||||
file_put_contents($logfile, "\n".format_log_date()." ".$config_name.' BAD signature in: "'.$filename.'" '.$error, FILE_APPEND);
|
||||
}
|
||||
|
||||
// echo "SUMMARY: ".$gnupg_summary[$info[0]['summary']]."\n";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue