From 9013d73f2a4fa337c232f0731cb6a63dd17b2135 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sun, 31 Dec 2023 09:51:53 -0700 Subject: [PATCH] Initial changes to format of spam.log. --- Rocksolid_Light/rocksolid/newsportal.php | 6 +++--- Rocksolid_Light/rslight/scripts/rslight-lib.php | 12 +++++++----- Rocksolid_Light/rslight/scripts/spoolnews.php | 10 ++++++---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index c8c3d46..1b0eadb 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -1363,10 +1363,10 @@ function check_spam($subject, $from, $newsgroups, $ref, $body, $msgid, $useheade } unlink($spamfile); if ($res === 1) { - file_put_contents($logfile, "\n" . format_log_date() . " identified spam: " . $from . " " . $newsgroups . " " . $msgid, FILE_APPEND); + file_put_contents($logfile, "\n" . format_log_date() . " spamc:\tSPAM\t" . $msgid . "\t" . $newsgroups . "\t" . $from, FILE_APPEND); file_put_contents($spamdir . '/' . $msgid, $spamresult); } else { - file_put_contents($logfile, "\n" . format_log_date() . " clean message: " . $from . " " . $newsgroups . " " . $msgid, FILE_APPEND); + file_put_contents($logfile, "\n" . format_log_date() . " spamc:\tHAM\t" . $msgid . "\t" . $newsgroups . "\t" . $from, FILE_APPEND); } return array( 'res' => $res, @@ -1794,7 +1794,7 @@ function get_config_file_value($configfile, $request) } } -// This function is specific to user configuration values +// This function is specific to $config_dir configuration values function get_config_value($configfile, $request) { global $config_dir; diff --git a/Rocksolid_Light/rslight/scripts/rslight-lib.php b/Rocksolid_Light/rslight/scripts/rslight-lib.php index 089578d..1c01700 100644 --- a/Rocksolid_Light/rslight/scripts/rslight-lib.php +++ b/Rocksolid_Light/rslight/scripts/rslight-lib.php @@ -395,6 +395,12 @@ function process_post($message, $group) } } } + if ($no_mid == 1) { + $identity = $subject . "," . $from[1] . "," . $ngroups[1] . "," . $references . "," . $body; + $msgid = '<' . md5($identity) . '$1@' . trim($CONFIG['email_tail'], '@') . '>'; + } else { + $msgid = $mid[1]; + } /* * SPAM CHECK */ @@ -416,7 +422,7 @@ function process_post($message, $group) $section = get_section_by_group($group); @mkdir($spooldir . "/" . $section . "/outgoing", 0755, 'recursive'); - $postfilename = $spooldir . '/' . $section . '/outgoing/' . $mid[1] . '.msg'; + $postfilename = $spooldir . '/' . $section . '/outgoing/' . $msgid . '.msg'; $postfilehandle = fopen($postfilename, 'w'); if ($no_date == 1) { $article_date = time(); @@ -426,11 +432,7 @@ function process_post($message, $group) $date_rep = $finddate[1]; } if ($no_mid == 1) { - $identity = $subject . "," . $from[1] . "," . $ngroups[1] . "," . $references . "," . $body; - $msgid = '<' . md5($identity) . '$1@' . trim($CONFIG['email_tail'], '@') . '>'; fputs($postfilehandle, "Message-ID: " . $msgid . "\r\n"); - } else { - $msgid = $mid[1]; } if ($no_org == 1) { fputs($postfilehandle, "Organization: " . $CONFIG['organization'] . "\r\n"); diff --git a/Rocksolid_Light/rslight/scripts/spoolnews.php b/Rocksolid_Light/rslight/scripts/spoolnews.php index 3cb98ce..34d5b55 100644 --- a/Rocksolid_Light/rslight/scripts/spoolnews.php +++ b/Rocksolid_Light/rslight/scripts/spoolnews.php @@ -39,6 +39,7 @@ if (isset($OVERRIDES['save_nocem_messages']) && $OVERRIDES['save_nocem_messages' $file_groups = $config_path . "groups.txt"; $local_groupfile = $spooldir . "/" . $config_name . "/local_groups.txt"; $logfile = $logdir . '/spoolnews.log'; +$spamlog = $logdir . '/spam.log'; # END MAIN CONFIGURATION @mkdir($spooldir . "/" . $config_name, 0755, 'recursive'); @@ -150,7 +151,7 @@ echo "\nSpoolnews Done\n"; function get_articles($ns, $group) { - global $enable_rslight, $rslight_gpg, $spooldir, $nocem_dir, $save_nocem_messages, $CONFIG, $OVERRIDES, $user_ban_file, $maxarticles_per_run, $maxfirstrequest, $workpath, $path, $remote_groupfile, $local_groupfile, $local, $logdir, $config_name, $logfile; + global $enable_rslight, $rslight_gpg, $spooldir, $nocem_dir, $save_nocem_messages, $CONFIG, $OVERRIDES, $user_ban_file, $maxarticles_per_run, $maxfirstrequest, $workpath, $path, $remote_groupfile, $local_groupfile, $local, $logdir, $config_name, $spamlog, $logfile; if ($ns == false) { file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Lost connection to " . $CONFIG['remote_server'] . ":" . $CONFIG['remote_port'], FILE_APPEND); @@ -158,7 +159,7 @@ function get_articles($ns, $group) } $grouppath = $path . preg_replace('/\./', '/', $group); - $banned_names = file($user_ban_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); +// $banned_names = file($user_ban_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $msgid_filter = get_config_value('header_filters.conf', 'Message-ID'); $subject_filter = get_config_value('header_filters.conf', 'Subject'); $from_filter = get_config_value('header_filters.conf', 'From'); @@ -376,9 +377,10 @@ function get_articles($ns, $group) $lines = $lines - 1; $bytes = $bytes + ($lines * 2); // Don't spool article if $banned != 0 - if ($banned != false) { + if ($banned !== false) { unlink($articleHandle); - file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Skipping: " . $CONFIG['remote_server'] . " " . $group . ":" . $article . " banned in " . $banned, FILE_APPEND); + file_put_contents($spamlog, "\n" . format_log_date() . " ".$banned." :\tSPAM\t" . $mid[1] . "\t" . $groupnames[1] . "\t" . $from[1], FILE_APPEND); +// file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Skipping: " . $CONFIG['remote_server'] . " " . $group . ":" . $article . " banned in " . $banned, FILE_APPEND); $article ++; } else { if ((strpos($CONFIG['nocem_groups'], $group) !== false) && ($CONFIG['enable_nocem'] == true)) {