initial commit of file from CVS for smeserver-smeadmin on Sat Sep 7 16:42:16 AEST 2024
This commit is contained in:
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
admin
|
@@ -0,0 +1 @@
|
||||
smeadmin
|
@@ -0,0 +1 @@
|
||||
pass
|
@@ -0,0 +1 @@
|
||||
smeadmin
|
@@ -0,0 +1 @@
|
||||
PNG
|
@@ -0,0 +1 @@
|
||||
250
|
@@ -0,0 +1 @@
|
||||
500
|
@@ -0,0 +1 @@
|
||||
1
|
@@ -0,0 +1 @@
|
||||
4
|
@@ -0,0 +1 @@
|
||||
2
|
@@ -0,0 +1 @@
|
||||
50
|
@@ -0,0 +1 @@
|
||||
60
|
@@ -0,0 +1 @@
|
||||
1
|
@@ -0,0 +1 @@
|
||||
40
|
@@ -0,0 +1 @@
|
||||
40
|
@@ -0,0 +1 @@
|
||||
5
|
@@ -0,0 +1 @@
|
||||
5
|
@@ -0,0 +1 @@
|
||||
5
|
@@ -0,0 +1 @@
|
||||
2
|
@@ -0,0 +1 @@
|
||||
1
|
@@ -0,0 +1 @@
|
||||
|
@@ -0,0 +1 @@
|
||||
www.google.fr
|
@@ -0,0 +1 @@
|
||||
temp1
|
@@ -0,0 +1 @@
|
||||
temp2
|
@@ -0,0 +1 @@
|
||||
fan1
|
@@ -0,0 +1 @@
|
||||
3
|
@@ -0,0 +1 @@
|
||||
admin
|
@@ -0,0 +1 @@
|
||||
off
|
1
root/etc/e-smith/db/configuration/defaults/smeadmind/hd1
Normal file
1
root/etc/e-smith/db/configuration/defaults/smeadmind/hd1
Normal file
@@ -0,0 +1 @@
|
||||
sda
|
1
root/etc/e-smith/db/configuration/defaults/smeadmind/hd2
Normal file
1
root/etc/e-smith/db/configuration/defaults/smeadmind/hd2
Normal file
@@ -0,0 +1 @@
|
||||
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
139
root/etc/e-smith/db/configuration/migrate/smeadmin
Normal file
139
root/etc/e-smith/db/configuration/migrate/smeadmin
Normal file
@@ -0,0 +1,139 @@
|
||||
{
|
||||
use MIME::Base64 qw(encode_base64);
|
||||
|
||||
my $smeadmindb = $DB->get('smeadmind') || $DB->new_record("smeadmind",{type=>'service'});
|
||||
|
||||
$pw = "not set due to error";
|
||||
|
||||
if ( open( RANDOM, "/dev/urandom" ) ){
|
||||
my $buf;
|
||||
if ( read( RANDOM, $buf, 25 ) != 25 ){
|
||||
warn("Short read from /dev/random: $!");
|
||||
}
|
||||
else{
|
||||
$pw = encode_base64($buf);
|
||||
chomp $pw;
|
||||
}
|
||||
close RANDOM;
|
||||
}
|
||||
else{
|
||||
warn "Could not open /dev/urandom: $!";
|
||||
}
|
||||
|
||||
# let's migrate sme9admind values to smeadmind
|
||||
if ( defined $sme9admind && ! defined $smeadmind ) {
|
||||
for my $propertie (keys %sme9admind) {
|
||||
next if $propertie eq "DbName" || $propertie eq "DbUser";
|
||||
$smeadmindb->set_prop($propertie, $sme9admind{$propertie});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$smeadmindb->set_prop('DbPassword', $pw) if not $smeadmindb->prop('DbPassword');
|
||||
|
||||
if ( -e "/etc/e-smith/web/panels/manager/html/smeadmin/_smeadmin.conf" ){
|
||||
open(CONF,"</etc/e-smith/web/panels/manager/html/smeadmin/_smeadmin.conf");
|
||||
my @confs = <CONF>;
|
||||
close(CONF);
|
||||
foreach (@confs){
|
||||
foreach my $key (qw(
|
||||
db_database
|
||||
db_password
|
||||
db_username
|
||||
img_format
|
||||
img_width
|
||||
img_height
|
||||
other_mail_address_domains
|
||||
ping_target
|
||||
hddtemp_first_hd
|
||||
hddtemp_second_hd
|
||||
du_enabled
|
||||
sensors_first_temp_tag
|
||||
sensors_second_temp_tag
|
||||
sensors_fan_tag
|
||||
limit_pppoe_disconnection
|
||||
limit_pppoe_duration
|
||||
limit_vpn_duration
|
||||
mail_alert_recipient
|
||||
mail_status_recipient
|
||||
mail_status_delay_between
|
||||
max_mail_in
|
||||
max_mail_out
|
||||
max_hd_used
|
||||
max_cpu_total
|
||||
max_temp_hard
|
||||
max_temp_hd
|
||||
max_sessions_samba
|
||||
max_sessions_ssh
|
||||
max_sessions_ftp
|
||||
max_sessions_vpn
|
||||
)){
|
||||
# valeur = partie droite de la ligne contenant $key dans le fichier
|
||||
if ($_ =~ /\s*$key\s*=\s*(.*)/){
|
||||
$params{$key} = $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
# Si la valeur dans la db est diférente de la valeur trouve dans le fichier, alors on met a jour la db
|
||||
$smeadmindb->set_prop('DbName',$params{'db_database'});
|
||||
# if ($smeadmindb->prop('DbName') ne $params{'db_database'});
|
||||
$smeadmindb->set_prop('DbPassword',$params{'db_password'});
|
||||
# if ($smeadmindb->prop('DbPassword') ne $params{'db_password'});
|
||||
$smeadmindb->set_prop('DbUser',$params{'db_username'});
|
||||
# if ($smeadmindb->prop('DbUser') ne $params{'db_username'});
|
||||
$smeadmindb->set_prop('ImgFormat',$params{'img_format'});
|
||||
# if ($smeadmindb->prop('ImgFormat') ne $params{'img_format'});
|
||||
$smeadmindb->set_prop('ImgWidth',$params{'img_width'});
|
||||
# if ($smeadmindb->prop('ImgWidth') ne $params{'img_width'});
|
||||
$smeadmindb->set_prop('ImgHeight',$params{'img_height'});
|
||||
# if ($smeadmindb->prop('ImgHeight') ne $params{'img_height'});
|
||||
$smeadmindb->set_prop('OtherMailDomains',$params{'other_mail_address_domains'});
|
||||
# if ($smeadmindb->prop('OtherMailDomains') ne $params{'other_mail_address_domains'});
|
||||
$smeadmindb->set_prop('PingTarget',$params{'ping_target'});
|
||||
# if ($smeadmindb->prop('PingTarget') ne $params{'ping_target'});
|
||||
$smeadmindb->set_prop('hd1',$params{'hddtemp_first_hd'});
|
||||
# if ($smeadmindb->prop('hd1') ne $params{'hddtemp_first_hd'});
|
||||
$smeadmindb->set_prop('hd2',$params{'hddtemp_second_hd'});
|
||||
# if ($smeadmindb->prop('hd2') ne $params{'hddtemp_second_hd'});
|
||||
$smeadmindb->set_prop('UseDu',$params{'du_enabled'});
|
||||
# if ($smeadmindb->prop('UseDu') ne $params{'du_enabled'});
|
||||
$smeadmindb->set_prop('SensorsTag1',$params{'sensors_first_temp_tag'});
|
||||
# if ($smeadmindb->prop('SensorsTag1') ne $params{'sensors_first_temp_tag'});
|
||||
$smeadmindb->set_prop('SensorsTag2',$params{'sensors_second_temp_tag'});
|
||||
# if ($smeadmindb->prop('SensorsTag2') ne $params{'sensors_second_temp_tag'});
|
||||
$smeadmindb->set_prop('SensorsTagFan',$params{'sensors_fan_tag'});
|
||||
# if ($smeadmindb->prop('SensorsTagFan') ne $params{'sensors_fan_tag'});
|
||||
$smeadmindb->set_prop('LimitPppoeDisconnect',$params{'limit_pppoe_disconnection'});
|
||||
# if ($smeadmindb->prop('LimitPppoeDisconnect') ne $params{'limit_pppoe_disconnection'});
|
||||
$smeadmindb->set_prop('LimitPppoeDuration',$params{'limit_pppoe_duration'});
|
||||
# if ($smeadmindb->prop('LimitPppoeDuration') ne $params{'limit_pppoe_duration'});
|
||||
$smeadmindb->set_prop('LimitVpnDuration',$params{'limit_vpn_duration'});
|
||||
# if ($smeadmindb->prop('LimitVpnDuration') ne $params{'limit_vpn_duration'});
|
||||
$smeadmindb->set_prop('AlertMailRecipient',$params{'mail_alert_recipient'});
|
||||
# if ($smeadmindb->prop('AlertMailRecipient') ne $params{'mail_alert_recipient'});
|
||||
$smeadmindb->set_prop('StatusMailRecipient',$params{'mail_status_recipient'});
|
||||
# if ($smeadmindb->prop('StatusMailRecipient') ne $params{'mail_status_recipient'});
|
||||
$smeadmindb->set_prop('StatusInterval',$params{'mail_status_delay_between'});
|
||||
# if ($smeadmindb->prop('StatusInterval') ne $params{'mail_status_delay_between'});
|
||||
$smeadmindb->set_prop('MaxMailIn',$params{'max_mail_in'});
|
||||
# if ($smeadmindb->prop('MaxMailIn') ne $params{'max_mail_in'});
|
||||
$smeadmindb->set_prop('MaxMailOut',$params{'max_mail_out'});
|
||||
# if ($smeadmindb->prop('MaxMailOut') ne $params{'max_mail_out'});
|
||||
$smeadmindb->set_prop('MaxDiskSpace',$params{'max_hd_used'});
|
||||
# if ($smeadmindb->prop('MaxDiskSpace') ne $params{'max_hd_used'});
|
||||
$smeadmindb->set_prop('MaxCpu',$params{'max_cpu_total'});
|
||||
# if ($smeadmindb->prop('MaxCpu') ne $params{'max_cpu_total'});
|
||||
$smeadmindb->set_prop('MaxHwTemp',$params{'max_temp_hard'});
|
||||
# if ($smeadmindb->prop('MaxHwTemp') ne $params{'max_temp_hard'});
|
||||
$smeadmindb->set_prop('MaxSamba',$params{'max_sessions_samba'});
|
||||
# if ($smeadmindb->prop('MaxSamba') ne $params{'max_sessions_samba'});
|
||||
$smeadmindb->set_prop('MaxSsh',$params{'max_sessions_ssh'});
|
||||
# if ($smeadmindb->prop('MaxSsh') ne $params{'max_sessions_ssh'});
|
||||
$smeadmindb->set_prop('MaxFtp',$params{'max_sessions_ftp'});
|
||||
# if ($smeadmindb->prop('MaxFtp') ne $params{'max_sessions_ftp'});
|
||||
$smeadmindb->set_prop('MaxVpn',$params{'max_sessions_vpn'});
|
||||
# if ($smeadmindb->prop('MaxVpn') ne $params{'max_sessions_vpn'});
|
||||
system("/bin/mv /etc/e-smith/web/panels/manager/html/smeadmin/_smeadmin.conf /etc/e-smith/web/panels/manager/html/smeadmin/smeadmin.conf.old");
|
||||
}
|
||||
}
|
||||
|
13
root/etc/e-smith/events/actions/smeadmin-parselog
Executable file
13
root/etc/e-smith/events/actions/smeadmin-parselog
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/perl -w
|
||||
# Smeadmin - evenement appele par logrotate
|
||||
# Copyright (C) 2006
|
||||
# This file is distributed under the GPL license.
|
||||
# Landry Breuil <landry@firewall-services.com>, 2006.
|
||||
|
||||
#------------------------------------------------------------
|
||||
# On envoie le signal SIGUSR1 a smeadmind pour qu'il parse les logs
|
||||
#------------------------------------------------------------
|
||||
|
||||
exec("/usr/bin/killall", "-USR1", "smeadmind");
|
||||
# NOTREACHED
|
||||
die("Failed to exec /usr/bin/killall -USR1 smeadmind");
|
@@ -0,0 +1 @@
|
||||
PERMS=0750
|
160
root/etc/e-smith/templates/etc/e-smith/sql/init/smeadmin
Normal file
160
root/etc/e-smith/templates/etc/e-smith/sql/init/smeadmin
Normal file
@@ -0,0 +1,160 @@
|
||||
#!/bin/bash
|
||||
|
||||
# mysql
|
||||
if [ -d /var/lib/mysql/sme9admin ] && [ ! -d /var/lib/mysql/smeadmin ]; then
|
||||
echo "Migrating existing sme9admin MySQL database."
|
||||
mysqladmin create smeadmin
|
||||
mysqldump sme9admin | mysql smeadmin
|
||||
PASS=$(/sbin/e-smith/db configuration getprop smeadmind DbPassword)
|
||||
mysql -e " grant all privileges on smeadmin.* to 'smeadmin'@'localhost' identified by '$PASS'"
|
||||
mysqladmin flush-privileges
|
||||
elif [ -e /var/lib/mysql/smeadmin ]; then
|
||||
# c'est une mise jour, on fait une upgrade de la base si besoin
|
||||
sh /usr/share/doc/smeserver-smeadmin/update-mysql.sh
|
||||
else
|
||||
#si c'est une freshinstall on cree la bd mysql
|
||||
sh /usr/share/doc/smeserver-smeadmin/create-mysql.sh
|
||||
fi
|
||||
|
||||
# rrd
|
||||
# migrating previous sme9admin rrd
|
||||
if [ -d /var/lib/sme9admin ] && [ ! -d /var/lib/smeadmin ]; then
|
||||
echo "Migrating existing sme9admin RRDs files."
|
||||
cp -vr /var/lib/sme9admin /var/lib/smeadmin
|
||||
fi
|
||||
|
||||
#ADD more DS for version 1.5-10
|
||||
#first we test if these DS are already in the sensors.rrd
|
||||
if [[ -f /var/lib/smeadmin/sensors.rrd ]]; then
|
||||
rrdtool dump /var/lib/smeadmin/sensors.rrd > /tmp/new_file.xml
|
||||
testDS=$(grep -w 'fspd2\|thd3\|thd4\|thd5\|thd6' /tmp/new_file.xml)
|
||||
rm -f /tmp/new_file.xml
|
||||
fi
|
||||
# then since the DS are not in the sensors.rrd we create it
|
||||
if [[ -d /var/lib/smeadmin ]] && [[ ! $testDS ]]; then
|
||||
#if (fspd2,thd3,thd4,thd5,thd6) don't exist, then we create it without nuked the data already existent
|
||||
/usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd fspd2:GAUGE:600:0:10000
|
||||
/usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd3:GAUGE:600:0:100
|
||||
/usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd4:GAUGE:600:0:100
|
||||
/usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd5:GAUGE:600:0:100
|
||||
/usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd6:GAUGE:600:0:100
|
||||
|
||||
|
||||
elif [[ ! -d /var/lib/smeadmin ]]; then
|
||||
#si c'est une freshinstall on cree les rrd
|
||||
sh /usr/share/doc/smeserver-smeadmin/create-rrd.sh
|
||||
fi
|
||||
if [[ ! -f /var/lib/smeadmin/qpsmtpd.rrd ]]; then
|
||||
# si le rrd qpsmtpd existe pas (nouveauté SME9)
|
||||
rrdtool create /var/lib/smeadmin/qpsmtpd.rrd -s 300 \
|
||||
DS:check_basicheaders:GAUGE:600:0:U \
|
||||
DS:check_goodrcptto:GAUGE:600:0:U \
|
||||
DS:clamav:GAUGE:600:0:U \
|
||||
DS:karma:GAUGE:600:0:U \
|
||||
DS:tls_failed:GAUGE:600:0:U \
|
||||
DS:rhsbl:GAUGE:600:0:U \
|
||||
DS:check_earlytalker:GAUGE:600:0:U \
|
||||
DS:resolvable_fromhost:GAUGE:600:0:U \
|
||||
DS:dnsbl:GAUGE:600:0:U \
|
||||
DS:fcrdns:GAUGE:600:0:U \
|
||||
DS:spf:GAUGE:600:0:U \
|
||||
DS:check_spamhelo:GAUGE:600:0:U \
|
||||
DS:uribl:GAUGE:600:0:U \
|
||||
DS:dmarc:GAUGE:600:0:U \
|
||||
DS:auth_failed:GAUGE:600:0:U \
|
||||
DS:total_denied:GAUGE:600:0:U \
|
||||
DS:spam_denied:GAUGE:600:0:U \
|
||||
DS:other_denied:GAUGE:600:0:U \
|
||||
DS:spam_queued:GAUGE:600:0:U \
|
||||
DS:queued:GAUGE:600:0:U \
|
||||
DS:total:GAUGE:600:0:U \
|
||||
RRA:AVERAGE:0.5:1:12 \
|
||||
RRA:AVERAGE:0.5:1:72 \
|
||||
RRA:AVERAGE:0.5:1:288 \
|
||||
RRA:AVERAGE:0.5:6:336 \
|
||||
RRA:AVERAGE:0.5:24:372 \
|
||||
RRA:AVERAGE:0.5:288:365 \
|
||||
RRA:MAX:0.5:1:12 \
|
||||
RRA:MAX:0.5:1:72 \
|
||||
RRA:MAX:0.5:1:288 \
|
||||
RRA:MAX:0.5:6:336 \
|
||||
RRA:MAX:0.5:24:372 \
|
||||
RRA:MAX:0.5:288:365 \
|
||||
RRA:MIN:0.5:1:12 \
|
||||
RRA:MIN:0.5:1:72 \
|
||||
RRA:MIN:0.5:1:288 \
|
||||
RRA:MIN:0.5:6:336 \
|
||||
RRA:MIN:0.5:24:372 \
|
||||
RRA:MIN:0.5:288:365
|
||||
|
||||
else
|
||||
/usr/bin/rrdinfo /var/lib/smeadmin/qpsmtpd.rrd|grep auth_failed > /dev/null
|
||||
if [ $? -eq 1 ]; then
|
||||
/usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin qpsmtpd.rrd auth_failed:GAUGE:600:0:U
|
||||
fi
|
||||
fi
|
||||
if [[ ! -f /var/lib/smeadmin/qmail.rrd ]]; then
|
||||
# nombre et raisons de connexions refusées ou acceptées et file d'attente
|
||||
rrdtool create /var/lib/smeadmin/qmail.rrd -s 300 \
|
||||
DS:local_failure:GAUGE:600:0:U \
|
||||
DS:local_deferral:GAUGE:600:0:U \
|
||||
DS:local_success:GAUGE:600:0:U \
|
||||
DS:local_total:GAUGE:600:0:U \
|
||||
DS:remote_failure:GAUGE:600:0:U \
|
||||
DS:remote_deferral:GAUGE:600:0:U \
|
||||
DS:remote_success:GAUGE:600:0:U \
|
||||
DS:remote_total:GAUGE:600:0:U \
|
||||
DS:local_queue:GAUGE:600:0:U \
|
||||
DS:remote_queue:GAUGE:600:0:U \
|
||||
RRA:AVERAGE:0.5:1:12 \
|
||||
RRA:AVERAGE:0.5:1:72 \
|
||||
RRA:AVERAGE:0.5:1:288 \
|
||||
RRA:AVERAGE:0.5:6:336 \
|
||||
RRA:AVERAGE:0.5:24:372 \
|
||||
RRA:AVERAGE:0.5:288:365 \
|
||||
RRA:MAX:0.5:1:12 \
|
||||
RRA:MAX:0.5:1:72 \
|
||||
RRA:MAX:0.5:1:288 \
|
||||
RRA:MAX:0.5:6:336 \
|
||||
RRA:MAX:0.5:24:372 \
|
||||
RRA:MAX:0.5:288:365 \
|
||||
RRA:MIN:0.5:1:12 \
|
||||
RRA:MIN:0.5:1:72 \
|
||||
RRA:MIN:0.5:1:288 \
|
||||
RRA:MIN:0.5:6:336 \
|
||||
RRA:MIN:0.5:24:372 \
|
||||
RRA:MIN:0.5:288:365
|
||||
fi
|
||||
if [[ ! -f /var/lib/smeadmin/altqmail.rrd ]]; then
|
||||
# nombre et raisons de connexions refusées ou acceptées et file d'attente
|
||||
rrdtool create /var/lib/smeadmin/altqmail.rrd -s 300 \
|
||||
DS:local_failure:GAUGE:600:0:U \
|
||||
DS:local_deferral:GAUGE:600:0:U \
|
||||
DS:local_success:GAUGE:600:0:U \
|
||||
DS:local_total:GAUGE:600:0:U \
|
||||
DS:remote_failure:GAUGE:600:0:U \
|
||||
DS:remote_deferral:GAUGE:600:0:U \
|
||||
DS:remote_success:GAUGE:600:0:U \
|
||||
DS:remote_total:GAUGE:600:0:U \
|
||||
DS:local_queue:GAUGE:600:0:U \
|
||||
DS:remote_queue:GAUGE:600:0:U \
|
||||
RRA:AVERAGE:0.5:1:12 \
|
||||
RRA:AVERAGE:0.5:1:72 \
|
||||
RRA:AVERAGE:0.5:1:288 \
|
||||
RRA:AVERAGE:0.5:6:336 \
|
||||
RRA:AVERAGE:0.5:24:372 \
|
||||
RRA:AVERAGE:0.5:288:365 \
|
||||
RRA:MAX:0.5:1:12 \
|
||||
RRA:MAX:0.5:1:72 \
|
||||
RRA:MAX:0.5:1:288 \
|
||||
RRA:MAX:0.5:6:336 \
|
||||
RRA:MAX:0.5:24:372 \
|
||||
RRA:MAX:0.5:288:365 \
|
||||
RRA:MIN:0.5:1:12 \
|
||||
RRA:MIN:0.5:1:72 \
|
||||
RRA:MIN:0.5:1:288 \
|
||||
RRA:MIN:0.5:6:336 \
|
||||
RRA:MIN:0.5:24:372 \
|
||||
RRA:MIN:0.5:288:365
|
||||
fi
|
||||
|
2020
root/etc/e-smith/web/functions/smeadmin
Executable file
2020
root/etc/e-smith/web/functions/smeadmin
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user