initial commit of file from CVS for smeserver-unjunkmgr on Sat Sep 7 21:11:06 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 21:11:06 +10:00
parent 14a99ec4d0
commit 320f4a90e3
24 changed files with 2484 additions and 2 deletions

View File

@@ -0,0 +1 @@
yes

View File

@@ -0,0 +1 @@
no

View File

@@ -0,0 +1 @@
yes

View File

@@ -0,0 +1 @@
enabled

View File

@@ -0,0 +1 @@
central.swerts-knudsen.dk

View File

@@ -0,0 +1 @@
1112

View File

@@ -0,0 +1 @@
service

View File

@@ -0,0 +1 @@
yes

View File

@@ -0,0 +1,28 @@
{
use esmith::ConfigDB;
my $dbh = esmith::ConfigDB->open()
|| die "Unable to open configuration dbase.";
my %sa_conf = $dbh->get('unjunkmgr')->props;
while ( my ( $parameter, $value ) = each(%sa_conf) ) {
if ( $parameter eq 'enabled' ) {
$enabled = $value;
}
if ( $parameter eq 'useremails' ) {
$user_emails = $value;
}
}
$OUT = "";
if ( uc($enabled) eq 'YES' ) {
$OUT .= "# Schedule the UnJunk every 5 minutes\n";
$OUT
.= "0-59/5 * * * * root /usr/local/unjunkmgr/spamchanger.pl -file=/tmp/unjunk.file\n";
$OUT .= "\n";
$OUT
.= "# Schedule the weekly Blocked Junk Summary to arrive at 1PM Friday\n";
$OUT .= "0 13 * * 5 root /usr/local/unjunkmgr/spamreminder.pl\n";
}
}

View File

@@ -0,0 +1,33 @@
{
use esmith::ConfigDB;
my $dbh = esmith::ConfigDB->open()
|| die "Unable to open configuration dbase.";
my %sa_conf = $dbh->get('unjunkmgr')->props;
while ( my ( $parameter, $value ) = each(%sa_conf) ) {
if ( $parameter eq 'enabled' ) {
$enabled = $value;
}
}
$OUT = "";
if ( uc($enabled) eq 'YES' ) {
my $random_hour = 5 + int( rand(50) );
$OUT .= "# Hourly Antivirus stats (random minute)\n";
$OUT .= $random_hour . " * * * * root /usr/local/unjunkmgr/spamfilter-statsclient.pl viruswebstats hour\n";
$OUT .= "# The last 24 hour Antivirus stats (random minute)\n";
$OUT .= $random_hour . " * * * * root /usr/local/unjunkmgr/spamfilter-statsclient.pl viruswebstats day\n";
$OUT .= "# Hourly Spam stats (random minute)\n";
$OUT .= $random_hour . " * * * * root /usr/local/unjunkmgr/spamfilter-statsclient.pl spamwebstats hour\n";
$OUT .= "# The last 24 hour Spam stats (random minute)\n";
$OUT .= $random_hour . " * * * * root /usr/local/unjunkmgr/spamfilter-statsclient.pl spamwebstats day\n";
$OUT .= "\n";
$OUT .= "# Now get the MRTG stats run\n";
$OUT .= $random_hour . ' * * * * root /usr/bin/mrtg /etc/mrtg/unjunkstats.cfg >/dev/null 2>&1';
$OUT .= "\n";
}
}

View File

