initial commit of file from CVS for smeserver-unjunkmgr on Sat Sep 7 21:11:06 AEST 2024
This commit is contained in:
@@ -0,0 +1 @@
|
||||
yes
|
@@ -0,0 +1 @@
|
||||
no
|
@@ -0,0 +1 @@
|
||||
yes
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
central.swerts-knudsen.dk
|
@@ -0,0 +1 @@
|
||||
1112
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
yes
|
28
root/etc/e-smith/templates/etc/crontab/unjunk
Normal file
28
root/etc/e-smith/templates/etc/crontab/unjunk
Normal 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";
|
||||
}
|
||||
}
|
||||
|
33
root/etc/e-smith/templates/etc/crontab/unjunkstats
Normal file
33
root/etc/e-smith/templates/etc/crontab/unjunkstats
Normal 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";
|
||||
}
|
||||
}
|
||||
|
@@ -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";
|
||||
}
|
||||
|
28
root/etc/e-smith/web/functions/unjunkmgr
Normal file
28
root/etc/e-smith/web/functions/unjunkmgr
Normal 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;
|
||||
|
40
root/etc/mrtg/unjunkstats.cfg
Normal file
40
root/etc/mrtg/unjunkstats.cfg
Normal 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]: Spam:
|
||||
LegendO[spam]: Scanned:
|
||||
Legend1[spam]: Spam:
|
||||
Legend2[spam]: Scanned:
|
||||
Legend3[spam]:
|
||||
Legend4[spam]:
|
||||
Legend5[spam]: 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]: Virus:
|
||||
LegendO[virus]: Scanned:
|
||||
Legend1[virus]: Virus:
|
||||
Legend2[virus]: Scanned:
|
||||
Legend3[virus]:
|
||||
Legend4[virus]:
|
||||
Legend5[virus]: Virus Percent:
|
||||
Colours[virus]: RED#FF0000,DARK GREEN#23D016,WHITE#FFFFFF,WHITE#FFFFFF,RED#FF0000
|
Reference in New Issue
Block a user