@@ -0,0 +1,46 @@
{
use esmith::NetworksDB;
use esmith::ConfigDB;
my $ndb = esmith::NetworksDB->open_ro();
$localAccess = $ndb->local_access_spec();
$localAccess =~ s#/255\.255\.255\.255##g;
my $dbh = esmith::ConfigDB->open() || die "Unable to open configuration dbase.";
my %sa_conf = $dbh->get('unjunkmgr')->props;
while (my ($parameter,$value) = each(%sa_conf)) {
if ($parameter eq 'LocalOnly') {
$local = $value;
}
if ($parameter eq 'enabled') {
$enabled = $value;
}
}
$OUT = "";
if (not (uc($enabled) eq 'YES')) {
return;
}
$OUT .= "# This is the location of the UnJunk web interface\n";
$OUT .= "AddHandler cgi-script .pl\n";
$OUT .= "Alias /unjunkmgr /usr/local/unjunkmgr\n";
$OUT .= "<Directory /usr/local/unjunkmgr>\n";
$OUT .= " Options +FollowSymLinks +ExecCGI\n";
$OUT .= " AllowOverride All\n";
$OUT .= " <FilesMatch \.php\$\>\n";
$OUT .= " SetHandler \"proxy:unix:/var/run/php-fpm/php$version.sock|fcgi://localhost\"\n";
$OUT .= " </FilesMatch>\n";
if (uc($local) eq 'YES') {
$OUT .= " Require ip $localAccess\n";
} else {
$OUT .= " Require all granted\n";
}
$OUT .= "</Directory>\n";
}

View File

@@ -0,0 +1,28 @@
#!/usr/bin/perl
#----------------------------------------------------------------------
# heading : Administration
# description : Unjunkmgr
# navigation : 4000 4200
#----------------------------------------------------------------------
use strict;
use CGI ':all';
use CGI::Carp qw(fatalsToBrowser);
BEGIN {
$ENV{'PATH'} = '/bin:/usr/bin:/sbin';
$ENV{'SHELL'} = '/bin/bash';
delete $ENV{'ENV'};
}
my $q = new CGI;
my $content
= "0; url=https://" . $ENV{'HTTP_X_FORWARDED_HOST'} . "/unjunkmgr";
$q->default_dtd('-//W3C//DTD XHTML 1.0 Transitional//EN');
print $q->header('text/html');
print $q->start_html(
-head => meta( { -http_equiv => 'refresh', -content => $content } ) );
print $q->end_html;

View File

@@ -0,0 +1,40 @@
workdir: /usr/local/unjunkmgr/
interval: 60
#---------------------------------------------------------------
Target[spam]: `/usr/local/unjunkmgr/spamfilter-statsclient.pl spam hour`
AddHead[spam]: <link rel="stylesheet" type="text/css" href="unjunkmgr.css">
MaxBytes[spam]: 100000
Options[spam]: gauge,nopercent,dorelpercent,nobanner,nolegend
Title[spam]: Spam Statistics
PageTop[spam]: <H1> Email Spam Statistics</H1>
WithPeak[spam]: dwmy
YLegend[spam]: messages
ShortLegend[spam]: messages
LegendI[spam]: &nbsp;Spam:
LegendO[spam]: &nbsp;Scanned:
Legend1[spam]: &nbsp;Spam:
Legend2[spam]: &nbsp;Scanned:
Legend3[spam]:
Legend4[spam]:
Legend5[spam]: &nbsp;Spam Percent:
Colours[spam]: RED#FF0000,DARK GREEN#23D016,WHITE#FFFFFF,WHITE#FFFFFF,RED#FF0000
Target[virus]: `/usr/local/unjunkmgr/spamfilter-statsclient.pl virus hour`
AddHead[virus]: <link rel="stylesheet" type="text/css" href="unjunkmgr.css">
MaxBytes[virus]: 100000
Options[virus]: gauge,nopercent,dorelpercent,nobanner,nolegend
Title[virus]: Virus Statistics
PageTop[virus]: <H1> Email Virus Statistics</H1>
WithPeak[virus]: dwmy
YLegend[virus]: messages
ShortLegend[virus]: messages
LegendI[virus]: &nbsp;Virus:
LegendO[virus]: &nbsp;Scanned:
Legend1[virus]: &nbsp;Virus:
Legend2[virus]: &nbsp;Scanned:
Legend3[virus]:
Legend4[virus]:
Legend5[virus]: &nbsp;Virus Percent:
Colours[virus]: RED#FF0000,DARK GREEN#23D016,WHITE#FFFFFF,WHITE#FFFFFF,RED#FF0000