Add perl files from smeserver-manager on CVS
This commit is contained in:
parent
cce958acd7
commit
25474c4922
@ -0,0 +1 @@
|
|||||||
|
enabled
|
2
root/etc/e-smith/db/configuration/defaults/smanager/type
Normal file
2
root/etc/e-smith/db/configuration/defaults/smanager/type
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
service
|
||||||
|
|
38
root/etc/e-smith/db/configuration/migrate/smanager
Normal file
38
root/etc/e-smith/db/configuration/migrate/smanager
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
sub gen_pwd {
|
||||||
|
use MIME::Base64 qw(encode_base64);
|
||||||
|
my $p = "not set due to error";
|
||||||
|
if ( open( RANDOM, "/dev/urandom" ) ){
|
||||||
|
my $buf;
|
||||||
|
# 57 bytes is a full line of Base64 coding, and contains
|
||||||
|
# 456 bits of randomness - given a perfectly random /dev/random
|
||||||
|
if ( read( RANDOM, $buf, 57 ) != 57 ){
|
||||||
|
warn("Short read from /dev/random: $!");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$p = encode_base64($buf);
|
||||||
|
chomp $p;
|
||||||
|
}
|
||||||
|
close RANDOM;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
warn "Could not open /dev/urandom: $!";
|
||||||
|
}
|
||||||
|
return $p;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $rec = $DB->get('smanager')
|
||||||
|
|| $DB->new_record('smanager', {type => 'service'});
|
||||||
|
|
||||||
|
my $pwd = $rec->prop('Secrets');
|
||||||
|
if (not $pwd or length($pwd) < 57){
|
||||||
|
my $pwd = gen_pwd();
|
||||||
|
$rec->set_prop('Secrets', $pwd);
|
||||||
|
}
|
||||||
|
|
||||||
|
my $theme = $rec->prop('Theme');
|
||||||
|
if (not $theme){
|
||||||
|
$rec->set_prop('Theme', 'default');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
109
root/etc/e-smith/events/actions/locales2-conf
Normal file
109
root/etc/e-smith/events/actions/locales2-conf
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# copyright (C) 1999-2006 Mitel Networks Corporation
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
package esmith;
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use constant DEBUG => 0;
|
||||||
|
|
||||||
|
use constant I18NMODULES => '/usr/share/smanager/lib/SrvMngr/I18N/Modules';
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# get locale modules list
|
||||||
|
#-------------------------
|
||||||
|
opendir DIR, I18NMODULES or die "Couldn't open ", I18NMODULES, "\n";
|
||||||
|
my @dirs = grep (/^[A-Z]/, readdir (DIR));
|
||||||
|
closedir DIR;
|
||||||
|
|
||||||
|
# put 'General' lexicon first
|
||||||
|
unshift @dirs, 'General';
|
||||||
|
|
||||||
|
foreach my $module (@dirs) {
|
||||||
|
|
||||||
|
next if (-f I18NMODULES . "/$module");
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# get lexicons list
|
||||||
|
#-------------------------
|
||||||
|
opendir DIR, I18NMODULES . "/$module" or die "Couldn't open ", I18NMODULES, "\n";
|
||||||
|
my @lexs = grep (/_.*\.lex$/, readdir (DIR));
|
||||||
|
closedir DIR;
|
||||||
|
|
||||||
|
foreach my $lex (@lexs) {
|
||||||
|
my $long_lex = I18NMODULES . "/$module/$lex";
|
||||||
|
|
||||||
|
next if (-d $long_lex);
|
||||||
|
|
||||||
|
# my ($mod, $lang) = split /[_.]/, $lex; # module name without '_'
|
||||||
|
my @elements = split /[_.]/, $lex;
|
||||||
|
next if ( scalar @elements < 3 );
|
||||||
|
|
||||||
|
my $mod = join( '_', @elements[0..(scalar @elements - 3)] );
|
||||||
|
my $lang = @elements[scalar @elements - 2];
|
||||||
|
|
||||||
|
next if ( $mod ne lc($module) );
|
||||||
|
|
||||||
|
$lang =~ s/-/_/;
|
||||||
|
my $long_pm = I18NMODULES . "/$module/$lang". '.pm';
|
||||||
|
if ( -f $long_pm ) {
|
||||||
|
# .pm file not newer than .lex
|
||||||
|
next if ((stat($long_lex))[9] < (stat($long_pm))[9]);
|
||||||
|
print "locales2: error cp\n" unless system("cp -f $long_pm ${long_pm}.svg") == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
open(FIL, '>:encoding(UTF-8)', $long_pm)
|
||||||
|
or die "Couldn't open ", $long_pm, " for writing.\n";
|
||||||
|
|
||||||
|
print FIL "package SrvMngr::I18N::Modules::${module}::${lang};\n";
|
||||||
|
print FIL "use strict;\nuse warnings;\nuse utf8;\nuse Mojo::Base 'SrvMngr::I18N';\n\n";
|
||||||
|
print FIL "use SrvMngr::I18N::Modules::General::${lang};\n\nmy %lexicon = (\n";
|
||||||
|
|
||||||
|
#--------------------
|
||||||
|
# copy lexicon to pm
|
||||||
|
#--------------------
|
||||||
|
open(FIL2, '<:encoding(UTF-8)', $long_lex)
|
||||||
|
or die "Couldn't open ", $long_lex, " for reading.\n";
|
||||||
|
while ( <FIL2> ) {
|
||||||
|
print FIL $_;
|
||||||
|
}
|
||||||
|
close FIL2;
|
||||||
|
|
||||||
|
print FIL ");\n\nour %Lexicon = (\n";
|
||||||
|
print FIL " %\{ SrvMngr::I18N::Modules::General::${lang}::Lexicon \},\n" unless $module eq 'General';
|
||||||
|
print FIL " %lexicon\n);\n\n\n1;\n";
|
||||||
|
|
||||||
|
close FIL;
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# eval and restore if NOT OK
|
||||||
|
#-------------------------
|
||||||
|
if ( eval "use lib '".I18NMODULES."/../../../'; require '$long_pm';" ) {
|
||||||
|
print "Lexicon $lang for $module ($lex) written to ${lang}.pm\n" if DEBUG;
|
||||||
|
if ( -f ${long_pm}.'.svg' ) {
|
||||||
|
print "locales2: error rm" unless system("rm -f ${long_pm}.svg") == 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "ERROR: Lexicon $lang for $module ($lex) NOT written to ${lang}.pm\n$@\n";
|
||||||
|
if ( -f ${long_pm}.'.svg' ) {
|
||||||
|
print "locales2: error mv" unless system("mv -f ${long_pm}.svg $long_pm") == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
176
root/etc/e-smith/events/actions/navigation2-conf
Normal file
176
root/etc/e-smith/events/actions/navigation2-conf
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# copyright (C) 1999-2006 Mitel Networks Corporation
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
package esmith;
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use constant SMNGR_LIB => '/usr/share/smanager/lib';
|
||||||
|
use constant I18NMODULES => 'SrvMngr/I18N/Modules';
|
||||||
|
use constant WEBFUNCTIONS => 'SrvMngr/Controller';
|
||||||
|
use constant NAVDIR => '/home/e-smith/db';
|
||||||
|
use constant NAVIGATIONDIR => 'navigation2';
|
||||||
|
use constant DEBUG => 0;
|
||||||
|
|
||||||
|
use esmith::NavigationDB;
|
||||||
|
use esmith::I18N;
|
||||||
|
|
||||||
|
use Data::Dumper; # activate if DEBUG
|
||||||
|
|
||||||
|
my $navigation_ignore =
|
||||||
|
"(\.\.?|Swttheme\.pm|Login\.pm|Request\.pm|Modules\.pm(-.*)?)";
|
||||||
|
|
||||||
|
my $i18n = new esmith::I18N;
|
||||||
|
|
||||||
|
my %navdbs;
|
||||||
|
|
||||||
|
opendir FUNCTIONS, SMNGR_LIB.'/'.WEBFUNCTIONS or
|
||||||
|
die "Couldn't open ", SMNGR_LIB.'/'.WEBFUNCTIONS, "\n";
|
||||||
|
my @files = grep (!/^${navigation_ignore}$/, readdir (FUNCTIONS));
|
||||||
|
closedir FUNCTIONS;
|
||||||
|
|
||||||
|
my @langs = $i18n->availableLanguages();
|
||||||
|
#my @langs = ('en', 'fr');
|
||||||
|
#print Dumper(\@langs);
|
||||||
|
|
||||||
|
|
||||||
|
foreach my $lang (@langs)
|
||||||
|
{
|
||||||
|
my $long_lex = SMNGR_LIB.'/'.I18NMODULES."/General/general_$lang.lex";
|
||||||
|
next unless ( -e $long_lex );
|
||||||
|
|
||||||
|
open(LEX, '<:encoding(UTF-8)', $long_lex)
|
||||||
|
or die "Couldn't open ", $long_lex, " for reading.\n";
|
||||||
|
my @gen_lex = <LEX>;
|
||||||
|
close LEX;
|
||||||
|
|
||||||
|
foreach my $file (@files)
|
||||||
|
{
|
||||||
|
next if (-d SMNGR_LIB.'/'.WEBFUNCTIONS . "/$file");
|
||||||
|
# next unless ( $file =~ m/D.*\.pm$/ );
|
||||||
|
next unless ( $file =~ m/[A-Z].*\.pm$/ );
|
||||||
|
|
||||||
|
my $file2 = lc($file);
|
||||||
|
$file2 =~ s/\.pm$//;
|
||||||
|
|
||||||
|
#--------------------------------------------------
|
||||||
|
# extract heading, description and weight information
|
||||||
|
# from Mojo controller
|
||||||
|
#--------------------------------------------------
|
||||||
|
open(SCRIPT, SMNGR_LIB.'/'.WEBFUNCTIONS . "/$file");
|
||||||
|
my $heading = undef;
|
||||||
|
my $description = undef;
|
||||||
|
my $heading_weight = undef;
|
||||||
|
my $description_weight = undef;
|
||||||
|
my $menucat = undef;
|
||||||
|
my $routes = undef;
|
||||||
|
|
||||||
|
while ( <SCRIPT> )
|
||||||
|
{
|
||||||
|
$heading = $1 if (/^\s*#\s*heading\s*:\s*(.+?)\s*$/);
|
||||||
|
$description = $1
|
||||||
|
if (/^\s*#\s*description\s*:\s*(.+?)\s*$/);
|
||||||
|
($heading_weight, $description_weight) = ($1, $2)
|
||||||
|
if (/^\s*#\s*navigation\s*:\s*(\d+?)\s+(\d+?)\s*$/);
|
||||||
|
$menucat = $1
|
||||||
|
if (/^\s*#\s*menu\s*:\s*(.+?)\s*$/);
|
||||||
|
|
||||||
|
last if (defined $heading and
|
||||||
|
defined $description and
|
||||||
|
defined $heading_weight and
|
||||||
|
defined $description_weight and
|
||||||
|
defined $menucat);
|
||||||
|
|
||||||
|
# routes : end (stop before eof if 'menu' is not here before 'routes'!!!
|
||||||
|
$routes = $1 if (/^\s*#\s*routes\s*:\s*(.+?)\s*$/);
|
||||||
|
last if (defined $routes and $routes eq 'end');
|
||||||
|
}
|
||||||
|
close SCRIPT;
|
||||||
|
|
||||||
|
print "updating script $file for lang $lang\n" if DEBUG;
|
||||||
|
my $navdb = $navdbs{$lang};
|
||||||
|
my $navinfo = NAVDIR.'/'.NAVIGATIONDIR . "/navigation.$lang";
|
||||||
|
$navdb ||= esmith::NavigationDB->open($navinfo);
|
||||||
|
$navdb ||= esmith::NavigationDB->create($navinfo) or
|
||||||
|
die "Couldn't create $navinfo\n";
|
||||||
|
$navdbs{$lang} ||= $navdb;
|
||||||
|
my $rec = $navdb->get($file2) ||
|
||||||
|
$navdb->new_record($file2, { type => 'panel' } );
|
||||||
|
|
||||||
|
my @panel_lex = ();
|
||||||
|
$long_lex = SMNGR_LIB.'/'.I18NMODULES.'/'.ucfirst($file2)."/${file2}_$lang.lex";
|
||||||
|
if ( -e $long_lex ) {
|
||||||
|
open(LEX, '<:encoding(UTF-8)', $long_lex)
|
||||||
|
or die "Couldn't open ", $long_lex, " for reading.\n";
|
||||||
|
@panel_lex = <LEX>;
|
||||||
|
close LEX;
|
||||||
|
}
|
||||||
|
|
||||||
|
my %Lexicon = ();
|
||||||
|
push(@panel_lex, @gen_lex);
|
||||||
|
my $top_error = 0;
|
||||||
|
|
||||||
|
chomp @panel_lex;
|
||||||
|
for (@panel_lex) {
|
||||||
|
next unless $_; # first one empty
|
||||||
|
my ($k, $v) = split / => /, $_;
|
||||||
|
# errors on split to $v (use DEBUG to see)
|
||||||
|
if ( $k and $v ) {
|
||||||
|
$k =~ s/\'//g;
|
||||||
|
$v =~ s/\'//g;
|
||||||
|
$v =~ s/,$//g;
|
||||||
|
$Lexicon{ $k } = $v;
|
||||||
|
} else {
|
||||||
|
$k = "?" unless ($k);
|
||||||
|
print STDERR "Error for $lang $file2 on $k \n" if DEBUG;
|
||||||
|
$top_error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( $top_error > 0) {
|
||||||
|
if ( DEBUG ) {
|
||||||
|
print STDERR "$top_error errors for $lang $file2\n";
|
||||||
|
# print Dumper(\@panel_lex);
|
||||||
|
# print Dumper(\%Lexicon);
|
||||||
|
# exit 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $loc_heading = localise( \%Lexicon, $heading );
|
||||||
|
my $loc_description = localise( \%Lexicon, $description );
|
||||||
|
$loc_heading =~ s/^\s*(\w.*?)\s*$/$1/;
|
||||||
|
$loc_description =~ s/^\s*(\w.*?)\s*$/$1/;
|
||||||
|
|
||||||
|
$rec->merge_props(
|
||||||
|
Heading => $loc_heading,
|
||||||
|
Description => $loc_description,
|
||||||
|
HeadingWeight => localise( \%Lexicon, $heading_weight ),
|
||||||
|
DescriptionWeight => localise( \%Lexicon, $description_weight ),
|
||||||
|
MenuCat => (defined $menucat ? $menucat : 'A'));
|
||||||
|
}
|
||||||
|
#warn "trying to close for lang $lang\n";
|
||||||
|
my $navdb = $navdbs{$lang};
|
||||||
|
$navdb->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub localise {
|
||||||
|
my ($lexicon, $string) = @_;
|
||||||
|
$string = "" unless defined $string;
|
||||||
|
return $lexicon->{$string} || $string;
|
||||||
|
}
|
82
root/etc/e-smith/events/actions/routes2-conf
Normal file
82
root/etc/e-smith/events/actions/routes2-conf
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# copyright (C) 1999-2006 Mitel Networks Corporation
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
package esmith;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
|
||||||
|
use constant WEBFUNCTIONS => '/usr/share/smanager/lib/SrvMngr/Controller';
|
||||||
|
|
||||||
|
my $rtdb ||= esmith::ConfigDB->open('routes') or
|
||||||
|
die "Couldn't create Routes DB\n";
|
||||||
|
|
||||||
|
opendir DIR, WEBFUNCTIONS or
|
||||||
|
die "Couldn't open ", WEBFUNCTIONS, "\n";
|
||||||
|
|
||||||
|
my @files = grep (/^[A-Z].*\.pm$/, readdir (DIR));
|
||||||
|
|
||||||
|
closedir DIR;
|
||||||
|
|
||||||
|
foreach my $file (@files) {
|
||||||
|
|
||||||
|
next if (-d WEBFUNCTIONS . "/$file");
|
||||||
|
|
||||||
|
my $file2 = lc($file);
|
||||||
|
$file2 =~ s/\.pm$//;
|
||||||
|
|
||||||
|
#--------------------------------------------------
|
||||||
|
# extract method, url, action, name from controllers script
|
||||||
|
#--------------------------------------------------
|
||||||
|
open(SCRIPT, WEBFUNCTIONS . "/$file");
|
||||||
|
my $routes = undef;
|
||||||
|
my $method = undef;
|
||||||
|
my $url = undef;
|
||||||
|
my $ctlact = undef;
|
||||||
|
my $name = undef;
|
||||||
|
|
||||||
|
while ( <SCRIPT> ) {
|
||||||
|
|
||||||
|
# name : contrib, method : get, url : /contrib, ctlact : contrib#main
|
||||||
|
($name, $method, $url, $ctlact) = ($1, $2, $3, $4)
|
||||||
|
if (/^#\s*name\s*:\s*(.+?),\s*method\s*:\s*(.+?),\s*url\s*:\s*(.+?),\s*ctlact\s*:\s*(.+?)\s*$/);
|
||||||
|
|
||||||
|
# routes : end
|
||||||
|
$routes = $1 if (/^\s*#\s*routes\s*:\s*(.+?)\s*$/);
|
||||||
|
last if (defined $routes and $routes eq 'end');
|
||||||
|
|
||||||
|
if (defined $method and defined $url and
|
||||||
|
defined $ctlact and defined $name) {
|
||||||
|
my $key = $file2.'+'.$name;
|
||||||
|
my $rec = $rtdb->get($key) ||
|
||||||
|
$rtdb->new_record($key, { type => 'route' } );
|
||||||
|
|
||||||
|
$rec->merge_props(
|
||||||
|
Url => $url,
|
||||||
|
Method => $method,
|
||||||
|
Ctlact => $ctlact
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close SCRIPT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
6
root/etc/e-smith/templates/etc/crontab/smanager
Normal file
6
root/etc/e-smith/templates/etc/crontab/smanager
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
return "# smanager is disabled\n"
|
||||||
|
unless $smanager{status} eq 'enabled';
|
||||||
|
|
||||||
|
return "15 0 * * * root /usr/share/smanager/script/daily.sh \n"
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
# vim: ft=perl:
|
||||||
|
|
||||||
|
$haveSSL = (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled") ? 'yes' : 'no';
|
||||||
|
$plainTextAccess = ${'httpd-admin'}{PermitPlainTextAccess} || 'no';
|
||||||
|
$plainPort = ${'httpd-e-smith'}{TCPPort} || '80';
|
||||||
|
$adminPort2 = ${'smanager'}{TCPPort} || '982';
|
||||||
|
$adminAccess = ${'smanager'}{access} || 'private';
|
||||||
|
$sslPort = ${modSSL}{TCPPort} || '443';
|
||||||
|
|
||||||
|
$OUT = '';
|
||||||
|
|
||||||
|
foreach $place ('smanager')
|
||||||
|
{
|
||||||
|
if (($port eq $plainPort) && ($haveSSL eq 'yes') && ($plainTextAccess ne 'yes'))
|
||||||
|
{
|
||||||
|
$OUT .= ' RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$' . "\n";
|
||||||
|
$OUT .= " RewriteRule ^/$place(/.*|\$) https://%{HTTP_HOST}/$place\$1 [L,R]\n";
|
||||||
|
$OUT .= "\n";
|
||||||
|
}
|
||||||
|
$OUT .= " RewriteRule ^/$place\$ https://%{HTTP_HOST}/$place/ [L,R]\n\n";
|
||||||
|
|
||||||
|
$OUT .= " ProxyRequests Off\n";
|
||||||
|
$OUT .= " ProxyPreserveHost On\n";
|
||||||
|
$OUT .= " ProxyPass /$place http://127.0.0.1:$adminPort2 keepalive=On\n";
|
||||||
|
$OUT .= " ProxyPassReverse /$place http://127.0.0.1:$adminPort2\n";
|
||||||
|
$OUT .= " RequestHeader set X-Forwarded-Proto 'http'\n";
|
||||||
|
|
||||||
|
$OUT .= " <Location '/$place'>\n";
|
||||||
|
if ($port eq $plainPort)
|
||||||
|
{
|
||||||
|
$OUT .= ' Require ip 127.0.0.1' . "\n";
|
||||||
|
}
|
||||||
|
elsif (($haveSSL eq 'yes') && ($port eq $sslPort) && ($adminAccess eq 'public'))
|
||||||
|
{
|
||||||
|
$OUT .= "# public access requested in conf db\n";
|
||||||
|
$OUT .= " Require all granted\n";
|
||||||
|
} else {
|
||||||
|
$OUT .= "# private access by default\n";
|
||||||
|
$OUT .= " Require ip $localAccess $externalSSLAccess\n";
|
||||||
|
}
|
||||||
|
$OUT .= " </Location>\n";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
\{
|
||||||
|
# configuration file for Mojolicious Server-Manager2 application
|
||||||
|
#
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
my @secrets = split /,/, $smanager{'Secrets'};
|
||||||
|
$OUT .= " secrets => ['";
|
||||||
|
if ( $secrets[0] ) { $OUT .= "$secrets[0]'"; }
|
||||||
|
if ( $secrets[1] ) { $OUT .= ",'$secrets[1]'"; }
|
||||||
|
if ( $secrets[2] ) { $OUT .= ",'$secrets[2]'"; }
|
||||||
|
$OUT .= "],";
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
theme => '{ $smanager{'Theme'} || 'default' }',
|
@ -0,0 +1,2 @@
|
|||||||
|
# session timeout
|
||||||
|
timeout => '{ $smanager{'Timeout'} || 300 }',
|
@ -0,0 +1,4 @@
|
|||||||
|
# password reset disabled by default
|
||||||
|
pwdreset => { ($smanager{'PwdReset'} eq 'enabled' ? '1' : '0') || '0' },
|
||||||
|
# reset delay in hours
|
||||||
|
pwdreset_delay => 2,
|
@ -0,0 +1,16 @@
|
|||||||
|
hypnotoad => \{
|
||||||
|
## adresses and ports listened
|
||||||
|
listen => ['http://127.0.0.1:{$smanager{'TCPPort'} || 982 }'],
|
||||||
|
proxy => 1,
|
||||||
|
pid_file => '/var/run/smanager.pid',
|
||||||
|
|
||||||
|
## process number based on CPU number [x 2]
|
||||||
|
workers => (`grep processor /proc/cpuinfo | wc -l` * 2),
|
||||||
|
|
||||||
|
## connections queue size, per worker
|
||||||
|
accepts => 100,
|
||||||
|
|
||||||
|
## propriétaire et groupe du serveur
|
||||||
|
user => 'admin',
|
||||||
|
group => 'admin'
|
||||||
|
\},
|
@ -0,0 +1,2 @@
|
|||||||
|
# is js-jquery available
|
||||||
|
hasJquery => { -f '/usr/share/smanager/themes/default/public/js/jquery.min.js' ? '1' : '0'; },
|
@ -0,0 +1,5 @@
|
|||||||
|
modules_dir => 'lib/SrvMngr/Controller',
|
||||||
|
webapp => 'smanager',
|
||||||
|
mode => 'production',
|
||||||
|
debug => 0,
|
||||||
|
\}
|
@ -0,0 +1,250 @@
|
|||||||
|
{
|
||||||
|
$OUT = <<'EOF';
|
||||||
|
|
||||||
|
/* from e-smith-manager to smanager (smeserver_manager2) */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
* copyright (C) 1999-2003 Mitel Networks Corporation
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
* Technical support for this program is available from Mitel Networks
|
||||||
|
* Please visit our web site www.mitel.com for details.
|
||||||
|
*----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This is the stylesheet used as the basis for older broswers.
|
||||||
|
|
||||||
|
Note that you CANNOT simly add styles here and hope they work. ONLY CSS
|
||||||
|
level 1 styles should be in this file. Everyting else goes into the other 3
|
||||||
|
files.
|
||||||
|
|
||||||
|
These basic styles ensire that browsers that don't understand the @import
|
||||||
|
method will still be usable. All modern browsers will use the styles in
|
||||||
|
sme_main.css, sme_menu.css or sme_header.css depending on the frame in which
|
||||||
|
the page is found.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Default HTML styles */
|
||||||
|
body {
|
||||||
|
background: #ffffff;
|
||||||
|
color: #000000;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
border-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
table, tr, td, div, p, form {
|
||||||
|
color: #000000;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-top: 8px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
margin-top: 2px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notsmall {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, .h1 {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
color: #333333;
|
||||||
|
font-size: 18px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2, .h2 {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
color: #333333;
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3, .h3 {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
color: #333333;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4, .h4 {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-style: italic;
|
||||||
|
color: #333333;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol, ul, li {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: normal;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
list-style-type: circle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Core styles for use with sme_header.css*/
|
||||||
|
body.header {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
background: #cccccc;
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
margin-left: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hilightbar {
|
||||||
|
background-color: #ffc50a;
|
||||||
|
font-size: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.infobar {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
background-color: #cccccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.darkergrey {
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.darkgrey {
|
||||||
|
background-color: #888888;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.update {
|
||||||
|
color: red;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
background: #cccccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Core styles for use with sme_menu.css */
|
||||||
|
|
||||||
|
body.menu {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
background-color: #e8f3e1;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.section {
|
||||||
|
padding-bottom: 2px;
|
||||||
|
padding-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #e8f3e1;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.item {
|
||||||
|
color: #00008b;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
background: #e8f3e1;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.sl {
|
||||||
|
color: green;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
background: #e8f3e1;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.alert {
|
||||||
|
color: red;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
background: #e8f3e1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Core styles for use with sme_main.css */
|
||||||
|
body.main {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.sme-noborders-label {
|
||||||
|
font-weight: bold;
|
||||||
|
width: 33%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr.sectionbar {
|
||||||
|
color: #666666;
|
||||||
|
background-color: #666666;
|
||||||
|
height: 1px;
|
||||||
|
width: 80%;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr.sme-copyrightbar {
|
||||||
|
color: #dddddd;
|
||||||
|
background-color: #dddddd;
|
||||||
|
height: 1px;
|
||||||
|
width: 100%;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sme-copyright {
|
||||||
|
color: #777777;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*These style definitions were found int he old css file (manager.css)
|
||||||
|
but don't seem to ever be referenced in the code. They're here
|
||||||
|
for reference.
|
||||||
|
|
||||||
|
.centerit {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.highlight {
|
||||||
|
background: #ffc61e;
|
||||||
|
}
|
||||||
|
.subheading {
|
||||||
|
background: #ffffff;
|
||||||
|
color: #1e385b;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
$OUT =<<'HERE';
|
||||||
|
|
||||||
|
/* from e-smith-manager to smanager (smeserver_manager2) */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
* copyright (C) 1999-2003 Mitel Networks Corporation
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
* Technical support for this program is available from Mitel Networks
|
||||||
|
* Please visit our web site www.mitel.com for details.
|
||||||
|
*----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*contribs.org styling
|
||||||
|
*/
|
||||||
|
body.header {
|
||||||
|
background: #bee6a2;
|
||||||
|
}
|
||||||
|
.hilightbar {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
.infobar {
|
||||||
|
background-color: #98d36e;
|
||||||
|
}
|
||||||
|
a.update {
|
||||||
|
font-size: 11px;
|
||||||
|
background: #98d36e;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Core styles for use with sme_menu.css */
|
||||||
|
body.menu {
|
||||||
|
background-color: #e8f3e1;
|
||||||
|
}
|
||||||
|
td.section {
|
||||||
|
background-color: #e8f3e1;
|
||||||
|
}
|
||||||
|
a.item {
|
||||||
|
background: #e8f3e1;
|
||||||
|
}
|
||||||
|
a.sl {
|
||||||
|
background: #e8f3e1;
|
||||||
|
}
|
||||||
|
a.alert {
|
||||||
|
background: #e8f3e1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Core Styles for use with sme_main.css */
|
||||||
|
hr.sectionbar {
|
||||||
|
color: #8ebe43;
|
||||||
|
background-color: #8ebe43;
|
||||||
|
}
|
||||||
|
hr.sme-copyrightbar {
|
||||||
|
color: #8ebe43;
|
||||||
|
background-color: #8ebe43;
|
||||||
|
}
|
||||||
|
HERE
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
/* DO NOT MODIFY THIS FILE! It is updated automatically */
|
@ -0,0 +1,440 @@
|
|||||||
|
{
|
||||||
|
$OUT = <<'EOF';
|
||||||
|
|
||||||
|
/* from e-smith-manager to smanager (smeserver_manager2) */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
* copyright (C) 1999-2003 Mitel Networks Corporation
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
* Technical support for this program is available from Mitel Networks
|
||||||
|
* Please visit our web site www.mitel.com for details.
|
||||||
|
*----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This is the stylesheet used in the main panels only.
|
||||||
|
|
||||||
|
This file inherits the styles use in sme_core in the "header" section, and
|
||||||
|
as noted in the code below. Note that some of the styles here are empty.
|
||||||
|
This is because the style definition has moved safely to sme_core.css
|
||||||
|
and the placeholder is left here for reference or future use.
|
||||||
|
|
||||||
|
There are a lot of styles in here, so read carefully. Each one is documented.
|
||||||
|
|
||||||
|
Styles that were in the old stylesheets, but are not used in the UI are at the
|
||||||
|
bottom, commented out. These can be removed at the end of the 6.0 cycle */
|
||||||
|
|
||||||
|
/* general page properties */
|
||||||
|
body, body.main {
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-right: 20px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Table properties ****************************************/
|
||||||
|
/* There are THREE types of tables
|
||||||
|
1. *.sme-layout* is used for layout purposes. It is the "master
|
||||||
|
container" on a page. It controls the top-level table
|
||||||
|
inside of which everything else is put.
|
||||||
|
2. *.sme-noborders* is used for layout, and defines a borderless table and
|
||||||
|
cells used within it.
|
||||||
|
2. *.sme-border* is used for tabular data, and defines a header row and borders
|
||||||
|
for tables that need borders
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*First, some defaults */
|
||||||
|
td {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
sme-layout* : Used for top-level layout
|
||||||
|
*/
|
||||||
|
|
||||||
|
table.sme-layout {
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr.sme-layout {
|
||||||
|
border: 1px solid #dddddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.sme-layout {
|
||||||
|
border: 1px solid #dddddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*This special style is actually used only for the button row along the bottom of each page*/
|
||||||
|
th.sme-layout {
|
||||||
|
border: 1px solid #dddddd;
|
||||||
|
background-color: #e8f3e1;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 9pt;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000000;
|
||||||
|
text-align: right;
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
sme-noborders* : Used for mid-level layout
|
||||||
|
*/
|
||||||
|
table.sme-noborders {
|
||||||
|
padding: 0px;
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
margin-left: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
td.sme-noborders-label {
|
||||||
|
font-weight: bold;
|
||||||
|
/*width: 250px;*/
|
||||||
|
text-align: right;
|
||||||
|
/*vertical-align: top;*/
|
||||||
|
background-color: #e8f3e1;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
td.sme-noborders-content {
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
td.sme-noborders-info, div.sme-noborders-info {
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
/* Used for a left-most column of radio buttons (see date/time panel) */
|
||||||
|
td.sme-radiobutton {
|
||||||
|
width: 30px;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
sme-border* : Used for tabular data
|
||||||
|
*/
|
||||||
|
table.sme-border {
|
||||||
|
border-collapse: collapse;
|
||||||
|
border: 2px solid #cccccc;
|
||||||
|
empty-cells: show;
|
||||||
|
margin: 5px 5px 5px 2px;
|
||||||
|
}
|
||||||
|
td.sme-border,
|
||||||
|
td.sme-border-warning,
|
||||||
|
td.sme-border-right,
|
||||||
|
td.sme-border-center {
|
||||||
|
border: 1px solid #cccccc;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #000000;
|
||||||
|
text-align: left;
|
||||||
|
padding-left: 2px;
|
||||||
|
padding-right: 2px;
|
||||||
|
padding-top: 3px;
|
||||||
|
padding-bottom: 3px;
|
||||||
|
}
|
||||||
|
td.sme-border-warning {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
td.sme-border-right {text-align: right;}
|
||||||
|
td.sme-border-center {text-align: center;}
|
||||||
|
th.sme-border {
|
||||||
|
border: 1px solid #cccccc;
|
||||||
|
background-color: #bee6a2;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000000;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: bottom;
|
||||||
|
padding-left: 2px;
|
||||||
|
padding-right: 2px;
|
||||||
|
padding-left: 3px;
|
||||||
|
padding-right: 3px;
|
||||||
|
padding-top: 3px;
|
||||||
|
padding-bottom: 3px;
|
||||||
|
/*border-width: 1px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #F2F0EE #75736E #75736E #F2F0EE ;*/
|
||||||
|
}
|
||||||
|
td.sme-border a, td.sme-border-right a, td.sme-border-center a {
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* misc layout stuff*/
|
||||||
|
/* these two are for any error messages that pop up*/
|
||||||
|
div.error, div.sme-error, span.error, span.sme-error {
|
||||||
|
color: red;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-width: 1px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: red ;
|
||||||
|
padding: 2px;
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-right: 20px;
|
||||||
|
margin-top:0px;
|
||||||
|
margin-bottom:0px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
div.error-noborders, div.sme-error-noborders,
|
||||||
|
span.error-noborders, span.sme-error-noborders
|
||||||
|
{
|
||||||
|
color: red;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-width: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.error h2, span.error h2,
|
||||||
|
div.error p, span.error p
|
||||||
|
{
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
/* These are for the special case of a link being inside an error message */
|
||||||
|
div.sme-error a, div.error a, span.error a, span.sme-error a,
|
||||||
|
div.error-noborders a, div.sme-error-noborders a,
|
||||||
|
span.error-noborders a, span.sme-error-noborders a
|
||||||
|
{
|
||||||
|
color: #ff0000;
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For when a link is the error message */
|
||||||
|
a.error:link, a.error:visited, a.error:hover, a.error:active {
|
||||||
|
color: #ff0000;
|
||||||
|
font-weight: normal;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* these two are for any success messages that pop up*/
|
||||||
|
div.success, span.success {
|
||||||
|
color: #006400;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-width: 1px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #006400 ;
|
||||||
|
padding: 2px;
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-right: 20px;
|
||||||
|
margin-top:0px;
|
||||||
|
margin-bottom:0px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* These two are for the special case of a link being inside a success message */
|
||||||
|
div.success a, span.success a
|
||||||
|
{
|
||||||
|
color: #006400;
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.success h2, span.success h2,
|
||||||
|
div.success p, span.success p
|
||||||
|
{
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*These two define the copyright footer styles, one for the line and one for the text*/
|
||||||
|
hr.sme-copyrightbar {
|
||||||
|
}
|
||||||
|
.sme-copyright {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* These ones define styles for the links that are made to look like
|
||||||
|
standard form submit buttons */
|
||||||
|
a.button-like:link,
|
||||||
|
a.button-like:visited,
|
||||||
|
a.button-like:hover,
|
||||||
|
a.button-like:active,
|
||||||
|
a.button-like-small:link,
|
||||||
|
a.button-like-small:visited,
|
||||||
|
a.button-like-small:hover,
|
||||||
|
a.button-like-small:active {
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
color: black;
|
||||||
|
background: #D4D0C8;
|
||||||
|
text-decoration: none;
|
||||||
|
text-align: left;
|
||||||
|
border-color: #F2F0EE #75736E #75736E #F2F0EE ;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-right: 2px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
margin-left: 2px;
|
||||||
|
border-style: solid;
|
||||||
|
border-top-width: 2px;
|
||||||
|
border-right-width: 2px;
|
||||||
|
border-bottom-width: 2px;
|
||||||
|
border-left-width: 2px;
|
||||||
|
padding-top: 2px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
padding-left: 6px;
|
||||||
|
padding-right: 6px;
|
||||||
|
}
|
||||||
|
a.button-like-small:link,
|
||||||
|
a.button-like-small:visited,
|
||||||
|
a.button-like-small:hover,
|
||||||
|
a.button-like-small:active {
|
||||||
|
border-top-width: 1px;
|
||||||
|
border-right-width: 1px;
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
border-left-width: 1px;
|
||||||
|
font-size: 10px;
|
||||||
|
padding-top: 0px;
|
||||||
|
padding-bottom: 0px;
|
||||||
|
padding-left: 1px;
|
||||||
|
padding-right: 1px;
|
||||||
|
}
|
||||||
|
a.button-like:active,
|
||||||
|
a.button-like-small:active {
|
||||||
|
border-color: #75736E #F2F0EE #F2F0EE #75736E ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EXPERIMENTAL SECTION */
|
||||||
|
/* These are styles used to experiment with. */
|
||||||
|
|
||||||
|
/* class for links, similar to the class in sme_menu.css, but for a red button */
|
||||||
|
a.button-like-red:link,
|
||||||
|
a.button-like-red:visited,
|
||||||
|
a.button-like-red:hover,
|
||||||
|
a.button-like-red:active {
|
||||||
|
border-left: #F1726C 2px solid;
|
||||||
|
border-right: #B42025 2px solid;
|
||||||
|
border-top: #F1726C 2px solid;
|
||||||
|
border-bottom: #B42025 2px solid;
|
||||||
|
}
|
||||||
|
a.button-like-red:active {
|
||||||
|
border-color: #75736E #F2F0EE #F2F0EE #75736E ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*These are style definitions found in the UI but not defined in any file I
|
||||||
|
could locate. They're listed here for historical purposes, but have been
|
||||||
|
removed from the UI
|
||||||
|
|
||||||
|
pagedescription (used in the first paragraph of text on a page) [HTML.pm]
|
||||||
|
label (used in forms) [HTML.pm]
|
||||||
|
field (used in forms) [HTML.pm]
|
||||||
|
fielddescription (used ???)[HTML.pm]
|
||||||
|
buttons (used in forms) [HTML.pm]
|
||||||
|
*/
|
||||||
|
/*td.sme-submitbutton {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*These style definitions were found int he old css file (manager.css)
|
||||||
|
but don't seem to ever be referenced in the code. They're here
|
||||||
|
for reference.
|
||||||
|
|
||||||
|
.banner {
|
||||||
|
background: #000000;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
.banner-right {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
background: #e17200;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
.border {
|
||||||
|
background: #000000;
|
||||||
|
color: #000000;
|
||||||
|
border-color: #000000;
|
||||||
|
}
|
||||||
|
.sidebar {
|
||||||
|
width: 200px;
|
||||||
|
background: #ffffff;
|
||||||
|
font-size: smaller;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
.sidebar-title {
|
||||||
|
background: #1e385b;
|
||||||
|
color: #ffffff;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.newsitem {
|
||||||
|
background: #ffffff;
|
||||||
|
color: #000000;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
margin-left: 5px;
|
||||||
|
margin-right: 5px;
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
.newsitem-title {
|
||||||
|
background: #cccccc;
|
||||||
|
color: #ffffff;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.newsitem-footer {
|
||||||
|
background: #cccccc;
|
||||||
|
color: #000000;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: smaller;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.newsitem-detail {
|
||||||
|
font-size: smaller;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
.formlabel {
|
||||||
|
background: #c0c0c0;
|
||||||
|
color: #000000;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: small;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.welcome-link {
|
||||||
|
background: #ffffff;
|
||||||
|
color: #1e385b;
|
||||||
|
}
|
||||||
|
.littlelink {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
}
|
||||||
|
#textlayer {
|
||||||
|
position: absolute;
|
||||||
|
visibility: inherit;
|
||||||
|
top: 160px;
|
||||||
|
left: 50px;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
#para {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
#title {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 7px 7px 7px 7px;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
$OUT =<<'HERE';
|
||||||
|
|
||||||
|
/* from e-smith-manager to smanager (smeserver_manager2) */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
* copyright (C) 1999-2003 Mitel Networks Corporation
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
* Technical support for this program is available from Mitel Networks
|
||||||
|
* Please visit our web site www.mitel.com for details.
|
||||||
|
*----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
/*contribs.org styling */
|
||||||
|
|
||||||
|
/* This special style is actually used only for the button row along the bottom of each page */
|
||||||
|
th.sme-layout {
|
||||||
|
border: 1px solid #8ebe43;
|
||||||
|
background-color: #bee6a2;
|
||||||
|
}
|
||||||
|
table.sme-border {
|
||||||
|
border: 2px solid #dddddd;
|
||||||
|
}
|
||||||
|
td.sme-border-warning,
|
||||||
|
td.sme-border-right,
|
||||||
|
td.sme-border-center {
|
||||||
|
border: 1px solid #dddddd;
|
||||||
|
}
|
||||||
|
td.sme-border-right {text-align: right;}
|
||||||
|
td.sme-border-center {text-align: center;}
|
||||||
|
th.sme-border {
|
||||||
|
border: 1px solid #dddddd;
|
||||||
|
background-color: #e8f3e1;
|
||||||
|
}
|
||||||
|
HERE
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
/* DO NOT MODIFY THIS FILE! It is updated automatically */
|
@ -0,0 +1,229 @@
|
|||||||
|
{
|
||||||
|
$OUT = <<'EOF';
|
||||||
|
|
||||||
|
/* from e-smith-manager to smanager (smeserver_manager2) */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
* copyright (C) 1999-2003 Mitel Networks Corporation
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
* Technical support for this program is available from Mitel Networks
|
||||||
|
* Please visit our web site www.mitel.com for details.
|
||||||
|
*----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This is the stylesheet used in the navigation panel only
|
||||||
|
|
||||||
|
This file inherits the styles use in sme_core in the "navigation" section,
|
||||||
|
and as noted in the code below. Note that some of the styles here are empty.
|
||||||
|
This is because the style definition has moved safely to sme_core.css and
|
||||||
|
the placeholder is left here for reference or future use.
|
||||||
|
|
||||||
|
There are a lot of styles in here, so read carefully. Each one is
|
||||||
|
documented.
|
||||||
|
|
||||||
|
Styles that were in the old stylesheets, but are not used in the UI are at
|
||||||
|
the bottom, commented out. These can be removed at the end of the 6.0
|
||||||
|
cycle */
|
||||||
|
|
||||||
|
/* Sets the general page properties */
|
||||||
|
body, body.menu {
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is the section heading style */
|
||||||
|
.section {
|
||||||
|
}
|
||||||
|
|
||||||
|
td.menu-cell {
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
margin-left: 0px;
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
padding-top: 0px;
|
||||||
|
padding-bottom: 0px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
All the a links use pseudoclasses to control the two visual link styles.
|
||||||
|
For example:
|
||||||
|
a.item:link the general link item
|
||||||
|
a.item-current:link: the active link item
|
||||||
|
|
||||||
|
The switch from item to item-current is done with a javascript script in the head of the
|
||||||
|
navigation page, using the onClick event.
|
||||||
|
|
||||||
|
We are making heavy use of the cascade with these.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* a:link controls the look of a link when the mouse is nowhere near it */
|
||||||
|
a.item:link, a.item-current:link,
|
||||||
|
a.warn:link, a.warn-current:link {
|
||||||
|
display: block;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
color: black;
|
||||||
|
background: #e8f3e1;
|
||||||
|
text-decoration: none;
|
||||||
|
text-align: left;
|
||||||
|
border-color: #e8f3e1;
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
margin-left: 0px;
|
||||||
|
border-style: solid;
|
||||||
|
border-top-width: 1px;
|
||||||
|
border-right-width: 1px;
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
border-left-width: 1px;
|
||||||
|
padding-right: 10px;
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-top: 0px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a:visited controls the look of a visited link (one that has been clicked) */
|
||||||
|
a.item:visited, a.item-current:visited,
|
||||||
|
a.warn:visited, a.warn-current:visited {
|
||||||
|
display: block;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
color: black;
|
||||||
|
background: #e8f3e1;
|
||||||
|
text-decoration: none;
|
||||||
|
border-color: #e8f3e1;
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
margin-left: 0px;
|
||||||
|
border-style: solid;
|
||||||
|
border-top-width: 1px;
|
||||||
|
border-right-width: 1px;
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
border-left-width: 1px;
|
||||||
|
padding-right: 10px;
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a:hover controls the look of a link under the curser*/
|
||||||
|
a.item:hover, a.item-current:hover,
|
||||||
|
a.warn:hover, a.warn-current:hover {
|
||||||
|
display: block;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
color: black;
|
||||||
|
text-decoration: none;
|
||||||
|
background: #cccccc;
|
||||||
|
border-color: #888888;
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
margin-left: 0px;
|
||||||
|
border-style: solid;
|
||||||
|
border-top-width: 1px;
|
||||||
|
border-right-width: 1px;
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
border-left-width: 1px;
|
||||||
|
padding-right: 10px;
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a:active controls the look of a link as it is selected*/
|
||||||
|
a.item:active, a.item-current:active,
|
||||||
|
a.warn:active, a.warn-current:active {
|
||||||
|
display: block;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
color: white;
|
||||||
|
background: black;
|
||||||
|
text-decoration: none ;
|
||||||
|
border-color: #000000;
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
margin-left: 0px;
|
||||||
|
border-style: solid;
|
||||||
|
border-top-width: 1px;
|
||||||
|
border-right-width: 1px;
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
border-left-width: 1px;
|
||||||
|
padding-right: 10px;
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
These styles are to ensure that a selected link appears selected, even if the link
|
||||||
|
opens in another frame. This uses a javascript chunk in the head of the navigation
|
||||||
|
frame to change the style using the onClick event.
|
||||||
|
*/
|
||||||
|
a.item-current:link, a.warn-current:link,
|
||||||
|
a.item-current:visited, a.warn-current:visited,
|
||||||
|
a.item-current:active, a.warn-current:active,
|
||||||
|
a.item-current:hover, a.warn-current:hover {
|
||||||
|
display: block;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
color: black;
|
||||||
|
text-decoration: none;
|
||||||
|
background: #ffffff;
|
||||||
|
border-color: #888888;
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
margin-left: 0px;
|
||||||
|
border-style: solid;
|
||||||
|
border-top-width: 1px;
|
||||||
|
border-right-width: 1px;
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
border-left-width: 1px;
|
||||||
|
padding-right: 10px;
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* these two add a border on the styles defined directly above when
|
||||||
|
the mouse is hovering over them */
|
||||||
|
a.item-current:hover, a.warn-current:hover {
|
||||||
|
border-color: #888888;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* These redefine a few elements to make room for the icon to the left of the warn class*/
|
||||||
|
a.warn:link, a.warn-current:link,
|
||||||
|
a.warn:visited, a.warn-current:visited,
|
||||||
|
a.warn:active, a.warn-current:active,
|
||||||
|
a.warn:hover, a.warn-current:hover {
|
||||||
|
background-image: url(/server-common/warn.gif);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: 10px;
|
||||||
|
padding-left: 25px;
|
||||||
|
}
|
||||||
|
/*end*/
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
/* DO NOT MODIFY THIS FILE! It is updated automatically */
|
@ -0,0 +1,278 @@
|
|||||||
|
{
|
||||||
|
$OUT = <<'EOF';
|
||||||
|
|
||||||
|
/* smeserver_manager2 */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
* copyright (C) 1999-2003 Mitel Networks Corporation
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
* Technical support for this program is available from Mitel Networks
|
||||||
|
* Please visit our web site www.mitel.com for details.
|
||||||
|
*----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This is the basic stylesheet originally used in the mojo version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
body{
|
||||||
|
background-color: #FFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container{
|
||||||
|
max-width: 100%;
|
||||||
|
position: relative;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navigation{
|
||||||
|
width: 190px;
|
||||||
|
position: absolute;
|
||||||
|
margin-left: 0px;
|
||||||
|
padding: 5px;
|
||||||
|
background-color: #E8F3E1;
|
||||||
|
/* height: 600px; */
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main{
|
||||||
|
margin-left: 195px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#central{
|
||||||
|
margin-left: 0px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer{
|
||||||
|
margin-left: 0px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header {
|
||||||
|
background: #bee6a2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header h1, a:link, a:visited {
|
||||||
|
color: black;
|
||||||
|
text-decoration: none;
|
||||||
|
/* contribs.org styling */
|
||||||
|
}
|
||||||
|
|
||||||
|
a:link { color: #006921; text-decoration: none; }
|
||||||
|
a:visited { color: #063; text-decoration: none; }
|
||||||
|
a:hover { color: #F00; text-decoration: none; }
|
||||||
|
a:active { color: #606060; text-decoration: none; }
|
||||||
|
|
||||||
|
.sme-error {
|
||||||
|
color: red;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-width: 1px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: red ;
|
||||||
|
padding: 2px;
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-top:0px;
|
||||||
|
margin-bottom:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sme-warning {
|
||||||
|
color: orange;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-width: 1px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: orange ;
|
||||||
|
padding: 4px;
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-right: 20px;
|
||||||
|
margin-top:2px;
|
||||||
|
margin-bottom:2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer img {
|
||||||
|
float: right;
|
||||||
|
position: fixed;
|
||||||
|
margin-left: 40%;
|
||||||
|
}
|
||||||
|
|
||||||
|
label.field-with-error {
|
||||||
|
color: #dd7e5e
|
||||||
|
}
|
||||||
|
|
||||||
|
input.field-with-error {
|
||||||
|
background-color: #fd9e7e
|
||||||
|
}
|
||||||
|
|
||||||
|
span.label {
|
||||||
|
display: inline-block;
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #e8f3e1; /*lightgreen;*/
|
||||||
|
width: 30%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.label {
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #e8f3e1; /*lightgreen;*/
|
||||||
|
width: 30%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.label2 {
|
||||||
|
display: inline-block;
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #e8f3e1; /*lightgreen;*/
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.data {
|
||||||
|
padding: 2px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-left: 0%;
|
||||||
|
/* background-color: lightblue;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
span.data2 {
|
||||||
|
padding: 2px;
|
||||||
|
/* background-color: lightblue; */
|
||||||
|
}
|
||||||
|
|
||||||
|
input.action {
|
||||||
|
margin-left: 0px;
|
||||||
|
background-color: #bee6a2; /*lightgreen;*/
|
||||||
|
color: darkgreen;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 2px solid #4CAF50; /* Green */
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.action:hover {background-color: #3e8e41; color:white;}
|
||||||
|
|
||||||
|
input.action:active {
|
||||||
|
background-color: #3e8e41;
|
||||||
|
transform: translate(-2px,2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.action2 {
|
||||||
|
margin-left: 0px;
|
||||||
|
color: black;
|
||||||
|
background-color: #d4d0c8;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#modul.desc {
|
||||||
|
padding: 3px;
|
||||||
|
background-color: grey;
|
||||||
|
}
|
||||||
|
|
||||||
|
[type = 'text'] {
|
||||||
|
margin-left: 0px;
|
||||||
|
/*background-color: lightblue;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.a, .return {
|
||||||
|
color: #661866;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.section {
|
||||||
|
}
|
||||||
|
.a, .item {
|
||||||
|
line-height: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.section-title {
|
||||||
|
display: inline-block;
|
||||||
|
color: #6CA345; /*#888;*/
|
||||||
|
padding-left: 5px;
|
||||||
|
padding-right: 5px;
|
||||||
|
line-height: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.menu-title {
|
||||||
|
display: inline-block;
|
||||||
|
color: #1A6D1A; /*#666;*/
|
||||||
|
padding-left: 1px;
|
||||||
|
padding-right: 1px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#module {
|
||||||
|
/* height: 600px; */
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#h2l1 {
|
||||||
|
height: 40px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#h2e11 {
|
||||||
|
width: 70%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
#h2e12 {
|
||||||
|
background-color: #C0E7A6;
|
||||||
|
float: left;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#h2l2 {
|
||||||
|
/* background-color: #A8F9E7;*/
|
||||||
|
border-top: solid white 3px;
|
||||||
|
border-bottom: solid white 2px;
|
||||||
|
height: 14px;
|
||||||
|
width: 100%;
|
||||||
|
padding: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#h2e21 {
|
||||||
|
float: left;
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#h2e22,#h2e23 {
|
||||||
|
float: left;
|
||||||
|
width: 10%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-password {
|
||||||
|
margin-left: -30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tg-icon {
|
||||||
|
position: relative;
|
||||||
|
top: 5px;
|
||||||
|
left: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*end*/
|
||||||
|
EOF
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
/* DO NOT MODIFY THIS FILE! It is updated automatically */
|
6
root/etc/logrotate.d/smanager
Normal file
6
root/etc/logrotate.d/smanager
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/usr/share/smanager/log/production.log {
|
||||||
|
weekly
|
||||||
|
copytruncate
|
||||||
|
rotate 12
|
||||||
|
missingok
|
||||||
|
}
|
20
root/usr/lib/systemd/system/smanager.service
Normal file
20
root/usr/lib/systemd/system/smanager.service
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Server Manager 2 Mojo
|
||||||
|
Requires=network.target httpd-e-smith.service ldap.service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
SyslogIdentifier=smanager
|
||||||
|
WorkingDirectory=/usr/share/smanager/script
|
||||||
|
PIDFile=/var/run/smanager.pid
|
||||||
|
ExecStartPre=/sbin/e-smith/service-status smanager
|
||||||
|
ExecStart=/usr/bin/hypnotoad srvmngr -f
|
||||||
|
ExecStop=/usr/bin/hypnotoad -s srvmngr
|
||||||
|
ExecReload=/usr/bin/hypnotoad srvmngr
|
||||||
|
KillMode=process
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sme-server.target
|
5
root/usr/share/smanager/conf/admin_muttrc
Normal file
5
root/usr/share/smanager/conf/admin_muttrc
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
set from = "admin"
|
||||||
|
set realname = "Administrator"
|
||||||
|
set record = "/usr/share/smanager/log/mail_sent"
|
||||||
|
##set content_type = "text/html"
|
||||||
|
|
6
root/usr/share/smanager/conf/srvmngr.conf
Normal file
6
root/usr/share/smanager/conf/srvmngr.conf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
secrets => ['new sessionsLeYTmFPhw3q', 'for validation QrPTZhWJmqCjyGZmguK'],
|
||||||
|
theme => 'default',
|
||||||
|
modules_dir => "lib/SrvMngr/Controller",
|
||||||
|
debug => 0,
|
||||||
|
}
|
15
root/usr/share/smanager/lib/README
Normal file
15
root/usr/share/smanager/lib/README
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
all files stored in directory :
|
||||||
|
-> /usr/share/perl5/vendor_perl/smeserver/Panel ?
|
||||||
|
|
||||||
|
startup subroutines added for the server version
|
||||||
|
|
||||||
|
sub startup{
|
||||||
|
$self->plugin Config
|
||||||
|
$self->mode
|
||||||
|
$self->setup_plugins;
|
||||||
|
$self->setup_helpers;
|
||||||
|
$self->setup_paths;
|
||||||
|
$self->setup_sessions;
|
||||||
|
$self->setup_routing;
|
||||||
|
$self->setup_hooks;
|
||||||
|
}
|
859
root/usr/share/smanager/lib/SrvMngr.pm
Normal file
859
root/usr/share/smanager/lib/SrvMngr.pm
Normal file
@ -0,0 +1,859 @@
|
|||||||
|
# SrvMngr: a web-based Sme Koozali server administration GUI
|
||||||
|
package SrvMngr;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use utf8;
|
||||||
|
|
||||||
|
use Mojo::Base 'Mojolicious';
|
||||||
|
|
||||||
|
use File::Spec;
|
||||||
|
use File::Spec::Functions qw( rel2abs catdir );
|
||||||
|
use Cwd;
|
||||||
|
use Net::Netmask;
|
||||||
|
|
||||||
|
use Mojo::File qw( path );
|
||||||
|
use Mojo::Home;
|
||||||
|
|
||||||
|
use DBM::Deep;
|
||||||
|
use Mojo::JWT;
|
||||||
|
|
||||||
|
use Mojolicious::Plugin::Config;
|
||||||
|
#use Mojolicious::Plugin::I18N;
|
||||||
|
|
||||||
|
use SrvMngr::Plugin::I18N;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr::Model::Main;
|
||||||
|
|
||||||
|
|
||||||
|
our $VERSION = '1.420';
|
||||||
|
$VERSION = eval $VERSION;
|
||||||
|
|
||||||
|
use Exporter 'import';
|
||||||
|
our @EXPORT_OK = qw(
|
||||||
|
init_session get_mod_url theme_list
|
||||||
|
getNavigation ip_number is_normal_password email_simple
|
||||||
|
mac_address_or_blank mac_address ip_number_or_blank
|
||||||
|
lang_space get_routes_list subnet_mask get_reg_mask
|
||||||
|
);
|
||||||
|
|
||||||
|
has home => sub {
|
||||||
|
my $path = $ENV{SRVMNGR_HOME} || getcwd;
|
||||||
|
return Mojo::Home->new(File::Spec->rel2abs($path));
|
||||||
|
};
|
||||||
|
|
||||||
|
has config_file => sub {
|
||||||
|
my $self = shift;
|
||||||
|
return $ENV{SRVMNGR_CONFIG} if $ENV{SRVMNGR_CONFIG};
|
||||||
|
return $self->home->rel_file('conf/srvmngr.conf');
|
||||||
|
};
|
||||||
|
|
||||||
|
has data_dir => sub {
|
||||||
|
my $self = shift;
|
||||||
|
return $ENV{SRVMNGR_DATA} if $ENV{SRVMNGR_DATA};
|
||||||
|
return $self->home->rel_file('data');
|
||||||
|
};
|
||||||
|
|
||||||
|
has temp_dir => sub {
|
||||||
|
my $self = shift;
|
||||||
|
return $ENV{SRVMNGR_TEMP} if $ENV{SRVMNGR_TEMP};
|
||||||
|
return $self->home->rel_file('temp');
|
||||||
|
};
|
||||||
|
|
||||||
|
has conf_dir => sub{
|
||||||
|
my $self = shift;
|
||||||
|
return $ENV{SRVMNGR_CONF} if $ENV{SRVMNGR_CONF};
|
||||||
|
return $self->home->rel_file('conf');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub startup {
|
||||||
|
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
$self->plugin( Config => { file => $self->config_file()} );
|
||||||
|
|
||||||
|
$self->mode( $self->config->{mode} || 'production' ); #'development'
|
||||||
|
|
||||||
|
$ENV{'MOJO_SMANAGER_DEBUG'} = $self->config->{debug} || 0;
|
||||||
|
|
||||||
|
$self->setup_plugins;
|
||||||
|
|
||||||
|
$self->setup_helpers;
|
||||||
|
|
||||||
|
$self->setup_paths;
|
||||||
|
|
||||||
|
$self->setup_sessions;
|
||||||
|
|
||||||
|
$self->setup_routing;
|
||||||
|
|
||||||
|
$self->setup_hooks;
|
||||||
|
|
||||||
|
# no data in cache
|
||||||
|
$self->renderer->cache->max_keys(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub setup_sessions {
|
||||||
|
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
# Setup signed sessions
|
||||||
|
$self->app->secrets( $self->config->{secrets} );
|
||||||
|
$self->sessions->cookie_name('smanager');
|
||||||
|
$self->sessions->default_expiration( $self->config->{timeout} );
|
||||||
|
$self->sessions->secure( 1 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub setup_paths {
|
||||||
|
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
# Replace the default paths
|
||||||
|
$self->renderer->paths([$self->home->rel_file('themes/default/templates')]);
|
||||||
|
$self->static->paths([$self->home->rel_file('themes/default/public')]);
|
||||||
|
|
||||||
|
my $theme = $self->config->{theme} || 'default';
|
||||||
|
if ( $theme ne 'default' ) {
|
||||||
|
# Put the new theme first
|
||||||
|
my $t_path = $self->home->rel_file('themes/'.$theme);
|
||||||
|
unshift @{$self->renderer->paths}, $t_path.'/templates' if -d $t_path.'/templates';
|
||||||
|
unshift @{$self->static->paths}, $t_path.'/public' if -d $t_path.'/public';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub setup_helpers {
|
||||||
|
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
$self->helper(log_req => sub {
|
||||||
|
my $c = shift;
|
||||||
|
my $mess = shift || '';
|
||||||
|
my $method = $c->req->method;
|
||||||
|
my $url = $c->req->url;
|
||||||
|
my $version = $c->req->version;
|
||||||
|
my $ip = $c->tx->remote_address;
|
||||||
|
return "Request received => $method $url HTTP/$version from $ip : $mess ";
|
||||||
|
});
|
||||||
|
|
||||||
|
$self->helper( 'home_page' => sub{ '/initial' } );
|
||||||
|
|
||||||
|
$self->helper( 'auth_fail' => sub {
|
||||||
|
my $self = shift;
|
||||||
|
my $message = shift || $self->l('acs_NO');
|
||||||
|
$self->flash( error => $message );
|
||||||
|
$self->redirect_to( $self->home_page, status => 403 );
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
$self->helper( 'is_admin' => sub {
|
||||||
|
my $self = shift;
|
||||||
|
if ( defined $self->session->{username} && defined $self->session->{is_admin} ) {
|
||||||
|
return $self->session->{is_admin};
|
||||||
|
}
|
||||||
|
return undef;
|
||||||
|
});
|
||||||
|
|
||||||
|
$self->helper( 'is_unsafe' => sub {
|
||||||
|
return SrvMngr::Model::Main->reconf_needed();
|
||||||
|
});
|
||||||
|
|
||||||
|
$self->helper( 'is_logged_in' => sub {
|
||||||
|
my $self = shift;
|
||||||
|
if ( defined $self->session->{logged_in} ) {
|
||||||
|
return 1 if ( $self->session('logged_in') == 1 );
|
||||||
|
}
|
||||||
|
return undef;
|
||||||
|
});
|
||||||
|
|
||||||
|
$self->helper(lang_space => \&_lang_space);
|
||||||
|
|
||||||
|
$self->plugin( Config => { file => $self->config_file()} );
|
||||||
|
|
||||||
|
$self->helper( send_email => sub {
|
||||||
|
my ($c, $address, $subject, $body) = @_;
|
||||||
|
|
||||||
|
if (not defined $body) {
|
||||||
|
warn "send_email: Need 3 parameters (Address, Subject, Body)\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $rcfile = $c->app->conf_dir().'/admin_muttrc';
|
||||||
|
|
||||||
|
#warn "send_email: $rcfile * $address\n"; #$rcfile $subject $address\n";
|
||||||
|
system( "/bin/echo \"$body\" | /usr/bin/mutt -F $rcfile -s \"$subject\" \"$address\"" ) == 0
|
||||||
|
or warn "error sendmail: $address \n"; # $subject";
|
||||||
|
});
|
||||||
|
|
||||||
|
$self->helper( pwdrst => sub {
|
||||||
|
my $c = shift;
|
||||||
|
my $file = $c->app->data_dir().'/pwdrst.db';
|
||||||
|
state $db = DBM::Deep->new($file);
|
||||||
|
});
|
||||||
|
|
||||||
|
$self->helper( jwt => sub {
|
||||||
|
Mojo::JWT->new(secret => shift->app->secrets->[0] || die)
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub setup_plugins {
|
||||||
|
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
$self->plugin('TagHelpers');
|
||||||
|
|
||||||
|
$self->plugin('RenderFile');
|
||||||
|
|
||||||
|
# CSRF protection if production mode
|
||||||
|
# $self->plugin('Mojolicious::Plugin::CSRFDefender' => {
|
||||||
|
# Adapted plugin for use with GET method
|
||||||
|
$self->plugin('SrvMngr::Plugin::CSRFDefender' => {
|
||||||
|
onetime => 1,
|
||||||
|
error_status => 400,
|
||||||
|
error_content => 'Error: CSRF token is invalid or outdated'
|
||||||
|
#error_template => 'csrf_400'
|
||||||
|
}) if ( $self->mode eq 'production' );
|
||||||
|
|
||||||
|
$self->plugin('SrvMngr::Plugin::I18N' => {namespace => 'SrvMngr::I18N', default => 'en'});
|
||||||
|
|
||||||
|
# $self->plugin('Mojolicious::Plugin::FrozenSessions' => {});
|
||||||
|
|
||||||
|
$self->helper(log_req => sub {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $mess = shift || '';
|
||||||
|
|
||||||
|
my $method = $c->req->method;
|
||||||
|
my $url = $c->req->url;
|
||||||
|
my $version = $c->req->version;
|
||||||
|
my $ip = $c->tx->remote_address;
|
||||||
|
|
||||||
|
return "Request received => $method $url HTTP/$version from $ip: $mess ";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub setup_routing {
|
||||||
|
|
||||||
|
my $self = shift;
|
||||||
|
my $r = $self->app->routes;
|
||||||
|
$r->namespaces(['SrvMngr::Controller']);
|
||||||
|
|
||||||
|
$r->get('/')->to('initial#main')->name('initial');
|
||||||
|
$r->get('/initial')->to('initial#main')->name('initial');
|
||||||
|
$r->get('/login')->to('login#main')->name('login');
|
||||||
|
$r->post('/login')->to('login#login')->name('signin');
|
||||||
|
$r->get('/manual')->to('manual#main')->name('manual');
|
||||||
|
$r->get('/support')->to('support#main')->name('support');
|
||||||
|
|
||||||
|
# Password reset allowed for this server
|
||||||
|
if ( ( $self->config->{pwdreset} || '0') == 1 ) {
|
||||||
|
$r->get('/login2')->to('login#pwdrescue')->name('pwdresc');
|
||||||
|
$r->get('/loginc')->to('login#confpwd')->name('resetpwdconf');
|
||||||
|
$r->get('/userpasswordr')->to('userpassword#main')->name('upwdreset');
|
||||||
|
$r->post('/userpasswordr')->to('userpassword#change_password')->name('upwdreset2');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $if_logged_in = $r->under( sub {
|
||||||
|
my $c =shift;
|
||||||
|
return $c->is_logged_in || $c->auth_fail($c->l("acs_LOGIN"));
|
||||||
|
});
|
||||||
|
$if_logged_in->post('/swttheme')->to('swttheme#main')->name('swttheme');
|
||||||
|
$if_logged_in->get('/review')->to('review#main')->name('review');
|
||||||
|
$if_logged_in->get('/logout')->to('logout#logout')->name('logout');
|
||||||
|
$if_logged_in->get('/userpassword')->to('userpassword#main')->name('passwd');
|
||||||
|
$if_logged_in->post('/userpassword')->to('userpassword#change_password')->name('passwd2');
|
||||||
|
|
||||||
|
my $if_admin = $r->under( sub {
|
||||||
|
my $c =shift;
|
||||||
|
return $c->is_admin || $c->auth_fail($c->l("acs_ADMIN"));
|
||||||
|
});
|
||||||
|
|
||||||
|
$if_admin->get('/backup')->to('backup#main')->name('backup');
|
||||||
|
$if_admin->post('/backup')->to('backup#do_display')->name('backupd');
|
||||||
|
$if_admin->get('/backupd')->to('backup#do_display')->name('backupc'); # corrections #
|
||||||
|
$if_admin->post('/backupd')->to('backup#do_update')->name('backupu');
|
||||||
|
|
||||||
|
$if_admin->get('/bugreport')->to('bugreport#main')->name('bugreport');
|
||||||
|
$if_admin->post('/bugreport')->to('bugreport#do_report')->name('bugreport2');
|
||||||
|
$if_admin->post('/bugreportD')->to('bugreport#download_config_report')->name('bugreportD');
|
||||||
|
|
||||||
|
$if_admin->get('/clamav')->to('clamav#main')->name('clamav');
|
||||||
|
$if_admin->post('/clamav')->to('clamav#do_update')->name('clamav2');
|
||||||
|
|
||||||
|
$if_admin->get('/datetime')->to('datetime#main')->name('datetime');
|
||||||
|
$if_admin->post('/datetime')->to('datetime#do_update')->name('datetime2');
|
||||||
|
|
||||||
|
$if_admin->get('/directory')->to('directory#main')->name('directory');
|
||||||
|
$if_admin->post('/directory')->to('directory#do_update')->name('directory2');
|
||||||
|
|
||||||
|
$if_admin->get('/domains')->to('domains#main')->name('domainsg');
|
||||||
|
$if_admin->post('/domains')->to('domains#do_display')->name('domainsp');
|
||||||
|
$if_admin->get('/domains2')->to('domains#do_display')->name('domains2g');
|
||||||
|
$if_admin->post('/domains2')->to('domains#do_update')->name('domains2p');
|
||||||
|
|
||||||
|
$if_admin->get('/emailsettings')->to('emailsettings#main')->name('emailsettings');
|
||||||
|
$if_admin->post('/emailsettings')->to('emailsettings#do_display')->name('emailsetting');
|
||||||
|
$if_admin->post('/emailsettingd')->to('emailsettings#do_update')->name('emailsettingu');
|
||||||
|
|
||||||
|
$if_admin->get('/groups')->to('groups#main')->name('groupsl');
|
||||||
|
$if_admin->post('/groups')->to('groups#do_display')->name('groupa');
|
||||||
|
$if_admin->get('/groups2')->to('groups#do_display')->name('groupd');
|
||||||
|
$if_admin->post('/groups2')->to('groups#do_update')->name('groupu');
|
||||||
|
|
||||||
|
$if_admin->get('/hostentries')->to('hostentries#main')->name('hostentries');
|
||||||
|
$if_admin->post('/hostentries')->to('hostentries#do_display')->name('hostentryadd');
|
||||||
|
$if_admin->get('/hostentriesd')->to('hostentries#do_display')->name('hostentrydis');
|
||||||
|
$if_admin->post('/hostentriesd')->to('hostentries#do_update')->name('hostentryupd');
|
||||||
|
|
||||||
|
$if_admin->get('/ibays')->to('ibays#main')->name('ibays');
|
||||||
|
$if_admin->post('/ibays')->to('ibays#do_display')->name('ibayadd');
|
||||||
|
$if_admin->get('/ibaysd')->to('ibays#do_display')->name('ibaydis');
|
||||||
|
$if_admin->post('/ibaysd')->to('ibays#do_update')->name('ibayupd');
|
||||||
|
|
||||||
|
$if_admin->get('/localnetworks')->to('localnetworks#main')->name('localnetworks');
|
||||||
|
$if_admin->post('/localnetworks')->to('localnetworks#do_display')->name('localnetworks');
|
||||||
|
$if_admin->post('/localnetworksa')->to('localnetworks#do_display')->name('localnetworksadd');
|
||||||
|
$if_admin->post('/localnetworksb')->to('localnetworks#do_display')->name('localnetworksadd1');
|
||||||
|
$if_admin->get('/localnetworksd')->to('localnetworks#do_display')->name('localnetworksdel');
|
||||||
|
$if_admin->post('/localnetworkse')->to('localnetworks#do_display')->name('localnetworksdel1');
|
||||||
|
|
||||||
|
$if_admin->get('/portforwarding')->to('portforwarding#main')->name('portforwarding');
|
||||||
|
$if_admin->post('/portforwarding')->to('portforwarding#do_display')->name('portforwarding');
|
||||||
|
$if_admin->post('/portforwardinga')->to('portforwarding#do_display')->name('portforwardingadd');
|
||||||
|
$if_admin->post('/portforwardingb')->to('portforwarding#do_display')->name('portforwardingadd1');
|
||||||
|
$if_admin->get('/portforwardingd')->to('portforwarding#do_display')->name('portforwardingdel');
|
||||||
|
$if_admin->post('/portforwardinge')->to('portforwarding#do_display')->name('portforwardingdel1');
|
||||||
|
|
||||||
|
$if_admin->get('/printers')->to('printers#main')->name('printersg');
|
||||||
|
$if_admin->post('/printers')->to('printers#do_display')->name('printera');
|
||||||
|
$if_admin->get('/printers2')->to('printers#do_display')->name('printer2g');
|
||||||
|
$if_admin->post('/printers2')->to('printers#do_update')->name('printers2p');
|
||||||
|
|
||||||
|
$if_admin->get('/proxy')->to('proxy#main')->name('proxy');
|
||||||
|
$if_admin->post('/proxy')->to('proxy#do_update')->name('proxy2');
|
||||||
|
|
||||||
|
$if_admin->get('/pseudonyms')->to('pseudonyms#main')->name('pseudonymsl');
|
||||||
|
$if_admin->post('/pseudonyms')->to('pseudonyms#do_display')->name('pseudonyma');
|
||||||
|
$if_admin->get('/pseudonyms2')->to('pseudonyms#do_display')->name('pseudonymd');
|
||||||
|
$if_admin->post('/pseudonyms2')->to('pseudonyms#do_update')->name('pseudonymu');
|
||||||
|
|
||||||
|
$if_admin->get('/qmailanalog')->to('qmailanalog#main')->name('qmailanalog');
|
||||||
|
$if_admin->post('/qmailanalog')->to('qmailanalog#do_update')->name('qmailanalog2');
|
||||||
|
|
||||||
|
$if_admin->get('/quota')->to('quota#main')->name('quota');
|
||||||
|
$if_admin->get('/quotad')->to('quota#do_display')->name('quotalist');
|
||||||
|
$if_admin->post('/quotad')->to('quota#do_update')->name('quotaupd');
|
||||||
|
$if_admin->post('/quota2')->to('quota#do_update')->name('quotaval');
|
||||||
|
|
||||||
|
$if_admin->get('/reboot')->to('reboot#main')->name('reboot');
|
||||||
|
$if_admin->post('/reboot')->to('reboot#do_action')->name('rebootact');
|
||||||
|
|
||||||
|
$if_admin->get('/remoteaccess')->to('remoteaccess#main')->name('remoteaccess');
|
||||||
|
$if_admin->post('/remoteaccess')->to('remoteaccess#do_action')->name('remoteaccessact');
|
||||||
|
|
||||||
|
$if_admin->get('/support')->to('support#main')->name('support');
|
||||||
|
|
||||||
|
$if_admin->get('/useraccounts')->to('useraccounts#main')->name('useraccounts');
|
||||||
|
$if_admin->post('/useraccounts')->to('useraccounts#do_display')->name('useraccountadd');
|
||||||
|
$if_admin->get('/useraccountsd')->to('useraccounts#do_display')->name('useraccountdis');
|
||||||
|
$if_admin->post('/useraccountsd')->to('useraccounts#do_update')->name('useraccountupd');
|
||||||
|
$if_admin->post('/useraccountso')->to('useraccounts#do_display')->name('useraccountvpn');
|
||||||
|
|
||||||
|
$if_admin->get('/viewlogfiles')->to('viewlogfiles#main')->name('viewlogfiles');
|
||||||
|
$if_admin->post('/viewlogfiles')->to('viewlogfiles#do_action')->name('viewlogfiles2');
|
||||||
|
$if_admin->post('/viewlogfilesr')->to('viewlogfiles#do_action')->name('viewlogfilesr');
|
||||||
|
|
||||||
|
$if_admin->get('/yum')->to('yum#main')->name('yum');
|
||||||
|
$if_admin->post('/yum')->to('yum#do_display')->name('yumd1');
|
||||||
|
$if_admin->get('/yumd')->to('yum#do_display')->name('yumd');
|
||||||
|
$if_admin->post('/yumd')->to('yum#do_update')->name('yumu');
|
||||||
|
|
||||||
|
$if_admin->get('/welcome')->to('welcome#main')->name('welcome');
|
||||||
|
|
||||||
|
$if_admin->get('/workgroup')->to('workgroup#main')->name('workgroup');
|
||||||
|
$if_admin->post('/workgroup')->to('workgroup#do_update')->name('workgroup2');
|
||||||
|
|
||||||
|
# additional routes (for contribs) got from 'routes' db
|
||||||
|
#my @routes = @{SrvMngr::get_routes_list()};
|
||||||
|
|
||||||
|
foreach (@{SrvMngr::get_routes_list()}) {
|
||||||
|
|
||||||
|
if ( defined $_->{method} and defined $_->{url} and defined $_->{ctlact} and defined $_->{name} ) {
|
||||||
|
my $menu = defined $_->{menu} ? $_->{menu} : 'A';
|
||||||
|
if ( $menu eq 'N' ) {
|
||||||
|
$r->get($_->{url})->to($_->{ctlact})->name($_->{name})
|
||||||
|
if ( $_->{method} eq 'get');
|
||||||
|
$r->post($_->{url})->to($_->{ctlact})->name($_->{name})
|
||||||
|
if ( $_->{method} eq 'post');
|
||||||
|
} elsif ( $menu eq 'U' ) {
|
||||||
|
$if_logged_in->get($_->{url})->to($_->{ctlact})->name($_->{name})
|
||||||
|
if ( $_->{method} eq 'get');
|
||||||
|
$if_logged_in->post($_->{url})->to($_->{ctlact})->name($_->{name})
|
||||||
|
if ( $_->{method} eq 'post');
|
||||||
|
} else {
|
||||||
|
$if_admin->get($_->{url})->to($_->{ctlact})->name($_->{name})
|
||||||
|
if ( $_->{method} eq 'get');
|
||||||
|
$if_admin->post($_->{url})->to($_->{ctlact})->name($_->{name})
|
||||||
|
if ( $_->{method} eq 'post');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$if_admin->get('/config/:key' => {key => qr/[a-z0-9]{2,32}/})->to('request#getconfig')->name('getconfig');
|
||||||
|
$if_admin->get('/account/:key' => {key => qr/[a-z0-9]{2,32}/})->to('request#getaccount')->name('getaccount');
|
||||||
|
$if_admin->get('/:module' => {module => qr/[a-z0-9]{2,32}/})->to('modules#modsearch')->name('module_search');
|
||||||
|
$if_admin->any('/*whatever' => {whatever => ''})->to('modules#whatever')->name('whatever');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub setup_hooks {
|
||||||
|
my ($c) = @_;
|
||||||
|
|
||||||
|
$c->hook( before_routes => sub {
|
||||||
|
my $c = shift;
|
||||||
|
if ( not defined $c->session->{lang} ) {
|
||||||
|
SrvMngr::init_session ( $c );
|
||||||
|
}
|
||||||
|
$c->lang_space();
|
||||||
|
});
|
||||||
|
|
||||||
|
if ( my $path = $ENV{MOJO_REVERSE_PROXY} ) {
|
||||||
|
my @path_parts = grep /\S/, split m{/}, $path;
|
||||||
|
$c->hook( before_dispatch => sub {
|
||||||
|
my ( $c ) = @_;
|
||||||
|
my $url = $c->req->url;
|
||||||
|
my $base = $url->base;
|
||||||
|
push @{ $base->path }, @path_parts;
|
||||||
|
$base->path->trailing_slash(1);
|
||||||
|
$url->path->leading_slash(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub init_session {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info("Init app session.");
|
||||||
|
|
||||||
|
my %datas = ();
|
||||||
|
%datas = %{SrvMngr::Model::Main->init_data()};
|
||||||
|
|
||||||
|
$c->session->{lang} = $datas{'lang'};
|
||||||
|
$c->session->{copyRight} = $c->l($datas{'copyRight'});
|
||||||
|
$c->session->{releaseVersion} = $datas{'releaseVersion'};
|
||||||
|
$c->session->{PwdSet} = $datas{'PwdSet'};
|
||||||
|
$c->session->{SystemName} = $datas{'SystemName'};
|
||||||
|
$c->session->{DomainName} = $datas{'DomainName'};
|
||||||
|
$c->session->{Access} = $datas{'Access'};
|
||||||
|
if ( not defined $c->session->{CurrentTheme} ) {
|
||||||
|
$c->session->{CurrentTheme} = $c->config->{theme};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_mod_url{
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $module = shift;
|
||||||
|
|
||||||
|
# test if module (panel) exists
|
||||||
|
my $module_file = $c->config->{modules_dir} . '/' . ucfirst($module) . '.pm';
|
||||||
|
if ( -e $module_file){
|
||||||
|
return "/$module";
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head2 theme_list()
|
||||||
|
|
||||||
|
Returns a hash of themes for the header theme field's drop down list.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
|
||||||
|
sub theme_list {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my @files = ();
|
||||||
|
my @themes = ();
|
||||||
|
my $theme_ignore = "(\.\.?)";
|
||||||
|
|
||||||
|
# my $themedir = '/usr/share/smanager/themes/';
|
||||||
|
my $themedir = $c->app->home->rel_file('themes/');
|
||||||
|
|
||||||
|
if (opendir (DIR, $themedir)) {
|
||||||
|
@files = grep (!/^${theme_ignore}$/, readdir(DIR));
|
||||||
|
closedir (DIR);
|
||||||
|
} else {
|
||||||
|
warn "Can't open directory $themedir\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $theme (@files) {
|
||||||
|
if (-d "$themedir/$theme") {
|
||||||
|
push @themes, $theme;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return \@themes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# subroutine to feed navigation bar
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getNavigation {
|
||||||
|
|
||||||
|
use esmith::NavigationDB;
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $lang = shift || 'en-us';
|
||||||
|
my $menu = shift || 'N';
|
||||||
|
|
||||||
|
# my $lang = $c->session->{lang} || 'en-us';
|
||||||
|
|
||||||
|
# Use this variable throughout to keep track of files
|
||||||
|
# list of just the files
|
||||||
|
|
||||||
|
my @files = ();
|
||||||
|
my %files_hash = ();
|
||||||
|
|
||||||
|
#-----------------------------------------------------
|
||||||
|
# Determine the directory where the functions are kept
|
||||||
|
#-----------------------------------------------------
|
||||||
|
my $navigation_ctlr_ignore =
|
||||||
|
"(\.\.?|Swttheme\.pm|Login\.pm|Request\.pm|Modules\.pm(-.*)?)";
|
||||||
|
# "(\.\.?|Initial\.pm|Manual\.pm|Swttheme\.pm|Request\.pm|Modules\.pm(-.*)?)";
|
||||||
|
my $navigation_cgi_ignore =
|
||||||
|
"(\.\.?|navigation|noframes|online-manual|(internal|pleasewait)(-.*)?)";
|
||||||
|
|
||||||
|
# my $ctrldir = $c->app->home->rel_file('lib/SrvMngr/Controller');
|
||||||
|
my $ctrldir = '/usr/share/smanager/lib/SrvMngr/Controller';
|
||||||
|
my $cgidir = '/etc/e-smith/web/panels/manager/cgi-bin/';
|
||||||
|
|
||||||
|
if (opendir (DIR, $ctrldir)) {
|
||||||
|
@files = grep (!/^${navigation_ctlr_ignore}$/,
|
||||||
|
readdir (DIR));
|
||||||
|
closedir (DIR);
|
||||||
|
} else {
|
||||||
|
warn "Can't open directory $ctrldir\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $file (@files) {
|
||||||
|
next if (-d "$ctrldir/$file");
|
||||||
|
next if ( $file !~ m/^[A-Z].*\.pm$/ );
|
||||||
|
|
||||||
|
my $file2 = lc($file);
|
||||||
|
$file2 =~ s/\.pm$//;
|
||||||
|
$files_hash{$file2} = 'ctrl';
|
||||||
|
}
|
||||||
|
|
||||||
|
# Is there some old panels not managed in new way ?
|
||||||
|
@files = ();
|
||||||
|
if (opendir (DIR, $cgidir)) {
|
||||||
|
@files = grep (!/^${navigation_cgi_ignore}$/,
|
||||||
|
readdir (DIR));
|
||||||
|
closedir (DIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $file (@files) {
|
||||||
|
next if (-d "$cgidir/$file");
|
||||||
|
$files_hash{$file} = 'cgim' if ( ! exists $files_hash{$file} );
|
||||||
|
}
|
||||||
|
|
||||||
|
#--------------------------------------------------
|
||||||
|
# For each script, extract the description and category
|
||||||
|
# information. Build up an associative array mapping headings
|
||||||
|
# to heading structures. Each heading structure contains the
|
||||||
|
# total weight for the heading, the number of times the heading
|
||||||
|
# has been encountered, and another associative array mapping
|
||||||
|
# descriptions to description structures. Each description
|
||||||
|
# structure contains the filename of the particular cgi script
|
||||||
|
# and a weight.
|
||||||
|
#--------------------------------------------------
|
||||||
|
my %nav = ();
|
||||||
|
|
||||||
|
use constant NAVIGATIONDIR => '/home/e-smith/db/navigation2';
|
||||||
|
# use constant WEBFUNCTIONS => '/etc/e-smith/web/functions';
|
||||||
|
|
||||||
|
my $navinfo = NAVIGATIONDIR . "/navigation.$lang";
|
||||||
|
|
||||||
|
my $navdb = esmith::NavigationDB->open_ro( $navinfo ) or
|
||||||
|
die "Couldn't open $navinfo\n";
|
||||||
|
|
||||||
|
# Check the navdb for anything with a UrlPath, which means that it doesn't
|
||||||
|
# have a cgi file to be picked up by the above code. Ideally, only pages
|
||||||
|
# that exist should be in the db, but that's not the case. Anything
|
||||||
|
# without a cgi file will have to remove themselves on uninstall from the
|
||||||
|
# navigation dbs.
|
||||||
|
foreach my $rec ($navdb->get_all)
|
||||||
|
{
|
||||||
|
if ($rec->prop('UrlPath'))
|
||||||
|
{
|
||||||
|
$files_hash{$rec->{key}} = $cgidir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $file (keys %files_hash)
|
||||||
|
{
|
||||||
|
#my $heading = 'Unknown';
|
||||||
|
my $heading = 'Legacy';
|
||||||
|
|
||||||
|
my $description = $file;
|
||||||
|
my $headingWeight = 99999;
|
||||||
|
my $descriptionWeight = 99999;
|
||||||
|
my $urlpath = '';
|
||||||
|
my $menucat = 'A'; # admin menu (default)
|
||||||
|
|
||||||
|
my $rec = $navdb->get($file);
|
||||||
|
|
||||||
|
if (defined $rec)
|
||||||
|
{
|
||||||
|
$heading = $rec->prop('Heading');
|
||||||
|
$description = $rec->prop('Description');
|
||||||
|
$headingWeight = $rec->prop('HeadingWeight');
|
||||||
|
$descriptionWeight = $rec->prop('DescriptionWeight');
|
||||||
|
$urlpath = $rec->prop('UrlPath') || '';
|
||||||
|
$menucat = $rec->prop('MenuCat') || 'A'; # admin menu (default)
|
||||||
|
}
|
||||||
|
next if $menu ne $menucat;
|
||||||
|
|
||||||
|
#--------------------------------------------------
|
||||||
|
# add heading, description and weight information to data structure
|
||||||
|
#--------------------------------------------------
|
||||||
|
|
||||||
|
unless (exists $nav {$heading})
|
||||||
|
{
|
||||||
|
$nav {$heading} = { COUNT => 0, WEIGHT => 0, DESCRIPTIONS => [] };
|
||||||
|
}
|
||||||
|
|
||||||
|
$nav {$heading} {'COUNT'} ++;
|
||||||
|
$nav {$heading} {'WEIGHT'} += $headingWeight;
|
||||||
|
|
||||||
|
# Check for manager panel, and assign the appropriate
|
||||||
|
# cgi-bin prefix for the links.
|
||||||
|
# Grab the last 2 directories by splitting for '/'s and
|
||||||
|
# then concatenating the last 2
|
||||||
|
# probably a better way, but I don't know it.
|
||||||
|
|
||||||
|
my $path;
|
||||||
|
if ( $files_hash{$file} eq 'ctrl') {
|
||||||
|
$path = "2";
|
||||||
|
} elsif ( $files_hash{$file} eq 'cgim') {
|
||||||
|
$path = "/cgi-bin";
|
||||||
|
} else {
|
||||||
|
my @filename = split /\//, $files_hash{$file};
|
||||||
|
$path = "/$filename[scalar @filename - 2]/$filename[scalar @filename - 1]";
|
||||||
|
};
|
||||||
|
|
||||||
|
push @{ $nav {$heading} {'DESCRIPTIONS'} },
|
||||||
|
{ DESCRIPTION => $description,
|
||||||
|
WEIGHT => $descriptionWeight,
|
||||||
|
FILENAME => $urlpath ? $urlpath : "$path/$file",
|
||||||
|
CGIPATH => $path,
|
||||||
|
MENUCAT => $menucat
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return \%nav;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub _lang_space {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $panel = $c->tx->req->url;
|
||||||
|
if ( $panel =~ m/\.css$|\.js$|\.jpg$|\.gif$|\.png$/ ) {
|
||||||
|
#warn "panel not treated $panel";
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
my $lang = ( $c->tx->req->headers->accept_language || ['en_US'] );
|
||||||
|
$lang = (split(/,/, $lang))[0];
|
||||||
|
# my $lang = (split(/,/, $c->tx->req->headers->accept_language))[0];
|
||||||
|
## convert xx_XX lang format to xx-xx + delete .UTFxx + lowercase
|
||||||
|
# $lang =~ s/_(.*)\..*$/-${1}/; # just keep 'en-us'
|
||||||
|
##$lang = lc( substr( $lang,0,2 ) ); # just keep 'en'
|
||||||
|
|
||||||
|
$panel = '/initial' if ($panel eq '/' or $panel eq '');
|
||||||
|
|
||||||
|
(my $module = $panel) =~ s|\?.*$||;
|
||||||
|
$module =~ s|^/||;
|
||||||
|
$module = ucfirst($module);
|
||||||
|
|
||||||
|
my $moduleLong = "SrvMngr::I18N::Modules::$module";
|
||||||
|
(my $dir = $moduleLong) =~ s|::|/|g;
|
||||||
|
my $I18Ndir = $c->app->home->rel_file('lib/') . '/' . $dir;
|
||||||
|
|
||||||
|
##$c->app->log->debug("$panel $module $moduleLong $I18Ndir");
|
||||||
|
if ( ! -d $I18Ndir ) {
|
||||||
|
( $moduleLong = $moduleLong) =~ s/.$//;
|
||||||
|
( $I18Ndir = $I18Ndir) =~ s/.$//;
|
||||||
|
}
|
||||||
|
if ( -d $I18Ndir ) {
|
||||||
|
## $c->app->log->debug("hook_b_r->panel route. lang: $lang namespace: $moduleLong ldir; $I18Ndir");
|
||||||
|
warn "NS already loaded: $moduleLong \n" if ( $c->i18ns() eq $moduleLong ); # i18ns changed
|
||||||
|
$c->i18ns( $moduleLong, $lang );
|
||||||
|
} else {
|
||||||
|
warn "Locale lexicon missing for $module \n";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub get_routes_list {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $rtdb = esmith::ConfigDB->open_ro('routes') || die 'Cannot open Routes db';
|
||||||
|
my @routes = $rtdb->get_all();
|
||||||
|
my @rt;
|
||||||
|
|
||||||
|
for (@routes) {
|
||||||
|
my ( $contrib, $name ) = split ( /\+/, $_->key);
|
||||||
|
push @rt,
|
||||||
|
{ 'method' => $_->prop('Method'), 'url' => $_->prop('Url'),
|
||||||
|
'ctlact' => $_->prop('Ctlact'), 'menu' => $_->prop('Menu'),
|
||||||
|
'name' => $name, 'contrib' => $contrib,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return \@rt;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub ip_number {
|
||||||
|
|
||||||
|
# from CGI::FormMagick::Validator qw( ip_number );
|
||||||
|
|
||||||
|
my ($c, $data) = @_;
|
||||||
|
|
||||||
|
return undef unless defined $data;
|
||||||
|
|
||||||
|
return $c->l('FM_IP_NUMBER1') . " (" . $data . ")" unless $data =~ /^[\d.]+$/;
|
||||||
|
|
||||||
|
my @octets = split /\./, $data;
|
||||||
|
my $dots = ($data =~ tr/.//);
|
||||||
|
|
||||||
|
return $c->l('FM_IP_NUMBER2') unless (scalar @octets == 4 and $dots == 3);
|
||||||
|
|
||||||
|
foreach my $octet (@octets) {
|
||||||
|
return $c->l("FM_IP_NUMBER3", $octet) if $octet > 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub is_normal_password {
|
||||||
|
|
||||||
|
# from CGI::FormMagick::Validator qw( password );
|
||||||
|
|
||||||
|
my ($c, $data) = @_;
|
||||||
|
$_ = $data;
|
||||||
|
if (not defined $_) {
|
||||||
|
return $c->l("FM_PASSWORD1");
|
||||||
|
} elsif (/\d/ and /[A-Z]/ and /[a-z]/ and /\W|_/ and length($_) > 6) {
|
||||||
|
return "OK";
|
||||||
|
} else {
|
||||||
|
return $c->l("FM_PASSWORD2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub email_simple {
|
||||||
|
my ($c, $data) = @_;
|
||||||
|
|
||||||
|
use Mail::RFC822::Address;
|
||||||
|
|
||||||
|
if (not defined $data ) {
|
||||||
|
return $c->l("FM_EMAIL_SIMPLE1");
|
||||||
|
} elsif (Mail::RFC822::Address::valid($data)) {
|
||||||
|
return "OK";
|
||||||
|
} else {
|
||||||
|
return $c->l("FM_EMAIL_SIMPLE2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub mac_address_or_blank {
|
||||||
|
my ($c, $data) = @_;
|
||||||
|
return "OK" unless $data;
|
||||||
|
return mac_address($c, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub mac_address {
|
||||||
|
|
||||||
|
# from CGI::FormMagick::Validator::Network
|
||||||
|
|
||||||
|
my ($c, $data) = @_;
|
||||||
|
|
||||||
|
$_ = lc $data; # easier to match on $_
|
||||||
|
if (not defined $_) {
|
||||||
|
return $c->l('FM_MAC_ADDRESS1');
|
||||||
|
} elsif (/^([0-9a-f][0-9a-f](:[0-9a-f][0-9a-f]){5})$/) {
|
||||||
|
return "OK";
|
||||||
|
} else {
|
||||||
|
return $c->l('FM_MAC_ADDRESS2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub ip_number_or_blank {
|
||||||
|
|
||||||
|
# XXX - FIXME - we should push this down into CGI::FormMagick
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $ip = shift;
|
||||||
|
|
||||||
|
if (!defined($ip) || $ip eq "")
|
||||||
|
{
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
return ip_number( $c, $ip );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub subnet_mask {
|
||||||
|
|
||||||
|
my ( $data ) = @_;
|
||||||
|
|
||||||
|
# we test for a valid mask or bit mask
|
||||||
|
my $tip="192.168.1.50";
|
||||||
|
my $block = new Net::Netmask("$tip/$data") or return "INV1 $data";
|
||||||
|
|
||||||
|
if ($block->mask() eq "$data" || $block->bits() eq "$data") {
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
return "INV2 $data";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_reg_mask {
|
||||||
|
|
||||||
|
my ( $address, $mask ) = @_;
|
||||||
|
|
||||||
|
# we transform bit mask to regular mask
|
||||||
|
my $block = new Net::Netmask("$address/$mask");
|
||||||
|
|
||||||
|
return $block->mask();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
2129
root/usr/share/smanager/lib/SrvMngr/Controller/Backup.pm
Normal file
2129
root/usr/share/smanager/lib/SrvMngr/Controller/Backup.pm
Normal file
File diff suppressed because it is too large
Load Diff
175
root/usr/share/smanager/lib/SrvMngr/Controller/Bugreport.pm
Normal file
175
root/usr/share/smanager/lib/SrvMngr/Controller/Bugreport.pm
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
package SrvMngr::Controller::Bugreport;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Investigation
|
||||||
|
# description : Report a bug
|
||||||
|
# navigation : 7000 500
|
||||||
|
|
||||||
|
# routes : end
|
||||||
|
#------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
use Text::Template;
|
||||||
|
use File::Basename;
|
||||||
|
use esmith::FormMagick qw( gen_locale_date_string );
|
||||||
|
|
||||||
|
our $cdb = esmith::ConfigDB->open or die "Couldn't open ConfigDB\n";
|
||||||
|
|
||||||
|
# Get some basic info on the current SME install
|
||||||
|
our $sysconfig = $cdb->get('sysconfig');
|
||||||
|
our $systemmode = $cdb->get('SystemMode')->value;
|
||||||
|
our $previoussystemmode = $sysconfig->prop('PreviousSystemMode');
|
||||||
|
our $releaseversion = $sysconfig->prop('ReleaseVersion');
|
||||||
|
|
||||||
|
# Prepare some filehandles for templates and reports
|
||||||
|
our $templatefile = '/tmp/bugreport_template.txt';
|
||||||
|
our $configreportfile = '/tmp/configreport.txt';
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %bugr_datas = ();
|
||||||
|
|
||||||
|
my $title = $c->l('bugr_FORM_TITLE');
|
||||||
|
my $modul = $c->render_to_string( inline => $c->l('bugr_DESCRIPTION'));
|
||||||
|
|
||||||
|
$bugr_datas{'trt'} = 'SHOW';
|
||||||
|
|
||||||
|
$c->stash(title => $title, modul => $modul, bugr_datas => \%bugr_datas);
|
||||||
|
$c->render(template => 'bugreport');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_report {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('bugr_FORM_TITLE');
|
||||||
|
|
||||||
|
my $trt = $c->param('trt') || 'SHOW';
|
||||||
|
|
||||||
|
my %bugr_datas = ();
|
||||||
|
$bugr_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
if ( $trt eq 'SHOW' ) {
|
||||||
|
create_configuration_report();
|
||||||
|
|
||||||
|
my $out = $c->render_to_string(inline => show_config_report());
|
||||||
|
|
||||||
|
$bugr_datas{'trt'} = 'DOWN';
|
||||||
|
|
||||||
|
$c->stash(title => $title, modul => $out, bugr_datas => \%bugr_datas);
|
||||||
|
$c->render(template => 'bugreport2');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DOWN' ) {
|
||||||
|
|
||||||
|
my $modul = 'Bug report download';
|
||||||
|
|
||||||
|
# $c->render_file(
|
||||||
|
# 'filepath' => "$configreportfile",
|
||||||
|
# 'format' => 'x-download',
|
||||||
|
# 'content_disposition' => 'attachment',
|
||||||
|
# 'cleanup' => 1,
|
||||||
|
# );
|
||||||
|
|
||||||
|
# the following in this sub will not be used !!!
|
||||||
|
# $bugr_datas{'trt'} = 'DOWN';
|
||||||
|
|
||||||
|
# $c->stash(title => $title, modul => $modul, bugr_datas => \%bugr_datas);
|
||||||
|
# $c->render(template => 'bugreport');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub create_configuration_report {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
# TBD: possibly check $q for a boolean value eg. from a checkbox
|
||||||
|
# indicating the user has read privacy warning etc.
|
||||||
|
|
||||||
|
# create the reporting template
|
||||||
|
my $configreport_template = Text::Template->new(TYPE => 'FILE', SOURCE => '/etc/e-smith/web/common/configuration_report.tmpl', UNTAINT => 1);
|
||||||
|
my $report_creation_time = gen_locale_date_string;
|
||||||
|
|
||||||
|
# curent kernel
|
||||||
|
my $curkernel = `uname -r`;
|
||||||
|
|
||||||
|
# get additional RPMs
|
||||||
|
my @newrpms = `/sbin/e-smith/audittools/newrpms`;
|
||||||
|
|
||||||
|
# get additional Repositories
|
||||||
|
my @repositories = `/sbin/e-smith/audittools/repositories`;
|
||||||
|
#print @repositories;
|
||||||
|
|
||||||
|
# get templates
|
||||||
|
my @templates = `/sbin/e-smith/audittools/templates`;
|
||||||
|
|
||||||
|
# get events
|
||||||
|
my @events = `/sbin/e-smith/audittools/events`;
|
||||||
|
|
||||||
|
|
||||||
|
# set template variables
|
||||||
|
my %vars = (report_creation_time => \$report_creation_time,
|
||||||
|
releaseversion => \$releaseversion,
|
||||||
|
curkernel => \$curkernel,
|
||||||
|
systemmode => \$systemmode,
|
||||||
|
previoussystemmode => \$previoussystemmode,
|
||||||
|
newrpms => \@newrpms,
|
||||||
|
templates => \@templates,
|
||||||
|
events => \@events,
|
||||||
|
repositories => \@repositories,
|
||||||
|
);
|
||||||
|
|
||||||
|
# prcess template
|
||||||
|
my $result = $configreport_template->fill_in(HASH => \%vars);
|
||||||
|
|
||||||
|
# write processed template to file
|
||||||
|
open (my $cfgrep, '>', $configreportfile) or die "Could not create temporary file for config report!";
|
||||||
|
print $cfgrep $result;
|
||||||
|
close $cfgrep;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub show_config_report {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $out = '';
|
||||||
|
$out .= sprintf "<PRE>";
|
||||||
|
|
||||||
|
open (my $cfgrep, '<', $configreportfile) or die "Could not find temporary config report file!";
|
||||||
|
|
||||||
|
while (<$cfgrep>) {
|
||||||
|
$out .= sprintf("%s", $_);
|
||||||
|
}
|
||||||
|
|
||||||
|
$out .= sprintf "</PRE>";
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub download_config_report {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
$c->render_file(
|
||||||
|
'filepath' => "$configreportfile",
|
||||||
|
'format' => 'x-download',
|
||||||
|
'content_disposition' => 'attachment',
|
||||||
|
'cleanup' => 1,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
113
root/usr/share/smanager/lib/SrvMngr/Controller/Clamav.pm
Normal file
113
root/usr/share/smanager/lib/SrvMngr/Controller/Clamav.pm
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
package SrvMngr::Controller::Clamav;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : System
|
||||||
|
# description : Antivirus (ClamAV)
|
||||||
|
# navigation : 4000 600
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#------------------------------
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
#package esmith::FormMagick::Panel::clamav;
|
||||||
|
|
||||||
|
our $db = esmith::ConfigDB->open() || die "Couldn't open config db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %clm_datas = ();
|
||||||
|
my $title = $c->l('clm_FORM_TITLE');
|
||||||
|
my $modul = $c->render_to_string(inline => $c->l('clm_DESC_FILESYSTEM_SCAN_PERIOD'));
|
||||||
|
|
||||||
|
$clm_datas{'FilesystemScan'} = ($db->get_prop('clamav','FilesystemScan')) || 'disabled';
|
||||||
|
$clm_datas{'Quarantine'} = ($db->get_prop('clamav','Quarantine')) || 'disabled';
|
||||||
|
|
||||||
|
$clm_datas{'clam_versions'} = get_clam_versions();
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $modul, clm_datas => \%clm_datas );
|
||||||
|
$c->render(template => 'clamav');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $http_clamav_status = $c->param('http_clamav_status') || 'disabled';
|
||||||
|
my $smtp_clamav_status = $c->param('smtp_clamav_status') || '';
|
||||||
|
|
||||||
|
my $result = "";
|
||||||
|
|
||||||
|
$c->change_settings();
|
||||||
|
|
||||||
|
# Update the system
|
||||||
|
system("/sbin/e-smith/signal-event clamav-update") == 0
|
||||||
|
or $result = $c->l('clm_ERROR_UPDATING_CONFIGURATION');
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('clm_SUCCESS') ;
|
||||||
|
$c->flash( success => $result );
|
||||||
|
} else {
|
||||||
|
$c->flash( error => $result );
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->redirect_to('/clamav');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub change_settings {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $status = $c->param('status');
|
||||||
|
|
||||||
|
my $FilesystemScan = ( $c->param('FilesystemScan') || 'disabled' );
|
||||||
|
my $Quarantine = ( $c->param('Quarantine') || 'disabled' );
|
||||||
|
|
||||||
|
my $DatabaseMirror = ( $c->param('DatabaseMirror') || 'db.us.clamav.net' );
|
||||||
|
my $UpdateOfficeHrs = ( $c->param('UpdateOfficeHrs') || 'disabled' );
|
||||||
|
my $UpdateNonOfficeHrs = ( $c->param('UpdateNonOfficeHrs') || 'disabled' );
|
||||||
|
my $UpdateWeekend = ( $c->param('UpdateWeekend') || 'disabled' );
|
||||||
|
|
||||||
|
my $HTTPProxyServer = ( $c->param('HTTPProxyServer') || '' );
|
||||||
|
my $HTTPProxyPort = ( $c->param('HTTPProxyPort') || '' );
|
||||||
|
my $HTTPProxyUsername = ( $c->param('HTTPProxyUsername') || '' );
|
||||||
|
my $HTTPProxyPassword = ( $c->param('HTTPProxyPassword') || '' );
|
||||||
|
|
||||||
|
my $clamav = $db->get('clamav') || $db->new_record('clamav', {type=>'service'});
|
||||||
|
$status ||= $clamav->prop('status');
|
||||||
|
|
||||||
|
$clamav->merge_props(
|
||||||
|
status => $status,
|
||||||
|
FilesystemScan => $FilesystemScan,
|
||||||
|
Quarantine => $Quarantine,
|
||||||
|
DatabaseMirror => $DatabaseMirror,
|
||||||
|
UpdateOfficeHrs => $UpdateOfficeHrs,
|
||||||
|
UpdateNonOfficeHrs => $UpdateNonOfficeHrs,
|
||||||
|
UpdateWeekend => $UpdateWeekend,
|
||||||
|
HTTPProxyServer => $HTTPProxyServer,
|
||||||
|
HTTPProxyPort => $HTTPProxyPort,
|
||||||
|
HTTPProxyUsername => $HTTPProxyUsername,
|
||||||
|
HTTPProxyPassword => $HTTPProxyPassword,
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_clam_versions
|
||||||
|
{
|
||||||
|
my $version = `/usr/bin/freshclam -V`;
|
||||||
|
chomp $version;
|
||||||
|
$version =~ s/^ClamAV //;
|
||||||
|
|
||||||
|
return $version;
|
||||||
|
}
|
||||||
|
1;
|
404
root/usr/share/smanager/lib/SrvMngr/Controller/Datetime.pm
Normal file
404
root/usr/share/smanager/lib/SrvMngr/Controller/Datetime.pm
Normal file
@ -0,0 +1,404 @@
|
|||||||
|
package SrvMngr::Controller::Datetime;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : System
|
||||||
|
# description : Date and time
|
||||||
|
# navigation : 4000 400
|
||||||
|
|
||||||
|
# routes : end
|
||||||
|
#------------------------------
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
use esmith::FormMagick;
|
||||||
|
use esmith::util;
|
||||||
|
|
||||||
|
our $cdb = esmith::ConfigDB->open() || die "Couldn't open config db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %dat_datas = ();
|
||||||
|
my $title = $c->l('dat_FORM_TITLE');
|
||||||
|
my $modul = $c->l('dat_INITIAL_DESC');
|
||||||
|
|
||||||
|
|
||||||
|
$dat_datas{ntpstatus} = 'disabled';
|
||||||
|
|
||||||
|
my $rec = $cdb->get('ntpd');
|
||||||
|
if ($rec) {
|
||||||
|
$dat_datas{'ntpserver'} = $rec->prop('NTPServer') || '';
|
||||||
|
if ( $rec->prop('status') eq 'enabled' ) {
|
||||||
|
$dat_datas{ntpstatus} = 'enabled'
|
||||||
|
unless ($rec->prop('SyncToHWClockSupported') || 'yes') eq 'yes' and $dat_datas{ntpserver} =~ m#^\s*$#;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
($dat_datas{weekday}, $dat_datas{monthname},
|
||||||
|
$dat_datas{month}, $dat_datas{day}, $dat_datas{year},
|
||||||
|
$dat_datas{hour}, $dat_datas{minute}, $dat_datas{second},
|
||||||
|
$dat_datas{ampm}) = split /\|/,
|
||||||
|
`/bin/date '+%A|%B|%-m|%-d|%Y|%-I|%M|%S|%p'`;
|
||||||
|
|
||||||
|
# get rid of trailing carriage return on last field
|
||||||
|
chop ($dat_datas{ampm});
|
||||||
|
|
||||||
|
$dat_datas{'now_string'} = esmith::FormMagick->gen_locale_date_string();
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $modul, dat_datas => \%dat_datas );
|
||||||
|
$c->render('datetime');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my %dat_datas = ();
|
||||||
|
my $title = $c->l('dat_FORM_TITLE');
|
||||||
|
my $modul = $c->l('dat_INITIAL_DESC');
|
||||||
|
my $result;
|
||||||
|
my $success;
|
||||||
|
|
||||||
|
my $old_ntpstatus = $c->param('Old_ntpstatus');
|
||||||
|
$dat_datas{ntpstatus} = $c->param('Ntpstatus');
|
||||||
|
|
||||||
|
|
||||||
|
if ( $dat_datas{ntpstatus} ne $old_ntpstatus) {
|
||||||
|
|
||||||
|
if ( $dat_datas{ntpstatus} eq 'disabled' ) {
|
||||||
|
($dat_datas{weekday},
|
||||||
|
$dat_datas{monthname},
|
||||||
|
$dat_datas{month},
|
||||||
|
$dat_datas{day},
|
||||||
|
$dat_datas{year},
|
||||||
|
$dat_datas{hour},
|
||||||
|
$dat_datas{minute},
|
||||||
|
$dat_datas{second},
|
||||||
|
$dat_datas{ampm}) = split /\|/,
|
||||||
|
`/bin/date '+%A|%B|%-m|%-d|%Y|%-I|%M|%S|%p'`;
|
||||||
|
|
||||||
|
# get rid of trailing carriage return on last field
|
||||||
|
chop ($dat_datas{ampm});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$dat_datas{ntpserver} = ($cdb->get_prop('ntpd','NTPServer')) || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$dat_datas{now_string} = esmith::FormMagick->gen_locale_date_string();
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $modul, dat_datas => \%dat_datas );
|
||||||
|
return $c->render('datetime');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $dat_datas{ntpstatus} eq 'enabled' ) {
|
||||||
|
|
||||||
|
# update ntpserver
|
||||||
|
|
||||||
|
$dat_datas{ntpserver} = $c->param('Ntpserver') || '';
|
||||||
|
|
||||||
|
if ( $dat_datas{ntpserver} eq "pool.ntp.org" ) {
|
||||||
|
$result .= $c->l('dat_INVALID_NTP_ADDR');
|
||||||
|
} elsif ( $dat_datas{ntpserver} =~ /^([a-zA-Z0-9\.\-]+)$/ ) {
|
||||||
|
$dat_datas{ntpserver} = $1;
|
||||||
|
# } elsif ( $dat_datas{ntpserver} =~ /^\s*$/ ) {
|
||||||
|
# $dat_datas{ntpserver} = "";
|
||||||
|
} else {
|
||||||
|
$result .= $c->l('dat_INVALID_NTP_ADDR');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$success = update_ntpserver( $c, $dat_datas{ntpserver} );
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
# set Locale time & clean ntpserver
|
||||||
|
|
||||||
|
#my $servername = ($c->param('ServerName') || 'WS');
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = validate_change_datetime( $c );
|
||||||
|
if ( $result eq 'OK' ) {
|
||||||
|
$success = $c->l('dat_UPDATING_CLOCK');
|
||||||
|
$result = '';
|
||||||
|
disable_ntp();
|
||||||
|
$success .= '<br>'. $c->l('dat_SERVER_DISABLED_DESC');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $result ) {
|
||||||
|
$c->stash( error => $result );
|
||||||
|
$c->stash( title => $title, modul => $modul, dat_datas => \%dat_datas );
|
||||||
|
return $c->render('datetime');
|
||||||
|
}
|
||||||
|
#$result = $c->l('dat_SUCCESS');
|
||||||
|
|
||||||
|
my $message = "'Datetime' update DONE";
|
||||||
|
$c->app->log->info($message);
|
||||||
|
$c->flash( success => $success );
|
||||||
|
|
||||||
|
$c->redirect_to('/datetime');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_change_datetime {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
#--------------------------------------------------
|
||||||
|
# Untaint parameters and check for validity
|
||||||
|
#--------------------------------------------------
|
||||||
|
|
||||||
|
my $timezone = $c->param ('Timezone');
|
||||||
|
if ($timezone =~ /^([\w\-]+\/?[\w\-+]*)$/) {
|
||||||
|
$timezone = $1;
|
||||||
|
} else {
|
||||||
|
$timezone = "US/Eastern";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $month = $c->param ('Month');
|
||||||
|
|
||||||
|
if ($month =~ /^(\d{1,2})$/) {
|
||||||
|
$month = $1;
|
||||||
|
} else {
|
||||||
|
$month = "1";
|
||||||
|
}
|
||||||
|
if (($month < 1) || ($month > 12)) {
|
||||||
|
return $c->l('dat_INVALID_MONTH')." $month. ". $c->l('dat_MONTH_BETWEEN_1_AND_12');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $day = $c->param ('Day');
|
||||||
|
|
||||||
|
if ($day =~ /^(\d{1,2})$/) {
|
||||||
|
$day = $1;
|
||||||
|
} else {
|
||||||
|
$day = "1";
|
||||||
|
}
|
||||||
|
if (($day < 1) || ($day > 31)) {
|
||||||
|
return $c->l('dat_INVALID_DAY')." $day. ". $c->l('dat_BETWEEN_1_AND_31');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $year = $c->param ('Year');
|
||||||
|
if ($year =~ /^(\d{4})$/) {
|
||||||
|
$year = $1;
|
||||||
|
} else {
|
||||||
|
$year = "2000";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($year < 1900) || ($year > 2200)) {
|
||||||
|
return $c->l('dat_INVALID_YEAR')." $year. ". $c->l('dat_FOUR_DIGIT_YEAR');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $hour = $c->param ('Hour');
|
||||||
|
if ($hour =~ /^(\d{1,2})$/) {
|
||||||
|
$hour = $1;
|
||||||
|
} else {
|
||||||
|
$hour = "12";
|
||||||
|
}
|
||||||
|
if (($hour < 1) || ($hour > 12)) {
|
||||||
|
return $c->l('dat_INVALID_HOUR')." $hour. ". $c->l('dat_BETWEEN_1_AND_12');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $minute = $c->param ('Minute');
|
||||||
|
if ($minute =~ /^(\d{1,2})$/) {
|
||||||
|
$minute = $1;
|
||||||
|
} else {
|
||||||
|
$minute = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($minute < 0) || ($minute > 59)) {
|
||||||
|
return $c->l('datINVALID_MINUTE')." $minute. ".$c->l('dat_BETWEEN_0_AND_59');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $second = $c->param ('Second');
|
||||||
|
if ($second =~ /^(\d{1,2})$/) {
|
||||||
|
$second = $1;
|
||||||
|
} else {
|
||||||
|
$second = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($second < 0) || ($second > 59)) {
|
||||||
|
return $c->l('dat_INVALID_SECOND')." $second. ". $c->l('dat_BETWEEN_0_AND_59');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $ampm = $c->param ('Ampm');
|
||||||
|
if ($ampm =~ /^(AM|PM)$/) {
|
||||||
|
$ampm = $1;
|
||||||
|
} else {
|
||||||
|
$ampm = "AM";
|
||||||
|
}
|
||||||
|
|
||||||
|
# convert to 24 hour time
|
||||||
|
|
||||||
|
$hour = $hour % 12;
|
||||||
|
if ($ampm eq "PM") {
|
||||||
|
$hour = $hour + 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
#--------------------------------------------------
|
||||||
|
# Store time zone in configuration database
|
||||||
|
#--------------------------------------------------
|
||||||
|
|
||||||
|
my $conf = esmith::ConfigDB->open();
|
||||||
|
my $old = $conf->get('UnsavedChanges')->value;
|
||||||
|
my $rec = $conf->get('TimeZone');
|
||||||
|
unless ($rec) {
|
||||||
|
$rec = $conf->new_record('TimeZone',undef);
|
||||||
|
}
|
||||||
|
$rec->set_value($timezone);
|
||||||
|
$conf->get('UnsavedChanges')->set_value($old);
|
||||||
|
|
||||||
|
#--------------------------------------------------
|
||||||
|
# Signal event to change time zone, system time
|
||||||
|
# and hardware clock
|
||||||
|
#--------------------------------------------------
|
||||||
|
|
||||||
|
my $newdate = sprintf "%02d%02d%02d%02d%04d.%02d",
|
||||||
|
$month, $day, $hour, $minute, $year, $second;
|
||||||
|
|
||||||
|
esmith::util::backgroundCommand(2,
|
||||||
|
"/sbin/e-smith/signal-event","timezone-update",$newdate);
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub update_ntpserver {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $ntpserver = shift;
|
||||||
|
|
||||||
|
my $msg;
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# Looks good; go ahead and change the parameters.
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
my $old = $cdb->get('UnsavedChanges')->value;
|
||||||
|
my $rec = $cdb->get('ntpd');
|
||||||
|
if ($rec) {
|
||||||
|
$rec->set_prop('status','enabled');
|
||||||
|
$rec->set_prop('NTPServer',$ntpserver);
|
||||||
|
} else {
|
||||||
|
$rec = $cdb->new_record( 'ntpd',
|
||||||
|
{ type=>'service', status=>'enabled', SyncToHWClockSupported => 'yes', NTPServer=>$ntpserver } );
|
||||||
|
}
|
||||||
|
$cdb->get('UnsavedChanges')->set_value($old);
|
||||||
|
|
||||||
|
$msg = $c->l('dat_SETTINGS_CHANGED');
|
||||||
|
|
||||||
|
if ( $ntpserver =~ /^\s*$/ ) {
|
||||||
|
$rec->set_prop('status', ($rec->prop('SyncToHWClockSupported') || 'yes') eq 'yes' ? 'enabled' : 'disabled');
|
||||||
|
$rec->set_prop('NTPServer', '');
|
||||||
|
$msg = $c->l('dat_INVALID_NTP_SERVER') if ($rec->prop('SyncToHWClockSupported') || 'yes') ne 'yes';
|
||||||
|
}
|
||||||
|
|
||||||
|
esmith::util::backgroundCommand( 2, "/sbin/e-smith/signal-event", "timeserver-update" );
|
||||||
|
|
||||||
|
return $msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub disable_ntp {
|
||||||
|
|
||||||
|
# make sure that the parameters are set for disabled
|
||||||
|
|
||||||
|
my $old = $cdb->get('UnsavedChanges')->value;
|
||||||
|
my $rec = $cdb->get('ntpd');
|
||||||
|
|
||||||
|
if ($rec) {
|
||||||
|
$rec->set_prop('status', ($rec->prop('SyncToHWClockSupported') || 'yes') eq 'yes' ? 'enabled' : 'disabled');
|
||||||
|
$rec->set_prop('NTPServer','');
|
||||||
|
} else {
|
||||||
|
$rec = $cdb->new_record('ntpd',
|
||||||
|
{type=>'service', status=>'enabled', SyncToHWClockSupported => 'yes', NTPServer=>''});
|
||||||
|
}
|
||||||
|
|
||||||
|
$cdb->get('UnsavedChanges')->set_value($old);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub getTimezone {
|
||||||
|
|
||||||
|
#--------------------------------------------------
|
||||||
|
# Figure out time zone by looking first looking at
|
||||||
|
# the configuration database value of TimeZone.
|
||||||
|
# If that is not defined, try and get it from /etc/localtime.
|
||||||
|
# If that doesn't work, default to US/Eastern.
|
||||||
|
#--------------------------------------------------
|
||||||
|
|
||||||
|
my $localtime;
|
||||||
|
my $timezonedefault = "US/Eastern";
|
||||||
|
|
||||||
|
if (defined $cdb->get('TimeZone')) {
|
||||||
|
$timezonedefault = $cdb->get('TimeZone')->value;
|
||||||
|
} else {
|
||||||
|
if (defined ($localtime = readlink '/etc/localtime')) {
|
||||||
|
my $pos = index $localtime, 'zoneinfo/';
|
||||||
|
if ( $pos > -1 ) {
|
||||||
|
$timezonedefault = substr $localtime, ($pos + 9);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $timezonedefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub getZone_list {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
#--------------------------------------------------
|
||||||
|
# Get a sorted list of time zones
|
||||||
|
#--------------------------------------------------
|
||||||
|
|
||||||
|
$ENV{BASH_ENV} = '';
|
||||||
|
if (! open (ZONES, "cd /usr/share/zoneinfo; /usr/bin/find . -type f -or -type l | /bin/grep '^./[A-Z]' |"))
|
||||||
|
{
|
||||||
|
warn ( $c->l('COULD_NOT_OPEN_TZ_FILE').$!.'.' );
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
my $zone;
|
||||||
|
my @zones = ();
|
||||||
|
|
||||||
|
while (defined ($zone = <ZONES>))
|
||||||
|
{
|
||||||
|
chop ($zone);
|
||||||
|
$zone =~ s/^.\///;
|
||||||
|
push @zones, $zone;
|
||||||
|
}
|
||||||
|
close ZONES;
|
||||||
|
my @zt = sort @zones;
|
||||||
|
return \@zt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub getMonth_list {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
return [[ $c->l('dat_JANUARY') => '1'],
|
||||||
|
[ $c->l('dat_FEBRUARY') => '2'],
|
||||||
|
[ $c->l('dat_MARCH') => '3'],
|
||||||
|
[ $c->l('dat_APRIL') => '4'],
|
||||||
|
[ $c->l('dat_MAY') => '5'],
|
||||||
|
[ $c->l('dat_JUNE') => '6'],
|
||||||
|
[ $c->l('dat_JULY') => '7'],
|
||||||
|
[ $c->l('dat_AUGUST') => '8'],
|
||||||
|
[ $c->l('dat_SEPTEMBER') => '9'],
|
||||||
|
[ $c->l('dat_OCTOBER') => '10'],
|
||||||
|
[ $c->l('dat_NOVEMBER') => '11'],
|
||||||
|
[ $c->l('dat_DECEMBER') => '12']];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
97
root/usr/share/smanager/lib/SrvMngr/Controller/Directory.pm
Normal file
97
root/usr/share/smanager/lib/SrvMngr/Controller/Directory.pm
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
package SrvMngr::Controller::Directory;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : User management
|
||||||
|
# description : Directory
|
||||||
|
# navigation : 2000 300
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
#use esmith::util qw(ldapBase);
|
||||||
|
use esmith::FormMagick::Panel::directory;
|
||||||
|
|
||||||
|
our $db = esmith::ConfigDB->open() || die "Couldn't open config db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %dir_datas = ();
|
||||||
|
my $title = $c->l('dir_FORM_TITLE');
|
||||||
|
my $modul = $c->render_to_string(inline => $c->l('dir_DESCRIPTION'));
|
||||||
|
|
||||||
|
$dir_datas{'root'} = get_ldap_base();
|
||||||
|
|
||||||
|
$dir_datas{'access'} = ($db->get_prop('ldap','access')) || 'private';
|
||||||
|
$dir_datas{'department'} = ($db->get_prop('ldap','defaultDepartment')) || '';
|
||||||
|
$dir_datas{'company'} = ($db->get_prop('ldap','defaultCompany')) || '';
|
||||||
|
$dir_datas{'street'} = ($db->get_prop('ldap','defaultStreet')) || '';
|
||||||
|
$dir_datas{'city'} = ($db->get_prop('ldap','defaultCity')) || '';
|
||||||
|
$dir_datas{'phonenumber'} = ($db->get_prop('ldap','defaultPhoneNumber')) || '';
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $modul, dir_datas => \%dir_datas );
|
||||||
|
$c->render(template => 'directory');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $access = $c->param('access');
|
||||||
|
my $department = $c->param('department');
|
||||||
|
my $company = $c->param('company');
|
||||||
|
my $street = $c->param('street');
|
||||||
|
my $city = $c->param('city');
|
||||||
|
my $phonenumber = $c->param('phonenumber');
|
||||||
|
my $existing = $c->param('existing');
|
||||||
|
|
||||||
|
my $result = "";
|
||||||
|
|
||||||
|
$db->get('ldap')->set_prop('access', $access);
|
||||||
|
$db->get('ldap')->set_prop('defaultDepartment', $department);
|
||||||
|
$db->get('ldap')->set_prop('defaultCompany', $company);
|
||||||
|
$db->get('ldap')->set_prop('defaultStreet', $street);
|
||||||
|
$db->get('ldap')->set_prop('defaultCity', $city);
|
||||||
|
$db->get('ldap')->set_prop('defaultPhoneNumber', $phonenumber);
|
||||||
|
|
||||||
|
if ($existing eq 'update') {
|
||||||
|
my $ac = esmith::AccountsDB->open() || die "Couldn't open accounts db";
|
||||||
|
my @users = $ac->users();
|
||||||
|
|
||||||
|
foreach my $user (@users) {
|
||||||
|
$user->set_prop('Phone', $phonenumber);
|
||||||
|
$user->set_prop('Company', $company);
|
||||||
|
$user->set_prop('Dept', $department);
|
||||||
|
$user->set_prop('City', $city);
|
||||||
|
$user->set_prop('Street', $street);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#
|
||||||
|
# Update the system
|
||||||
|
#
|
||||||
|
|
||||||
|
system ("/sbin/e-smith/signal-event ldap-update") == 0
|
||||||
|
or $result = $c->l('ERROR_UPDATING_CONFIGURATION');
|
||||||
|
|
||||||
|
my $title = $c->l('dir_FORM_TITLE');
|
||||||
|
|
||||||
|
if ( $result eq '' ) { $result = $c->l('dir_SUCCESS'); }
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $result );
|
||||||
|
$c->render(template => 'module');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
502
root/usr/share/smanager/lib/SrvMngr/Controller/Domains.pm
Normal file
502
root/usr/share/smanager/lib/SrvMngr/Controller/Domains.pm
Normal file
@ -0,0 +1,502 @@
|
|||||||
|
package SrvMngr::Controller::Domains;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Network
|
||||||
|
# description : Domains
|
||||||
|
# navigation : 6000 300
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
#use Data::Dumper;
|
||||||
|
|
||||||
|
#use esmith::FormMagick::Panel::domains;
|
||||||
|
|
||||||
|
use esmith::DomainsDB;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
#use URI::Escape;
|
||||||
|
|
||||||
|
|
||||||
|
our $ddb = esmith::DomainsDB->open || die "Couldn't open domains db";
|
||||||
|
our $cdb = esmith::ConfigDB->open || die "Couldn't open configuration db";
|
||||||
|
our $adb = esmith::AccountsDB->open || die "Couldn't open accounts db";
|
||||||
|
|
||||||
|
our $REGEXP_DOMAIN = qq([a-zA-Z0-9\-\.]+);
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %dom_datas = ();
|
||||||
|
my $title = $c->l('dom_FORM_TITLE');
|
||||||
|
|
||||||
|
$dom_datas{trt} = 'LST';
|
||||||
|
|
||||||
|
my @domains;
|
||||||
|
for ($ddb->domains())
|
||||||
|
{
|
||||||
|
my $ns = $_->prop('Nameservers') || 'internet';
|
||||||
|
|
||||||
|
push @domains,
|
||||||
|
{ Domain => $_->key, $_->props,
|
||||||
|
Nameservers => $ns,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$dom_datas{forwarder} = $cdb->get_prop('dnscache', 'Forwarder');
|
||||||
|
$dom_datas{forwarder2} = $cdb->get_prop('dnscache', 'Forwarder2') || '';
|
||||||
|
|
||||||
|
$c->stash( title => $title, dom_datas => \%dom_datas, domains => \@domains );
|
||||||
|
$c->render(template => 'domains');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = $c->param('trt');
|
||||||
|
my $domain = $c->param('Domain') || '';
|
||||||
|
|
||||||
|
#$trt = 'DEL' if ( $rt eq 'domaindel1' );
|
||||||
|
#$trt = 'UPD' if ( $rt eq 'domainupd1' );
|
||||||
|
#$trt = 'UP2' if ( $rt eq 'domainup21' );
|
||||||
|
#$trt = 'ADD' if ( $rt eq 'domainadd1' );
|
||||||
|
|
||||||
|
my %dom_datas = ();
|
||||||
|
my $title = $c->l('dom_FORM_TITLE');
|
||||||
|
my $result = '';
|
||||||
|
|
||||||
|
$dom_datas{'trt'} = $trt;
|
||||||
|
if ( $trt ne 'ADD' and $trt ne 'UPD' and $trt ne 'UP2' and $trt ne 'DEL' ) {
|
||||||
|
$result = "Trt unknown ( $trt ) !"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
#nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' ) {
|
||||||
|
|
||||||
|
my $rec = $ddb->get($domain);
|
||||||
|
if ( $rec ) {
|
||||||
|
$dom_datas{domain} = $domain;
|
||||||
|
$dom_datas{description} = $rec->prop('Description') || '';
|
||||||
|
$dom_datas{content} = $rec->prop('Content') || '';
|
||||||
|
$dom_datas{nameservers} = $rec->prop('Nameservers') || 'internet';
|
||||||
|
} else {
|
||||||
|
$result = "Domain $domain not found !"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'UP2' ) {
|
||||||
|
|
||||||
|
$dom_datas{forwarder} = $cdb->get_prop('dnscache', 'Forwarder') || '';
|
||||||
|
$dom_datas{forwarder2} = $cdb->get_prop('dnscache', 'Forwarder2') || '';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
my $rec = $ddb->get($domain);
|
||||||
|
if ( $rec ) {
|
||||||
|
$dom_datas{domain} = $domain;
|
||||||
|
$dom_datas{description} = $rec->prop('Description') || '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'LST' ) {
|
||||||
|
my @domains;
|
||||||
|
if ($adb) {
|
||||||
|
@domains = $ddb->domains();
|
||||||
|
}
|
||||||
|
$c->stash( domains => \@domains );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$c->stash( error => $result );
|
||||||
|
}
|
||||||
|
$c->stash( title => $title, dom_datas => \%dom_datas );
|
||||||
|
$c->render( template => 'domains' );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = $c->param('trt');
|
||||||
|
|
||||||
|
my %dom_datas = ();
|
||||||
|
my ($res, $result) = '';
|
||||||
|
|
||||||
|
#my $domain = uri_unescape($c->param('domain'));
|
||||||
|
my $domain = $c->param('Domain');
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
|
||||||
|
my $account = $c->param('Account');
|
||||||
|
|
||||||
|
# controls (validate ?????)
|
||||||
|
#? validate_new_domain_name( $c, $domain, $account );
|
||||||
|
#$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
#$result .= ' blocked';
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->create_modify_domain( 'create', $domain );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('dom_SUCCESSFULLY_CREATED') . " $domain";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' ) {
|
||||||
|
|
||||||
|
my $description = $c->param('Description');
|
||||||
|
my $content = $c->param('Content');
|
||||||
|
my $nameservers = $c->param('Nameservers');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
#$res = validate_description( $c, $account );
|
||||||
|
#$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
#$result .= 'blocked';
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->create_modify_domain( 'modify', $domain );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('dom_SUCCESSFULLY_MODIFIED') . " $domain";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'UP2' ) {
|
||||||
|
|
||||||
|
my $forwarder = $c->param('Forwarder');
|
||||||
|
my $forwarder2 = $c->param('Forwarder2');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
|
||||||
|
$res = $c->ip_number_or_blank( $forwarder );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->ip_number_or_blank( $forwarder2 );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
#$result .= 'blocked';
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->modify_dns( $forwarder, $forwarder2 );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('SUCCESS') . " $forwarder $forwarder2";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
# controls
|
||||||
|
#$res = validate_is_domain($c, $domain);
|
||||||
|
#$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
#$result .= 'blocked';
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->delete_domain( $domain );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('dom_SUCCESSFULLY_DELETED') . " $domain";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# common parts
|
||||||
|
|
||||||
|
if ($res ne 'OK') {
|
||||||
|
my $title = $c->l('dom_FORM_TITLE');
|
||||||
|
$dom_datas{'domain'} = $domain;
|
||||||
|
$dom_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
$c->stash( error => $result . "($res)" );
|
||||||
|
$c->stash( title => $title, dom_datas => \%dom_datas );
|
||||||
|
return $c->render( 'domains' );
|
||||||
|
}
|
||||||
|
|
||||||
|
my $message = "'Domains' updates ($trt) DONE";
|
||||||
|
$c->app->log->info($message);
|
||||||
|
|
||||||
|
$c->flash( success => $result );
|
||||||
|
$c->redirect_to('/domains');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub create_modify_domain {
|
||||||
|
|
||||||
|
my ($c, $action, $domain) = @_;
|
||||||
|
|
||||||
|
$domain = $1 if ($domain =~ /^($REGEXP_DOMAIN)$/);
|
||||||
|
unless ($domain) {
|
||||||
|
return ($c->l($action eq 'create' ? 'dom_ERROR_CREATING_DOMAIN'
|
||||||
|
: 'dom_ERROR_MODIFYING_DOMAIN') . ' Ctl');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $rec = $ddb->get($domain);
|
||||||
|
if ($rec and $action eq 'create') {
|
||||||
|
return $c->l('dom_DOMAIN_IN_USE_ERROR');
|
||||||
|
}
|
||||||
|
if (not $rec and $action eq 'modify') {
|
||||||
|
return $c->l('dom_NONEXISTENT_DOMAIN_ERROR');
|
||||||
|
}
|
||||||
|
|
||||||
|
$rec ||= $ddb->new_record($domain, { type => 'domain' });
|
||||||
|
my %props;
|
||||||
|
$props{$_} = $c->param($_) for ( qw(Content Description Nameservers) );
|
||||||
|
$rec->merge_props(%props);
|
||||||
|
|
||||||
|
if ( system( "/sbin/e-smith/signal-event",
|
||||||
|
"domain-$action", "$domain" ) != 0 ) {
|
||||||
|
return ($c->l($action eq 'create' ? 'dom_ERROR_CREATING_DOMAIN'
|
||||||
|
: 'dom_ERROR_MODIFYING_DOMAIN') . " Exe $action");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub delete_domain {
|
||||||
|
|
||||||
|
my ($c, $domain) = @_;
|
||||||
|
|
||||||
|
$domain = $1 if ($domain =~ /^($REGEXP_DOMAIN)$/);
|
||||||
|
return ($c->l('dom_ERROR_WHILE_REMOVING_DOMAIN') . ' Ctl') unless ($domain);
|
||||||
|
|
||||||
|
my $rec = $ddb->get($domain);
|
||||||
|
return ($c->l('dom_NONEXISTENT_DOMAIN_ERROR')) if (not $rec);
|
||||||
|
|
||||||
|
$rec->set_prop('type', 'domain-deleted');
|
||||||
|
|
||||||
|
if (system("/sbin/e-smith/signal-event", "domain-delete", "$domain") != 0) {
|
||||||
|
return ($c->l('dom_ERROR_WHILE_REMOVING_DOMAIN') . 'Exe');
|
||||||
|
}
|
||||||
|
|
||||||
|
$rec->delete;
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub modify_dns {
|
||||||
|
|
||||||
|
my ($c, $forwarder, $forwarder2) = @_;
|
||||||
|
|
||||||
|
my $dnscache = $cdb->get('dnscache');
|
||||||
|
|
||||||
|
($forwarder, $forwarder2) = ($forwarder2, '')
|
||||||
|
if ($forwarder2 and not $forwarder);
|
||||||
|
|
||||||
|
if ($forwarder) {
|
||||||
|
$dnscache->set_prop('Forwarder', $forwarder);
|
||||||
|
} else {
|
||||||
|
$dnscache->delete_prop('Forwarder');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($forwarder2) {
|
||||||
|
$dnscache->set_prop('Forwarder2', $forwarder2);
|
||||||
|
} else {
|
||||||
|
$dnscache->delete_prop('Forwarder2');
|
||||||
|
}
|
||||||
|
|
||||||
|
unless ( system( "/sbin/e-smith/signal-event", "dns-update" ) == 0 )
|
||||||
|
{
|
||||||
|
return $c->l('dom_ERROR_UPDATING');
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub existing_accounts_list {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my @existingAccounts = ( ['Administrator' => 'admin']);
|
||||||
|
|
||||||
|
foreach my $a ($adb->get_all) {
|
||||||
|
if ($a->prop('type') =~ /(user|group)/) {
|
||||||
|
push @existingAccounts, [ $a->key => $a->key ];
|
||||||
|
}
|
||||||
|
if ($a->prop('type') eq "domain") {
|
||||||
|
my $target = $adb->get($a->prop('Account'));
|
||||||
|
|
||||||
|
unless ($target)
|
||||||
|
{
|
||||||
|
warn "WARNING: domain (" . $a->key . ") => missing Account("
|
||||||
|
. $a->prop('Account') . ")\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
push @existingAccounts, [ $a->key, $a->key ]
|
||||||
|
unless ($target->prop('type') eq "domain");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(\@existingAccounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub content_options_list {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my @options = ( [ $c->l('dom_PRIMARY_SITE') => 'Primary' ]);
|
||||||
|
|
||||||
|
foreach ($adb->ibays) {
|
||||||
|
push @options, [ $_->prop('Name') => $_->key ]
|
||||||
|
if ($_->key ne 'Primary');
|
||||||
|
}
|
||||||
|
|
||||||
|
return \@options
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_content_value
|
||||||
|
{
|
||||||
|
my $c = shift;
|
||||||
|
my $domain = shift;
|
||||||
|
|
||||||
|
return $domain ? $ddb->get_prop($domain, 'Content') : 'Primary';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_description_value
|
||||||
|
{
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $domain = $c->param('Domain') || undef;
|
||||||
|
|
||||||
|
return $ddb->get_prop($domain, 'Description');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub nameserver_options_list {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $domain = $c->param('Domain') || undef;
|
||||||
|
|
||||||
|
my @opts = qw(localhost internet);
|
||||||
|
push @opts, 'corporate' if ($cdb->get_prop('dnscache', 'Forwarder'));
|
||||||
|
my $ns = ($ddb->get_prop($domain, 'Nameservers') || 'internet');
|
||||||
|
push @opts, $ns unless scalar grep { /^$ns$/ } @opts;
|
||||||
|
|
||||||
|
my @options;
|
||||||
|
foreach (@opts) {
|
||||||
|
push @options, [ $c->l( "dom_$_" ) => $_ ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return \@options;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_nameserver_value {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $domain = $c->param('Domain') || undef;
|
||||||
|
|
||||||
|
return ($ddb->get_prop($domain, 'Nameservers') || 'internet');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_Domain
|
||||||
|
{
|
||||||
|
my $c = shift;
|
||||||
|
my $domain = lc shift;
|
||||||
|
|
||||||
|
return ($domain =~ /^($REGEXP_DOMAIN)$/) ? 'OK' :
|
||||||
|
'DOMAIN_NAME_VALIDATION_ERROR';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_Description
|
||||||
|
{
|
||||||
|
# XXX - FIXME - NOTREACHED
|
||||||
|
# We used to use the Description in the Appletalk volume name
|
||||||
|
# which meant it needed validation. I don't see any reason to
|
||||||
|
# do this any more
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $description = shift;
|
||||||
|
|
||||||
|
return ($description =~ /^([\-\'\w][\-\'\w\s\.]*)$/) ? 'OK' :
|
||||||
|
'DOMAIN_DESCRIPTION_VALIDATION_ERROR';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub ip_number_or_blank {
|
||||||
|
|
||||||
|
# XXX - FIXME - we should push this down into CGI::FormMagick
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $ip = shift;
|
||||||
|
|
||||||
|
if (!defined($ip) || $ip eq "")
|
||||||
|
{
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
return ip_number( $c, $ip );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub ip_number {
|
||||||
|
|
||||||
|
# from CGI::FormMagick::Validator qw( ip_number );
|
||||||
|
|
||||||
|
my ($c, $data) = @_;
|
||||||
|
|
||||||
|
return undef unless defined $data;
|
||||||
|
|
||||||
|
return $c->l('FM_IP_NUMBER1') unless $data =~ /^[\d.]+$/;
|
||||||
|
|
||||||
|
my @octets = split /\./, $data;
|
||||||
|
my $dots = ($data =~ tr/.//);
|
||||||
|
|
||||||
|
return $c->l('FM_IP_NUMBER2') unless (scalar @octets == 4 and $dots == 3);
|
||||||
|
|
||||||
|
foreach my $octet (@octets) {
|
||||||
|
return $c->l("FM_IP_NUMBER3", $octet) if $octet > 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
925
root/usr/share/smanager/lib/SrvMngr/Controller/Emailsettings.pm
Normal file
925
root/usr/share/smanager/lib/SrvMngr/Controller/Emailsettings.pm
Normal file
@ -0,0 +1,925 @@
|
|||||||
|
package SrvMngr::Controller::Emailsettings;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : System
|
||||||
|
# description : E-mail
|
||||||
|
# navigation : 4000 500
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session ip_number_or_blank);
|
||||||
|
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
|
||||||
|
use esmith::util;
|
||||||
|
use File::Basename;
|
||||||
|
|
||||||
|
our $pattern_db = esmith::ConfigDB->open("mailpatterns");
|
||||||
|
our $cdb = esmith::ConfigDB->open || die "Couldn't open config db";
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %mai_datas = ();
|
||||||
|
my $title = $c->l('mai_FORM_TITLE');
|
||||||
|
|
||||||
|
$mai_datas{'trt'} = 'LIST';
|
||||||
|
$mai_datas{fetchmailmethod} = $cdb->get_prop('fetchmail', 'Method');
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => '', mai_datas => \%mai_datas );
|
||||||
|
$c->render(template => 'emailsettings');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'LIST');
|
||||||
|
|
||||||
|
my %mai_datas = ();
|
||||||
|
my $title = $c->l('mai_FORM_TITLE');
|
||||||
|
my ($notif, $dest) = '';
|
||||||
|
|
||||||
|
$mai_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
if ( $trt eq 'ACC' ) {
|
||||||
|
$dest = 'emailaccess';
|
||||||
|
$mai_datas{fetchmailmethod} = $cdb->get_prop('fetchmail', 'Method');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'FIL' ) {
|
||||||
|
$dest = 'emailfilter';
|
||||||
|
$mai_datas{'virusstatus'} = $c->get_virus_status();
|
||||||
|
$mai_datas{'spamstatus'} = $cdb->get_prop('spamassassin', 'status');
|
||||||
|
$mai_datas{'spamsensitivity'} = $cdb->get_prop('spamassassin', 'Sensitivity','medium');
|
||||||
|
$mai_datas{'spamtaglevel'} = $cdb->get_prop('spamassassin', 'TagLevel') || '0';
|
||||||
|
$mai_datas{'spamrejectlevel'} = $cdb->get_prop('spamassassin', 'RejectLevel') || '0';
|
||||||
|
$mai_datas{spamsortspam} = $cdb->get_prop('spamassassin', 'SortSpam');
|
||||||
|
$mai_datas{spamsubjecttag} = $cdb->get_prop('spamassassin', 'SubjectTag');
|
||||||
|
$mai_datas{spamsubject} = $cdb->get_prop('spamassassin', 'Subject');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'REC' ) {
|
||||||
|
$dest = 'emailreceive';
|
||||||
|
$mai_datas{fetchmailmethod} = $cdb->get_prop('fetchmail', 'Method');
|
||||||
|
$mai_datas{freqoffice} = $cdb->get_prop('fetchmail', 'FreqOffice');
|
||||||
|
$mai_datas{freqoutside} = $cdb->get_prop('fetchmail', 'FreqOutside');
|
||||||
|
$mai_datas{freqweekend} = $cdb->get_prop('fetchmail', 'FreqWeekend');
|
||||||
|
$mai_datas{secondarymailserver} = $cdb->get_prop('fetchmail', 'SecondaryMailServer');
|
||||||
|
$mai_datas{secondarymailaccount} = $cdb->get_prop('fetchmail', 'SecondaryMailAccount');
|
||||||
|
$mai_datas{secondarymailpassword} = $cdb->get_prop('fetchmail', 'SecondaryMailPassword');
|
||||||
|
$mai_datas{specifyheader} = get_secondary_mail_use_envelope();
|
||||||
|
$mai_datas{secondarymailenvelope} = $cdb->get_prop('fetchmail', 'SecondaryMailEnvelope');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
$dest = 'emaildeliver';
|
||||||
|
$mai_datas{emailunknownuser} = $cdb->get_value('EmailUnknownUser') || '"returntosender';
|
||||||
|
$mai_datas{delegatemailserver} = $cdb->get_value('DelegateMailServer');
|
||||||
|
$mai_datas{smtpsmarthost} = $cdb->get_value('SMTPSmartHost');
|
||||||
|
$mai_datas{smtpauthproxystatus} = $cdb->get_prop('smtp-auth-proxy', 'status') || 'disabled';
|
||||||
|
$mai_datas{smtpauthproxyuserid} = $cdb->get_prop('smtp-auth-proxy', 'Userid') || '';
|
||||||
|
$mai_datas{smtpauthproxypassword} = $cdb->get_prop('smtp-auth-proxy', 'Passwd') || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $notif, mai_datas => \%mai_datas );
|
||||||
|
return $c->render( template => $dest );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = $c->param('trt');
|
||||||
|
|
||||||
|
my %mai_datas = ();
|
||||||
|
$mai_datas{trt} = $trt;
|
||||||
|
|
||||||
|
my $title = $c->l('mai_FORM_TITLE');
|
||||||
|
|
||||||
|
my ($dest, $res, $result) = '';
|
||||||
|
|
||||||
|
if ( $trt eq 'ACC' ) {
|
||||||
|
|
||||||
|
$dest = 'emailaccess';
|
||||||
|
# $mai_datas{xxx} = $c->param('XXX');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
# $res = xxxxxxx( $c );
|
||||||
|
# $result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->change_settings_access();
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('mai_SUCCESS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'FIL' ) {
|
||||||
|
|
||||||
|
$dest = 'emailfilter';
|
||||||
|
# $mai_datas{xxx} = $c->param('XXX');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
# $res = zzzzzz( $c );
|
||||||
|
# $result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->change_settings_filtering();
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('mai_SUCCESS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'REC' ) {
|
||||||
|
|
||||||
|
$dest = 'emailreceive';
|
||||||
|
# $mai_datas{xxx} = $c->param('XXX');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
# $res = yyyyyyyyy( $c );
|
||||||
|
# $result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->change_settings_reception();
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('mai_SUCCESS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
$dest = 'emaildeliver';
|
||||||
|
# $mai_datas{xxx} = $c->param('XXX');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
$res = $c->ip_number_or_blank( $c->param('DelegateMailServer') );
|
||||||
|
$result .= $res . ' DMS <br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->validate_smarthost( $c->param('SMTPSmartHost') );
|
||||||
|
$result .= $res . ' SH <br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->nonblank_if_smtpauth( $c->param('SMTPSmartHost') );
|
||||||
|
$result .= $res . ' SH <br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->nonblank_if_smtpauth( $c->param('SMTPAUTHPROXY_Userid') );
|
||||||
|
$result .= $res . ' USR <br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->nonblank_if_smtpauth( $c->param('SMTPAUTHPROXY_Passwd') );
|
||||||
|
$result .= $res . ' PWD <br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->change_settings_delivery();
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('mai_SUCCESS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# common part
|
||||||
|
|
||||||
|
if ($res ne 'OK') {
|
||||||
|
$c->stash( error => $result );
|
||||||
|
$c->stash( title => $title, mai_datas => \%mai_datas );
|
||||||
|
return $c->render( $dest );
|
||||||
|
}
|
||||||
|
|
||||||
|
my $message = "emailsettings updates $trt DONE";
|
||||||
|
$c->app->log->info($message);
|
||||||
|
$c->flash( success => $result );
|
||||||
|
|
||||||
|
$c->redirect_to("/emailsettings");
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub get_virus_status {
|
||||||
|
|
||||||
|
my ($c, $localise) = @_;
|
||||||
|
|
||||||
|
my $status = $cdb->get_prop("qpsmtpd", 'VirusScan') || 'disabled';
|
||||||
|
|
||||||
|
return $localise ? $c->localise_status($status) : $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_spam_status {
|
||||||
|
|
||||||
|
my ($c, $localise) = @_;
|
||||||
|
|
||||||
|
my $status = $cdb->get_prop('spamassassin', 'status') || 'disabled';
|
||||||
|
|
||||||
|
return $localise ? $c->localise_status($status) : $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub localise_status {
|
||||||
|
|
||||||
|
my ($c, $status) = @_;
|
||||||
|
|
||||||
|
return $c->l($status eq 'enabled' ? $c->l('ENABLED') : $c->l('DISABLED'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_prop {
|
||||||
|
|
||||||
|
my ($c, $item, $prop, $default) = @_;
|
||||||
|
|
||||||
|
return $cdb->get_prop($item, $prop) || $default;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_value {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $item = shift;
|
||||||
|
|
||||||
|
return $cdb->get_value($item) || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_emailunknownuser_status {
|
||||||
|
|
||||||
|
my ($c, $localise) = @_;
|
||||||
|
|
||||||
|
my $options = $c->get_emailunknownuser_options();
|
||||||
|
|
||||||
|
my $val = $cdb->get_value('EmailUnknownUser') || "returntosender";
|
||||||
|
|
||||||
|
return $localise ? $c->l($options->{$val}) : $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_patterns_status {
|
||||||
|
|
||||||
|
my ($c, $localise) = @_;
|
||||||
|
|
||||||
|
my $status = $cdb->get_prop("qpsmtpd", 'PatternsScan') || 'disabled';
|
||||||
|
|
||||||
|
return $localise ? $c->localise_status($status) : $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub adjust_patterns {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my @selected = @{$c->every_param('BlockExecutableContent')};
|
||||||
|
|
||||||
|
foreach my $pattern ( $pattern_db->get_all_by_prop( type => "pattern") )
|
||||||
|
{
|
||||||
|
my $status = (grep $pattern->key eq $_, @selected) ? 'enabled'
|
||||||
|
: 'disabled';
|
||||||
|
$pattern->set_prop('Status', $status);
|
||||||
|
}
|
||||||
|
|
||||||
|
$pattern_db->reload;
|
||||||
|
|
||||||
|
return scalar @selected;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_current_pop3_access {
|
||||||
|
|
||||||
|
my ($c, $localise) = @_;
|
||||||
|
|
||||||
|
my $pop3Status = $cdb->get_prop('pop3', 'status') || 'enabled';
|
||||||
|
my $pop3Access = $cdb->get_prop('pop3', 'access') || 'private';
|
||||||
|
|
||||||
|
my $pop3sStatus = $cdb->get_prop('pop3s', 'status') || 'enabled';
|
||||||
|
my $pop3sAccess = $cdb->get_prop('pop3s', 'access') || 'private';
|
||||||
|
|
||||||
|
my $options = get_pop_options();
|
||||||
|
|
||||||
|
if ($pop3Status ne 'enabled' && $pop3sStatus ne 'enabled')
|
||||||
|
{
|
||||||
|
return $localise ? $c->l($options->{disabled}) : 'disabled';
|
||||||
|
}
|
||||||
|
elsif ($pop3Status eq 'enabled' && $pop3Access eq 'public')
|
||||||
|
{
|
||||||
|
return $localise ? $c->l($options->{public}) : 'public';
|
||||||
|
}
|
||||||
|
elsif ($pop3sStatus eq 'enabled' && $pop3sAccess eq 'public')
|
||||||
|
{
|
||||||
|
return $localise ? $c->l($options->{publicSSL}) : 'publicSSL';
|
||||||
|
}
|
||||||
|
return $localise ? $c->l($options->{private}) : 'private';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_current_imap_access {
|
||||||
|
|
||||||
|
my ($c, $localise) = @_;
|
||||||
|
|
||||||
|
my $imapStatus = $cdb->get_prop('imap', 'status') || 'enabled';
|
||||||
|
my $imapAccess = $cdb->get_prop('imap', 'access') || 'private';
|
||||||
|
|
||||||
|
my $imapsStatus = $cdb->get_prop('imaps', 'status') || 'enabled';
|
||||||
|
my $imapsAccess = $cdb->get_prop('imaps', 'access') || 'private';
|
||||||
|
|
||||||
|
my $options = get_imap_options();
|
||||||
|
|
||||||
|
if (($imapStatus ne 'enabled' || $imapAccess eq 'localhost') && $imapsStatus ne 'enabled')
|
||||||
|
{
|
||||||
|
return $localise ? $c->l($options->{disabled}) : 'disabled';
|
||||||
|
}
|
||||||
|
if ($imapStatus eq 'enabled' && $imapAccess eq 'public')
|
||||||
|
{
|
||||||
|
return $localise ? $c->l($options->{public}) : 'public';
|
||||||
|
}
|
||||||
|
elsif ($imapsStatus eq 'enabled' && $imapsAccess eq 'public')
|
||||||
|
{
|
||||||
|
return $localise ? $c->l($options->{publicSSL}) : 'publicSSL';
|
||||||
|
}
|
||||||
|
return $localise ? $c->l($options->{private}) : 'private';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_current_smtp_auth {
|
||||||
|
|
||||||
|
my ($c, $localise) = @_;
|
||||||
|
|
||||||
|
my $smtpStatus = $cdb->get_prop('qpsmtpd', 'status') || 'enabled';
|
||||||
|
my $smtpAuth = $cdb->get_prop('qpsmtpd', 'Authentication') || 'enabled';
|
||||||
|
|
||||||
|
my $smtpsStatus = $cdb->get_prop('sqpsmtpd', 'status') || 'enabled';
|
||||||
|
my $smtpsAuth = $cdb->get_prop('sqpsmtpd', 'Authentication') || 'enabled';
|
||||||
|
|
||||||
|
my $options = get_smtp_auth_options();
|
||||||
|
|
||||||
|
if ($smtpStatus eq 'enabled' && $smtpAuth eq 'enabled')
|
||||||
|
{
|
||||||
|
return $localise ? $c->l($options->{public}) : 'public';
|
||||||
|
}
|
||||||
|
elsif ($smtpsStatus eq 'enabled' && $smtpsAuth eq 'enabled')
|
||||||
|
{
|
||||||
|
return $localise ? $c->l($options->{publicSSL}) : 'publicSSL';
|
||||||
|
}
|
||||||
|
return $localise ? $c->l($options->{disabled}) : 'disabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_current_webmail_status {
|
||||||
|
|
||||||
|
my ($c, $localise) = @_;
|
||||||
|
|
||||||
|
# determine status of webmail
|
||||||
|
my $WebmailStatus = "disabled";
|
||||||
|
|
||||||
|
my $IMPStatus = $cdb->get_prop('imp', 'status') || 'disabled';
|
||||||
|
|
||||||
|
my $HordeStatus = $cdb->get_prop('horde', 'status') || 'disabled';
|
||||||
|
|
||||||
|
my $MysqlStatus = $cdb->get_prop('mariadb', 'status') || 'disabled';
|
||||||
|
|
||||||
|
my $PHPStatus = $cdb->get_prop('php', 'status') || 'disabled';
|
||||||
|
|
||||||
|
my $Networkaccess = $cdb->get_prop('horde','access') || 'disabled';
|
||||||
|
|
||||||
|
# all four components must be on for webmail to be working
|
||||||
|
if ( ( $IMPStatus eq "enabled" )
|
||||||
|
&& ( $HordeStatus eq "enabled" )
|
||||||
|
&& ( $MysqlStatus eq "enabled" )
|
||||||
|
&& ( $PHPStatus eq "enabled" )
|
||||||
|
&& ( $Networkaccess eq "public"))
|
||||||
|
{
|
||||||
|
$WebmailStatus = "enabledSSL";
|
||||||
|
}
|
||||||
|
|
||||||
|
elsif ( ( $IMPStatus eq "enabled" )
|
||||||
|
&& ( $HordeStatus eq "enabled" )
|
||||||
|
&& ( $MysqlStatus eq "enabled" )
|
||||||
|
&& ( $PHPStatus eq "enabled" )
|
||||||
|
&& ( $Networkaccess eq "private" ))
|
||||||
|
{
|
||||||
|
$WebmailStatus = "localnetworkSSL";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $options = get_webmail_options();
|
||||||
|
|
||||||
|
return $localise ? $c->l($options->{$WebmailStatus})
|
||||||
|
: $WebmailStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_pop_opt {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
return [[ $c->l('DISABLED') => 'disabled' ],
|
||||||
|
[ $c->l('NETWORKS_ALLOW_LOCAL') => 'private' ],
|
||||||
|
[ $c->l('mai_SECURE_POP3') => 'publicSSL' ],
|
||||||
|
[ $c->l('mai_INSECURE_POP3') => 'public' ]];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_pop_options {
|
||||||
|
|
||||||
|
my $c = @_;
|
||||||
|
|
||||||
|
my %options = (
|
||||||
|
disabled => 'DISABLED',
|
||||||
|
private => 'NETWORKS_ALLOW_LOCAL',
|
||||||
|
publicSSL => 'mai_SECURE_POP3'
|
||||||
|
);
|
||||||
|
|
||||||
|
my $access = $cdb->get_prop('pop3', 'access') || 'private';
|
||||||
|
|
||||||
|
$options{public} = 'mai_INSECURE_POP3' if ($access eq 'public');
|
||||||
|
|
||||||
|
\%options;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_imap_opt {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
return [[ $c->l('DISABLED') => 'disabled' ],
|
||||||
|
[ $c->l('NETWORKS_ALLOW_LOCAL') => 'private' ],
|
||||||
|
[ $c->l('mai_SECURE_IMAP') => 'publicSSL' ],
|
||||||
|
[ $c->l('mai_INSECURE_IMAP') => 'public' ]];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_imap_options {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my %options = (
|
||||||
|
disabled => 'DISABLED',
|
||||||
|
private => 'NETWORKS_ALLOW_LOCAL',
|
||||||
|
publicSSL => 'mai_SECURE_IMAP'
|
||||||
|
);
|
||||||
|
|
||||||
|
my $access = $cdb->get_prop('imap', 'access') || 'private';
|
||||||
|
|
||||||
|
$options{public} = 'mai_INSECURE_IMAP' if ($access eq 'public');
|
||||||
|
|
||||||
|
\%options;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_smtp_auth_options {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my %options = ( disabled => 'DISABLED', publicSSL => 'mai_SECURE_SMTP', public => 'mai_INSECURE_SMTP');
|
||||||
|
|
||||||
|
\%options;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_webmail_opt {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
return [[ $c->l('DISABLED') => 'disabled' ],
|
||||||
|
[ $c->l('mai_ENABLED_SECURE_ONLY') => 'enabledSSL' ],
|
||||||
|
[ $c->l('mai_ONLY_LOCAL_NETWORK_SSL') => 'localnetworkSSL' ],
|
||||||
|
[ $c->l('mai_ENABLED_BOTH') => 'public' ]];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_webmail_options {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my %options = (
|
||||||
|
disabled => 'DISABLED',
|
||||||
|
enabledSSL => 'mai_ENABLED_SECURE_ONLY',
|
||||||
|
localnetworkSSL => 'mai_ONLY_LOCAL_NETWORK_SSL' );
|
||||||
|
|
||||||
|
\%options;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_retrieval_opt {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
return $cdb->get("SystemMode")->value eq "servergateway-private"
|
||||||
|
? [ $c->l('mai_MULTIDROP') => 'multidrop']
|
||||||
|
: [[ $c->l('mai_STANDARD') => 'standard'],
|
||||||
|
[ $c->l('mai_ETRN') => 'etrn' ],
|
||||||
|
[ $c->l('mai_MULTIDROP') => 'multidrop']];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_smtp_auth_opt {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
return [[ $c->l('DISABLED') => 'disabled'],
|
||||||
|
[ $c->l('mai_SECURE_SMTP') => 'publicSSL'],
|
||||||
|
[ $c->l('mai_INSECURE_SMTP') => 'public']];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_emailunknownuser_options {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $accounts = esmith::AccountsDB->open_ro();
|
||||||
|
my %existingAccounts = ('admin' => $c->l("mai_FORWARD_TO_ADMIN"),
|
||||||
|
'returntosender' => $c->l("mai_RETURN_TO_SENDER") );
|
||||||
|
|
||||||
|
foreach my $account ($accounts->get_all) {
|
||||||
|
next if $account->key eq 'everyone';
|
||||||
|
if ($account->prop('type') =~ /(user|group|pseudonym)/) {
|
||||||
|
$existingAccounts{$account->key} = $c->l("mai_FORWARD_TO") . " " . $account->key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(\%existingAccounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_emailunknownuser_opt {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $accounts = esmith::AccountsDB->open_ro();
|
||||||
|
|
||||||
|
my @existingAccounts = ([ $c->l("mai_FORWARD_TO_ADMIN") => 'admin'],
|
||||||
|
[ $c->l("mai_RETURN_TO_SENDER") => 'returntosender']);
|
||||||
|
|
||||||
|
foreach my $account ($accounts->get_all) {
|
||||||
|
next if $account->key eq 'everyone';
|
||||||
|
if ($account->prop('type') =~ /(user|group|pseudonym)/) {
|
||||||
|
push @existingAccounts, [ $c->l("mai_FORWARD_TO") . " " . $account->key => $account->key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(\@existingAccounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_patterns_opt {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my @options;
|
||||||
|
|
||||||
|
foreach my $pattern ( $pattern_db->get_all_by_prop( type => "pattern" ) ) {
|
||||||
|
my %props = $pattern->props;
|
||||||
|
push @options, [ $props{'Description'} => $pattern->key ];
|
||||||
|
}
|
||||||
|
return \@options;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_patterns_current_opt {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my @selected;
|
||||||
|
|
||||||
|
foreach my $pattern ( $pattern_db->get_all_by_prop( type => "pattern" ) ) {
|
||||||
|
my %props = $pattern->props;
|
||||||
|
push @selected, $pattern->key if ($props{'Status'} eq 'enabled');
|
||||||
|
}
|
||||||
|
return \@selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_spam_level_options {
|
||||||
|
|
||||||
|
return [ 0..20 ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_spam_sensitivity_opt {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
return [[ $c->l('mai_VERYLOW') => 'verylow' ],
|
||||||
|
[ $c->l('mai_LOW') => 'low' ],
|
||||||
|
[ $c->l('mai_MEDIUM') => 'medium' ],
|
||||||
|
[ $c->l('mai_HIGH') => 'high' ],
|
||||||
|
[ $c->l('mai_VERYHIGH') => 'veryhigh' ],
|
||||||
|
[ $c->l('mai_CUSTOM') => 'custom' ]];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub fetchmail_freq {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
return [[ $c->l('mai_NEVER') => 'never' ],
|
||||||
|
[ $c->l('mai_EVERY5MIN') => 'every5min' ],
|
||||||
|
[ $c->l('mai_EVERY15MIN') => 'every15min' ],
|
||||||
|
[ $c->l('mai_EVERY30MIN') => 'every30min' ],
|
||||||
|
[ $c->l('mai_EVERYHOUR') => 'everyhour' ],
|
||||||
|
[ $c->l('mai_EVERY2HRS') => 'every2hrs' ]];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub display_multidrop {
|
||||||
|
|
||||||
|
my $status = $cdb->get_prop('fetchmail', 'status') || 'disabled';
|
||||||
|
|
||||||
|
# XXX FIXME - WIP
|
||||||
|
# Only display ETRN/multidrop settings if relevant
|
||||||
|
# To do this, we need an "Show ETRN/multidrop settings" button
|
||||||
|
# in standard mode.
|
||||||
|
|
||||||
|
# return ($status eq 'enabled');
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub change_settings_reception {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $FetchmailMethod = ( $c->param('FetchmailMethod') || 'standard' );
|
||||||
|
|
||||||
|
my $FetchmailFreqOffice = ( $c->param('FreqOffice') || 'every15min' );
|
||||||
|
|
||||||
|
my $FetchmailFreqOutside = ( $c->param('FreqOutside') || 'everyhour' );
|
||||||
|
my $FetchmailFreqWeekend = ( $c->param('FreqWeekend') || 'everyhour' );
|
||||||
|
my $SpecifyHeader = ( $c->param('SpecifyHeader') || 'off' );
|
||||||
|
|
||||||
|
my $fetchmail = $cdb->get('fetchmail') || $cdb->new_record( "fetchmail",
|
||||||
|
{ type => "service", status => "disabled" } );
|
||||||
|
|
||||||
|
if ( $FetchmailMethod eq 'standard' ) {
|
||||||
|
$fetchmail->set_prop( 'status', 'disabled' );
|
||||||
|
$fetchmail->set_prop( 'Method', $FetchmailMethod );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$fetchmail->set_prop( 'status', 'enabled' );
|
||||||
|
$fetchmail->set_prop( 'Method', $FetchmailMethod );
|
||||||
|
$fetchmail->set_prop( 'SecondaryMailServer',
|
||||||
|
$c->param('SecondaryMailServer') )
|
||||||
|
unless ( $c->param('SecondaryMailServer') eq '' );
|
||||||
|
|
||||||
|
$fetchmail->set_prop('FreqOffice', $FetchmailFreqOffice );
|
||||||
|
$fetchmail->set_prop('FreqOutside', $FetchmailFreqOutside );
|
||||||
|
$fetchmail->set_prop('FreqWeekend', $FetchmailFreqWeekend );
|
||||||
|
$fetchmail->set_prop('SecondaryMailAccount',
|
||||||
|
$c->param('SecondaryMailAccount') )
|
||||||
|
unless ( $c->param('SecondaryMailAccount') eq '' );
|
||||||
|
|
||||||
|
$fetchmail->set_prop( 'SecondaryMailPassword',
|
||||||
|
$c->param('SecondaryMailPassword') )
|
||||||
|
unless ( $c->param('SecondaryMailPassword') eq '' );
|
||||||
|
|
||||||
|
if ( $SpecifyHeader eq 'on' ) {
|
||||||
|
$fetchmail->merge_props(
|
||||||
|
'SecondaryMailEnvelope' => $c->param('SecondaryMailEnvelope') );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$fetchmail->delete_prop('SecondaryMailEnvelope');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $smtpAuth = ($c->param('SMTPAuth') || 'public');
|
||||||
|
if ($smtpAuth eq 'public') {
|
||||||
|
$cdb->set_prop("qpsmtpd", "Authentication", "enabled" );
|
||||||
|
$cdb->set_prop("sqpsmtpd", "Authentication", "enabled" );
|
||||||
|
} elsif ($smtpAuth eq 'publicSSL') {
|
||||||
|
$cdb->set_prop("qpsmtpd", "Authentication", "disabled" );
|
||||||
|
$cdb->set_prop("sqpsmtpd", "Authentication", "enabled" );
|
||||||
|
} else {
|
||||||
|
$cdb->set_prop("qpsmtpd", "Authentication", "disabled" );
|
||||||
|
$cdb->set_prop("sqpsmtpd", "Authentication", "disabled" );
|
||||||
|
}
|
||||||
|
|
||||||
|
unless ( system( "/sbin/e-smith/signal-event", "email-update" ) == 0 )
|
||||||
|
{
|
||||||
|
return $c->l('mai_ERROR_UPDATING_CONFIGURATION');
|
||||||
|
}
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub change_settings_delivery {
|
||||||
|
|
||||||
|
my ($c) = shift;
|
||||||
|
|
||||||
|
my $EmailUnknownUser = ($c->param('EmailUnknownUser') || 'returntosender');
|
||||||
|
|
||||||
|
$cdb->set_value('SMTPSmartHost', $c->param('SMTPSmartHost'));
|
||||||
|
$cdb->set_value('DelegateMailServer', $c->param('DelegateMailServer'));
|
||||||
|
$cdb->set_value('EmailUnknownUser', $EmailUnknownUser);
|
||||||
|
|
||||||
|
my $proxy = $cdb->get('smtp-auth-proxy');
|
||||||
|
my %props = $proxy->props;
|
||||||
|
|
||||||
|
for ( qw(Userid Passwd status) )
|
||||||
|
{
|
||||||
|
$props{$_} = $c->param("SMTPAUTHPROXY_$_");
|
||||||
|
}
|
||||||
|
|
||||||
|
$proxy->merge_props(%props);
|
||||||
|
|
||||||
|
unless ( system( "/sbin/e-smith/signal-event", "email-update" ) == 0 )
|
||||||
|
{
|
||||||
|
return $c->l('mai_ERROR_UPDATING_CONFIGURATION');
|
||||||
|
}
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub change_settings_access {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $pop3Access = ($c->param('POPAccess') || 'private');
|
||||||
|
if ($pop3Access eq 'disabled') {
|
||||||
|
$cdb->set_prop('pop3', "status", "disabled" );
|
||||||
|
$cdb->set_prop('pop3s', "status", "disabled" );
|
||||||
|
} else {
|
||||||
|
$cdb->set_prop('pop3', "status", "enabled" );
|
||||||
|
$cdb->set_prop('pop3s', "status", "enabled" );
|
||||||
|
}
|
||||||
|
if ($pop3Access eq 'public') {
|
||||||
|
$cdb->set_prop('pop3', "access", "public" );
|
||||||
|
$cdb->set_prop('pop3s', "access", "public" );
|
||||||
|
} elsif ($pop3Access eq 'publicSSL') {
|
||||||
|
$cdb->set_prop('pop3', "access", "private" );
|
||||||
|
$cdb->set_prop('pop3s', "access", "public" );
|
||||||
|
} else {
|
||||||
|
$cdb->set_prop('pop3', "access", "private" );
|
||||||
|
$cdb->set_prop('pop3s', "access", "private" );
|
||||||
|
}
|
||||||
|
|
||||||
|
my $imapAccess = ($c->param('IMAPAccess') || 'private');
|
||||||
|
if ($imapAccess eq 'disabled') {
|
||||||
|
$cdb->set_prop('imap', "status", "enabled" );
|
||||||
|
$cdb->set_prop('imap', "access", "localhost" );
|
||||||
|
$cdb->set_prop('imaps', "status", "disabled" );
|
||||||
|
} elsif ($imapAccess eq 'public') {
|
||||||
|
$cdb->set_prop('imap', "status", "enabled" );
|
||||||
|
$cdb->set_prop('imap', "access", "public" );
|
||||||
|
$cdb->set_prop('imaps', "status", "enabled" );
|
||||||
|
$cdb->set_prop('imaps', "access", "public" );
|
||||||
|
} elsif ($imapAccess eq 'publicSSL') {
|
||||||
|
$cdb->set_prop('imap', "status", "enabled" );
|
||||||
|
$cdb->set_prop('imap', "access", "private" );
|
||||||
|
$cdb->set_prop('imaps', "status", "enabled" );
|
||||||
|
$cdb->set_prop('imaps', "access", "public" );
|
||||||
|
} else {
|
||||||
|
$cdb->set_prop('imap', "status", "enabled" );
|
||||||
|
$cdb->set_prop('imap', "access", "private" );
|
||||||
|
$cdb->set_prop('imaps', "status", "enabled" );
|
||||||
|
$cdb->set_prop('imaps', "access", "private" );
|
||||||
|
}
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# Set webmail state in configuration database, and access
|
||||||
|
# type for SSL
|
||||||
|
# PHP and MySQL should always be on, and are enabled by default
|
||||||
|
# We don't do anything with them here.
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
my $webmail = ($c->param('WebMail') || 'disabled');
|
||||||
|
if ( $webmail eq "enabled" ) {
|
||||||
|
$cdb->set_prop('php', "status", $webmail );
|
||||||
|
$cdb->set_prop('mariadb',"status", $webmail );
|
||||||
|
$cdb->set_prop('imp',"status", $webmail );
|
||||||
|
$cdb->set_prop('horde', "status", $webmail );
|
||||||
|
$cdb->set_prop('imp',"access", "full" );
|
||||||
|
$cdb->set_prop('horde',"access", "public" );
|
||||||
|
$cdb->set_prop('horde',"HttpsOnly", "no" );
|
||||||
|
}
|
||||||
|
elsif ( $webmail eq "enabledSSL" ) {
|
||||||
|
$cdb->set_prop('php',"status", "enabled" );
|
||||||
|
$cdb->set_prop('mariadb',"status", "enabled" );
|
||||||
|
$cdb->set_prop('imp',"status", 'enabled' );
|
||||||
|
$cdb->set_prop('horde',"status", 'enabled' );
|
||||||
|
$cdb->set_prop('imp',"access", "SSL" );
|
||||||
|
$cdb->set_prop('horde',"access", "public" );
|
||||||
|
$cdb->set_prop('horde',"HttpsOnly", "yes" );
|
||||||
|
}
|
||||||
|
|
||||||
|
elsif ( $webmail eq "localnetworkSSL" ) {
|
||||||
|
$cdb->set_prop('php',"status", "enabled" );
|
||||||
|
$cdb->set_prop('mariadb',"status", "enabled" );
|
||||||
|
$cdb->set_prop('imp',"status", 'enabled' );
|
||||||
|
$cdb->set_prop('horde',"status", 'enabled' );
|
||||||
|
$cdb->set_prop('imp',"access", "SSL" );
|
||||||
|
$cdb->set_prop('horde',"access", "private" );
|
||||||
|
$cdb->set_prop('horde',"HttpsOnly", "yes" );
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
$cdb->set_prop('imp',"status", 'disabled' );
|
||||||
|
$cdb->set_prop('horde',"status", 'disabled' );
|
||||||
|
}
|
||||||
|
|
||||||
|
unless ( system( "/sbin/e-smith/signal-event", "email-update" ) == 0 ) {
|
||||||
|
return $c->l('mai_ERROR_UPDATING_CONFIGURATION');
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub change_settings_filtering {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $virus_status = ( $c->param('VirusStatus') || 'disabled' );
|
||||||
|
$cdb->set_prop("qpsmtpd", 'VirusScan', $virus_status);
|
||||||
|
|
||||||
|
for my $param ( qw(
|
||||||
|
status
|
||||||
|
Sensitivity
|
||||||
|
TagLevel
|
||||||
|
RejectLevel
|
||||||
|
SortSpam
|
||||||
|
Subject
|
||||||
|
SubjectTag) )
|
||||||
|
{
|
||||||
|
$cdb->set_prop('spamassassin', $param, $c->param("Spam$param"));
|
||||||
|
}
|
||||||
|
|
||||||
|
my $patterns_status = $c->adjust_patterns() ? 'enabled' : 'disabled';
|
||||||
|
$cdb->set_prop("qpsmtpd", 'PatternsScan', $patterns_status);
|
||||||
|
|
||||||
|
unless ( system( "/sbin/e-smith/signal-event", "email-update" ) == 0 )
|
||||||
|
{
|
||||||
|
return $c->l('mai_ERROR_UPDATING_CONFIGURATION');
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#sub blank_or_ip_number {
|
||||||
|
|
||||||
|
# my ($c, $value) = @_;
|
||||||
|
|
||||||
|
# return 'OK' unless (defined $value); # undef is blank
|
||||||
|
# return 'OK' if ($value =~ /^$/); # blank is blank
|
||||||
|
# return $c->call_fm_validation("ip_number",$value,''); # otherwise, validate the input
|
||||||
|
|
||||||
|
#}
|
||||||
|
|
||||||
|
|
||||||
|
sub nonblank_if_smtpauth {
|
||||||
|
|
||||||
|
my ($c, $value) = @_;
|
||||||
|
|
||||||
|
return "OK" unless ($c->param("SMTPAUTHPROXY_status") eq 'enabled');
|
||||||
|
|
||||||
|
return ($value =~ /\S+/) ? "OK" : $c->l('mai_VALIDATION_SMTPAUTH_NONBLANK');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_secondary_mail_use_envelope {
|
||||||
|
|
||||||
|
my $use_envelope = $cdb->get_prop('fetchmail', 'SecondaryMailEnvelope');
|
||||||
|
if ( defined $use_envelope ) {
|
||||||
|
return ('on');
|
||||||
|
} else {
|
||||||
|
return ('off');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_smarthost {
|
||||||
|
my $fm = shift;
|
||||||
|
my $smarthost = shift;
|
||||||
|
|
||||||
|
return ('OK') if ( $smarthost =~ /^(\S+\.\S+)$/ );
|
||||||
|
|
||||||
|
return ('OK') if ( $smarthost eq '' );
|
||||||
|
|
||||||
|
return "INVALID_SMARTHOST";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
507
root/usr/share/smanager/lib/SrvMngr/Controller/Groups.pm
Normal file
507
root/usr/share/smanager/lib/SrvMngr/Controller/Groups.pm
Normal file
@ -0,0 +1,507 @@
|
|||||||
|
package SrvMngr::Controller::Groups;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : User management
|
||||||
|
# description : GROUPS
|
||||||
|
# navigation : 2000 200
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
#use Data::Dumper;
|
||||||
|
|
||||||
|
#use esmith::FormMagick::Panel::groups;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
|
||||||
|
our $cdb = esmith::ConfigDB->open || die "Couldn't open configuration db";
|
||||||
|
our $adb = esmith::AccountsDB->open || die "Couldn't open accounts db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %grp_datas = ();
|
||||||
|
my $title = $c->l('grp_FORM_TITLE');
|
||||||
|
|
||||||
|
$grp_datas{trt} = 'LST';
|
||||||
|
|
||||||
|
my @groups;
|
||||||
|
if ($adb) {
|
||||||
|
@groups = $adb->groups();
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, grp_datas => \%grp_datas, groups => \@groups );
|
||||||
|
$c->render(template => 'groups');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'LST');
|
||||||
|
my $group = $c->param('group');
|
||||||
|
|
||||||
|
my %grp_datas = ();
|
||||||
|
my $title = $c->l('grp_FORM_TITLE');
|
||||||
|
|
||||||
|
$grp_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
#nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' ) {
|
||||||
|
|
||||||
|
my %members = ();
|
||||||
|
my %users = ();
|
||||||
|
|
||||||
|
my $rec = $adb->get($group);
|
||||||
|
if ($rec and $rec->prop('type') eq 'group') {
|
||||||
|
|
||||||
|
$grp_datas{group} = $group;
|
||||||
|
$grp_datas{description} = $rec->prop('Description') || '';
|
||||||
|
|
||||||
|
%members = @{$c->gen_members_list( $group )};
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( members => \%members, users => \%users );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
my %members = ();
|
||||||
|
my %ibays = ();
|
||||||
|
|
||||||
|
my $rec = $adb->get($group);
|
||||||
|
if ($rec and $rec->prop('type') eq 'group') {
|
||||||
|
|
||||||
|
$grp_datas{group} = $group;
|
||||||
|
$grp_datas{description} = $rec->prop('Description') || '';
|
||||||
|
|
||||||
|
%members = @{$c->gen_members_list($group)};
|
||||||
|
|
||||||
|
%ibays = @{$c->gen_ibays_list($group)};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( members => \%members, ibays => \%ibays );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'LST' ) {
|
||||||
|
my @groups;
|
||||||
|
if ($adb) {
|
||||||
|
@groups = $adb->groups();
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( groups => \@groups );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, grp_datas => \%grp_datas );
|
||||||
|
$c->render( template => 'groups' );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'LST');
|
||||||
|
my $groupName = $c->param('groupName') || '';
|
||||||
|
|
||||||
|
my $title = $c->l('grp_FORM_TITLE');
|
||||||
|
my ($res, $result) = '';
|
||||||
|
|
||||||
|
my %grp_datas = ();
|
||||||
|
$grp_datas{'trt'} = $trt;
|
||||||
|
$grp_datas{'group'} = $groupName;
|
||||||
|
my @members = ();
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
|
||||||
|
my $groupDesc = $c->param('groupDesc');
|
||||||
|
@members = @{$c->every_param('groupMembers')};
|
||||||
|
|
||||||
|
my $members = join ( ",", @members );
|
||||||
|
|
||||||
|
# controls
|
||||||
|
$res = $c->validate_group( $groupName );
|
||||||
|
$result .= $res . '<br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->validate_group_length( $groupName );
|
||||||
|
$result .= $res . '<br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->validate_group_naming_conflict( $groupName );
|
||||||
|
$result .= $res . '<br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->validate_description( $groupDesc );
|
||||||
|
$result .= $res . '<br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->validate_group_has_members( @members );
|
||||||
|
$result .= $res . '<br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
my %props = (
|
||||||
|
'type', 'group', 'Description',
|
||||||
|
$groupDesc, 'Members', $members
|
||||||
|
);
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
|
||||||
|
$adb->new_record( $groupName, \%props );
|
||||||
|
|
||||||
|
# Untaint groupName before use in system()
|
||||||
|
($groupName) = ($groupName =~ /^([a-z][\-\_\.a-z0-9]*)$/);
|
||||||
|
|
||||||
|
system("/sbin/e-smith/signal-event", "group-create", "$groupName") == 0
|
||||||
|
or $result .= $c->l('qgp_CREATE_ERROR')."\n";
|
||||||
|
}
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('grp_CREATED_GROUP') . ' ' . $groupName;
|
||||||
|
$res = 'OK';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' ) {
|
||||||
|
|
||||||
|
my $groupDesc = $c->param('groupDesc');
|
||||||
|
@members = @{$c->every_param('groupMembers')};
|
||||||
|
my $members = join ( ",", @members );
|
||||||
|
|
||||||
|
# controls
|
||||||
|
$res = '';
|
||||||
|
$res = validate_description( $c, $groupDesc );
|
||||||
|
$result .= $res . '<br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = validate_group_has_members( $c, @members );
|
||||||
|
$result .= $res . '<br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
|
||||||
|
$adb->get($groupName)->set_prop( 'Members', $members );
|
||||||
|
$adb->get($groupName)->set_prop( 'Description', $groupDesc );
|
||||||
|
|
||||||
|
# Untaint groupName before use in system()
|
||||||
|
($groupName) = ($groupName =~ /^([a-z][\-\_\.a-z0-9]*)$/);
|
||||||
|
|
||||||
|
system("/sbin/e-smith/signal-event", "group-modify", "$groupName") ==0
|
||||||
|
or $result .= $c->l('qgp_MODIFY_ERROR')."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('grp_MODIFIED_GROUP') . ' ' . $groupName;
|
||||||
|
$res = 'OK';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
if ($groupName =~ /^([a-z][\-\_\.a-z0-9]*)$/) {
|
||||||
|
$groupName = $1;
|
||||||
|
} else {
|
||||||
|
$result .= $c->l('grp_ERR_INTERNAL_FAILURE') . ':' . $groupName;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $rec = $adb->get($groupName);
|
||||||
|
$result .= $c->l('grp_ERR_INTERNAL_FAILURE') . ':' . $groupName unless ($rec);
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = delete_group( $c, $groupName );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('grp_DELETED_GROUP') . ' ' . $groupName;
|
||||||
|
$res = 'OK';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# common parts
|
||||||
|
|
||||||
|
if ($res ne 'OK') {
|
||||||
|
$c->stash( error => $result );
|
||||||
|
my %members = @{$c->gen_members_list($groupName)};
|
||||||
|
$c->stash( title => $title, members => \%members, grp_datas => \%grp_datas );
|
||||||
|
return $c->render('groups');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $message = "'Groups' updates ($trt) DONE";
|
||||||
|
$c->app->log->info($message);
|
||||||
|
$c->flash( success => $result );
|
||||||
|
|
||||||
|
$c->redirect_to('/groups');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sub delete_group {
|
||||||
|
|
||||||
|
my ( $c, $groupName ) = @_;
|
||||||
|
|
||||||
|
# Update the db account (1)
|
||||||
|
$adb->get($groupName)->set_prop('type', 'group-deleted');
|
||||||
|
|
||||||
|
# Untaint groupName before use in system()
|
||||||
|
($groupName) = ($groupName =~ /^([a-z][\-\_\.a-z0-9]*)$/);
|
||||||
|
|
||||||
|
return (system ("/sbin/e-smith/signal-event", "group-delete", "$groupName") ||
|
||||||
|
! $adb->get($groupName)->delete()) ?
|
||||||
|
$c->l('DELETE_ERROR') : 'OK';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub gen_members_list {
|
||||||
|
|
||||||
|
my ( $c, $group ) = @_;
|
||||||
|
|
||||||
|
my @members = ();
|
||||||
|
my $rec = $adb->get($group);
|
||||||
|
@members = split ( /,/, $rec->prop('Members') ) if ( $rec );
|
||||||
|
|
||||||
|
my %names;
|
||||||
|
foreach my $m (@members) {
|
||||||
|
my $name;
|
||||||
|
if ( $m eq 'admin' ) {
|
||||||
|
$name = "Administrator";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$name = $adb->get($m)->prop('FirstName') . " "
|
||||||
|
. $adb->get($m)->prop('LastName');
|
||||||
|
}
|
||||||
|
$names{$m} = $name;
|
||||||
|
}
|
||||||
|
@members = %names;
|
||||||
|
|
||||||
|
return \@members;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub gen_ibays_list {
|
||||||
|
|
||||||
|
my ( $c, $group ) = @_;
|
||||||
|
|
||||||
|
my %names;
|
||||||
|
foreach my $ibay ( $adb->ibays ) {
|
||||||
|
if ( $ibay->prop('Group') eq $group ) {
|
||||||
|
$names{$ibay->key} = $ibay->prop('Name');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
my @ibays = %names;
|
||||||
|
|
||||||
|
return \@ibays;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub gen_users_list {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my @users = sort { $a->key() cmp $b->key() } $adb->users();
|
||||||
|
my %names;
|
||||||
|
|
||||||
|
foreach my $user ( @users ) {
|
||||||
|
$names{$user->key} = $user->prop('FirstName') . " "
|
||||||
|
. $user->prop('LastName');
|
||||||
|
}
|
||||||
|
|
||||||
|
return \%names;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head1 VALIDATION
|
||||||
|
|
||||||
|
=head2 validate_is_group FM GROUP
|
||||||
|
|
||||||
|
returns OK if GROUP is a current group. otherwisee returns "NOT_A_GROUP"
|
||||||
|
|
||||||
|
=begin testing
|
||||||
|
|
||||||
|
#ok($panel->validate_is_group('root') eq 'OK', "Root is a group");
|
||||||
|
ok($panel->validate_is_group('ro2ot') eq 'NOT_A_GROUP', "Ro2ot is not a group");
|
||||||
|
|
||||||
|
=end testing
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_is_group () {
|
||||||
|
my $c = shift;
|
||||||
|
my $group = shift;
|
||||||
|
|
||||||
|
my @groups = $adb->groups();
|
||||||
|
my %groups = map { $_->key => 1 } @groups;
|
||||||
|
|
||||||
|
unless ( exists $groups{$group} ) {
|
||||||
|
return ($c->l('grp_NOT_A_GROUP'));
|
||||||
|
}
|
||||||
|
return ("OK");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head2 validate_group_naming_conflict FM GROUPNAME
|
||||||
|
|
||||||
|
Returns "OK" if this group's name doesn't conflict with anything
|
||||||
|
Returns "PSEUDONYM_CONFLICT" if this name conflicts with a pseudonym
|
||||||
|
Returns "NAME_CONFLICT" if this group name conflicts with anything else
|
||||||
|
|
||||||
|
ok (undef, 'need testing for validate_naming_Conflicts');
|
||||||
|
=cut
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_group_naming_conflict
|
||||||
|
{
|
||||||
|
my $c = shift;
|
||||||
|
my $groupName = shift;
|
||||||
|
|
||||||
|
my $account = $adb->get($groupName);
|
||||||
|
my $type;
|
||||||
|
|
||||||
|
if (defined $account)
|
||||||
|
{
|
||||||
|
$type = $account->prop('type');
|
||||||
|
}
|
||||||
|
elsif (defined getpwnam($groupName) || defined getgrnam($groupName))
|
||||||
|
{
|
||||||
|
$type = "system";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return('OK');
|
||||||
|
}
|
||||||
|
return ($c->l('grp_ACCOUNT_CONFLICT', $groupName, $type));
|
||||||
|
}
|
||||||
|
|
||||||
|
=head2 validate_group FM groupname
|
||||||
|
|
||||||
|
Returns OK if the group name contains only valid characters
|
||||||
|
Returns GROUP_NAMING otherwise
|
||||||
|
|
||||||
|
=being testing
|
||||||
|
|
||||||
|
ok(validate_group('','foo') eq 'OK', 'foo is a valid group);
|
||||||
|
ok(validate_group('','f&oo') eq 'GROUP_CONTAINS_INVALD', 'f&oo is not a valid group);
|
||||||
|
|
||||||
|
=end testing
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub validate_group {
|
||||||
|
my $c = shift;
|
||||||
|
my $groupName = shift;
|
||||||
|
unless ( $groupName =~ /^([a-z][\-\_\.a-z0-9]*)$/ ) {
|
||||||
|
return $c->l('grp_GROUP_NAMING');
|
||||||
|
}
|
||||||
|
return ('OK');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head2 validate_group_length FM GROUPNAME
|
||||||
|
|
||||||
|
returns 'OK' if the group name is shorter than the maximum group name length
|
||||||
|
returns 'GROUP_TOO_LONG' otherwise
|
||||||
|
|
||||||
|
=begin testing
|
||||||
|
|
||||||
|
ok(($panel->validate_group_length('foo') eq 'OK'), "a short groupname passes");
|
||||||
|
ok(($panel->validate_group_length('fooooooooooooooooo') eq 'GROUP_TOO_LONG'), "a long groupname fails");
|
||||||
|
|
||||||
|
=end testing
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub validate_group_length {
|
||||||
|
my $c = shift;
|
||||||
|
my $groupName = shift;
|
||||||
|
|
||||||
|
|
||||||
|
my $maxGroupNameLength = ($cdb->get('maxGroupNameLength')
|
||||||
|
? $cdb->get('maxGroupNameLength')->prop('type')
|
||||||
|
: "") || 12;
|
||||||
|
|
||||||
|
if ( length $groupName > $maxGroupNameLength ) {
|
||||||
|
return $c->l('grp_GROUP_TOO_LONG', $maxGroupNameLength);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ('OK');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head2 validate_group_has_members FM MEMBERS
|
||||||
|
|
||||||
|
Validates that the cgi parameter MEMBERS is an array with at least one entry
|
||||||
|
Returns OK if true. Otherwise, returns NO_MEMBERS
|
||||||
|
|
||||||
|
|
||||||
|
=begin testing
|
||||||
|
|
||||||
|
ok(validate_group_has_members('',qw(foo bar)) eq 'OK', "We do ok with a group with two members");
|
||||||
|
|
||||||
|
ok(validate_group_has_members('',qw()) eq 'NO_MEMBERS', "We do ok with a group with no members");
|
||||||
|
ok(validate_group_has_members('') eq 'NO_MEMBERS', "We do ok with a group with undef members");
|
||||||
|
|
||||||
|
=end testing
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub validate_group_has_members {
|
||||||
|
my $c = shift;
|
||||||
|
my @members = (@_);
|
||||||
|
my $count = @members;
|
||||||
|
if ( $count == 0 ) {
|
||||||
|
return ($c->l('grp_NO_MEMBERS'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ('OK');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=pod
|
||||||
|
|
||||||
|
=head2 validate_description ($description).
|
||||||
|
Checks the supplied description. Period is allowed in description
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub validate_description
|
||||||
|
{
|
||||||
|
my ($c, $description) = @_;
|
||||||
|
if ( $description =~ /^([\-\'\w][\-\'\w\s\.]*)$/ ) {
|
||||||
|
return ('OK');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ($c->l('FM_ERR_UNEXPECTED_DESC'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1
|
615
root/usr/share/smanager/lib/SrvMngr/Controller/Hostentries.pm
Normal file
615
root/usr/share/smanager/lib/SrvMngr/Controller/Hostentries.pm
Normal file
@ -0,0 +1,615 @@
|
|||||||
|
package SrvMngr::Controller::Hostentries;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Network
|
||||||
|
# description : Hostnames and addresses
|
||||||
|
# navigation : 6000 200
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
#use Data::Dumper;
|
||||||
|
|
||||||
|
#use esmith::FormMagick::Panel::hostentries;
|
||||||
|
|
||||||
|
use esmith::DomainsDB;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
use esmith::HostsDB;
|
||||||
|
use esmith::NetworksDB;
|
||||||
|
use HTML::Entities;
|
||||||
|
use Net::IPv4Addr qw(ipv4_in_network);
|
||||||
|
|
||||||
|
#use URI::Escape;
|
||||||
|
|
||||||
|
our $ddb = esmith::DomainsDB->open || die "Couldn't open hostentries db";
|
||||||
|
our $cdb = esmith::ConfigDB->open || die "Couldn't open configuration db";
|
||||||
|
our $hdb = esmith::HostsDB->open || die "Couldn't open hosts db";
|
||||||
|
our $ndb = esmith::NetworksDB->open || die "Couldn't open networks db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info( $c->log_req );
|
||||||
|
|
||||||
|
my %hos_datas = ();
|
||||||
|
my $title = $c->l('hos_FORM_TITLE');
|
||||||
|
my $notif = '';
|
||||||
|
|
||||||
|
$hos_datas{trt} = 'LIST';
|
||||||
|
|
||||||
|
my %dom_hosts = ();
|
||||||
|
|
||||||
|
foreach my $d ( @{ domains_list() } ) {
|
||||||
|
$dom_hosts{$d} = { COUNT => 0, HOSTS => [] };
|
||||||
|
|
||||||
|
if ( my @hosts = $hdb->get_hosts_by_domain($d) ) {
|
||||||
|
$dom_hosts{$d}{'COUNT'} = scalar(@hosts);
|
||||||
|
|
||||||
|
# my @entries;
|
||||||
|
push @{ $dom_hosts{$d}{'HOSTS'} }, host_data($_) foreach (@hosts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash(
|
||||||
|
title => $title,
|
||||||
|
notif => $notif,
|
||||||
|
hos_datas => \%hos_datas,
|
||||||
|
dom_hosts => \%dom_hosts
|
||||||
|
);
|
||||||
|
$c->render( template => 'hostentries' );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info( $c->log_req );
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = $c->param('trt') || 'LST';
|
||||||
|
my $hostname = $c->param('Hostname') || '';
|
||||||
|
|
||||||
|
$trt = 'ADD' if ( $rt eq 'hostentryadd' );
|
||||||
|
$trt = 'LST' if ( $trt ne 'DEL' && $trt ne 'UPD' && $trt ne 'ADD' );
|
||||||
|
|
||||||
|
my %hos_datas = ();
|
||||||
|
my $title = $c->l('hos_FORM_TITLE');
|
||||||
|
my $notif = '';
|
||||||
|
|
||||||
|
$hos_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' or $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
my $rec = $hdb->get($hostname);
|
||||||
|
if ($rec) {
|
||||||
|
$hos_datas{hostname} = $rec->key;
|
||||||
|
( $hos_datas{name}, $hos_datas{domain} ) =
|
||||||
|
split_hostname($hostname);
|
||||||
|
$hos_datas{internalip} = $rec->prop('InternalIP') || '';
|
||||||
|
$hos_datas{externalip} = $rec->prop('ExternalIP') || '';
|
||||||
|
$hos_datas{macaddress} = $rec->prop('MACAddress') || '';
|
||||||
|
$hos_datas{hosttype} = $rec->prop('HostType');
|
||||||
|
$hos_datas{comment} =
|
||||||
|
HTML::Entities::encode( $rec->prop('Comment') );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$notif = "Hostname $hostname not found !";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
# my $rec = $hdb->get($hostname);
|
||||||
|
# if ( $rec ) {
|
||||||
|
# get_hos_datas( $rec, %hos_datas );
|
||||||
|
# } else {
|
||||||
|
# $notif = "Hostname $hostname not found !"
|
||||||
|
# }
|
||||||
|
#}
|
||||||
|
|
||||||
|
if ( $trt eq 'LIST' ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $notif, hos_datas => \%hos_datas );
|
||||||
|
$c->render( template => 'hostentries' );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info( $c->log_req );
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ( $c->param('trt') || 'LIST' );
|
||||||
|
|
||||||
|
my %hos_datas = ();
|
||||||
|
my $title = $c->l('hos_FORM_TITLE');
|
||||||
|
my $notif = '';
|
||||||
|
my $result = '';
|
||||||
|
|
||||||
|
$hos_datas{'name'} = lc $c->param('Name');
|
||||||
|
$hos_datas{'domain'} = lc $c->param('Domain');
|
||||||
|
$hos_datas{'hostname'} = $c->param('Hostname');
|
||||||
|
$hos_datas{'comment'} = $c->param('Comment');
|
||||||
|
$hos_datas{'hosttype'} = $c->param('Hosttype');
|
||||||
|
$hos_datas{'internalip'} = $c->param('Internalip');
|
||||||
|
$hos_datas{'macaddress'} = $c->param('Macaddress');
|
||||||
|
$hos_datas{'externalip'} = $c->param('Externalip');
|
||||||
|
my $hostname = "$hos_datas{'name'}.$hos_datas{'domain'}";
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
|
||||||
|
$hos_datas{'hostname'} = $hostname;
|
||||||
|
|
||||||
|
# controls
|
||||||
|
my $res = '';
|
||||||
|
unless ( $hos_datas{'name'} =~ /^[a-z0-9][a-z0-9-]*$/ ) {
|
||||||
|
$result .= $c->l('hos_HOSTNAME_VALIDATOR_ERROR') . '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
unless ( $hos_datas{comment} =~ /^([a-zA-Z0-9][\_\.\-,A-Za-z0-9\s]*)$/
|
||||||
|
|| $hos_datas{comment} eq '' )
|
||||||
|
{
|
||||||
|
$result .= $c->l('hos_HOSTNAME_COMMENT_ERROR') . '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
# Look for duplicate hosts.
|
||||||
|
my $hostrec = undef;
|
||||||
|
if ( $hostrec = $hdb->get($hostname) ) {
|
||||||
|
$result .= $c->l(
|
||||||
|
'hos_HOSTNAME_EXISTS_ERROR',
|
||||||
|
{
|
||||||
|
fullHostName => $hostname,
|
||||||
|
type => $hostrec->prop('HostType')
|
||||||
|
}
|
||||||
|
) . '<br>',;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !$result and $hos_datas{hosttype} ne 'Self' ) {
|
||||||
|
if ( $hos_datas{hosttype} eq 'Local' ) {
|
||||||
|
$hos_datas{'trt'} = 'ALC'; # ADD/LOCAL
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$hos_datas{'trt'} = 'ARM'; # ADD/REMOVE
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => '', hos_datas => \%hos_datas );
|
||||||
|
return $c->render( template => 'hostentries' );
|
||||||
|
}
|
||||||
|
|
||||||
|
#!#$result .= ' blocked';
|
||||||
|
|
||||||
|
if ( !$result ) {
|
||||||
|
$res = create_modify_hostentry( $c, $trt, %hos_datas );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
if ( !$result ) {
|
||||||
|
$result = $c->l('hos_CREATE_OR_MODIFY_SUCCEEDED') . ' ' . $hostname;
|
||||||
|
$trt = 'SUC';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' ) {
|
||||||
|
|
||||||
|
# controls
|
||||||
|
my $res = '';
|
||||||
|
|
||||||
|
#$res = validate_description( $c, $account );
|
||||||
|
#$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
unless ( $hos_datas{comment} =~ /^([a-zA-Z0-9][\_\.\-,A-Za-z0-9\s]*)$/
|
||||||
|
|| $hos_datas{comment} eq '' )
|
||||||
|
{
|
||||||
|
$result .= $c->l('hos_HOSTNAME_COMMENT_ERROR') . '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !$result and $hos_datas{hosttype} ne 'Self' ) {
|
||||||
|
if ( $hos_datas{hosttype} eq 'Local' ) {
|
||||||
|
$hos_datas{'trt'} = 'ULC'; # UPDATE/LOCAL
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$hos_datas{'trt'} = 'URM'; # UPDATE/REMOVE
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => '', hos_datas => \%hos_datas );
|
||||||
|
return $c->render( template => 'hostentries' );
|
||||||
|
}
|
||||||
|
|
||||||
|
#!#$result .= 'blocked';
|
||||||
|
|
||||||
|
if ( !$result ) {
|
||||||
|
$res = create_modify_hostentry( $c, $trt, %hos_datas );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !$result ) {
|
||||||
|
$result = $c->l('hos_MODIFY_SUCCEEDED') . ' ' . $hostname;
|
||||||
|
$trt = 'SUC';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt =~ /^.LC$/ ) {
|
||||||
|
|
||||||
|
# controls
|
||||||
|
my $res = '';
|
||||||
|
$res = ip_number( $c, $hos_datas{internalip} );
|
||||||
|
$result .= $res . ' ' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = not_in_dhcp_range( $c, $hos_datas{internalip} );
|
||||||
|
$result .= $res . ' ' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = not_taken( $c, $hos_datas{internalip} );
|
||||||
|
$result .= $res . ' ' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = must_be_local( $c, $hos_datas{internalip} );
|
||||||
|
$result .= $res . ' ' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = mac_address_or_blank( $c, $hos_datas{macaddress} );
|
||||||
|
$result .= $res . ' ' unless $res eq 'OK';
|
||||||
|
|
||||||
|
#!#$result .= 'blocked';
|
||||||
|
|
||||||
|
if ( !$result ) {
|
||||||
|
$res = create_modify_hostentry( $c, $trt, %hos_datas );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !$result ) {
|
||||||
|
$result = $c->l('hos_MODIFY_SUCCEEDED') . ' ' . $hostname;
|
||||||
|
$trt = 'SUC';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt =~ /^.RM$/ ) {
|
||||||
|
|
||||||
|
# controls
|
||||||
|
my $res = '';
|
||||||
|
$res = ip_number_or_blank( $c, $hos_datas{externalip} );
|
||||||
|
$result .= $res . '<br>' unless $res eq 'OK';
|
||||||
|
|
||||||
|
#!#$result .= 'blocked';
|
||||||
|
|
||||||
|
if ( !$result ) {
|
||||||
|
$res = create_modify_hostentry( $c, $trt, %hos_datas );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !$result ) {
|
||||||
|
$result = $c->l('hos_MODIFY_SUCCEEDED') . ' ' . $hostname;
|
||||||
|
$trt = 'SUC';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#if ( $trt eq 'ULC' ) {
|
||||||
|
#}
|
||||||
|
|
||||||
|
#if ( $trt eq 'URM' ) {
|
||||||
|
#}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
# controls
|
||||||
|
my $res = '';
|
||||||
|
|
||||||
|
#$res = validate_is_hostentry($c, $hostname);
|
||||||
|
#$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
#!#$result .= 'blocked';
|
||||||
|
|
||||||
|
if ( !$result ) {
|
||||||
|
my $res = delete_hostentry( $c, $hos_datas{hostname} );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
if ( !$result ) {
|
||||||
|
$result = $c->l('hos_REMOVE_SUCCEEDED') . ' ' . $hostname;
|
||||||
|
$trt = 'SUC';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$hos_datas{'hostname'} = $hostname;
|
||||||
|
$hos_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $result, hos_datas => \%hos_datas );
|
||||||
|
|
||||||
|
if ( $hos_datas{trt} ne 'SUC' ) {
|
||||||
|
return $c->render( template => 'hostentries' );
|
||||||
|
}
|
||||||
|
$c->redirect_to('/hostentries');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub create_modify_hostentry {
|
||||||
|
|
||||||
|
my ( $c, $trt, %hos_datas ) = @_;
|
||||||
|
|
||||||
|
my $hostname = $hos_datas{hostname};
|
||||||
|
my $action;
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' or $trt eq 'ALC' or $trt eq 'ARM' ) {
|
||||||
|
$action = 'create';
|
||||||
|
}
|
||||||
|
if ( $trt eq 'UPD' or $trt eq 'ULC' or $trt eq 'URM' ) {
|
||||||
|
$action = 'modify';
|
||||||
|
}
|
||||||
|
|
||||||
|
unless ($hostname) {
|
||||||
|
return $c->l(
|
||||||
|
$action eq 'create'
|
||||||
|
? $c->l('hos_ERROR_CREATING_HOST')
|
||||||
|
: $c->l('hos_ERROR_MODIFYING_HOST')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Untaint and lowercase $hostname
|
||||||
|
$hostname =~ /([\w\.-]+)/;
|
||||||
|
$hostname = lc($1);
|
||||||
|
|
||||||
|
my $rec = $hdb->get($hostname);
|
||||||
|
if ( $rec and $action eq 'create' ) {
|
||||||
|
return $c->l('hos_HOSTNAME_IN_USE_ERROR');
|
||||||
|
}
|
||||||
|
if ( not $rec and $action eq 'modify' ) {
|
||||||
|
return $c->l('hos_NONEXISTENT_HOSTNAME_ERROR');
|
||||||
|
}
|
||||||
|
|
||||||
|
my %props = (
|
||||||
|
type => 'host',
|
||||||
|
HostType => $hos_datas{hosttype},
|
||||||
|
ExternalIP => $hos_datas{externalip},
|
||||||
|
InternalIP => $hos_datas{internalip},
|
||||||
|
MACAddress => $hos_datas{macaddress},
|
||||||
|
Comment => $hos_datas{comment},
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( $action eq 'create' ) {
|
||||||
|
if ( $hdb->new_record( $hostname, \%props ) ) {
|
||||||
|
if (
|
||||||
|
system( "/sbin/e-smith/signal-event", "host-$action",
|
||||||
|
$hostname ) != 0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return $c->l('hos_ERROR_WHILE_CREATING_HOST');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $action eq 'modify' ) {
|
||||||
|
if ( $rec->merge_props(%props) ) {
|
||||||
|
if (
|
||||||
|
system( "/sbin/e-smith/signal-event", "host-$action",
|
||||||
|
$hostname ) != 0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
rturn $c->l('hos_ERROR_WHILE_MODIFYING_HOST');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 'OK';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub delete_hostentry {
|
||||||
|
|
||||||
|
my ( $c, $hostname ) = @_;
|
||||||
|
|
||||||
|
# Untaint $hostname before use in system()
|
||||||
|
$hostname =~ /([\w\.-]+)/;
|
||||||
|
$hostname = $1;
|
||||||
|
|
||||||
|
return ( $c->l('hos_ERROR_WHILE_REMOVING_HOST') ) unless ($hostname);
|
||||||
|
|
||||||
|
my $rec = $hdb->get($hostname);
|
||||||
|
return ( $c->l('hos_NONEXISTENT_HOST_ERROR') ) if ( not $rec );
|
||||||
|
|
||||||
|
if ( $rec->delete() ) {
|
||||||
|
if (
|
||||||
|
system( "/sbin/e-smith/signal-event", "host-delete", "$hostname" )
|
||||||
|
== 0 )
|
||||||
|
{
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ( $c->l('hos_ERROR_WHILE_DELETING_HOST') );
|
||||||
|
}
|
||||||
|
|
||||||
|
sub domains_list {
|
||||||
|
|
||||||
|
my $d = esmith::DomainsDB->open_ro() or die "Couldn't open DomainsDB";
|
||||||
|
my @domains;
|
||||||
|
for ( $d->domains ) {
|
||||||
|
my $ns = $_->prop("Nameservers") || 'localhost';
|
||||||
|
push @domains, $_->key if ( $ns eq 'localhost' );
|
||||||
|
}
|
||||||
|
|
||||||
|
return \@domains;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub host_data {
|
||||||
|
|
||||||
|
my $host_record = shift;
|
||||||
|
|
||||||
|
my $ht = $host_record->prop('HostType');
|
||||||
|
my $ip =
|
||||||
|
( $ht eq 'Self' ) ? $cdb->get_value('LocalIP')
|
||||||
|
: ( $ht eq 'Remote' ) ? $host_record->prop('ExternalIP')
|
||||||
|
: $host_record->prop('InternalIP');
|
||||||
|
|
||||||
|
my %data = (
|
||||||
|
'IP' => $ip,
|
||||||
|
'HostName' => $host_record->key(),
|
||||||
|
'HostType' => $host_record->prop('HostType'),
|
||||||
|
'MACAddress' => ( $host_record->prop('MACAddress') || '' ),
|
||||||
|
'Comment' => ( $host_record->prop('Comment') || '' ),
|
||||||
|
'static' => ( $host_record->prop('static') || 'no' )
|
||||||
|
);
|
||||||
|
return \%data
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub hosttype_list {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
return [
|
||||||
|
[ $c->l('SELF') => 'Self' ],
|
||||||
|
[ $c->l('LOCAL') => 'Local' ],
|
||||||
|
[ $c->l('REMOTE') => 'Remote' ]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub split_hostname {
|
||||||
|
my $hostname = shift;
|
||||||
|
return ( $hostname =~ /^([^\.]+)\.(.+)$/ );
|
||||||
|
}
|
||||||
|
|
||||||
|
sub mac_address_or_blank {
|
||||||
|
my ( $c, $data ) = @_;
|
||||||
|
return "OK" unless $data;
|
||||||
|
return mac_address( $c, $data );
|
||||||
|
}
|
||||||
|
|
||||||
|
sub mac_address {
|
||||||
|
|
||||||
|
# from CGI::FormMagick::Validator::Network
|
||||||
|
|
||||||
|
my ( $c, $data ) = @_;
|
||||||
|
|
||||||
|
$_ = lc $data; # easier to match on $_
|
||||||
|
if ( not defined $_ ) {
|
||||||
|
return $c->l('FM_MAC_ADDRESS1');
|
||||||
|
}
|
||||||
|
elsif (/^([0-9a-f][0-9a-f](:[0-9a-f][0-9a-f]){5})$/) {
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $c->l('FM_MAC_ADDRESS2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub ip_number_or_blank {
|
||||||
|
|
||||||
|
# XXX - FIXME - we should push this down into CGI::FormMagick
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $ip = shift;
|
||||||
|
|
||||||
|
if ( !defined($ip) || $ip eq "" ) {
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
return ip_number( $c, $ip );
|
||||||
|
}
|
||||||
|
|
||||||
|
sub ip_number {
|
||||||
|
|
||||||
|
# from CGI::FormMagick::Validator qw( ip_number );
|
||||||
|
|
||||||
|
my ( $c, $data ) = @_;
|
||||||
|
|
||||||
|
return undef unless defined $data;
|
||||||
|
|
||||||
|
return $c->l('FM_IP_NUMBER1') unless $data =~ /^[\d.]+$/;
|
||||||
|
|
||||||
|
my @octets = split /\./, $data;
|
||||||
|
my $dots = ( $data =~ tr/.// );
|
||||||
|
|
||||||
|
return $c->l('FM_IP_NUMBER2') unless ( scalar @octets == 4 and $dots == 3 );
|
||||||
|
|
||||||
|
foreach my $octet (@octets) {
|
||||||
|
return $c->l( "FM_IP_NUMBER3", $octet ) if $octet > 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
sub not_in_dhcp_range {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $address = shift;
|
||||||
|
|
||||||
|
my $status = $cdb->get('dhcpd')->prop('status') || "disabled";
|
||||||
|
return 'OK' unless $status eq "enabled";
|
||||||
|
|
||||||
|
my $start = $cdb->get('dhcpd')->prop('start');
|
||||||
|
my $end = $cdb->get('dhcpd')->prop('end');
|
||||||
|
|
||||||
|
return ( esmith::util::IPquadToAddr($start) <=
|
||||||
|
esmith::util::IPquadToAddr($address)
|
||||||
|
&& esmith::util::IPquadToAddr($address) <=
|
||||||
|
esmith::util::IPquadToAddr($end) )
|
||||||
|
? $c->l('hos_ADDR_IN_DHCP_RANGE')
|
||||||
|
: 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
sub not_taken {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $localip = shift;
|
||||||
|
|
||||||
|
my $server_localip = $cdb->get_value('LocalIP') || '';
|
||||||
|
my $server_gateway = $cdb->get_value('GatewayIP') || '';
|
||||||
|
my $server_extip = $cdb->get_value('ExternalIP') || '';
|
||||||
|
|
||||||
|
#$c->debug_msg("\$localip is $localip");
|
||||||
|
#$c->debug_msg("\$server_localip is $server_localip");
|
||||||
|
#$c->debug_msg("\$server_gateway is $server_gateway");
|
||||||
|
#$c->debug_msg("\$server_extip is $server_extip");
|
||||||
|
|
||||||
|
if ( $localip eq $server_localip ) {
|
||||||
|
return $c->l('hos_ERR_IP_IS_LOCAL_OR_GATEWAY');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $localip eq $server_gateway ) {
|
||||||
|
return $c->l('hos_ERR_IP_IS_LOCAL_OR_GATEWAY');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ( $cdb->get_value('SystemMode') ne 'serveronly' )
|
||||||
|
&& ( $server_extip eq $localip ) )
|
||||||
|
{
|
||||||
|
return $c->l('hos_ERR_IP_IS_LOCAL_OR_GATEWAY');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $localip eq '127.0.0.1' ) {
|
||||||
|
return $c->l('hos_ERR_IP_IS_LOCAL_OR_GATEWAY');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub must_be_local {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $localip = shift;
|
||||||
|
|
||||||
|
# Make sure that the IP is indeed local.
|
||||||
|
#my $ndb = esmith::NetworksDB->open_ro;
|
||||||
|
my @local_list = $ndb->local_access_spec;
|
||||||
|
|
||||||
|
foreach my $spec (@local_list) {
|
||||||
|
next if $spec eq '127.0.0.1';
|
||||||
|
if ( eval { Net::IPv4Addr::ipv4_in_network( $spec, $localip ) } ) {
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Not OK. The IP is not on any of our local networks.
|
||||||
|
return $c->l('hos_ERR_IP_NOT_LOCAL');
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
577
root/usr/share/smanager/lib/SrvMngr/Controller/Ibays.pm
Normal file
577
root/usr/share/smanager/lib/SrvMngr/Controller/Ibays.pm
Normal file
@ -0,0 +1,577 @@
|
|||||||
|
package SrvMngr::Controller::Ibays;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Network
|
||||||
|
# description : Shared areas (was ibays)
|
||||||
|
# navigation : 6000 100
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw( theme_list init_session is_normal_password );
|
||||||
|
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
use esmith::DomainsDB;
|
||||||
|
|
||||||
|
#use esmith::FormMagick::Panel::ibays;
|
||||||
|
|
||||||
|
our $adb = esmith::AccountsDB->open || die "Couldn't open accounts db";
|
||||||
|
our $cdb = esmith::ConfigDB->open() || die "Couldn't open config db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %iba_datas = ();
|
||||||
|
my $title = $c->l('iba_FORM_TITLE');
|
||||||
|
|
||||||
|
$iba_datas{'trt'} = 'LIST';
|
||||||
|
|
||||||
|
my @ibays;
|
||||||
|
if ($adb)
|
||||||
|
{
|
||||||
|
@ibays = $adb->ibays();
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, iba_datas => \%iba_datas, ibays => \@ibays );
|
||||||
|
$c->render(template => 'ibays');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'LIST');
|
||||||
|
my $ibay = $c->param('ibay') || '';
|
||||||
|
|
||||||
|
#$trt = 'DEL' if ( $ibay );
|
||||||
|
#$trt = 'ADD' if ( $rt eq 'ibayadd' );
|
||||||
|
|
||||||
|
my %iba_datas = ();
|
||||||
|
my $title = $c->l('iba_FORM_TITLE');
|
||||||
|
my $modul = '';
|
||||||
|
|
||||||
|
$iba_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
|
||||||
|
$iba_datas{ibay} = '';
|
||||||
|
$iba_datas{description} = '';
|
||||||
|
$iba_datas{group} = '';
|
||||||
|
$iba_datas{userAccess} = '';
|
||||||
|
$iba_datas{publicAccess} = '';
|
||||||
|
$iba_datas{CgiBin} = '';
|
||||||
|
$iba_datas{SSL} = '';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' ) {
|
||||||
|
|
||||||
|
my $rec = $adb->get($ibay);
|
||||||
|
if ($rec and $rec->prop('type') eq 'ibay') {
|
||||||
|
$iba_datas{ibay} = $ibay;
|
||||||
|
$iba_datas{description} = $rec->prop('Name') || '';
|
||||||
|
$iba_datas{group} = $rec->prop('Group') || '';
|
||||||
|
$iba_datas{userAccess} = $rec->prop('UserAccess') || '';
|
||||||
|
$iba_datas{publicAccess} = $rec->prop('PublicAccess') || '';
|
||||||
|
$iba_datas{CgiBin} = $rec->prop('CgiBin') || 'disabled';
|
||||||
|
$iba_datas{SSL} = $rec->prop('SSL') || 'disabled';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
my $rec = $adb->get($ibay);
|
||||||
|
if ($rec and $rec->prop('type') eq 'ibay') {
|
||||||
|
$iba_datas{ibay} = $ibay;
|
||||||
|
$iba_datas{description} = $rec->prop('Name') || '';
|
||||||
|
$modul .= print_vhost_message( $c, $ibay );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'PWD' ) {
|
||||||
|
|
||||||
|
my $rec = $adb->get($ibay);
|
||||||
|
if ($rec and $rec->prop('type') eq 'ibay') {
|
||||||
|
$iba_datas{ibay} = $ibay;
|
||||||
|
$iba_datas{description} = $rec->prop('Name') || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'LIST' ) {
|
||||||
|
my @ibays;
|
||||||
|
$adb = esmith::AccountsDB->open || die "Couldn't open accounts db";
|
||||||
|
if ($adb)
|
||||||
|
{
|
||||||
|
@ibays = $adb->ibays();
|
||||||
|
}
|
||||||
|
$c->stash( ibays => \@ibays );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $modul, iba_datas => \%iba_datas );
|
||||||
|
$c->render( template => 'ibays' );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'LIST');
|
||||||
|
|
||||||
|
my %iba_datas = ();
|
||||||
|
my $title = $c->l('iba_FORM_TITLE');
|
||||||
|
|
||||||
|
$iba_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
my $result = '';
|
||||||
|
my $res;
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
|
||||||
|
my $name = ($c->param('ibay') || '');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
$res = validate_ibay( $c, $name );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = create_ibay( $c, $name );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('iba_SUCCESSFULLY_CREATED_IBAY') . ' ' . $name;
|
||||||
|
$iba_datas{trt} = 'LST';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' ) {
|
||||||
|
|
||||||
|
my $name = ($c->param('ibay') || '');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
$res = '';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = modify_ibay( $c, $name );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('iba_SUCCESSFULLY_MODIFIED_IBAY') . ' ' . $name;
|
||||||
|
$iba_datas{trt} = 'LST';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'PWD' ) {
|
||||||
|
|
||||||
|
my $ibay = ($c->param('ibay') || '');
|
||||||
|
my $pass1 = ($c->param('newPass') || '');
|
||||||
|
my $pass2 = ($c->param('newPassVerify') || '');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
unless ($pass1 eq $pass2) {
|
||||||
|
$result .= $c->l('iba_IBAY_PASSWD_VERIFY_ERROR') . ' - ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = check_password( $c, $pass1 );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = reset_password( $c, $ibay, $pass1 );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('iba_SUCCESSFULLY_RESET_PASSWORD') . ' ' . $ibay;
|
||||||
|
$iba_datas{trt} = 'LST';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
my $ibay = $c->param ('ibay');
|
||||||
|
|
||||||
|
if ($ibay =~ /^([a-z][a-z0-9]*)$/) {
|
||||||
|
$ibay = $1;
|
||||||
|
} else {
|
||||||
|
$result .= $c->l('iba_ERR_INTERNAL_FAILURE') . ':' . $ibay;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = remove_ibay( $c, $ibay );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('iba_SUCCESSFULLY_DELETED_IBAY') . ' ' . $ibay;
|
||||||
|
$iba_datas{trt} = 'LST';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# common parts
|
||||||
|
|
||||||
|
if ($res ne 'OK') {
|
||||||
|
$c->stash( error => $result );
|
||||||
|
$c->stash( title => $title, iba_datas => \%iba_datas );
|
||||||
|
return $c->render('ibays');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $message = "'Ibays' updates ($trt) DONE";
|
||||||
|
$c->app->log->info($message);
|
||||||
|
$c->flash( success => $result );
|
||||||
|
|
||||||
|
$c->redirect_to('/ibays');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_ibay {
|
||||||
|
|
||||||
|
my ($c, $name) = @_;
|
||||||
|
|
||||||
|
my $msg = validate_name($c, $name);
|
||||||
|
unless ($msg eq "OK")
|
||||||
|
{
|
||||||
|
return ($msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
$msg = max_ibay_name_length($c, $name);
|
||||||
|
unless ($msg eq "OK")
|
||||||
|
{
|
||||||
|
return ($msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
$msg = conflict_check($c, $name);
|
||||||
|
unless ($msg eq "OK")
|
||||||
|
{
|
||||||
|
return ($msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ('OK');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub create_ibay {
|
||||||
|
|
||||||
|
my ($c, $name) = @_;
|
||||||
|
|
||||||
|
my $msg;
|
||||||
|
my $uid = $adb->get_next_uid();
|
||||||
|
if (my $acct = $adb->new_record($name, {
|
||||||
|
Name => $c->param('ibayDesc'),
|
||||||
|
CgiBin => $c->param('CgiBin'),
|
||||||
|
Group => $c->param('group'),
|
||||||
|
PublicAccess => $c->param('publicAccess'),
|
||||||
|
SSL => $c->param('SSL'),
|
||||||
|
UserAccess => $c->param('userAccess'),
|
||||||
|
Uid => $uid,
|
||||||
|
Gid => $uid,
|
||||||
|
PasswordSet => 'no',
|
||||||
|
type => 'ibay',
|
||||||
|
}) )
|
||||||
|
{
|
||||||
|
# Untaint $name before use in system()
|
||||||
|
$name =~ /(.+)/; $name = $1;
|
||||||
|
if (system ("/sbin/e-smith/signal-event", "ibay-create", $name) == 0) {
|
||||||
|
$msg = 'OK';
|
||||||
|
} else {
|
||||||
|
$msg = $c->l('iba_ERROR_WHILE_CREATING_IBAY');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$msg = $c->l('iba_CANT_CREATE_IBAY');
|
||||||
|
}
|
||||||
|
return $msg;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub modify_ibay {
|
||||||
|
my ($c, $name) = @_;
|
||||||
|
|
||||||
|
my $msg;
|
||||||
|
if (my $acct = $adb->get($name)) {
|
||||||
|
if ($acct->prop('type') eq 'ibay') {
|
||||||
|
$acct->merge_props(
|
||||||
|
Name => $c->param('ibayDesc'),
|
||||||
|
CgiBin => $c->param('CgiBin'),
|
||||||
|
Group => $c->param('group'),
|
||||||
|
PublicAccess => $c->param('publicAccess'),
|
||||||
|
SSL => $c->param('SSL'),
|
||||||
|
UserAccess => $c->param('userAccess'),
|
||||||
|
);
|
||||||
|
|
||||||
|
# Untaint $name before use in system()
|
||||||
|
$name =~ /(.+)/; $name = $1;
|
||||||
|
if (system ("/sbin/e-smith/signal-event", "ibay-modify",
|
||||||
|
$name) == 0)
|
||||||
|
{
|
||||||
|
$msg = 'OK';
|
||||||
|
} else {
|
||||||
|
$msg = $c->l('iba_ERROR_WHILE_MODIFYING_IBAY');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$msg = $c->l('iba_CANT_FIND_IBAY');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$msg = $c->l('iba_CANT_FIND_IBAY');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $msg;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub print_vhost_message {
|
||||||
|
my $c = shift;
|
||||||
|
my $name = $c->param('ibay');
|
||||||
|
|
||||||
|
my $result = '';
|
||||||
|
|
||||||
|
my $domaindb = esmith::DomainsDB->open();
|
||||||
|
my @domains = $domaindb->get_all_by_prop(Content => $name);
|
||||||
|
my $vhostListItems = join "\n",
|
||||||
|
(map ($_->key." ".$_->prop('Description'), @domains));
|
||||||
|
if ($vhostListItems)
|
||||||
|
{
|
||||||
|
$result = $c->l('iba_VHOST_MESSAGE') . "<br><ul>";
|
||||||
|
foreach ( $vhostListItems ) {
|
||||||
|
$result .= "<li> $_ </li>";
|
||||||
|
}
|
||||||
|
$result .= '</ul>'
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub remove_ibay {
|
||||||
|
my ($c, $name) = @_;
|
||||||
|
|
||||||
|
my $msg = '';
|
||||||
|
if (my $acct = $adb->get($name)) {
|
||||||
|
if ($acct->prop('type') eq 'ibay') {
|
||||||
|
$acct->set_prop('type', 'ibay-deleted');
|
||||||
|
|
||||||
|
my $domains_db = esmith::DomainsDB->open();
|
||||||
|
my @domains = $domains_db->get_all_by_prop(Content=>$name);
|
||||||
|
foreach my $d (@domains) {
|
||||||
|
$d->set_prop(Content => 'Primary');
|
||||||
|
}
|
||||||
|
|
||||||
|
# Untaint $name before use in system()
|
||||||
|
$name =~ /(.+)/; $name = $1;
|
||||||
|
if (system ("/sbin/e-smith/signal-event", "ibay-delete",
|
||||||
|
$name) == 0)
|
||||||
|
{
|
||||||
|
$msg = 'OK';
|
||||||
|
$acct->delete();
|
||||||
|
} else {
|
||||||
|
$msg = $c->l('iba_ERROR_WHILE_DELETING_IBAY');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$msg = $c->l('iba_CANT_FIND_IBAY');
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$msg = $c->l('iba_CANT_FIND_IBAY');
|
||||||
|
}
|
||||||
|
return $msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub reset_password {
|
||||||
|
my ($c, $name, $newPass) = @_;
|
||||||
|
|
||||||
|
my ($msg, $acct);
|
||||||
|
|
||||||
|
if (($acct = $adb->get($name)) && ($acct->prop('type') eq 'ibay')) {
|
||||||
|
esmith::util::setIbayPassword ($acct->key, $newPass);
|
||||||
|
$acct->set_prop('PasswordSet', 'yes');
|
||||||
|
# Untaint $name before use in system()
|
||||||
|
$name =~ /(.+)/; $name = $1;
|
||||||
|
if (system ("/sbin/e-smith/signal-event", "password-modify",
|
||||||
|
$name) == 0)
|
||||||
|
{
|
||||||
|
$msg = 'OK';
|
||||||
|
} else {
|
||||||
|
$msg = $c->l('iba_ERROR_WHILE_RESETTING_PASSWORD');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$msg = $c->l('iba_CANT_FIND_IBAY');
|
||||||
|
}
|
||||||
|
return $msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub check_password {
|
||||||
|
my ($c, $password) = @_;
|
||||||
|
|
||||||
|
my $strength;
|
||||||
|
|
||||||
|
my $rec = $cdb->get('passwordstrength');
|
||||||
|
$strength = ($rec ? ($rec->prop('Ibays') || 'none') : 'none');
|
||||||
|
|
||||||
|
return validate_password( $c, $strength, $password );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_password {
|
||||||
|
|
||||||
|
my ($c, $strength, $pass) = @_;
|
||||||
|
|
||||||
|
use Crypt::Cracklib;
|
||||||
|
|
||||||
|
my $reason;
|
||||||
|
|
||||||
|
if ($strength eq "none") {
|
||||||
|
return $c->l("Passwords must be at least 7 characters long") unless (length($pass) > 6);
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
$reason = is_normal_password($c, $pass, undef);
|
||||||
|
return $reason unless ($reason eq "OK");
|
||||||
|
return "OK" unless ($strength eq "strong");
|
||||||
|
|
||||||
|
if ( -f '/usr/lib64/cracklib_dict.pwd' ) {
|
||||||
|
$reason = fascist_check($pass, '/usr/lib64/cracklib_dict');
|
||||||
|
} else {
|
||||||
|
$reason = fascist_check($pass, '/usr/lib/cracklib_dict');
|
||||||
|
}
|
||||||
|
$reason ||= "Software error: password check failed";
|
||||||
|
|
||||||
|
return "OK" if ($reason eq "ok");
|
||||||
|
|
||||||
|
return $c->l("Bad Password Choice") . ": "
|
||||||
|
. $c->l("The password you have chosen is not a good choice, because")
|
||||||
|
. " " . $c->($reason) . ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head2 group_list()
|
||||||
|
|
||||||
|
Returns a hash of groups for the Create/Modify screen's group field's
|
||||||
|
drop down list.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub group_list_m {
|
||||||
|
|
||||||
|
my @groups = $adb->groups();
|
||||||
|
|
||||||
|
my @grps = ( ['Admin' => 'admin'], ['Everyone' => 'shared']);
|
||||||
|
|
||||||
|
foreach my $g (@groups) {
|
||||||
|
push @grps, [ $g->prop('Description')." (". $g->key.")", $g->key() ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return \@grps;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head2 userAccess_list
|
||||||
|
|
||||||
|
Returns the hash of user access settings for showing in the user access
|
||||||
|
drop down list.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub userAccess_list_m {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
return [[ $c->l('WARG') => 'wr-admin-rd-group'],
|
||||||
|
[ $c->l('WGRE') => 'wr-group-rd-everyone'],
|
||||||
|
[ $c->l('WGRG') => 'wr-group-rd-group']];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
=head2 publicAccess_list
|
||||||
|
|
||||||
|
Returns the hash of public access settings for showing in the public
|
||||||
|
access drop down list.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub publicAccess_list_m {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
return [[ $c->l('NONE') => 'none'],
|
||||||
|
[ $c->l('LOCAL_NETWORK_NO_PASSWORD') => 'local'],
|
||||||
|
[ $c->l('LOCAL_NETWORK_PASSWORD') => 'local-pw'],
|
||||||
|
[ $c->l('ENTIRE_INTERNET_NO_PASSWORD') => 'global'],
|
||||||
|
[ $c->l('ENTIRE_INTERNET_PASSWORD') => 'global-pw'],
|
||||||
|
[ $c->l('ENTIRE_INTERNET_PASSWORD_REMOTE') => 'global-pw-remote']];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub max_ibay_name_length {
|
||||||
|
|
||||||
|
my ($c, $data) = @_;
|
||||||
|
$cdb->reload();
|
||||||
|
my $max = $cdb->get('maxIbayNameLength')->value;
|
||||||
|
|
||||||
|
if (length($data) <= $max) {
|
||||||
|
return "OK";
|
||||||
|
} else {
|
||||||
|
return $c->l('iba_MAX_IBAY_NAME_LENGTH_ERROR', $data, $max, $max);
|
||||||
|
# {acctName => $data,
|
||||||
|
# maxIbayNameLength => $max,
|
||||||
|
# maxLength => $max});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub conflict_check {
|
||||||
|
|
||||||
|
my ($c, $name) = @_;
|
||||||
|
my $rec = $adb->get($name);
|
||||||
|
|
||||||
|
my $type;
|
||||||
|
if (defined $rec)
|
||||||
|
{
|
||||||
|
my $type = $rec->prop('type');
|
||||||
|
if ($type eq "pseudonym")
|
||||||
|
{
|
||||||
|
my $acct = $rec->prop("Account");
|
||||||
|
my $acct_type = $adb->get($acct)->prop('type');
|
||||||
|
|
||||||
|
return $c->l('iba_ACCT_CLASHES_WITH_PSEUDONYM', $name, $acct_type, $acct);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif (defined getpwnam($name) || defined getgrnam($name))
|
||||||
|
{
|
||||||
|
$type = 'system';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# No account record and no account
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
return $c->l('iba_ACCOUNT_EXISTS', $name, $type);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub validate_name {
|
||||||
|
|
||||||
|
my ($c, $acctName) = @_;
|
||||||
|
|
||||||
|
unless ($acctName =~ /^([a-z][\_\.\-a-z0-9]*)$/)
|
||||||
|
{
|
||||||
|
return $c->l('iba_ACCT_NAME_HAS_INVALID_CHARS', $acctName);
|
||||||
|
}
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1
|
37
root/usr/share/smanager/lib/SrvMngr/Controller/Initial.pm
Normal file
37
root/usr/share/smanager/lib/SrvMngr/Controller/Initial.pm
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package SrvMngr::Controller::Initial;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Support
|
||||||
|
# description : Home
|
||||||
|
# navigation : 0000 000
|
||||||
|
# menu : N
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
#use SrvMngr::Model::Main;
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('initial_FORM_TITLE');
|
||||||
|
my $modul = $c->render_to_string(inline => $c->l('initial_FRAMES_BODY'));
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $modul );
|
||||||
|
|
||||||
|
$c->render(template => 'initial');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
@ -0,0 +1,41 @@
|
|||||||
|
package SrvMngr::Controller::Legacypanel;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# name : legacypanel, method : get, url : /legacypanel, ctlact : Legacypanel#main
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
#use SrvMngr::Model::Main;
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('legacy panel');
|
||||||
|
my $legacy_url = $c->param('url');
|
||||||
|
my $legacy_height = $c->param('height') | 600;
|
||||||
|
$c->stash( title => $title, modul => $legacy_url, height => $legacy_height );
|
||||||
|
$c->render(template => 'embedded');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub getlegacyurl {
|
||||||
|
my $c = shift;
|
||||||
|
my $url = shift;
|
||||||
|
return "/smanager/legacypanel?url=$url";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
291
root/usr/share/smanager/lib/SrvMngr/Controller/Localnetworks.pm
Normal file
291
root/usr/share/smanager/lib/SrvMngr/Controller/Localnetworks.pm
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
package SrvMngr::Controller::Localnetworks;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Network
|
||||||
|
# description : Local networks
|
||||||
|
# navigation : 6000 500
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session subnet_mask get_reg_mask ip_number);
|
||||||
|
|
||||||
|
#use Data::Dumper;
|
||||||
|
use esmith::util;
|
||||||
|
use esmith::HostsDB;
|
||||||
|
|
||||||
|
my $network_db = esmith::NetworksDB->open() || die("Couldn't open networks db");
|
||||||
|
my $ret = "OK";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info( $c->log_req );
|
||||||
|
|
||||||
|
my %ln_datas = ();
|
||||||
|
$ln_datas{return} = "";
|
||||||
|
my $title = $c->l('ln_LOCAL NETWORKS');
|
||||||
|
my $modul = '';
|
||||||
|
|
||||||
|
$ln_datas{trt} = 'LIST';
|
||||||
|
|
||||||
|
my @localnetworks;
|
||||||
|
if ($network_db) {
|
||||||
|
@localnetworks = $network_db->get_all_by_prop( type => 'network' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash(
|
||||||
|
title => $title,
|
||||||
|
modul => $modul,
|
||||||
|
ln_datas => \%ln_datas,
|
||||||
|
localnetworks => \@localnetworks
|
||||||
|
);
|
||||||
|
$c->render( template => 'localnetworks' );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info( $c->log_req );
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ( $c->param('trt') || 'LIST' );
|
||||||
|
|
||||||
|
$trt = 'DEL' if ( $rt eq 'localnetworksdel' );
|
||||||
|
$trt = 'ADD' if ( $rt eq 'localnetworksadd' );
|
||||||
|
$trt = 'ADD1' if ( $rt eq 'localnetworksadd1' );
|
||||||
|
$trt = 'DEL1' if ( $rt eq 'localnetworksdel1' );
|
||||||
|
|
||||||
|
my %ln_datas = ();
|
||||||
|
my $title = $c->l('ln_LOCAL NETWORKS');
|
||||||
|
my $modul = '';
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
#Add a network - called from the list panel
|
||||||
|
# Nothing to do here...as just need fields to input data.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD1' ) {
|
||||||
|
#Add a network - called after new network details filled in
|
||||||
|
my %ret = add_network($c);
|
||||||
|
#Return to list page if success
|
||||||
|
if ((index($ret{ret},"SUCCESS") != -1)) {
|
||||||
|
$trt = "LIST";
|
||||||
|
} else {
|
||||||
|
#Error - return to Add page
|
||||||
|
$trt = "ADD";
|
||||||
|
}
|
||||||
|
$network_db = esmith::NetworksDB->open() || die("Failed to open Networkdb-3"); #Refresh the network DB
|
||||||
|
$c->stash(ret=>\%ret); #stash it away for the template
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL1' ) {
|
||||||
|
#After Remove clicked on Delete network panel
|
||||||
|
my $network_db = esmith::NetworksDB->open() || die("Failed to open Networkdb-1");
|
||||||
|
my $localnetwork = $c->param("localnetwork");
|
||||||
|
my $delete_hosts = $c->param("deletehost")||"1"; #default to deleting them.
|
||||||
|
my $rec = $network_db->get($localnetwork)||die("Failed to find network on db:$localnetwork");
|
||||||
|
if ( $rec and $rec->prop('type') eq 'localnetwork' ) {
|
||||||
|
$ln_datas{localnetwork} = $localnetwork;
|
||||||
|
}
|
||||||
|
my %ret = remove_network($localnetwork,$delete_hosts);
|
||||||
|
|
||||||
|
$network_db = esmith::NetworksDB->open() || die("Failed to open Networkdb-2"); #Refresh the network DB
|
||||||
|
my @localnetworks;
|
||||||
|
if ($network_db) {
|
||||||
|
@localnetworks = $network_db->get_all_by_prop( type => 'network' );
|
||||||
|
}
|
||||||
|
# Load up ln_datas with values need by template
|
||||||
|
$ln_datas{subnet} = $rec->prop('Mask');
|
||||||
|
$ln_datas{router} = $rec->prop('Router');
|
||||||
|
$c->stash( ln_datas => \%ln_datas, localnetworks => \@localnetworks ,ret =>\%ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
#Initial delete panel requiring confirmation
|
||||||
|
my $localnetwork = $c->param("localnetwork") || '';
|
||||||
|
$c->stash(localnetwork=>$localnetwork);
|
||||||
|
my $rec = $network_db->get($localnetwork) || die("Failed to get local network in db::$localnetwork");
|
||||||
|
my $subnet = $rec->prop('Mask');
|
||||||
|
$ln_datas{subnet} = $subnet;
|
||||||
|
$ln_datas{router} = $rec->prop('Router');
|
||||||
|
my $numhosts = hosts_on_network($localnetwork,$subnet);
|
||||||
|
$ln_datas{localnetwork} = $localnetwork;
|
||||||
|
$ln_datas{deletehosts} = $numhosts>0?1:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'LIST' ) {
|
||||||
|
#List all the networks
|
||||||
|
my @localnetworks;
|
||||||
|
if ($network_db) {
|
||||||
|
@localnetworks = $network_db->get_all_by_prop( type => 'network' );
|
||||||
|
}
|
||||||
|
$c->stash( localnetworks => \@localnetworks );
|
||||||
|
## $c->redirect_to('/localnetworks');
|
||||||
|
}
|
||||||
|
|
||||||
|
$ln_datas{'trt'} = $trt;
|
||||||
|
$c->stash( title => $title, modul => $modul, ln_datas => \%ln_datas );
|
||||||
|
$c->render( template => 'localnetworks' );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub remove_network {
|
||||||
|
my $network = shift;
|
||||||
|
my $network_db = esmith::NetworksDB->open();
|
||||||
|
my $record = $network_db->get($network);
|
||||||
|
my $delete_hosts = shift;
|
||||||
|
|
||||||
|
if ( my $record = $network_db->get($network) ) {
|
||||||
|
my $subnet = $record->prop('Mask');
|
||||||
|
my $router = $record->prop('Router');
|
||||||
|
$record->set_prop( type => 'network-deleted' );
|
||||||
|
|
||||||
|
# Untaint $network before use in system()
|
||||||
|
$network =~ /(.+)/;
|
||||||
|
$network = $1;
|
||||||
|
if ( system( "/sbin/e-smith/signal-event", "network-delete", $network ) == 0 ) {
|
||||||
|
if ($delete_hosts) {
|
||||||
|
my @hosts_to_delete = hosts_on_network( $network, $subnet );
|
||||||
|
foreach my $host (@hosts_to_delete) {
|
||||||
|
$host->delete;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$record->delete;
|
||||||
|
return (ret=>'ln_SUCCESS_REMOVED_NETWORK',vars=>"$network,$subnet,$router");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return (ret=>"ln_ERROR_DELETING_NETWORK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return (ret=>"ln_NO_SUCH_NETWORK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub hosts_on_network {
|
||||||
|
my $network = shift;
|
||||||
|
my $netmask = shift;
|
||||||
|
|
||||||
|
die if not $network and $netmask;
|
||||||
|
|
||||||
|
my $cidr = "$network/$netmask";
|
||||||
|
my $hosts = esmith::HostsDB->open() || die("Couldn't open hosts db");
|
||||||
|
my @localhosts = grep { $_->prop('HostType') eq 'Local' } $hosts->hosts;
|
||||||
|
my @hosts_on_network = ();
|
||||||
|
foreach my $host (@localhosts) {
|
||||||
|
my $ip = $host->prop('InternalIP') || "";
|
||||||
|
if ($ip) {
|
||||||
|
if ( Net::IPv4Addr::ipv4_in_network( $cidr, $ip ) ) {
|
||||||
|
push @hosts_on_network, $host;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return @hosts_on_network if wantarray;
|
||||||
|
return scalar @hosts_on_network;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub add_network
|
||||||
|
{
|
||||||
|
my ($fm) = @_;
|
||||||
|
my $networkAddress = $fm->param('networkAddress');
|
||||||
|
my $networkMask = $fm->param('networkMask');
|
||||||
|
my $networkRouter = $fm->param('networkRouter');
|
||||||
|
|
||||||
|
#Validate Ips and subnet mask
|
||||||
|
|
||||||
|
my $res = ip_number($fm, $networkAddress);
|
||||||
|
return (ret=>'ln_INVALID_IP_ADDRESS', vars=>"Network Address $res") unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = subnet_mask( $networkMask );
|
||||||
|
return (ret=>'ln_INVALID_SUBNET_MASK', vars=>"$networkMask" ) unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = ip_number($fm, $networkRouter);
|
||||||
|
return (ret=>'ln_INVALID_IP_ADDRESS' , vars=>"Routeur Address $res") unless $res eq 'OK';
|
||||||
|
|
||||||
|
# we transform bit mask to regular mask
|
||||||
|
$networkMask = get_reg_mask( $networkAddress, $networkMask );
|
||||||
|
|
||||||
|
my $network_db = esmith::NetworksDB->open()
|
||||||
|
|| esmith::NetworksDB->create();
|
||||||
|
my $config_db = esmith::ConfigDB->open();
|
||||||
|
|
||||||
|
my $localIP = $config_db->get('LocalIP');
|
||||||
|
my $localNetmask = $config_db->get('LocalNetmask');
|
||||||
|
|
||||||
|
my ( $localNetwork, $localBroadcast ) =
|
||||||
|
esmith::util::computeNetworkAndBroadcast( $localIP->value(),
|
||||||
|
$localNetmask->value() );
|
||||||
|
|
||||||
|
my ( $routerNetwork, $routerBroadcast ) =
|
||||||
|
esmith::util::computeNetworkAndBroadcast( $networkRouter,
|
||||||
|
$localNetmask->value() );
|
||||||
|
|
||||||
|
# Note to self or future developers:
|
||||||
|
# the following tests should probably be validation routines
|
||||||
|
# in the form itself, but it just seemed too fiddly to do that
|
||||||
|
# at the moment. -- Skud 2002-04-11
|
||||||
|
# I agree --bjr 2020-04-18
|
||||||
|
|
||||||
|
|
||||||
|
if ( $routerNetwork ne $localNetwork )
|
||||||
|
{
|
||||||
|
return (ret=>'ln_NOT_ACCESSIBLE_FROM_LOCAL_NETWORK');
|
||||||
|
}
|
||||||
|
|
||||||
|
my ( $network, $broadcast ) =
|
||||||
|
esmith::util::computeNetworkAndBroadcast( $networkAddress, $networkMask );
|
||||||
|
|
||||||
|
if ( $network eq $localNetwork )
|
||||||
|
{
|
||||||
|
return (ret=>'ln_NETWORK_ALREADY_LOCAL');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $network_db->get($network) )
|
||||||
|
{
|
||||||
|
return (ret=>'ln_NETWORK_ALREADY_ADDED');
|
||||||
|
}
|
||||||
|
|
||||||
|
$network_db->new_record(
|
||||||
|
$network,
|
||||||
|
{
|
||||||
|
Mask => $networkMask,
|
||||||
|
Router => $networkRouter,
|
||||||
|
type => 'network',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
# Untaint $network before use in system()
|
||||||
|
$network =~ /(.+)/;
|
||||||
|
$network = $1;
|
||||||
|
system( "/sbin/e-smith/signal-event", "network-create", $network ) == 0
|
||||||
|
or ( return (ret=>'ln_ERROR_CREATING_NETWORK' ));
|
||||||
|
|
||||||
|
my ( $totalHosts, $firstAddr, $lastAddr ) =
|
||||||
|
esmith::util::computeHostRange( $network, $networkMask );
|
||||||
|
|
||||||
|
my $msg;
|
||||||
|
if ( $totalHosts == 1 )
|
||||||
|
{
|
||||||
|
return (ret=>'ln_SUCCESS_SINGLE_ADDRESS',vars=>"$network,$networkMask,$networkRouter");
|
||||||
|
}
|
||||||
|
elsif (( $totalHosts == 256 )
|
||||||
|
|| ( $totalHosts == 65536 )
|
||||||
|
|| ( $totalHosts == 16777216 ) )
|
||||||
|
{
|
||||||
|
return ( ret=>'ln_SUCCESS_NETWORK_RANGE',vars=>"$network,$networkMask,$networkRouter,$totalHosts,$firstAddr,$lastAddr");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ my $simpleMask = esmith::util::computeLocalNetworkPrefix( $network, $networkMask );
|
||||||
|
return ( ret => 'ln_SUCCESS_NONSTANDARD_RANGE',
|
||||||
|
vars=>"$network,$networkMask,$networkRouter,$totalHosts,$firstAddr,$lastAddr,$simpleMask");
|
||||||
|
}
|
||||||
|
}
|
273
root/usr/share/smanager/lib/SrvMngr/Controller/Login.pm
Normal file
273
root/usr/share/smanager/lib/SrvMngr/Controller/Login.pm
Normal file
@ -0,0 +1,273 @@
|
|||||||
|
package SrvMngr::Controller::Login;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Support
|
||||||
|
# description : Login
|
||||||
|
# navigation : 0000 001
|
||||||
|
# menu : N
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# for information
|
||||||
|
# $r->get('/login')->to('login#main')->name('login');
|
||||||
|
# $r->post('/login')->to('login#login')->name('signin');
|
||||||
|
# $r->get('/login2')->to('login#pwdrescue')->name('pwdresc');
|
||||||
|
# $r->get('/loginc')->to('login#confpwd')->name('resetpwdconf');
|
||||||
|
# for information
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr::Model::Main;
|
||||||
|
|
||||||
|
use SrvMngr qw( theme_list init_session );
|
||||||
|
|
||||||
|
my $MAX_LOGIN_ATTEMPTS = 3;
|
||||||
|
my $DURATION_BLOCKED = 30 * 60; # access blocked for 30 min
|
||||||
|
my $TIMEOUT_FAILED_LOGIN = 1;
|
||||||
|
my $RESET_DURATION = 2 * 60 * 60; # 2 hours for resetting
|
||||||
|
|
||||||
|
our $adb = esmith::AccountsDB->open() or die "Couldn't open DB Accounts\n";
|
||||||
|
|
||||||
|
my $allowed_user_re = qr/^\w{5,10}$/;
|
||||||
|
my %Login_Attempts;
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->stash( trt => 'NORM' );
|
||||||
|
$c->render('login');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub login {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $trt = $c->param('Trt');
|
||||||
|
|
||||||
|
# password reset request
|
||||||
|
if ( $trt eq 'RESET' ) {
|
||||||
|
my $res = $c->mail_rescue();
|
||||||
|
if ( $res ne 'OK' ) {
|
||||||
|
$c->stash( error => $res, trt => $trt );
|
||||||
|
return $c->render('login');
|
||||||
|
}
|
||||||
|
$c->flash( success => $c->l('use_RESET_REGISTERED') );
|
||||||
|
record_login_attempt($c, 'RESET');
|
||||||
|
return $c->redirect_to( $c->home_page );
|
||||||
|
}
|
||||||
|
|
||||||
|
# normal loggin
|
||||||
|
my $name = $c->param('Username');
|
||||||
|
my $pass = $c->param('Password');
|
||||||
|
my $from = $c->param('From');
|
||||||
|
|
||||||
|
if ( is_denied($c) ) {
|
||||||
|
$c->stash( error => $c->l('use_TOO_MANY_LOGIN'), trt => 'NORM' );
|
||||||
|
return $c->render('login');
|
||||||
|
}
|
||||||
|
|
||||||
|
# untaint
|
||||||
|
unless ( ($name =~ /^([a-z][\-\_\.a-z0-9]*)$/) && ($pass =~ /^([ -~]+)$/) ) {
|
||||||
|
record_login_attempt($c, 'FAILED');
|
||||||
|
$c->stash( error => $c->l('use_INVALID_DATA'), trt => 'NORM' );
|
||||||
|
return $c->render('login');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $alias = SrvMngr::Model::Main->check_adminalias( $c );
|
||||||
|
if ( $alias ) {
|
||||||
|
if ( $name eq $alias ) {
|
||||||
|
$name = 'admin';
|
||||||
|
} elsif ( $name eq 'admin' ) {
|
||||||
|
record_login_attempt($c, 'FAILED');
|
||||||
|
$c->stash( error => $c->l('use_SORRY'), trt => 'NORM' );
|
||||||
|
return $c->render('login');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SrvMngr::Model::Main->check_credentials($name, $pass)) {
|
||||||
|
$c->session(logged_in => 1); # set the logged_in flag
|
||||||
|
$c->session(username => $name); # keep a copy of the username
|
||||||
|
# if ( $name eq 'admin' || $adb->is_user_in_group($name, 'AdmiN') ) # for futur use
|
||||||
|
if ( $name eq 'admin' ) {
|
||||||
|
$c->session(is_admin => 1);
|
||||||
|
} else {
|
||||||
|
$c->session(is_admin => 0);
|
||||||
|
}
|
||||||
|
$c->session(expiration => 600); # expire this session in 10 minutes
|
||||||
|
|
||||||
|
$c->flash( success => $c->l('use_WELCOME') );
|
||||||
|
record_login_attempt($c, 'SUCCESS');
|
||||||
|
} else {
|
||||||
|
record_login_attempt($c, 'FAILED');
|
||||||
|
sleep $TIMEOUT_FAILED_LOGIN;
|
||||||
|
|
||||||
|
$c->stash( error => $c->l('use_SORRY'), trt => 'NORM' );
|
||||||
|
return $c->render('login');
|
||||||
|
}
|
||||||
|
|
||||||
|
$from = $c->home_page if ( $from eq 'login' );
|
||||||
|
$c->redirect_to( $from );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub pwdrescue {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
$c->stash( trt => 'RESET' );
|
||||||
|
|
||||||
|
$c->render('login');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub mail_rescue {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $name = $c->param('Username');
|
||||||
|
my $from = $c->param('From');
|
||||||
|
|
||||||
|
my $res;
|
||||||
|
|
||||||
|
$res .= $c->l('use_TOO_MANY_LOGIN') if ( is_denied($c) );
|
||||||
|
|
||||||
|
# untaint
|
||||||
|
if ( ! $res && $name !~ /^([a-z][\-\_\.a-z0-9]*)$/ ) {
|
||||||
|
record_login_attempt($c, 'FAILED');
|
||||||
|
$res .= $c->l('use_ERR_NAME');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $res && $name eq 'admin' ) {
|
||||||
|
$res .= $c->l('use_NOT_THAT_OPER');
|
||||||
|
}
|
||||||
|
|
||||||
|
# user exists ?
|
||||||
|
if ( ! $res ) {
|
||||||
|
my $acct = $adb->get($name);
|
||||||
|
if ( ! $acct || $acct->prop('type') ne "user" || $acct->prop('PasswordSet') ne 'yes' ) {
|
||||||
|
$res .= $c->l('use_NOT_THAT_OPER');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res if $res;
|
||||||
|
|
||||||
|
# send email
|
||||||
|
my $email = $name .'@'. $c->session->{DomainName};
|
||||||
|
my $until = time() + $RESET_DURATION;
|
||||||
|
|
||||||
|
$c->pwdrst->{$name} = {
|
||||||
|
email => $email,
|
||||||
|
date => $until,
|
||||||
|
confirmed => 0,
|
||||||
|
};
|
||||||
|
my $jwt = $c->jwt->claims({username => $name})->encode;
|
||||||
|
my $url = $c->url_for('loginc')->to_abs->query(jwt => $jwt);
|
||||||
|
|
||||||
|
# $c->email( $email, $c->l('use_CONFIRM_RESET'), $c->render_to_string(inline => $c->l('use_GO_TO_URL', $url) ) );
|
||||||
|
# directly (without minion)
|
||||||
|
$c->send_email( $email, $c->l('use_CONFIRM_RESET'), $c->render_to_string(inline => $c->l('use_GO_TO_URL', $url) ) );
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub logout {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
$c->session( expires => 1 );
|
||||||
|
$c->flash( success => $c->l('use_BYE') );
|
||||||
|
$c->flash( error => 'Byegood' );
|
||||||
|
|
||||||
|
$c->redirect_to( $c->home_page );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub confpwd {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $jwt = $c->param('jwt');
|
||||||
|
my $name = $c->jwt->decode($jwt)->{username};
|
||||||
|
|
||||||
|
# request already treated or outdated
|
||||||
|
if ( $c->pwdrst->{$name}{confirmed} != 0 or $c->pwdrst->{$name}{date} < time() ) {
|
||||||
|
$c->flash( error => $c->l('use_INVALID_REQUEST'));
|
||||||
|
return $c->redirect_to( $c->home_page );
|
||||||
|
}
|
||||||
|
|
||||||
|
# reset password for this account
|
||||||
|
$c->pwdrst->{$name}{confirmed} = 1;
|
||||||
|
|
||||||
|
$c->flash( success => $c->l('use_OK_FOR_RESET') );
|
||||||
|
|
||||||
|
# call userpassword with encoded name
|
||||||
|
my $url = $c->url_for('userpasswordr')->to_abs->query(jwt => $jwt);
|
||||||
|
# warn "confpwd: " . $url . "\n";
|
||||||
|
|
||||||
|
return $c->redirect_to( $url );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub record_login_attempt {
|
||||||
|
|
||||||
|
my ($c, $result) = @_;
|
||||||
|
|
||||||
|
my $user = $c->param('Username');
|
||||||
|
my $ip_address = $c->tx->remote_address;
|
||||||
|
|
||||||
|
if ($result eq 'RESET') {
|
||||||
|
|
||||||
|
$c->app->log->info(join "\t", "Password reset requested for : $user at ", $ip_address);
|
||||||
|
|
||||||
|
} elsif ($result eq 'SUCCESS') {
|
||||||
|
|
||||||
|
$c->app->log->info(join "\t", "Login succeeded: $user", $ip_address);
|
||||||
|
$Login_Attempts{$ip_address}->{tries} = 0; # reset the number of login attempts
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$c->app->log->info(join "\t", "Login FAILED: $user", $ip_address);
|
||||||
|
$Login_Attempts{$ip_address}->{tries}++;
|
||||||
|
if ( $Login_Attempts{$ip_address}->{tries} > $MAX_LOGIN_ATTEMPTS ) {
|
||||||
|
$Login_Attempts{$ip_address}->{denied_until} = time() + $DURATION_BLOCKED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub is_denied {
|
||||||
|
my ($c) = @_;
|
||||||
|
|
||||||
|
my $ip_address = $c->tx->remote_address;
|
||||||
|
|
||||||
|
return unless exists $Login_Attempts{$ip_address}
|
||||||
|
&& exists $Login_Attempts{$ip_address}->{denied_until};
|
||||||
|
|
||||||
|
return 'Denied'
|
||||||
|
if $Login_Attempts{$ip_address}->{denied_until} > time();
|
||||||
|
|
||||||
|
# TIMEOUT has expired, reset attempts
|
||||||
|
delete $Login_Attempts{$ip_address}->{denied_until};
|
||||||
|
$Login_Attempts{$ip_address}->{tries} = 0;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
34
root/usr/share/smanager/lib/SrvMngr/Controller/Logout.pm
Normal file
34
root/usr/share/smanager/lib/SrvMngr/Controller/Logout.pm
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package SrvMngr::Controller::Logout;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Current User
|
||||||
|
# description : Logout
|
||||||
|
# navigation : 1000 900
|
||||||
|
# menu : U
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw( theme_list init_session );
|
||||||
|
|
||||||
|
|
||||||
|
sub logout {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
$c->session( expires => 1 );
|
||||||
|
$c->flash( success => 'Goodbye' );
|
||||||
|
|
||||||
|
$c->redirect_to( $c->home_page );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
34
root/usr/share/smanager/lib/SrvMngr/Controller/Manual.pm
Normal file
34
root/usr/share/smanager/lib/SrvMngr/Controller/Manual.pm
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package SrvMngr::Controller::Manual;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Support
|
||||||
|
# description : Online manual
|
||||||
|
# navigation : 0000 100
|
||||||
|
# menu : N
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('manual_FORM_TITLE');
|
||||||
|
my $modul = $c->render_to_string(inline => $c->l('manual_DESCRIPTION'));
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $modul);
|
||||||
|
|
||||||
|
$c->render(template => 'manual');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
71
root/usr/share/smanager/lib/SrvMngr/Controller/Modules.pm
Normal file
71
root/usr/share/smanager/lib/SrvMngr/Controller/Modules.pm
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package SrvMngr::Controller::Modules;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
|
||||||
|
sub bugreport {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $modul = $c->render_to_string( inline => "<p># my (\$lang, \$releaseVersion,
|
||||||
|
<br># \$c->stash\(\'lang\', \'releaseVer\'
|
||||||
|
# \'navigation\'</p>");
|
||||||
|
|
||||||
|
$c->stash( modul => $modul );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub support {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
my $modul = $c->stash('modul');
|
||||||
|
$modul .= 'Mail result is 1 + 8.';
|
||||||
|
|
||||||
|
$c->stash( modul => $modul, PwdSet => '0', Unsafe => '0' );
|
||||||
|
|
||||||
|
#$c->render('modules/support');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub modsearch {
|
||||||
|
my $c = shift;
|
||||||
|
my $module = $c->param('module');
|
||||||
|
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $redirect_url = SrvMngr->get_mod_url($module);
|
||||||
|
if($redirect_url ne "-1"){
|
||||||
|
#$c->render(text => "mod_search: $module to $redirect_url");
|
||||||
|
return $c->redirect_to($redirect_url);
|
||||||
|
#return $c->redirect_to( url_for($redirect_url) );
|
||||||
|
}
|
||||||
|
#$c->render(text => "mod_search: $module to 'welcome'");
|
||||||
|
return $c->redirect_to( $c->home_page );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub whatever {
|
||||||
|
my $c = shift;
|
||||||
|
my $whatever = $c->param('whatever');
|
||||||
|
|
||||||
|
$c->app->log->info($c->log_req . ' ' . $whatever);
|
||||||
|
|
||||||
|
$c->render(text => "whatever: /$whatever did not match.", status => 404);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
410
root/usr/share/smanager/lib/SrvMngr/Controller/Portforwarding.pm
Normal file
410
root/usr/share/smanager/lib/SrvMngr/Controller/Portforwarding.pm
Normal file
@ -0,0 +1,410 @@
|
|||||||
|
package SrvMngr::Controller::Portforwarding;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Network
|
||||||
|
# description : Port forwarding
|
||||||
|
# navigation : 6000 600
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
#use Regexp::Common qw /net/;
|
||||||
|
|
||||||
|
#use Data::Dumper;
|
||||||
|
use esmith::util;
|
||||||
|
use esmith::HostsDB;
|
||||||
|
|
||||||
|
our $db = esmith::ConfigDB->open
|
||||||
|
|| die "Can't open configuration database: $!\n";
|
||||||
|
our $tcp_db = esmith::ConfigDB->open('portforward_tcp')
|
||||||
|
|| die "Can't open portforward_tcp database: $!\n";
|
||||||
|
our $udp_db = esmith::ConfigDB->open('portforward_udp')
|
||||||
|
|| die "Can't open portforward_udp database: $!\n";
|
||||||
|
|
||||||
|
|
||||||
|
my %ret = ();
|
||||||
|
|
||||||
|
use constant FALSE => 0;
|
||||||
|
use constant TRUE => 1;
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info( $c->log_req );
|
||||||
|
|
||||||
|
my %pf_datas = ();
|
||||||
|
$pf_datas{return} = "";
|
||||||
|
my $title = $c->l('pf_FORM_TITLE');
|
||||||
|
my $modul = '';
|
||||||
|
|
||||||
|
$pf_datas{trt} = 'LIST';
|
||||||
|
|
||||||
|
my @tcpforwards = $tcp_db->get_all;
|
||||||
|
my @udpforwards = $udp_db->get_all;
|
||||||
|
my $empty = 1 if not @tcpforwards and not @udpforwards;
|
||||||
|
|
||||||
|
$c->stash(
|
||||||
|
title => $title,
|
||||||
|
modul => $modul,
|
||||||
|
pf_datas => \%pf_datas,
|
||||||
|
tcpforwards =>\@tcpforwards,
|
||||||
|
udpforwards =>\@udpforwards,
|
||||||
|
empty => $empty
|
||||||
|
);
|
||||||
|
$c->render( template => 'portforwarding' );
|
||||||
|
}
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info( $c->log_req );
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ( $c->param('trt') || 'LIST' );
|
||||||
|
|
||||||
|
|
||||||
|
$trt = 'DEL' if ( $rt eq 'portforwardingdel' );
|
||||||
|
$trt = 'ADD' if ( $rt eq 'portforwardingadd' );
|
||||||
|
$trt = 'ADD1' if ( $rt eq 'portforwardingadd1' );
|
||||||
|
$trt = 'DEL1' if ( $rt eq 'portforwardingdel1' );
|
||||||
|
|
||||||
|
my %pf_datas = ();
|
||||||
|
my $title = $c->l('pf_FORM_TITLE');
|
||||||
|
my $modul = '';
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
# Add a portforward- called from the list panel
|
||||||
|
# Nothing to do here...as just need template to display fields to input data.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD1' ) {
|
||||||
|
#Add a port forward - called after new pf details filled in
|
||||||
|
my %ret = add_portforward($c);
|
||||||
|
#Return to list page if success
|
||||||
|
if ((index($ret{ret},"SUCCESS") != -1)) {
|
||||||
|
$trt = "LIST";
|
||||||
|
} else {
|
||||||
|
#Error - return to Add page
|
||||||
|
$trt = "ADD";
|
||||||
|
}
|
||||||
|
$c->stash(ret=>\%ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL1' ) {
|
||||||
|
##After Remove clicked on Delete network panel
|
||||||
|
my $sport = $c->param("sport") || '';
|
||||||
|
my $proto = $c->param("proto") || '';
|
||||||
|
#work out which protocol
|
||||||
|
my $fdb;
|
||||||
|
if ($proto eq 'TCP') {
|
||||||
|
$fdb = $tcp_db;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$fdb = $udp_db;
|
||||||
|
}
|
||||||
|
#check that the sport is in the db
|
||||||
|
my $entry = $fdb->get($sport) || die("Unable to find sport and proto $sport $proto");
|
||||||
|
$entry->delete;
|
||||||
|
system( "/sbin/e-smith/signal-event", "portforwarding-update") == 0
|
||||||
|
or ( die($c->l('pf_ERR_NONZERO_RETURN_EVENT')));
|
||||||
|
$trt = "LIST";
|
||||||
|
my %ret = (ret=>"pf_SUCCESS");
|
||||||
|
$c->stash(ret=>\%ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
##Initial delete panel requiring confirmation
|
||||||
|
my $sport = $c->param("sport") || '';
|
||||||
|
my $proto = $c->param("proto") || '';
|
||||||
|
$c->stash(sport=>$sport);
|
||||||
|
#work out which protocol
|
||||||
|
my $fdb;
|
||||||
|
if ($proto eq 'TCP') {
|
||||||
|
$fdb = $tcp_db;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$fdb = $udp_db;
|
||||||
|
}
|
||||||
|
#pull out details and pass to template
|
||||||
|
my $entry = $fdb->get($sport) || die("Unable to find sport and proto $sport $proto");
|
||||||
|
$pf_datas{proto} = $proto;
|
||||||
|
$pf_datas{sport} = $sport;
|
||||||
|
$pf_datas{dhost} = $entry->prop('DestHost');
|
||||||
|
$pf_datas{dport} = $entry->prop('DestPort') || '';
|
||||||
|
$pf_datas{cmmnt} = $entry->prop('Comment') || '';
|
||||||
|
$pf_datas{allow} = $entry->prop('AllowHosts') || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'LIST' ) {
|
||||||
|
#List all the port forwards
|
||||||
|
my @tcpforwards = $tcp_db->get_all;
|
||||||
|
my @udpforwards = $udp_db->get_all;
|
||||||
|
my $empty = 1 if not @tcpforwards and not @udpforwards;
|
||||||
|
|
||||||
|
$c->stash(
|
||||||
|
tcpforwards =>\@tcpforwards,
|
||||||
|
udpforwards =>\@udpforwards,
|
||||||
|
empty => $empty
|
||||||
|
);
|
||||||
|
|
||||||
|
#my %forwards = (TCP=>@tcpforwards,UDP=>@udpforwards);
|
||||||
|
#$c->stash(portforwarding => %forwards);
|
||||||
|
}
|
||||||
|
|
||||||
|
$pf_datas{'trt'} = $trt;
|
||||||
|
$c->stash( title => $title, modul => $modul, pf_datas => \%pf_datas );
|
||||||
|
$c->render( template => 'portforwarding' );
|
||||||
|
}
|
||||||
|
|
||||||
|
sub add_portforward {
|
||||||
|
my $c = shift;
|
||||||
|
my $sport = $c->param("sport") || '';
|
||||||
|
my $proto = $c->param("proto") || '';
|
||||||
|
#work out which protocol
|
||||||
|
my $fdb;
|
||||||
|
if ($proto eq 'TCP') {
|
||||||
|
$fdb = $tcp_db;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$fdb = $udp_db;
|
||||||
|
}
|
||||||
|
#Get the other values
|
||||||
|
my $dport = $c->param("dport");
|
||||||
|
my $dhost = get_destination_host($c);
|
||||||
|
my $cmmnt = $c->param("cmmnt") || "";
|
||||||
|
my $allow = $c->param("allow") || "";
|
||||||
|
my $deny = (($c->param("allow")) ? "0.0.0.0/0" : "");
|
||||||
|
$proto =~ s/^\s+|\s+$//g;
|
||||||
|
$sport =~ s/^\s+|\s+$//g;
|
||||||
|
$dport =~ s/^\s+|\s+$//g;
|
||||||
|
$dhost =~ s/^\s+|\s+$//g;
|
||||||
|
#Validate the values
|
||||||
|
%ret=validate_source_port($c) ; unless (index($ret{ret},"SUCCESS")!= -1) {return %ret;}
|
||||||
|
%ret=validate_allowed_hosts($c) ; if (index($ret{ret},"SUCCESS")== -1) {return %ret;}
|
||||||
|
%ret=validate_destination_port($c) ; if (index($ret{ret},"SUCCESS")== -1) {return %ret;}
|
||||||
|
%ret=validate_destination_host($c) ; if (index($ret{ret},"SUCCESS")== -1) {return %ret;}
|
||||||
|
# and then write it to the DB and tell the exec about it.
|
||||||
|
my $entry = $fdb->get($sport) || $fdb->new_record($sport, { type => 'forward' });
|
||||||
|
$entry->set_prop('DestHost', $dhost);
|
||||||
|
$entry->set_prop('DestPort', $dport) if $dport;
|
||||||
|
$entry->set_prop('Comment', $cmmnt);
|
||||||
|
$entry->set_prop('AllowHosts', $allow);
|
||||||
|
$entry->set_prop('DenyHosts', $deny);
|
||||||
|
system( "/sbin/e-smith/signal-event", "portforwarding-update") == 0
|
||||||
|
or ( return (ret=>'pf_ERR_NONZERO_RETURN_EVENT' ));
|
||||||
|
my %ret = (ret=>"pf_SUCCESS");
|
||||||
|
return %ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_destination_host
|
||||||
|
{
|
||||||
|
my $q = shift;
|
||||||
|
my $dhost = $q->param("dhost");
|
||||||
|
my $localip = $db->get_prop('InternalInterface', 'IPAddress');
|
||||||
|
my $external_ip = $db->get_prop('ExternalInterface', 'IPAddress') || $localip;
|
||||||
|
|
||||||
|
if ($dhost =~ /^(127.0.0.1|$localip|$external_ip)$/i)
|
||||||
|
{
|
||||||
|
# localhost token gets expanded at runtime to current external IP
|
||||||
|
$dhost = 'localhost';
|
||||||
|
}
|
||||||
|
return $dhost;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub validate_source_port {
|
||||||
|
my $q = shift;
|
||||||
|
my $sport = $q->param('sport');
|
||||||
|
$sport =~ s/^\s+|\s+$//g;
|
||||||
|
# If this is a port range, split it up and validate it individually.
|
||||||
|
my @ports = ();
|
||||||
|
if ($sport =~ /-/)
|
||||||
|
{
|
||||||
|
@ports = split /-/, $sport;
|
||||||
|
if (@ports > 2)
|
||||||
|
{
|
||||||
|
#$self->debug_msg("found more than 2 ports: @ports");
|
||||||
|
return (ret=>'pf_ERR_BADPORT');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
push @ports, $sport;
|
||||||
|
}
|
||||||
|
#$self->debug_msg("the ports array is: @ports");
|
||||||
|
foreach my $port (@ports)
|
||||||
|
{
|
||||||
|
#$self->debug_msg("looping on port $port");
|
||||||
|
if (! isValidPort($port))
|
||||||
|
{
|
||||||
|
#$self->debug_msg("returning: " . $self->localise('ERR_BADPORT'));
|
||||||
|
return (ret=>'pf_ERR_BADPORT');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Now, lets screen any duplicates.
|
||||||
|
my $protocol = $q->param('protocol');
|
||||||
|
my @forwards = ();
|
||||||
|
|
||||||
|
# Grab the existing rules for this protocol.
|
||||||
|
if ($protocol eq 'TCP') {
|
||||||
|
@forwards = map { $_->key } $tcp_db->get_all;
|
||||||
|
} elsif ($protocol eq 'UDP') {
|
||||||
|
@forwards = map { $_->key } $udp_db->get_all;
|
||||||
|
}
|
||||||
|
foreach my $psport (@forwards)
|
||||||
|
{
|
||||||
|
if (detect_collision($sport, $psport))
|
||||||
|
{
|
||||||
|
return (ret=>'pf_ERR_PORT_COLLISION');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (ret=>"pf_SUCCESS");
|
||||||
|
}
|
||||||
|
|
||||||
|
sub detect_collision
|
||||||
|
{
|
||||||
|
my $port_a = shift;
|
||||||
|
my $port_b = shift;
|
||||||
|
|
||||||
|
# If they're both single ports, see if they're the same.
|
||||||
|
if (($port_a !~ /-/) && ($port_b !~ /-/))
|
||||||
|
{
|
||||||
|
return $port_a eq $port_b;
|
||||||
|
}
|
||||||
|
# If port_a is not a range but port_b is, is a in b?
|
||||||
|
elsif ($port_a !~ /-/)
|
||||||
|
{
|
||||||
|
my ($b1, $b2) = split /-/, $port_b;
|
||||||
|
return (($port_a >= $b1) && ($port_a <= $b2));
|
||||||
|
}
|
||||||
|
elsif ($port_b !~ /-/)
|
||||||
|
{
|
||||||
|
my ($a1, $a2) = split /-/, $port_a;
|
||||||
|
return (($port_b >= $a1) && ($port_b <= $a2));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# They're both ranges. Do they overlap?
|
||||||
|
my ($a1, $a2) = split /-/, $port_a;
|
||||||
|
my ($b1, $b2) = split /-/, $port_b;
|
||||||
|
# They can overlap in two ways. Either a1 is in b, or b1 is in a.
|
||||||
|
if (($a1 >= $b1) && ($a1 <= $b2))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
elsif (($b1 >= $a1) && ($b1 <= $a2))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_destination_port {
|
||||||
|
my $c = shift;
|
||||||
|
my $dport = $c->param('dport');
|
||||||
|
$dport =~ s/^\s+|\s+$//g;
|
||||||
|
# If the dport is empty, that's ok.
|
||||||
|
return (ret=>'pf_SUCCESS') if not $dport;
|
||||||
|
|
||||||
|
# If this is a port range, split it up and validate it individually.
|
||||||
|
my @ports = ();
|
||||||
|
if ($dport =~ /-/)
|
||||||
|
{
|
||||||
|
@ports = split /-/, $dport;
|
||||||
|
if (@ports > 2)
|
||||||
|
{
|
||||||
|
#$self->debug_msg("found more than 2 ports: @ports");
|
||||||
|
return (ret=>'pf_ERR_BADPORT');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
push @ports, $dport;
|
||||||
|
}
|
||||||
|
#$self->debug_msg("the ports array is: @ports");
|
||||||
|
|
||||||
|
foreach my $port (@ports)
|
||||||
|
{
|
||||||
|
#$self->debug_msg("looping on port $port");
|
||||||
|
if (! isValidPort($port))
|
||||||
|
{
|
||||||
|
#$self->debug_msg("returning: " . $self->localise('ERR_BADPORT'));
|
||||||
|
return (ret=>'pf_ERR_BADPORT');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (ret=>'pf_SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub isValidPort() {
|
||||||
|
my $port = shift;
|
||||||
|
|
||||||
|
return FALSE unless defined $port;
|
||||||
|
|
||||||
|
if (($port =~ /^\d+$/) &&
|
||||||
|
($port > 0) &&
|
||||||
|
($port < 65536))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub validate_destination_host {
|
||||||
|
my $c = shift;
|
||||||
|
my $dhost = $c->param('dhost');
|
||||||
|
$dhost =~ s/^\s+|\s+$//g;
|
||||||
|
|
||||||
|
my $localip = $db->get_prop('InternalInterface', 'IPAddress');
|
||||||
|
my $external_ip = $db->get_prop('ExternalInterface', 'IPAddress') || $localip;
|
||||||
|
|
||||||
|
if ($dhost =~ /^(localhost|127.0.0.1|$localip|$external_ip)$/i)
|
||||||
|
{
|
||||||
|
# localhost token gets expanded at runtime to current external IP
|
||||||
|
$c->param(-name=>'dhost', -value=>'localhost');
|
||||||
|
return (ret=>'pf_SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $systemmode = $db->get_value('SystemMode');
|
||||||
|
|
||||||
|
if ($systemmode eq 'serveronly') {
|
||||||
|
return (ret=>'pf_IN_SERVERONLY');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isValidIP($dhost)) {
|
||||||
|
return (ret=>'pf_SUCCESS');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return (ret=>'pf_ERR_BADIP');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub validate_allowed_hosts {
|
||||||
|
my $c = shift;
|
||||||
|
my $ahost = $c->param('allow');
|
||||||
|
$ahost =~ s/^\s+|\s+$//g;
|
||||||
|
|
||||||
|
my %valid_ahost_list = (ret=>"pf_SUCCESS");
|
||||||
|
|
||||||
|
foreach (split(/[\s,]+/, $ahost)) {
|
||||||
|
my $valid_ipnet = 0;
|
||||||
|
$valid_ipnet = 1 if ($_ =~ m/^\d+\.\d+\.\d+\.\d+$/);
|
||||||
|
$valid_ipnet = 1 if ($_ =~ m/^\d+\.\d+\.\d+\.\d+\/\d+$/);
|
||||||
|
%valid_ahost_list = (ret=>"pf_ERR_BADAHOST") if ($valid_ipnet != 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return %valid_ahost_list;
|
||||||
|
}
|
||||||
|
1;
|
379
root/usr/share/smanager/lib/SrvMngr/Controller/Printers.pm
Normal file
379
root/usr/share/smanager/lib/SrvMngr/Controller/Printers.pm
Normal file
@ -0,0 +1,379 @@
|
|||||||
|
package SrvMngr::Controller::Printers;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : System
|
||||||
|
# description : Printers
|
||||||
|
# navigation : 4000 800
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
use esmith::FormMagick::Panel::printers;
|
||||||
|
|
||||||
|
our $adb = esmith::AccountsDB->open || die "Couldn't open accounts db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %prt_datas = ();
|
||||||
|
my $title = $c->l('prt_FORM_TITLE');
|
||||||
|
|
||||||
|
$prt_datas{'trt'} = 'LIST';
|
||||||
|
|
||||||
|
my @printerDrivers;
|
||||||
|
if ($adb)
|
||||||
|
{
|
||||||
|
@printerDrivers = $adb->printers();
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, prt_datas => \%prt_datas, printerDrivers => \@printerDrivers );
|
||||||
|
$c->render(template => 'printers');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'LIST');
|
||||||
|
my $printer = $c->param('printer') || '';
|
||||||
|
|
||||||
|
#$trt = 'DEL' if ( $printer );
|
||||||
|
#$trt = 'ADD' if ( $rt eq 'printeradd' );
|
||||||
|
|
||||||
|
my %prt_datas = ();
|
||||||
|
my $title = $c->l('prt_FORM_TITLE');
|
||||||
|
|
||||||
|
$prt_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
|
||||||
|
# nothing
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
my $rec = $adb->get($printer);
|
||||||
|
if ($rec and $rec->prop('type') eq 'printer') {
|
||||||
|
$prt_datas{printer} = $printer;
|
||||||
|
$prt_datas{description} = $rec->prop('Description') || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'LIST' ) {
|
||||||
|
my @printerDrivers;
|
||||||
|
if ($adb)
|
||||||
|
{
|
||||||
|
@printerDrivers = $adb->printers();
|
||||||
|
}
|
||||||
|
$c->stash( printerDrivers => \@printerDrivers );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, prt_datas => \%prt_datas );
|
||||||
|
$c->render( template => 'printers' );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'LIST');
|
||||||
|
|
||||||
|
my %prt_datas = ();
|
||||||
|
my $title = $c->l('prt_FORM_TITLE');
|
||||||
|
$prt_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
my ($res, $result) = '';
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
|
||||||
|
my $name = ($c->param('Name') || '');
|
||||||
|
my $description = ($c->param('Description') || '');
|
||||||
|
my $location = ($c->param('Location') || '');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
$res = $c->validate_printer( $name, $description, $location );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
if ( $location eq 'remote' and ! $result) {
|
||||||
|
$prt_datas{'trt'} = 'NET';
|
||||||
|
$prt_datas{'name'} = $name;
|
||||||
|
$prt_datas{'description'} = $description;
|
||||||
|
$prt_datas{'location'} = $location;
|
||||||
|
$c->stash( title => $title, prt_datas => \%prt_datas );
|
||||||
|
return $c->render( template => 'printers' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->new_printer( $name, $description, $location );
|
||||||
|
#$remoteName, $address );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('prt_CREATED_SUCCESSFULLY') . ' ' . $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'NET' ) {
|
||||||
|
|
||||||
|
my $name = ($c->param('Name') || '');
|
||||||
|
my $description = ($c->param('Description') || '');
|
||||||
|
my $location = ($c->param('Location') || '');
|
||||||
|
my $remoteName = ($c->param ('RemoteName') || '');
|
||||||
|
my $address = ($c->param ('Address') || '');
|
||||||
|
|
||||||
|
$prt_datas{'name'} = $name;
|
||||||
|
$prt_datas{'description'} = $description;
|
||||||
|
$prt_datas{'location'} = $location;
|
||||||
|
|
||||||
|
# controls
|
||||||
|
$res = $c->validate_network( $location, $remoteName, $address);
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->new_printer( $name, $description, $location, $remoteName, $address );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('prt_CREATED_SUCCESSFULLY') . ' ' . $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
my $printer = ($c->param ('printer') || '');
|
||||||
|
|
||||||
|
if ($printer =~ /^([a-z][a-z0-9]*)$/) {
|
||||||
|
$printer = $1;
|
||||||
|
} else {
|
||||||
|
$result .= $c->l('prt_ERR_INTERNAL_FAILURE') . ':' . $printer;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $rec = $adb->get($printer);
|
||||||
|
$result .= $c->l('prt_ERR_INTERNAL_FAILURE') . ':' . $printer unless ($rec);
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->del_printer( $printer );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('prt_DELETED_SUCCESSFULLY') . ' ' . $printer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# common parts
|
||||||
|
|
||||||
|
if ($res ne 'OK') {
|
||||||
|
$c->stash( error => $result );
|
||||||
|
$c->stash( title => $title, prt_datas => \%prt_datas );
|
||||||
|
return $c->render('printers');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $message = "'Printers' updates ($trt) DONE";
|
||||||
|
$c->app->log->info($message);
|
||||||
|
$c->flash( success => $result );
|
||||||
|
#$c->flash( error => 'No changes applied !!' ); # for testing purpose
|
||||||
|
|
||||||
|
$c->redirect_to('/printers');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub del_printer {
|
||||||
|
|
||||||
|
my ( $c, $printer ) = @_;
|
||||||
|
|
||||||
|
# Update the db account (1)
|
||||||
|
my $rec = $adb->get($printer);
|
||||||
|
|
||||||
|
$rec->set_prop('type', 'printer-deleted');
|
||||||
|
system ("/sbin/e-smith/signal-event printer-delete $printer") == 0
|
||||||
|
or return $c->error('ERR_DELETING');
|
||||||
|
|
||||||
|
$rec->delete();
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_printer {
|
||||||
|
|
||||||
|
my ($c, $name, $description, $location, $remoteName, $address ) = @_;
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# Validate parameters and untaint them
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
if ($name =~ /^([a-z][a-z0-9]*)$/) {
|
||||||
|
$name = $1;
|
||||||
|
} else {
|
||||||
|
return $c->l('prt_ERR_UNEXPECTED_NAME') . ': ' . $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($description =~ /^([\'\w\s]+)$/) {
|
||||||
|
$description = $1;
|
||||||
|
} else {
|
||||||
|
return $c->l('prt_ERR_UNEXPECTED_DESC') . ': ' . $description;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($location =~ /^(lp[0-9]+|remote|usb\/lp[0-9]+)$/){
|
||||||
|
$location = $1;
|
||||||
|
} else {
|
||||||
|
$location = "lp0";
|
||||||
|
}
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# Looks good. Find out if this printer has been taken
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
my $rec = $adb->get($name);
|
||||||
|
my $type;
|
||||||
|
if ($rec and ($type = $rec->prop('type'))) {
|
||||||
|
return $c->l('prt_ERR_EXISTS') . ' : ' . $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_network {
|
||||||
|
|
||||||
|
my ($c, $location, $remoteName, $address ) = @_;
|
||||||
|
|
||||||
|
if ($location eq 'remote') {
|
||||||
|
|
||||||
|
my $msg = hostname_or_ip2 ( $c, $address );
|
||||||
|
return $msg unless $msg eq 'OK';
|
||||||
|
|
||||||
|
if ($address =~ /^([a-zA-Z0-9\.\-]+)$/) {
|
||||||
|
$address = $1;
|
||||||
|
} else {
|
||||||
|
return $c->l('prt_ERR_INVALID_ADDRESS') . ' : ' . $address;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($remoteName =~ /^([^\|]*)$/) {
|
||||||
|
$remoteName = $1;
|
||||||
|
} else {
|
||||||
|
return $c->l('prt_ERR_INVALID_REMOTE_NAME') . ' : ' . $remoteName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub new_printer {
|
||||||
|
|
||||||
|
my ($c, $name, $description, $location, $remoteName, $address ) = @_;
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# Printer name is available! Update printers database and
|
||||||
|
# signal the create-printer event.
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
my $result = '';
|
||||||
|
|
||||||
|
my $rec = $adb->new_record($name,
|
||||||
|
{type=>'printer',
|
||||||
|
Description => $description,
|
||||||
|
Address => $address,
|
||||||
|
RemoteName => $remoteName,
|
||||||
|
Location => $location});
|
||||||
|
|
||||||
|
system ("/sbin/e-smith/signal-event printer-create $name") == 0
|
||||||
|
or return $c->error('ERR_CREATING');
|
||||||
|
|
||||||
|
return 'OK',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub hostname_or_ip2 {
|
||||||
|
|
||||||
|
my ($fm, $data) = @_;
|
||||||
|
if ($data =~ /^[\d\.]+$/) {
|
||||||
|
if (ip_number2($fm, $data) eq "OK")
|
||||||
|
{
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $fm->l('prt_MUST_BE_VALID_HOSTNAME_OR_IP');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ($data =~ /^([a-zA-Z0-9\.\-]+)$/ )
|
||||||
|
{
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $fm->l('prt_MUST_BE_VALID_HOSTNAME_OR_IP');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub ip_number2 {
|
||||||
|
# from CGI::FormMagick::Validator::ip_number($fm, $data)
|
||||||
|
|
||||||
|
my ($fm, $data) = @_;
|
||||||
|
|
||||||
|
return undef unless defined $data;
|
||||||
|
|
||||||
|
return 'FM_IP_NUMBER1' unless $data =~ /^[\d.]+$/;
|
||||||
|
|
||||||
|
my @octets = split /\./, $data;
|
||||||
|
my $dots = ($data =~ tr/.//);
|
||||||
|
|
||||||
|
return 'FM_IP_NUMBER2' unless (scalar @octets == 4 and $dots == 3);
|
||||||
|
|
||||||
|
foreach my $octet (@octets) {
|
||||||
|
return $fm->l("FM_IP_NUMBER3", {octet => $octet}) if $octet > 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head2 publicAccess_list
|
||||||
|
|
||||||
|
Returns the hash of public access settings for showing in the public
|
||||||
|
access drop down list.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub printerLocation_list {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
return [[ $c->l('prt_LOCAL_PRINTER_0') => 'lp0'],
|
||||||
|
[ $c->l('prt_LOCAL_PRINTER_1') => 'lp1'],
|
||||||
|
[ $c->l('prt_LOCAL_PRINTER_2') => 'lp2'],
|
||||||
|
[ $c->l('prt_NET_PRINTER') => 'remote' ],
|
||||||
|
[ $c->l('prt_FIRST_USB_PRINTER') => 'usb/lp0'],
|
||||||
|
[ $c->l('prt_SECOND_USB_PRINTER') => 'usb/lp1']];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1
|
75
root/usr/share/smanager/lib/SrvMngr/Controller/Proxy.pm
Normal file
75
root/usr/share/smanager/lib/SrvMngr/Controller/Proxy.pm
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
package SrvMngr::Controller::Proxy;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : System
|
||||||
|
# description : Proxy settings
|
||||||
|
# navigation : 4000 700
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
our $db = esmith::ConfigDB->open || die "Couldn't open config db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %prx_datas = ();
|
||||||
|
my $title = $c->l('prx_TITLE');
|
||||||
|
my $modul = $c->render_to_string(inline => $c->l('prx_FIRST_PAGE_DESCRIPTION'));
|
||||||
|
|
||||||
|
$prx_datas{'http_proxy_status'} = ($db->get_prop('squid','status')) || 'disabled';
|
||||||
|
|
||||||
|
#if (system('/bin/rpm -q e-smith-email > /dev/null') == 0)
|
||||||
|
#{
|
||||||
|
$prx_datas{'smtp_proxy_status'} = $db->get_prop('qpsmtpd','Proxy') || undef;
|
||||||
|
#}
|
||||||
|
#(system('/bin/rpm -q e-smith-email > /dev/null') == 0) ?
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $modul, prx_datas => \%prx_datas );
|
||||||
|
$c->render(template => 'proxy');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $http_proxy_status = $c->param('http_proxy_status') || 'disabled';
|
||||||
|
my $smtp_proxy_status = $c->param('smtp_proxy_status') || '';
|
||||||
|
|
||||||
|
my $result = "";
|
||||||
|
|
||||||
|
my $squid = $db->get('squid') or $result = $c->l('prx_ERR_NO_SQUID_REC');
|
||||||
|
# smtpd is allowed to not exist, as the relevant packages may not be
|
||||||
|
# installed.
|
||||||
|
my $smtpd = $db->get('qpsmtpd') || undef;
|
||||||
|
|
||||||
|
$squid->set_prop('status', $http_proxy_status);
|
||||||
|
$smtpd->set_prop('Proxy', $smtp_proxy_status) if $smtpd;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Update the system
|
||||||
|
#
|
||||||
|
system("/sbin/e-smith/signal-event proxy-update") == 0
|
||||||
|
or $result = $c->l('prx_ERR_PROXY_UPDATE_FAILED');
|
||||||
|
|
||||||
|
my $title = $c->l('prx_TITLE');
|
||||||
|
|
||||||
|
if ( $result eq '' ) { $result = $c->l('prx_SUCCESS'); }
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $result );
|
||||||
|
$c->render(template => 'module');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
406
root/usr/share/smanager/lib/SrvMngr/Controller/Pseudonyms.pm
Normal file
406
root/usr/share/smanager/lib/SrvMngr/Controller/Pseudonyms.pm
Normal file
@ -0,0 +1,406 @@
|
|||||||
|
package SrvMngr::Controller::Pseudonyms;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : User management
|
||||||
|
# description : Pseudonyms
|
||||||
|
# navigation : 2000 210
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
#use Data::Dumper;
|
||||||
|
|
||||||
|
#use esmith::FormMagick::Panel::pseudonyms;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
#use URI::Escape;
|
||||||
|
|
||||||
|
|
||||||
|
our $cdb = esmith::ConfigDB->open || die "Couldn't open configuration db";
|
||||||
|
our $adb = esmith::AccountsDB->open || die "Couldn't open accounts db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %pse_datas = ();
|
||||||
|
my $title = $c->l('pse_FORM_TITLE');
|
||||||
|
my $notif = '';
|
||||||
|
|
||||||
|
$pse_datas{trt} = 'LST';
|
||||||
|
|
||||||
|
my @pseudonyms;
|
||||||
|
if ($adb)
|
||||||
|
{
|
||||||
|
@pseudonyms = $adb->pseudonyms();
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $notif, pse_datas => \%pse_datas, pseudonyms => \@pseudonyms );
|
||||||
|
$c->render(template => 'pseudonyms');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'LST');
|
||||||
|
my $pseudonym = $c->param('pseudonym') || '';
|
||||||
|
|
||||||
|
my $title = $c->l('pse_FORM_TITLE');
|
||||||
|
my %pse_datas = ();
|
||||||
|
$pse_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
#nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' ) {
|
||||||
|
|
||||||
|
my $rec = $adb->get($pseudonym);
|
||||||
|
if ($rec and $rec->prop('type') eq 'pseudonym') {
|
||||||
|
|
||||||
|
$pse_datas{pseudonym} = $pseudonym;
|
||||||
|
$pse_datas{account} = $rec->prop('Account') || '';
|
||||||
|
$pse_datas{internal} = is_pseudonym_internal($pseudonym);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
my $rec = $adb->get($pseudonym);
|
||||||
|
if ($rec and $rec->prop('type') eq 'pseudonym') {
|
||||||
|
|
||||||
|
$pse_datas{pseudonym} = $pseudonym;
|
||||||
|
$pse_datas{account} = $rec->prop('Account') || '';
|
||||||
|
$pse_datas{internal} = is_pseudonym_internal($pseudonym);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'LST' ) {
|
||||||
|
my @pseudonyms;
|
||||||
|
if ($adb) {
|
||||||
|
@pseudonyms = $adb->pseudonyms();
|
||||||
|
}
|
||||||
|
$c->stash( pseudonyms => \@pseudonyms );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, pse_datas => \%pse_datas );
|
||||||
|
$c->render( template => 'pseudonyms' );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'LST');
|
||||||
|
|
||||||
|
my $title = $c->l('pse_FORM_TITLE');
|
||||||
|
my %pse_datas = ();
|
||||||
|
$pse_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
my ($res, $result) = '';
|
||||||
|
|
||||||
|
#my $pseudonym = uri_unescape($c->param('Pseudonym'));
|
||||||
|
my $pseudonym = $c->param('Pseudonym');
|
||||||
|
$pse_datas{'pseudonym'} = $pseudonym;
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
|
||||||
|
my $account = $c->param('Account');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
$res = $c->validate_new_pseudonym_name( $pseudonym, $account );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
#$result .= ' blocked';
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$adb->new_record( $pseudonym, { type => 'pseudonym',
|
||||||
|
Account => $account} )
|
||||||
|
or $result .= "Error occurred while creating pseudonym in database.";
|
||||||
|
# Untaint $pseudonym before use in system()
|
||||||
|
($pseudonym) = ($pseudonym =~ /(.+)/);
|
||||||
|
system( "/sbin/e-smith/signal-event", "pseudonym-create", "$pseudonym",)
|
||||||
|
== 0 or $result .= 'pse_CREATE_ERROR.';
|
||||||
|
}
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = 'OK';
|
||||||
|
$result = $c->l('pse_CREATE_SUCCEEDED') . ' ' . $pseudonym;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' ) {
|
||||||
|
|
||||||
|
my $account = $c->param('Account');
|
||||||
|
my $internal = $c->param ('Internal') || 'NO';
|
||||||
|
my $removable = $adb->get($pseudonym)->prop('Removable') || 'yes';
|
||||||
|
|
||||||
|
my %props = ('Account' => $account);
|
||||||
|
|
||||||
|
if ($removable eq 'yes') {
|
||||||
|
if ($internal eq "YES") { $props{'Visible'} = 'internal'; }
|
||||||
|
else { $adb->get($pseudonym)->delete_prop('Visible'); }
|
||||||
|
}
|
||||||
|
|
||||||
|
# controls
|
||||||
|
#$res = '';
|
||||||
|
#$res = validate_description( $c, $account );
|
||||||
|
#$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
#$result .= 'blocked';
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$adb->get($pseudonym)->merge_props(%props)
|
||||||
|
or $result .= "Error occurred while modifying pseudonym in database.";
|
||||||
|
# Untaint $pseudonym before use in system()
|
||||||
|
($pseudonym) = ($pseudonym =~ /(.+)/);
|
||||||
|
system( "/sbin/e-smith/signal-event", "pseudonym-modify", "$pseudonym",)
|
||||||
|
== 0 or $result .= "Error occurred while modifying pseudonym.";
|
||||||
|
}
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = 'OK';
|
||||||
|
$result = $c->l('pse_MODIFY_SUCCEEDED') . ' ' . $pseudonym;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
# controls
|
||||||
|
$res = '';
|
||||||
|
$res = validate_is_pseudonym($c, $pseudonym);
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
#$result .= 'blocked';
|
||||||
|
|
||||||
|
$res = '';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->delete_pseudonym( $pseudonym );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = 'OK';
|
||||||
|
$result = $c->l('pse_REMOVE_SUCCEEDED') . ' ' . $pseudonym;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# common parts
|
||||||
|
|
||||||
|
if ( $res ne 'OK' ) {
|
||||||
|
$c->stash( error => $result);
|
||||||
|
$c->stash( title => $title, pse_datas => \%pse_datas );
|
||||||
|
return $c->render('pseudonyms');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $message = "'Pseudonyms' updates $trt DONE";
|
||||||
|
$c->app->log->info($message);
|
||||||
|
$c->flash( success => $result );
|
||||||
|
|
||||||
|
$c->redirect_to('/pseudonyms');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub delete_pseudonym {
|
||||||
|
|
||||||
|
my ($c, $pseudonym) = @_;
|
||||||
|
|
||||||
|
my $msg = '';
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# Make the pseudonym inactive, signal pseudonym-delete event
|
||||||
|
# and then delete it
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
my @pseudonyms = $adb->pseudonyms();
|
||||||
|
|
||||||
|
foreach my $p_rec (@pseudonyms) {
|
||||||
|
if ($p_rec->prop("Account") eq $pseudonym) {
|
||||||
|
$adb->get($p_rec->key)->set_prop('type','pseudonym-deleted')
|
||||||
|
or $msg .= "Error occurred while changing pseudonym type.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$adb->get($pseudonym)->set_prop('type','pseudonym-deleted')
|
||||||
|
or $msg .= "Error occurred while changing pseudonym type.";
|
||||||
|
|
||||||
|
# Untaint $pseudonym before use in system()
|
||||||
|
($pseudonym) = ($pseudonym =~ /(.+)/);
|
||||||
|
system( "/sbin/e-smith/signal-event", "pseudonym-delete", "$pseudonym") == 0
|
||||||
|
or $msg .= "Error occurred while removing pseudonym.";
|
||||||
|
|
||||||
|
#TODO: is it ->delete or get()->delete
|
||||||
|
foreach my $p_rec (@pseudonyms) {
|
||||||
|
if ($p_rec->prop("Account") eq $pseudonym) {
|
||||||
|
$adb->get($p_rec->key)->delete()
|
||||||
|
or $msg .= "Error occurred while deleting pseudonym from database.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$adb->get($pseudonym)->delete()
|
||||||
|
or $msg .= "Error occurred while deleting pseudonym from database.";
|
||||||
|
|
||||||
|
return $msg unless $msg;
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sub existing_accounts_list {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my @existingAccounts = ( ['Administrator' => 'admin']);
|
||||||
|
|
||||||
|
foreach my $a ($adb->get_all) {
|
||||||
|
if ($a->prop('type') =~ /(user|group)/) {
|
||||||
|
push @existingAccounts, [ $a->key => $a->key ];
|
||||||
|
}
|
||||||
|
if ($a->prop('type') eq "pseudonym") {
|
||||||
|
my $target = $adb->get($a->prop('Account'));
|
||||||
|
|
||||||
|
unless ($target)
|
||||||
|
{
|
||||||
|
warn "WARNING: pseudonym (" . $a->key . ") => missing Account("
|
||||||
|
. $a->prop('Account') . ")\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
push @existingAccounts, [ $a->key, $a->key ]
|
||||||
|
unless ($target->prop('type') eq "pseudonym");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(\@existingAccounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head2 get_pseudonym_account
|
||||||
|
|
||||||
|
Returns the current Account property for this pseudonym
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub get_pseudonym_account {
|
||||||
|
my $c = shift;
|
||||||
|
my $pseudonym = shift;
|
||||||
|
|
||||||
|
my $a = $adb->get($pseudonym)->prop('Account');
|
||||||
|
if ($a eq "admin") {
|
||||||
|
$a = "Administrator";
|
||||||
|
} elsif ($a eq "shared") {
|
||||||
|
$a = $c->l("EVERYONE");
|
||||||
|
}
|
||||||
|
return($a);
|
||||||
|
}
|
||||||
|
|
||||||
|
=head2 is_pseudonym_not_removable
|
||||||
|
|
||||||
|
Returns 1 if the current Account is not removable, 0 otherwise
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub is_pseudonym_not_removable {
|
||||||
|
my $c = shift;
|
||||||
|
my $pseudonym = shift;
|
||||||
|
|
||||||
|
my $removable = $adb->get($pseudonym)->prop('Removable') || 'yes';
|
||||||
|
return 1 if ($removable eq 'yes');
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
=head2 is_pseudonym_internal
|
||||||
|
|
||||||
|
Returns YES if the current Account property Visible is 'internal'
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub is_pseudonym_internal {
|
||||||
|
# my $c = shift;
|
||||||
|
my $pseudonym = shift;
|
||||||
|
|
||||||
|
my $visible = $adb->get($pseudonym)->prop('Visible') || '';
|
||||||
|
return 'YES' if ($visible eq 'internal');
|
||||||
|
return 'NO';
|
||||||
|
}
|
||||||
|
|
||||||
|
=head2 validate_new_pseudonym_name FM PSEUDONYM
|
||||||
|
|
||||||
|
Returns "OK" if the pseudonym starts with a letter or number and
|
||||||
|
contains only letters, numbers, . - and _ and isn't taken
|
||||||
|
|
||||||
|
Returns "VALID_PSEUDONYM_NAMES" if the name contains invalid chars
|
||||||
|
|
||||||
|
Returns "NAME_IN_USE" if this pseudonym is taken.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub validate_new_pseudonym_name {
|
||||||
|
|
||||||
|
my ($c, $pseudonym, $account) = @_;
|
||||||
|
|
||||||
|
my $acct = $adb->get($pseudonym);
|
||||||
|
|
||||||
|
if (defined $acct) {
|
||||||
|
return($c->l('pse_NAME_IN_USE'));
|
||||||
|
|
||||||
|
} elsif ($pseudonym =~ /@/) {
|
||||||
|
use esmith::DomainsDB;
|
||||||
|
my $ddb = esmith::DomainsDB->open_ro
|
||||||
|
or die "Couldn't open DomainsDB\n";
|
||||||
|
my ($lhs, $rhs) = split /@/, $pseudonym;
|
||||||
|
return ($c->l('pse_PSEUDONYM_INVALID_DOMAIN')) unless ($ddb->get($rhs));
|
||||||
|
return ($c->l('pse_PSEUDONYM_INVALID_SAMEACCT')) if ($lhs eq $account);
|
||||||
|
return ('OK'); # p:' . $pseudonym . ' a:' . $account);
|
||||||
|
|
||||||
|
} elsif ( $pseudonym !~ /^([a-z0-9][a-z0-9\.\-_!#\?~\$\^\+&`%\/\*]*)$/ ) {
|
||||||
|
return($c->l('pse_VALID_PSEUDONYM_NAMES'));
|
||||||
|
} else {
|
||||||
|
return('OK');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head2 validate_is_pseudonym FM NAME
|
||||||
|
|
||||||
|
returns "OK" if it is.
|
||||||
|
returns "NOT_A_PSEUDONYM" if the name in question isn't an existing pseudonym
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub validate_is_pseudonym {
|
||||||
|
my $c = shift;
|
||||||
|
my $pseudonym = shift;
|
||||||
|
|
||||||
|
$pseudonym = $adb->get($pseudonym);
|
||||||
|
return($c->l('pse_NOT_A_PSEUDONYM')) unless $pseudonym;
|
||||||
|
|
||||||
|
my $type = $pseudonym->prop('type');
|
||||||
|
unless (defined $type && ($type eq 'pseudonym') ) {
|
||||||
|
return($c->l('NOT_A_PSEUDONYM'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ('OK');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
152
root/usr/share/smanager/lib/SrvMngr/Controller/Qmailanalog.pm
Normal file
152
root/usr/share/smanager/lib/SrvMngr/Controller/Qmailanalog.pm
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
package SrvMngr::Controller::Qmailanalog;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Investigation
|
||||||
|
# description : Mail log file analysis
|
||||||
|
# navigation : 7000 200
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use esmith::FormMagick qw(gen_locale_date_string);
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('qma_FORM_TITLE');
|
||||||
|
my $modul = $c->render_to_string(inline => $c->l('qma_INITIAL_DESC'));
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $modul );
|
||||||
|
$c->render(template => 'qmailanalog');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $result = "";
|
||||||
|
|
||||||
|
my $report_type = $c->param('report_type');
|
||||||
|
|
||||||
|
if ($report_type =~ /^(\S+)$/)
|
||||||
|
{
|
||||||
|
$report_type = $1;
|
||||||
|
}
|
||||||
|
elsif ($report_type =~ /^\s*$/)
|
||||||
|
{
|
||||||
|
$report_type = "zoverall";
|
||||||
|
} else {
|
||||||
|
$result = $c->l('INVALID_REPORT_TYPE') . $report_type;
|
||||||
|
$report_type = undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $title = $c->l('qma_FORM_TITLE');
|
||||||
|
|
||||||
|
$result = $c->render_to_string(inline => generateReport($c, $report_type)) if $report_type;
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $result );
|
||||||
|
$c->render(template => 'module');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub generateReport {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $report_type = shift;
|
||||||
|
|
||||||
|
my $out = '';
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# Looks good; go ahead and generate the report.
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
# $| = 1;
|
||||||
|
|
||||||
|
my $now_string = $c->gen_locale_date_string();
|
||||||
|
$out .= sprintf("<h3>%s %s </h3>", $c->l('REPORT_GENERATED'), $now_string);
|
||||||
|
|
||||||
|
if ($report_type =~ /^qmail-q/)
|
||||||
|
{
|
||||||
|
open(QMAILQUEUEREPORT, "/var/qmail/bin/$report_type |");
|
||||||
|
|
||||||
|
$out .= sprintf "<pre>";
|
||||||
|
|
||||||
|
while (<QMAILQUEUEREPORT>)
|
||||||
|
{
|
||||||
|
$out .= sprintf("%s", $_);
|
||||||
|
}
|
||||||
|
|
||||||
|
close QMAILQUEUEREPORT;
|
||||||
|
$out .= sprintf "</pre>";
|
||||||
|
|
||||||
|
$out .= sprintf("<h3>%s</h3>", $c->l('END_OF_REPORT'));
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
chdir "/var/log/qmail";
|
||||||
|
|
||||||
|
open(QMAILANALOG,
|
||||||
|
"/bin/cat \@* current 2>/dev/null"
|
||||||
|
. "| /usr/local/bin/tai64nunix"
|
||||||
|
. "| /usr/local/qmailanalog/bin/matchup 5>/dev/null"
|
||||||
|
. "| /usr/local/qmailanalog/bin/$report_type |"
|
||||||
|
);
|
||||||
|
|
||||||
|
$out .= sprintf "<pre>";
|
||||||
|
|
||||||
|
while (<QMAILANALOG>)
|
||||||
|
{
|
||||||
|
# Cook any special HTML characters
|
||||||
|
|
||||||
|
s/\&/\&/g;
|
||||||
|
s/\"/\"/g;
|
||||||
|
s/\>/\>/g;
|
||||||
|
s/\</\</g;
|
||||||
|
|
||||||
|
$out .= sprintf("%s", $_);
|
||||||
|
}
|
||||||
|
|
||||||
|
close QMAILANALOG;
|
||||||
|
$out .= sprintf "</pre>";
|
||||||
|
|
||||||
|
|
||||||
|
$out .= sprintf("<h3>%s</h3>", $c->l('END_OF_REPORT'));
|
||||||
|
return $out;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub reportType_list {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my @array = (
|
||||||
|
# [ $c->l('qma_LIST_OUTGOING') => 'qmail-qread' ],
|
||||||
|
# [ $c->l('qma_SUMMARIZE_QUEUE') => 'qmail-qstat' ],
|
||||||
|
[ $c->l('qma_SUCCESSFUL_DELIVERY_DELAY') => 'zddist' ],
|
||||||
|
[ $c->l('qma_REASONS_DEFERRAL') => 'zdeferrals' ],
|
||||||
|
[ $c->l('qma_REASONS_FAILURE') => 'zfailures' ],
|
||||||
|
[ $c->l('qma_BASIC_STATS') => 'zoverall' ],
|
||||||
|
[ $c->l('qma_RECIP_STATS') => 'zrecipients' ],
|
||||||
|
[ $c->l('qma_RECIP_HOSTS') => 'zrhosts' ],
|
||||||
|
[ $c->l('qma_RECIP_ORDERED') => 'zrxdelay' ],
|
||||||
|
[ $c->l('qma_SENDER_STATS') => 'zsenders' ],
|
||||||
|
[ $c->l('qma_SENDMAIL_STYLE') => 'zsendmail' ],
|
||||||
|
[ $c->l('qma_REASONS_SUCCESS') => 'zsuccesses' ],
|
||||||
|
[ $c->l('qma_SENDER_UIDS') => 'zsuids' ]
|
||||||
|
);
|
||||||
|
my @sorted_array = sort { $a->[0] cmp $b->[0] } @array;
|
||||||
|
return \@sorted_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
193
root/usr/share/smanager/lib/SrvMngr/Controller/Quota.pm
Normal file
193
root/usr/share/smanager/lib/SrvMngr/Controller/Quota.pm
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
package SrvMngr::Controller::Quota;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : User management
|
||||||
|
# description : Quotas
|
||||||
|
# navigation : 2000 300
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use esmith::FormMagick::Panel::quota;
|
||||||
|
|
||||||
|
#use esmith::TestUtils;
|
||||||
|
use Scalar::Util qw(looks_like_number);
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
#our $db = esmith::ConfigDB->open || die "Couldn't open config db";
|
||||||
|
our $adb = esmith::AccountsDB->open || die "Couldn't open accounts db";
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %quo_datas = ();
|
||||||
|
my $title = $c->l('quo_FORM_TITLE');
|
||||||
|
|
||||||
|
$quo_datas{'trt'} = 'LIST';
|
||||||
|
|
||||||
|
my @userAccounts;
|
||||||
|
if ($adb) {
|
||||||
|
@userAccounts = $adb->users();
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, quo_datas => \%quo_datas, userAccounts => \@userAccounts );
|
||||||
|
$c->render(template => 'quota');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'LIST');
|
||||||
|
my $user = $c->param('user') || '';
|
||||||
|
|
||||||
|
$trt = 'UPD' if ( $user );
|
||||||
|
|
||||||
|
my %quo_datas = ();
|
||||||
|
my $title = $c->l('quo_FORM_TITLE');
|
||||||
|
|
||||||
|
$quo_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' ) {
|
||||||
|
|
||||||
|
my $rec = $adb->get($user);
|
||||||
|
if ($rec and $rec->prop('type') eq 'user') {
|
||||||
|
$quo_datas{user} = $user;
|
||||||
|
$quo_datas{userRec} = $rec;
|
||||||
|
my $max = esmith::FormMagick::Panel::quota->toBestUnit($rec->prop('MaxBlocks'));
|
||||||
|
$quo_datas{hardlim} = $max;
|
||||||
|
$max = esmith::FormMagick::Panel::quota->toBestUnit($rec->prop('MaxBlocksSoftLim'));
|
||||||
|
$quo_datas{softlim} = $max;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, quo_datas => \%quo_datas );
|
||||||
|
$c->render( template => 'quota' );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('quo_FORM_TITLE');
|
||||||
|
my %quo_datas = ();
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'LIST');
|
||||||
|
|
||||||
|
$quo_datas{trt} = $trt;
|
||||||
|
my $result = '';
|
||||||
|
my $res;
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' ) {
|
||||||
|
|
||||||
|
$quo_datas{user} = ($c->param('user') || '');
|
||||||
|
$quo_datas{softlim} = ($c->param('Soft') || '');
|
||||||
|
$quo_datas{hardlim} = ($c->param('Hard') || '');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
$res = validate_quota( $c, $quo_datas{user}, $quo_datas{softlim}, $quo_datas{hardlim} );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('quo_SUCCESSFULLY_MODIFIED') . ' ' . $quo_datas{user};
|
||||||
|
} else {
|
||||||
|
$quo_datas{userRec} = $adb->get($quo_datas{user}) || undef;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# common parts
|
||||||
|
|
||||||
|
if ($res ne 'OK') {
|
||||||
|
$c->stash( error => $result );
|
||||||
|
$c->stash( title => $title, quo_datas => \%quo_datas );
|
||||||
|
return $c->render('quota');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $message = "'Quota' updates ($trt) DONE";
|
||||||
|
$c->app->log->info($message);
|
||||||
|
$c->flash( success => $result );
|
||||||
|
|
||||||
|
$c->redirect_to('/quota');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_quota {
|
||||||
|
my ($c, $acct, $softlim, $hardlim ) = @_;
|
||||||
|
my $msg;
|
||||||
|
|
||||||
|
my $rec = $adb->get($acct);
|
||||||
|
return $c->l('quo_ERR_NO_SUCH_ACCT') . ' : ' . $acct unless (defined $rec);
|
||||||
|
|
||||||
|
my $type = $rec->prop('type');
|
||||||
|
unless ($type eq "user") {
|
||||||
|
$msg = $c->l('quo_ERR_NOT_A_USER_ACCT').$acct.$c->l('quo_ACCOUNT_IS_TYPE').$type;
|
||||||
|
return $msg;
|
||||||
|
}
|
||||||
|
my $uid = getpwnam($acct);
|
||||||
|
return $c->l('COULD_NOT_GET_UID').$acct unless ($uid);
|
||||||
|
|
||||||
|
if (($softlim !~ /^(.+?)\s*([KMGT])?$/ ) || (!looks_like_number ($1))) {
|
||||||
|
return $c->l('quo_SOFT_VAL_MUST_BE_NUMBER');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $exponent = 1; # Entries with no suffix are assumed to be in megabytes.
|
||||||
|
if (defined ($2)) {
|
||||||
|
$exponent = index("KMGT",$2);
|
||||||
|
}
|
||||||
|
$softlim = ($1 * 1024 ** $exponent);
|
||||||
|
|
||||||
|
if (($hardlim !~ /^(.+?)\s*([KMGT])?$/ ) || (!looks_like_number ($1))) {
|
||||||
|
return $c->l('quo_HARD_VAL_MUST_BE_NUMBER');
|
||||||
|
}
|
||||||
|
$exponent = 1; # Entries with no suffix are assumed to be in megabytes.
|
||||||
|
if (defined ($2))
|
||||||
|
{
|
||||||
|
$exponent = index("KMGT",$2);
|
||||||
|
}
|
||||||
|
$hardlim = ($1 * 1024 ** $exponent);
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# Make sure that soft limit is less than hard limit.
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
unless ($hardlim == 0 or $hardlim > $softlim) {
|
||||||
|
return $c->l('quo_ERR_HARD_LT_SOFT');
|
||||||
|
}
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# Update accounts database and signal the user-modify event.
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
$rec->set_prop('MaxBlocks', $hardlim);
|
||||||
|
$rec->set_prop('MaxBlocksSoftLim', $softlim);
|
||||||
|
|
||||||
|
# Untaint $acct before using in system().
|
||||||
|
$acct =~ /^(\w[\-\w_\.]*)$/; $acct = $1;
|
||||||
|
system ("/sbin/e-smith/signal-event", "user-modify", "$acct") == 0
|
||||||
|
or die ($c->l('quo_ERR_MODIFYING')."\n");
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1
|
87
root/usr/share/smanager/lib/SrvMngr/Controller/Reboot.pm
Normal file
87
root/usr/share/smanager/lib/SrvMngr/Controller/Reboot.pm
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
package SrvMngr::Controller::Reboot;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : System
|
||||||
|
# description : Reboot or shutdown
|
||||||
|
# navigation : 4000 700
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('rbo_FORM_TITLE');
|
||||||
|
my $modul = '';
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $modul );
|
||||||
|
$c->render(template => 'reboot');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_action {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('rbo_FORM_TITLE');
|
||||||
|
my $result = "";
|
||||||
|
|
||||||
|
my $function = $c->param ('function');
|
||||||
|
|
||||||
|
my $debug = $c->param('debug');
|
||||||
|
|
||||||
|
if ($function eq "reboot") {
|
||||||
|
$result = $c->l('rbo_REBOOT_SUCCEEDED') . '<br>' . $c->l('rbo_DESC_REBOOT');
|
||||||
|
unless ($debug) {
|
||||||
|
esmith::util::backgroundCommand( 1, "/sbin/e-smith/signal-event", "reboot" );
|
||||||
|
# system( "/sbin/e-smith/signal-event", "reboot" ) == 0
|
||||||
|
# or die ("Error occurred while rebooting.\n");
|
||||||
|
}
|
||||||
|
} elsif ($function eq 'shutdown') {
|
||||||
|
$result = $c->l('rbo_SHUTDOWN_SUCCEEDED') . '<br>' . $c->l('rbo_DESC_SHUTDOWN');
|
||||||
|
unless ($debug) {
|
||||||
|
esmith::util::backgroundCommand( 1, "/sbin/e-smith/signal-event", "halt" );
|
||||||
|
# system( "/sbin/e-smith/signal-event", "halt" ) == 0
|
||||||
|
# or die ("Error occurred while halting.\n");
|
||||||
|
}
|
||||||
|
} elsif ($function eq 'reconfigure') {
|
||||||
|
$result = $c->l('rbo_RECONFIGURE_SUCCEEDED') . '<br>' . $c->l('rbo_DESC_RECONFIGURE');
|
||||||
|
unless ($debug) {
|
||||||
|
# esmith::util::backgroundCommand( 1, "/sbin/e-smith/signal-event", "post-upgrade",
|
||||||
|
# "; ", "/sbin/e-smith/signal-event", "reboot" );
|
||||||
|
system( "/sbin/e-smith/signal-event", "post-upgrade" ) == 0
|
||||||
|
or die ("Error occurred while running post-upgrade.\n");
|
||||||
|
system( "/sbin/e-smith/signal-event", "reboot" ) == 0
|
||||||
|
or die ("Error occurred while rebooting.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $result );
|
||||||
|
$c->render(template => 'module');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub rebootFunction_list {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
return [[ $c->l('rbo_REBOOT') => 'reboot' ],
|
||||||
|
[ $c->l('RECONFIGURE') => 'reconfigure' ],
|
||||||
|
[ $c->l('SHUTDOWN') => 'shutdown' ]];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
505
root/usr/share/smanager/lib/SrvMngr/Controller/Remoteaccess.pm
Normal file
505
root/usr/share/smanager/lib/SrvMngr/Controller/Remoteaccess.pm
Normal file
@ -0,0 +1,505 @@
|
|||||||
|
package SrvMngr::Controller::Remoteaccess;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Network
|
||||||
|
# description : Remote access
|
||||||
|
# navigation : 6000 400
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session ip_number subnet_mask get_reg_mask);
|
||||||
|
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
use esmith::util;
|
||||||
|
use File::Basename;
|
||||||
|
use Exporter;
|
||||||
|
use Carp;
|
||||||
|
use Socket qw( inet_aton );
|
||||||
|
|
||||||
|
#our @ISA = qw(esmith::FormMagick Exporter);
|
||||||
|
|
||||||
|
our @EXPORT = qw( networkAccess_list passwordLogin_list get_ssh_permit_root_login get_ssh_access get_telnet_mode
|
||||||
|
get_ftp_access get_ftp_password_login_access
|
||||||
|
get_value get_prop get_ssh_password_auth
|
||||||
|
validate_network_and_mask ip_number_or_blank subnet_mask_or_blank
|
||||||
|
get_ipsecrw_sessions pptp_and_dhcp_range
|
||||||
|
);
|
||||||
|
# get_pptp_sessions
|
||||||
|
|
||||||
|
our $db = esmith::ConfigDB->open || warn "Couldn't open configuration database";
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('rma_FORM_TITLE');
|
||||||
|
my $notif = '';
|
||||||
|
my %rma_datas = ();
|
||||||
|
|
||||||
|
#$rma_datas{ipsecrwSess} = $c->get_ipsecrw_sessions();
|
||||||
|
#$rma_datas{pptpSessions} = $c->get_pptp_sessions();
|
||||||
|
$rma_datas{sshAccess} = $c->get_ssh_access();
|
||||||
|
$rma_datas{sshPermitRootLogin} = $c->get_ssh_permit_root_login();
|
||||||
|
$rma_datas{sshPasswordAuthentication} = $c->get_ssh_password_auth();
|
||||||
|
$rma_datas{sshTCPPort} = $c->get_ssh_port();
|
||||||
|
$rma_datas{ftpAccess} = $c->get_ftp_access();
|
||||||
|
$rma_datas{ftpPasswordAccess} = $c->get_ftp_password_login_access();
|
||||||
|
#$rma_datas{telnetAccess} = $c->get_telnet_access;
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $notif, rma_datas => \%rma_datas );
|
||||||
|
$c->render(template => 'remoteaccess');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_action {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('rma_FORM_TITLE');
|
||||||
|
my ($result, $res, $trt) = '';
|
||||||
|
my %rma_datas = ();
|
||||||
|
|
||||||
|
$rma_datas{ipsecrwSess} = ($c->param ('IpsecrwSess') || '');
|
||||||
|
$rma_datas{ipsecrwReset} = ($c->param ('IpsecrwReset') || '');
|
||||||
|
|
||||||
|
#$rma_datas{pptpSessions} = ($c->param ('PptpSessions') || '0');
|
||||||
|
|
||||||
|
$rma_datas{validFromNetwork} = ($c->param ('ValidFromNetwork') || '');
|
||||||
|
$rma_datas{validFromMask} = ($c->param ('ValidFromMask') || '');
|
||||||
|
## my @remove = $q->param('validFromRemove'); ???????? the first one only !!
|
||||||
|
my @vals = $c->param ('Remove_nets');
|
||||||
|
$rma_datas{remove_nets} = join ',', @vals;
|
||||||
|
|
||||||
|
$rma_datas{sshaccess} = ($c->param ('SshAccess') || 'off');
|
||||||
|
$rma_datas{sshPermitRootLogin} = ($c->param ('SshPermitRootLogin') || 'no');
|
||||||
|
$rma_datas{sshPasswordAuthentication} = ($c->param ('SshPasswordAuthentication') || 'no');
|
||||||
|
$rma_datas{sshTCPPort} = ($c->param ('SshTCPPort') || '22');
|
||||||
|
|
||||||
|
$rma_datas{ftpAccess} = ($c->param ('FtpAccess') || 'off');
|
||||||
|
$rma_datas{ftpPasswordAccess} = ($c->param ('FtpPasswordAccess') || 'private');
|
||||||
|
|
||||||
|
$rma_datas{telnetAccess} = ($c->param ('TelnetAccess') || 'off');
|
||||||
|
|
||||||
|
# validate
|
||||||
|
my $v = $c->validation;
|
||||||
|
return $c->render('remoteaccess') unless $v->has_data;
|
||||||
|
|
||||||
|
#$v->optional('PptpSessions')->num(0, 999)->is_valid;
|
||||||
|
$v->optional('ValidFromNetwork')->size(7, 15)->is_valid;
|
||||||
|
$v->optional('ValidFromMask')->size(7, 15)->is_valid;
|
||||||
|
$v->required('SshTCPPort')->num(1, 65535)->is_valid;
|
||||||
|
|
||||||
|
$result .= 'field validation error' if $v->has_error;
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
|
||||||
|
# controls
|
||||||
|
#$res = pptp_and_dhcp_range( $c, $rma_datas{pptpSessions} );
|
||||||
|
#$result .= $res . ' ' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = ip_number_or_blank( $c, $rma_datas{validFromNetwork} );
|
||||||
|
$result .= $res . ' ' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = subnet_mask_or_blank( $c, $rma_datas{validFromMask} );
|
||||||
|
$result .= $res . ' ' unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = validate_network_and_mask( $c, $rma_datas{validFromNetwork}, $rma_datas{validFromMask} );
|
||||||
|
$result .= $res . ' ' unless $res eq 'OK';
|
||||||
|
|
||||||
|
#$result .= ' blocked for testing !' . $rma_datas{remove_nets};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = change_settings( $c, %rma_datas );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('rma_ACTION_SUCCEEDED');
|
||||||
|
$trt = 'SUC';
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $result, rma_datas => \%rma_datas );
|
||||||
|
|
||||||
|
if ( $trt ne 'SUC' ) {
|
||||||
|
return $c->render(template => 'remoteaccess');
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->redirect_to('/remoteaccess');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub networkAccess_list {
|
||||||
|
my $c = shift;
|
||||||
|
return [[ $c->l('rma_NO_ACCESS') => 'off'],
|
||||||
|
[ $c->l('NETWORKS_ALLOW_LOCAL') => 'private'],
|
||||||
|
[ $c->l('NETWORKS_ALLOW_PUBLIC') => 'public']];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub passwordLogin_list {
|
||||||
|
my $c = shift;
|
||||||
|
return [[$c->l('rma_PASSWORD_LOGIN_PRIVATE') => 'private'],
|
||||||
|
[$c->l('rma_PASSWORD_LOGIN_PUBLIC') => 'public']];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_prop {
|
||||||
|
|
||||||
|
my ($c, $item, $prop) = @_;
|
||||||
|
warn "You must specify a record key" unless $item;
|
||||||
|
warn "You must specify a property name" unless $prop;
|
||||||
|
my $record = $db->get($item) or warn "Couldn't get record for $item";
|
||||||
|
return $record ? $record->prop($prop) : undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_value {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $item = shift;
|
||||||
|
return ($db->get($item)->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_ftp_access {
|
||||||
|
|
||||||
|
my $status = get_prop('','ftp','status') || 'disabled';
|
||||||
|
return 'off' unless $status eq 'enabled';
|
||||||
|
|
||||||
|
my $access = get_prop('','ftp','access') || 'private';
|
||||||
|
return ($access eq 'public') ? 'normal' : 'private';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#sub get_pptp_sessions {
|
||||||
|
# my $status = get_prop('','pptpd','status');
|
||||||
|
# if (defined($status) && ($status eq 'enabled')) {
|
||||||
|
# return(get_prop('','pptpd','sessions') || 'no');
|
||||||
|
# return '0';
|
||||||
|
#}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_ssh_permit_root_login {
|
||||||
|
return(get_prop('','sshd','PermitRootLogin') || 'no');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_ssh_password_auth {
|
||||||
|
return(get_prop('','sshd','PasswordAuthentication') || 'yes');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_ssh_access {
|
||||||
|
|
||||||
|
my $status = get_prop('','sshd','status');
|
||||||
|
if (defined($status) && ($status eq 'enabled')) {
|
||||||
|
my $access = get_prop('','sshd','access');
|
||||||
|
$access = ($access eq 'public') ? 'public' : 'private';
|
||||||
|
return($access);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return('off');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_ssh_port {
|
||||||
|
return(get_prop('$c','sshd','TCPPort') || '22');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_ftp_password_login_access {
|
||||||
|
|
||||||
|
my $status = get_prop('','ftp','status') || 'disabled';
|
||||||
|
return 'private' unless $status eq 'enabled';
|
||||||
|
|
||||||
|
my $access = get_prop('','ftp','LoginAccess') || 'private';
|
||||||
|
|
||||||
|
return ($access eq 'public') ? 'public' : 'private';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_telnet_mode {
|
||||||
|
|
||||||
|
my $telnet = $db->get('telnet');
|
||||||
|
return('off') unless $telnet;
|
||||||
|
my $status = $telnet->prop('status') || 'disabled';
|
||||||
|
return('off') unless $status eq 'enabled';
|
||||||
|
my $access = $telnet->prop('access') || 'private';
|
||||||
|
return ($access eq "public") ? "public" : "private";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_ipsecrw_sessions {
|
||||||
|
|
||||||
|
my $status = $db->get('ipsec')->prop('RoadWarriorStatus');
|
||||||
|
if (defined($status) && ($status eq 'enabled')) {
|
||||||
|
return($db->get('ipsec')->prop('RoadWarriorSessions') || '0');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return('0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_ipsecrw_status {
|
||||||
|
|
||||||
|
return undef unless ( $db->get('ipsec'));
|
||||||
|
return $db->get('ipsec')->prop('RoadWarriorStatus');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub pptp_and_dhcp_range {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $val = shift || 0;
|
||||||
|
my $dhcp_status = $db->get_prop('dhcpd','status') || 'disabled';
|
||||||
|
my $dhcp_end = $db->get_prop('dhcpd','end') || '';
|
||||||
|
my $dhcp_start = $db->get_prop('dhcpd','start') || '';
|
||||||
|
|
||||||
|
if ( $dhcp_status eq 'enabled' ) {
|
||||||
|
my $ip_start = unpack 'N', inet_aton($dhcp_start);
|
||||||
|
my $ip_end = unpack 'N', inet_aton($dhcp_end);
|
||||||
|
my $ip_count = $ip_end - $ip_start;
|
||||||
|
return 'OK' if( $val < $ip_count );
|
||||||
|
return $c->l('rma_NUMBER_OF_PPTP_CLIENTS_MUST_BE_LESSER_THAN_NUMBER_OF_IP_IN_DHCP_RANGE');
|
||||||
|
} else {
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub _get_valid_from {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $rec = $db->get('httpd-admin');
|
||||||
|
return undef unless($rec);
|
||||||
|
my @vals = (split ',', ($rec->prop('ValidFrom') || ''));
|
||||||
|
return @vals;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub ip_number_or_blank {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $ip = shift;
|
||||||
|
|
||||||
|
if (!defined($ip) || $ip eq "") {
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
return ip_number($c, $ip);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub subnet_mask_or_blank {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $mask = shift;
|
||||||
|
|
||||||
|
if (!defined($mask) || $mask eq "") {
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
chomp $mask ;
|
||||||
|
|
||||||
|
return ( subnet_mask( $mask ) ne 'OK' ) ? $c->l('rma_INVALID_SUBNET_MASK') . " (" . $mask . ")" : 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_network_and_mask {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $net = shift || "";
|
||||||
|
my $mask = shift || "";
|
||||||
|
|
||||||
|
if ($net xor $mask) {
|
||||||
|
return $c->l('rma_ERR_INVALID_PARAMS' . " (" . $net."/".$mask . ")");
|
||||||
|
}
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub change_settings {
|
||||||
|
|
||||||
|
my ($c, %rma_datas) = @_;
|
||||||
|
|
||||||
|
#------------------------------------------------------------
|
||||||
|
# good; go ahead and change the access.
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
my $rec = $db->get('telnet');
|
||||||
|
if($rec) {
|
||||||
|
if ($rma_datas{telnetAccess} eq "off") {
|
||||||
|
$rec->set_prop('status','disabled');
|
||||||
|
} else {
|
||||||
|
$rec->set_prop('status','enabled');
|
||||||
|
$rec->set_prop('access', $rma_datas{telnetAccess});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$rec = $db->get('sshd') || $db->new_record('sshd', {type => 'service'});
|
||||||
|
$rec->set_prop('TCPPort', $rma_datas{sshTCPPort});
|
||||||
|
$rec->set_prop('status', ( $rma_datas{sshaccess} eq "off" ? 'disabled' : 'enabled'));
|
||||||
|
$rec->set_prop('access', $rma_datas{sshaccess});
|
||||||
|
$rec->set_prop('PermitRootLogin', $rma_datas{sshPermitRootLogin});
|
||||||
|
$rec->set_prop('PasswordAuthentication', $rma_datas{sshPasswordAuthentication});
|
||||||
|
|
||||||
|
|
||||||
|
$rec = $db->get('ftp');
|
||||||
|
if($rec) {
|
||||||
|
if ($rma_datas{ftpAccess} eq "off") {
|
||||||
|
$rec->set_prop('status', 'disabled');
|
||||||
|
$rec->set_prop('access', 'private');
|
||||||
|
$rec->set_prop('LoginAccess', 'private');
|
||||||
|
} elsif ($rma_datas{ftpAccess} eq "normal") {
|
||||||
|
$rec->set_prop('status', 'enabled');
|
||||||
|
$rec->set_prop('access', 'public');
|
||||||
|
$rec->set_prop('LoginAccess', $rma_datas{ftpPasswordAccess});
|
||||||
|
} else {
|
||||||
|
$rec->set_prop('status', 'enabled');
|
||||||
|
$rec->set_prop('access', 'private');
|
||||||
|
$rec->set_prop('LoginAccess', $rma_datas{ftpPasswordAccess});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# if ($rma_datas{pptpSessions} == 0) {
|
||||||
|
# $db->get('pptpd')->set_prop('status', 'disabled');
|
||||||
|
# } else {
|
||||||
|
# $db->get('pptpd')->set_prop('status', 'enabled');
|
||||||
|
# $db->get('pptpd')->set_prop('sessions', $rma_datas{pptpSessions});
|
||||||
|
# }
|
||||||
|
|
||||||
|
if ( $rma_datas{validFromNetwork} && $rma_datas{validFromMask} ) {
|
||||||
|
unless (add_new_valid_from( $c, $rma_datas{validFromNetwork}, $rma_datas{validFromMask} )) {
|
||||||
|
return $c->l('rma_ERROR_UPDATING_CONFIGURATION') . 'new net';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $rma_datas{remove_nets} ) {
|
||||||
|
unless (remove_valid_from( $c, $rma_datas{remove_nets} )) {
|
||||||
|
return $c->l('rma_ERROR_UPDATING_CONFIGURATION') . 'del net';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# reset ipsec roadwarrior CA,server,client certificates
|
||||||
|
if ($rma_datas{ipsecrwReset}) {
|
||||||
|
system('/sbin/e-smith/roadwarrior', 'reset_certs') == 0 or
|
||||||
|
return $c->l('rma_ERROR_UPDATING_CONFIGURATION') . 'rst ipsec';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $rma_datas{ipsecrwSess} ) {
|
||||||
|
set_ipsecrw_sessions( $c, $rma_datas{ipsecrwSess} );
|
||||||
|
}
|
||||||
|
|
||||||
|
unless ( system( "/sbin/e-smith/signal-event", "remoteaccess-update" ) == 0 ) {
|
||||||
|
return $c->l('rma_ERROR_UPDATING_CONFIGURATION');
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub set_ipsecrw_sessions {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $sessions = shift;
|
||||||
|
|
||||||
|
if (defined $sessions) {
|
||||||
|
$db->get('ipsec')->set_prop('RoadWarriorSessions', $sessions);
|
||||||
|
if (int($sessions) > 0) {
|
||||||
|
$db->get('ipsec')->set_prop('RoadWarriorStatus', 'enabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub add_new_valid_from {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $net = shift;
|
||||||
|
my $mask = shift;
|
||||||
|
|
||||||
|
# we transform bit mask to regular mask
|
||||||
|
$mask = get_reg_mask( $net, $mask );
|
||||||
|
|
||||||
|
my $rec = $db->get('httpd-admin');
|
||||||
|
return $c->error('ERR_NO_RECORD') unless $rec;
|
||||||
|
|
||||||
|
my $prop = $rec->prop('ValidFrom') || '';
|
||||||
|
|
||||||
|
my @vals = split /,/, $prop;
|
||||||
|
return '' if (grep /^$net\/$mask$/, @vals); # already have this entry
|
||||||
|
|
||||||
|
if ($prop ne '') {
|
||||||
|
$prop .= ",$net/$mask";
|
||||||
|
} else {
|
||||||
|
$prop = "$net/$mask";
|
||||||
|
}
|
||||||
|
|
||||||
|
$rec->set_prop('ValidFrom', $prop);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub remove_valid_from {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $remove_nets = shift;
|
||||||
|
|
||||||
|
my @remove = split /,/, $remove_nets;
|
||||||
|
|
||||||
|
# my @remove = $c->param('Remove_nets');
|
||||||
|
my @vals = $c->_get_valid_from();
|
||||||
|
|
||||||
|
foreach my $entry (@remove) {
|
||||||
|
|
||||||
|
return undef unless $entry;
|
||||||
|
|
||||||
|
my ($net, $mask) = split (/\//, $entry);
|
||||||
|
|
||||||
|
unless (@vals) {
|
||||||
|
print STDERR "ERROR: unable to load ValidFrom property from conf db\n";
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
# what if we don't have a mask because someone added an entry from
|
||||||
|
# the command line? by the time we get here, the panel will have
|
||||||
|
# added a 32 bit mask, so we don't know for sure if the value in db
|
||||||
|
# is $net alone or $net/255.255.255.255. we have to check for both
|
||||||
|
# in this special case...
|
||||||
|
@vals = (grep { $entry ne $_ && $net ne $_ } @vals);
|
||||||
|
}
|
||||||
|
|
||||||
|
my $prop;
|
||||||
|
if (@vals) {
|
||||||
|
$prop = join ',',@vals;
|
||||||
|
} else {
|
||||||
|
$prop = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->get('httpd-admin')->set_prop('ValidFrom', $prop);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
56
root/usr/share/smanager/lib/SrvMngr/Controller/Request.pm
Normal file
56
root/usr/share/smanager/lib/SrvMngr/Controller/Request.pm
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package SrvMngr::Controller::Request;
|
||||||
|
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
# retrieve a configuration db record
|
||||||
|
sub getconfig {
|
||||||
|
my $c = shift;
|
||||||
|
my $key = $c->param('key');
|
||||||
|
|
||||||
|
$c->app->log->info($c->log_req . ' ' . $key);
|
||||||
|
|
||||||
|
if ($key) {
|
||||||
|
use esmith::ConfigDB qw(open_ro);
|
||||||
|
my $cdb = esmith::ConfigDB->open_ro;
|
||||||
|
return getdb( $c, $cdb, $key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# retrieve an accounts db record, given its name
|
||||||
|
sub getaccount {
|
||||||
|
my $c = shift;
|
||||||
|
my $key = $c->param('key');
|
||||||
|
|
||||||
|
$c->app->log->info($c->log_req . ' ' . $key);
|
||||||
|
|
||||||
|
if ($key) {
|
||||||
|
use esmith::AccountsDB qw(open_ro);
|
||||||
|
my $adb = esmith::AccountsDB->open_ro;
|
||||||
|
return getdb( $c, $adb, $key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub getdb {
|
||||||
|
|
||||||
|
my ($c, $db, $key) = @_;
|
||||||
|
|
||||||
|
if ( my $rec = $db->get($key) ) {
|
||||||
|
return $c->render(json => { $key => { $rec->props }} );
|
||||||
|
}
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
235
root/usr/share/smanager/lib/SrvMngr/Controller/Review.pm
Normal file
235
root/usr/share/smanager/lib/SrvMngr/Controller/Review.pm
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
package SrvMngr::Controller::Review;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Support
|
||||||
|
# description : Review configuration
|
||||||
|
# navigation : 000 500
|
||||||
|
# menu : N
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading-o : Configuration
|
||||||
|
# description-o : Review configuration
|
||||||
|
# navigation-o : 6000 6800
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
#use SrvMngr::Review_sub qw(print_page);
|
||||||
|
#use smeserver::Panel::review;
|
||||||
|
use esmith::FormMagick::Panel::review;
|
||||||
|
|
||||||
|
our $db = esmith::ConfigDB->open_ro || die "Couldn't open config db";
|
||||||
|
our $domains = esmith::DomainsDB->open_ro || die "Couldn't open domains";
|
||||||
|
our $networks = esmith::NetworksDB->open_ro || die "Couldn't open networks";
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('rvw_FORM_TITLE');
|
||||||
|
my $modul = $c->render_to_string(inline => $c->l('rvw_DESCRIPTION'));
|
||||||
|
my %rvw_datas = ();
|
||||||
|
|
||||||
|
$rvw_datas{'servermode'} = (get_value('','SystemMode' )|| '');
|
||||||
|
$rvw_datas{'localip'} = get_value('$c','LocalIP' )
|
||||||
|
.'/'.get_value('$c','LocalNetmask');
|
||||||
|
$rvw_datas{'publicip'} =
|
||||||
|
esmith::FormMagick::Panel::review->get_public_ip_address($c);
|
||||||
|
$rvw_datas{'gateway'} =
|
||||||
|
$c->render_to_string(inline => print2_gateway_stanza($c));
|
||||||
|
$rvw_datas{'serveronly'} =
|
||||||
|
$c->render_to_string(inline => print2_serveronly_stanza($c));
|
||||||
|
$rvw_datas{'addlocalnetworks'} = get_local_networks($c);
|
||||||
|
$rvw_datas{'dhcpserver'} =
|
||||||
|
$c->render_to_string(inline => print2_dhcp_stanza($c));
|
||||||
|
|
||||||
|
$rvw_datas{'dnsserver'} = (get_value('','LocalIP' )|| '');
|
||||||
|
$rvw_datas{'webserver'} = 'www.'.(get_local_domain());
|
||||||
|
my $port = $db->get_prop("squid", "TransparentPort") || 3128;
|
||||||
|
$rvw_datas{'proxyserver'} = 'proxy.'.get_local_domain().":$port";
|
||||||
|
$rvw_datas{'ftpserver'} = 'ftp.'.get_local_domain();
|
||||||
|
$rvw_datas{'smtpserver'} = 'mail.'.get_local_domain();
|
||||||
|
|
||||||
|
$rvw_datas{'domainname'} = (get_value('','DomainName' )|| '');
|
||||||
|
$rvw_datas{'virtualdomains'} =
|
||||||
|
$c->render_to_string(inline => gen2_domains($c));
|
||||||
|
$rvw_datas{'primarywebsite'} = 'http://www.'.get_value('','DomainName');
|
||||||
|
$rvw_datas{'servermanager'} = 'https://'. (get_value('','SystemName') || 'localhost').'/server-manager/';
|
||||||
|
$rvw_datas{'usermanager'} = 'https://'. (get_value('','SystemName') || 'localhost').'/user-password/';
|
||||||
|
$rvw_datas{'emailaddresses'} =
|
||||||
|
$c->render_to_string(inline => gen2_email_addresses($c));
|
||||||
|
|
||||||
|
#$c->stash( releaseVersion => $c->session->{releaseVersion}, copyRight => $c->session->{copyRight},
|
||||||
|
#PwdSet => $c->session->{PwdSet}, Unsafe => $c->session->{Unsafe},
|
||||||
|
$c->stash( title => $title, modul => $modul, rvw_datas => \%rvw_datas,
|
||||||
|
);
|
||||||
|
|
||||||
|
$c->render(template => 'review');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head2 gen2_email_addresses
|
||||||
|
|
||||||
|
Returns a string of the various forms of email addresses that work
|
||||||
|
on an SMEServer (mojo v.)
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub gen2_email_addresses {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $domain = get_value($c,'DomainName');
|
||||||
|
my $useraccount = $c->l("rvw_EMAIL_USERACCOUNT");
|
||||||
|
my $firstname = $c->l("rvw_EMAIL_FIRSTNAME");
|
||||||
|
my $lastname = $c->l("rvw_EMAIL_LASTNAME");
|
||||||
|
|
||||||
|
my $out = "<I>" . $useraccount . "</I>\@" . $domain . "<BR>"
|
||||||
|
. "<I>" . $firstname . "</I>.<I>" . $lastname . "</I>\@" . $domain . "<BR>"
|
||||||
|
. "<I>" . $firstname . "</I>_<I>" . $lastname . "</I>\@" . $domain . "<BR>";
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head2 gen2_domains
|
||||||
|
|
||||||
|
Returns a string of the domains this SME Server serves or a localized string
|
||||||
|
saying "no domains defined" (mojo ver)
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub gen2_domains {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my @virtual = $domains->get_all_by_prop( type => 'domain');
|
||||||
|
my $numvirtual = @virtual;
|
||||||
|
if ($numvirtual == 0) {
|
||||||
|
$c->localise("NO_VIRTUAL_DOMAINS");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
my $out = "";
|
||||||
|
my $domain;
|
||||||
|
foreach $domain (sort @virtual) {
|
||||||
|
if ($out ne "") {
|
||||||
|
$out .= "<BR>";
|
||||||
|
}
|
||||||
|
$out .= $domain->key;
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=head2 get2_local_networks
|
||||||
|
|
||||||
|
Return a <br> delimited string of all the networks this SMEServer is
|
||||||
|
serving. (mojo ver)
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub get2_local_networks {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my @nets = $networks->get_all_by_prop('type' => 'network');
|
||||||
|
|
||||||
|
my $numNetworks = @nets;
|
||||||
|
if ($numNetworks == 0) {
|
||||||
|
return $c->l('rvw_NO_NETWORKS');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
my $out = "";
|
||||||
|
foreach my $network (sort @nets) {
|
||||||
|
if ($out ne "") {
|
||||||
|
$out .= "<BR>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$out .= $network->key."/" . get_net_prop($c, $network->key, 'Mask');
|
||||||
|
|
||||||
|
if ( defined get_net_prop($c, $network->key, 'Router') ) {
|
||||||
|
$out .= " via " . get_net_prop ($c, $network->key, 'Router');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=head2 print2_gateway_stanza
|
||||||
|
|
||||||
|
If this system is a server gateway, show the external ip and gateway ip (mojo ver)
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub print2_gateway_stanza
|
||||||
|
{
|
||||||
|
my $c = shift;
|
||||||
|
if (get_value($c,'SystemMode') =~ /servergateway/)
|
||||||
|
{
|
||||||
|
my $ip = get_value($c,'ExternalIP');
|
||||||
|
my $static =
|
||||||
|
(get_value($c, 'AccessType') eq 'dedicated') &&
|
||||||
|
(get_value($c, 'ExternalDHCP') eq 'off') &&
|
||||||
|
(get_prop($c, 'pppoe', 'status') eq 'disabled');
|
||||||
|
if ($static)
|
||||||
|
{
|
||||||
|
$ip .= "/".get_value($c,'ExternalNetmask');
|
||||||
|
}
|
||||||
|
my $out = $c->l('rvw_EXTERNAL_IP_ADDRESS_SUBNET_MASK').':'.$ip;
|
||||||
|
if ($static)
|
||||||
|
{
|
||||||
|
$out .= $c->l('rvw_GATEWAY').':'.get_value($c,'GatewayIP');
|
||||||
|
}
|
||||||
|
return $out
|
||||||
|
}
|
||||||
|
}
|
||||||
|
=head2 print2_serveronly_stanza
|
||||||
|
|
||||||
|
If this system is a standalone server with net access, show the external
|
||||||
|
gateway IP (mojo ver)
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub print2_serveronly_stanza {
|
||||||
|
my $c = shift;
|
||||||
|
if ( (get_value($c,'SystemMode') eq 'serveronly') &&
|
||||||
|
get_value($c,'AccessType') &&
|
||||||
|
(get_value($c,'AccessType') ne "off")) {
|
||||||
|
return ( get_value($c,'GatewayIP') );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
=head2 print2_dhcp_stanza
|
||||||
|
|
||||||
|
Prints out the current state of dhcp service (mojo ver)
|
||||||
|
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub print2_dhcp_stanza {
|
||||||
|
my $c = shift;
|
||||||
|
my $out = (get_prop($c,'dhcpd','status') || 'disabled' );
|
||||||
|
|
||||||
|
if (get_prop($c,'dhcpd', 'status') eq 'enabled') {
|
||||||
|
$out .= '<br>'.$c->l('rvw_BEGINNING_OF_DHCP_ADDRESS_RANGE').':';
|
||||||
|
$out .= (get_prop($c,'dhcpd','start') || '' ).'<br>';
|
||||||
|
$out .= $c->l('rvw_END_OF_DHCP_ADDRESS_RANGE').':';
|
||||||
|
$out .= (get_prop($c,'dhcpd','end') || '' );
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
44
root/usr/share/smanager/lib/SrvMngr/Controller/Support.pm
Normal file
44
root/usr/share/smanager/lib/SrvMngr/Controller/Support.pm
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package SrvMngr::Controller::Support;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Support
|
||||||
|
# description : Support and licensing
|
||||||
|
# navigation : 0000 200
|
||||||
|
# menu : N
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
use esmith::util;
|
||||||
|
|
||||||
|
|
||||||
|
sub display_licenses {
|
||||||
|
|
||||||
|
my $lang = shift;
|
||||||
|
|
||||||
|
my $lic = '';
|
||||||
|
foreach my $license (esmith::util::getLicenses($lang)) {
|
||||||
|
|
||||||
|
$lic .= $license . '<br>';
|
||||||
|
}
|
||||||
|
return $lic;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('support_FORM_TITLE');
|
||||||
|
my $modul = $c->render_to_string(inline => display_licenses($c->session->{lang}));
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $modul );
|
||||||
|
$c->render(template => 'module');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
51
root/usr/share/smanager/lib/SrvMngr/Controller/Swttheme.pm
Normal file
51
root/usr/share/smanager/lib/SrvMngr/Controller/Swttheme.pm
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package SrvMngr::Controller::Swttheme;
|
||||||
|
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
#use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
our $db = esmith::ConfigDB->open() || die "Couldn't open config db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $from = $c->param('From') || '/';
|
||||||
|
my $theme = $c->param('Theme');
|
||||||
|
|
||||||
|
$c->app->log->info(" swt theme '$from' '$theme' ");
|
||||||
|
|
||||||
|
my $oldTheme = $c->session->{CurrentTheme};
|
||||||
|
|
||||||
|
if ( $theme ne $oldTheme ) {
|
||||||
|
# $c->app->renderer->paths([$c->app->home->rel_file('themes/default/templates')]);
|
||||||
|
# $c->app->static->paths([$c->app->home->rel_file('themes/default/public')]);
|
||||||
|
# if ( $theme ne 'default' ) {
|
||||||
|
# # Put the new theme first
|
||||||
|
# my $t_path = $c->app->home->rel_file('themes/'.$theme);
|
||||||
|
# unshift @{$c->app->renderer->paths}, $t_path.'/templates' if -d $t_path.'/templates';
|
||||||
|
# unshift @{$c->app->static->paths}, $t_path.'/public' if -d $t_path.'/public';
|
||||||
|
# }
|
||||||
|
$c->session->{CurrentTheme} = $theme;
|
||||||
|
|
||||||
|
$db->get('smanager')->set_prop('Theme', $theme);
|
||||||
|
system ("/sbin/e-smith/signal-event smanager-theme-change") == 0
|
||||||
|
or warn "$c->l('ERROR_UPDATING')";
|
||||||
|
}
|
||||||
|
|
||||||
|
## (not sure) $c->flash( warning => $c->l('swt_LOGIN_AGAIN') );
|
||||||
|
$from = '/initial' if $from eq '/';
|
||||||
|
$from = '/' . $from if ( $from !~ m|^\/| );
|
||||||
|
|
||||||
|
$c->redirect_to( $from);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
961
root/usr/share/smanager/lib/SrvMngr/Controller/Useraccounts.pm
Normal file
961
root/usr/share/smanager/lib/SrvMngr/Controller/Useraccounts.pm
Normal file
@ -0,0 +1,961 @@
|
|||||||
|
package SrvMngr::Controller::Useraccounts;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : User management
|
||||||
|
# description : Users
|
||||||
|
# navigation : 2000 100
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session
|
||||||
|
is_normal_password email_simple);
|
||||||
|
|
||||||
|
#use esmith::FormMagick qw( validate_password );
|
||||||
|
#use CGI::FormMagick::Validator qw( call_fm_validation );
|
||||||
|
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
use esmith::util;
|
||||||
|
|
||||||
|
#use esmith::FormMagick;
|
||||||
|
#use esmith::cgi;
|
||||||
|
#use File::Basename;
|
||||||
|
#use Exporter;
|
||||||
|
#use Carp qw(verbose);
|
||||||
|
|
||||||
|
#use esmith::FormMagick::Panel::useraccounts;
|
||||||
|
|
||||||
|
our $adb = esmith::AccountsDB->open || die "Couldn't open accounts db";
|
||||||
|
our $cdb = esmith::ConfigDB->open() || die "Couldn't open config db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $notif = '';
|
||||||
|
my %usr_datas = ();
|
||||||
|
my $title = $c->l('usr_FORM_TITLE');
|
||||||
|
|
||||||
|
$usr_datas{'trt'} = 'LIST';
|
||||||
|
|
||||||
|
my @users = $adb->get('admin');
|
||||||
|
push @users, $adb->users();
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $notif, usr_datas => \%usr_datas, users => \@users );
|
||||||
|
$c->render(template => 'useraccounts');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'ADD');
|
||||||
|
my $user = ($c->param('user') || '');
|
||||||
|
|
||||||
|
my %usr_datas = ();
|
||||||
|
my $title = $c->l('usr_FORM_TITLE');
|
||||||
|
my ($notif, $modul) = '';
|
||||||
|
|
||||||
|
$usr_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
|
||||||
|
$usr_datas{user} = '';
|
||||||
|
$usr_datas{firstname} = '';
|
||||||
|
$usr_datas{lastname} = '';
|
||||||
|
$usr_datas{dept} = $c->get_ldap_value('Dept');
|
||||||
|
$usr_datas{company} = $c->get_ldap_value('Company');
|
||||||
|
$usr_datas{street} = $c->get_ldap_value('Street');
|
||||||
|
$usr_datas{city} = $c->get_ldap_value('City');
|
||||||
|
$usr_datas{phone} = $c->get_ldap_value('Phone');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' or $trt eq 'UPS' ) {
|
||||||
|
|
||||||
|
my $rec = $adb->get($user);
|
||||||
|
my $type = ( $trt eq 'UPS' ) ? 'system' : 'user';
|
||||||
|
if ($rec and $rec->prop('type') eq $type) {
|
||||||
|
$usr_datas{user} = $user;
|
||||||
|
$usr_datas{firstname} = $rec->prop('FirstName');
|
||||||
|
$usr_datas{lastname} = $rec->prop('LastName');
|
||||||
|
$usr_datas{vpnclientaccess} = $rec->prop('VPNClientAccess');
|
||||||
|
$usr_datas{emailforward} = $rec->prop('EmailForward');
|
||||||
|
$usr_datas{forwardaddress} = $rec->prop('ForwardAddress');
|
||||||
|
if ( $trt eq 'UPD' ) {
|
||||||
|
$usr_datas{dept} = $rec->prop('Dept');
|
||||||
|
$usr_datas{company} = $rec->prop('Company');
|
||||||
|
$usr_datas{street} = $rec->prop('Street');
|
||||||
|
$usr_datas{city} = $rec->prop('City');
|
||||||
|
$usr_datas{phone} = $rec->prop('Phone');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
my $rec = $adb->get($user);
|
||||||
|
if ($rec and $rec->prop('type') eq 'user') {
|
||||||
|
$usr_datas{user} = $user;
|
||||||
|
$usr_datas{name} = $c->get_user_name($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'PWD' or $trt eq 'PWS' ) {
|
||||||
|
|
||||||
|
my $rec = $adb->get($user);
|
||||||
|
my $type = ( $trt eq 'PWS' ) ? 'system' : 'user';
|
||||||
|
if ($rec and $rec->prop('type') eq $type) {
|
||||||
|
$usr_datas{user} = $user;
|
||||||
|
$usr_datas{name} = $c->get_user_name($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'LCK' ) {
|
||||||
|
|
||||||
|
my $rec = $adb->get($user);
|
||||||
|
if ($rec and $rec->prop('type') eq 'user') {
|
||||||
|
$usr_datas{user} = $user;
|
||||||
|
$usr_datas{name} = $c->get_user_name($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'LIST' ) {
|
||||||
|
my @useraccounts;
|
||||||
|
if ($adb)
|
||||||
|
{
|
||||||
|
@useraccounts = $adb->useraccounts();
|
||||||
|
}
|
||||||
|
$c->stash( useraccounts => \@useraccounts );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $notif, usr_datas => \%usr_datas );
|
||||||
|
$c->render( template => 'useraccounts' );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'LIST');
|
||||||
|
my $user = ($c->param('user') || '');
|
||||||
|
my $name = ($c->param('name') || '');
|
||||||
|
|
||||||
|
my %usr_datas = ();
|
||||||
|
$usr_datas{trt} = $trt;
|
||||||
|
|
||||||
|
my $title = $c->l('usr_FORM_TITLE');
|
||||||
|
|
||||||
|
|
||||||
|
my ($res, $result) = '';
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'ADD' ) {
|
||||||
|
|
||||||
|
# controls
|
||||||
|
|
||||||
|
my $first = $c->param('FirstName');
|
||||||
|
my $last = $c->param('LastName');
|
||||||
|
my $mail = $c->param('ForwardAddress');
|
||||||
|
|
||||||
|
unless ( $first ) {
|
||||||
|
$result .= $c->l('FM_NONBLANK') . ' - ';
|
||||||
|
}
|
||||||
|
unless ( $last ) {
|
||||||
|
$result .= $c->l('FM_NONBLANK') . ' - ';
|
||||||
|
}
|
||||||
|
#unless ( $mail ) {
|
||||||
|
# $result .= $c->l('FM_NONBLANK') . ' - ';
|
||||||
|
#}
|
||||||
|
|
||||||
|
$res = $c->validate_acctName( $user );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->validate_acctName_length( $user );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->validate_acctName_conflict( $user );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->pseudonym_clash( $first );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
if ( $mail ) {
|
||||||
|
$res = $c->emailforward( $mail );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
#$result .= 'Blocked for testing';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = create_user( $c, $user );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('usrUSER_CREATED') . ' ' . $user;
|
||||||
|
$usr_datas{trt} = 'SUC';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'UPD' or $trt eq 'UPS') {
|
||||||
|
|
||||||
|
# controls
|
||||||
|
|
||||||
|
my $first = $c->param('FirstName');
|
||||||
|
my $last = $c->param('LastName');
|
||||||
|
my $mail = $c->param('ForwardAddress');
|
||||||
|
|
||||||
|
unless ( $first ) {
|
||||||
|
$result .= $c->l('FM_NONBLANK') . ' - ';
|
||||||
|
}
|
||||||
|
unless ( $last ) {
|
||||||
|
$result .= $c->l('FM_NONBLANK') . ' - ';
|
||||||
|
}
|
||||||
|
|
||||||
|
#unless ( $mail ) {
|
||||||
|
# $result .= $c->l('FM_NONBLANK') . ' - ';
|
||||||
|
#}
|
||||||
|
|
||||||
|
$res = $c->pseudonym_clash( $first );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
if ( $mail ) {
|
||||||
|
$res = $c->emailforward( $mail );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#$result .= 'Blocked for testing';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
if ( $trt eq 'UPS' ) {
|
||||||
|
$res = $c->modify_admin();
|
||||||
|
} else {
|
||||||
|
$res = $c->modify_user( $user );
|
||||||
|
}
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('usr_USER_MODIFIED') . ' ' . $user;
|
||||||
|
$usr_datas{trt} = 'SUC';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'PWD' ) {
|
||||||
|
|
||||||
|
my $pass1 = $c->param('newPass');
|
||||||
|
my $pass2 = $c->param('newPassVerify');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
unless ($pass1) {
|
||||||
|
$result .= $c->l('FM_NONBLANK') . ' - ';
|
||||||
|
}
|
||||||
|
unless ($pass1 eq $pass2) {
|
||||||
|
$result .= $c->l('PASSWORD_VERIFY_ERROR') . ' - ';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = check_password( $c, $pass1 );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $user eq 'admin' ) {
|
||||||
|
$result .= "System password should not be reset here !";
|
||||||
|
}
|
||||||
|
#$result .= 'Blocked for testing';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
my $res = $c->reset_password( $user, $pass1 );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('usr_PASSWORD_CHANGE_SUCCEEDED', $user);
|
||||||
|
$usr_datas{trt} = 'SUC';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'PWS' ) { # system password reset (admin)
|
||||||
|
|
||||||
|
my $curpass = $c->param('CurPass');
|
||||||
|
my $pass1 = $c->param('Pass');
|
||||||
|
my $pass2 = $c->param('PassVerify');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
if ($curpass) {
|
||||||
|
$res = $c->system_authenticate_password( $curpass );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
} else {
|
||||||
|
$result .= $c->l('FM_NONBLANK') . ' - ';
|
||||||
|
}
|
||||||
|
|
||||||
|
unless ($pass1 and $pass2) {
|
||||||
|
$result .= $c->l('FM_NONBLANK') . ' - ';
|
||||||
|
}
|
||||||
|
|
||||||
|
unless ($pass1 eq $pass2) {
|
||||||
|
$result .= $c->l('usr_SYSTEM_PASSWORD_VERIFY_ERROR') . ' - ';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->system_validate_password( $pass1 );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = $c->system_check_password( $pass1 );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
#$result .= 'Blocked for testing';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
my $res = $c->system_change_password();
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('usr_SYSTEM_PASSWORD_CHANGED', $user);
|
||||||
|
$usr_datas{trt} = 'SUC';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'LCK' ) {
|
||||||
|
|
||||||
|
# controls
|
||||||
|
|
||||||
|
#$res = xxxxxxxxxxx();
|
||||||
|
#$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
#$result .= 'Blocked for testing';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
my $res = $c->lock_account( $user );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('usr_LOCKED_ACCOUNT', $user);
|
||||||
|
$usr_datas{trt} = 'SUC';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'DEL' ) {
|
||||||
|
|
||||||
|
# controls
|
||||||
|
|
||||||
|
#$res = xxxxxxxxxxx();
|
||||||
|
#$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
#$result .= 'Blocked for testing';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
my $res = $c->remove_account( $user );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->l('usr_SUCCESSFULLY_DELETED_USER') . ' ' . $user;
|
||||||
|
$usr_datas{trt} = 'SUC';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$usr_datas{'user'} = $user;
|
||||||
|
$usr_datas{'name'} = $name;
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $result, usr_datas => \%usr_datas );
|
||||||
|
if ($usr_datas{trt} ne 'SUC') {
|
||||||
|
return $c->render(template => 'useraccounts');
|
||||||
|
}
|
||||||
|
$c->redirect_to('/useraccounts');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub lock_account {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $user = $c->param('user');
|
||||||
|
my $acct = $adb->get($user);
|
||||||
|
if ($acct->prop('type') eq "user") {
|
||||||
|
undef $adb;
|
||||||
|
|
||||||
|
# Untaint the username before use in system()
|
||||||
|
$user =~ /^(\w[\-\w_\.]*)$/;
|
||||||
|
$user = $1;
|
||||||
|
if (system("/sbin/e-smith/signal-event", "user-lock", $user)) {
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
return $c->l("usr_ERR_OCCURRED_LOCKING");
|
||||||
|
}
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
return 'OK';
|
||||||
|
} else {
|
||||||
|
return $c->l('NO_SUCH_USER', $user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub remove_account {
|
||||||
|
my ($c) = @_;
|
||||||
|
my $user = $c->param('user');
|
||||||
|
|
||||||
|
my $acct = $adb->get($user);
|
||||||
|
if ($acct->prop('type') eq 'user') {
|
||||||
|
$acct->set_prop('type', 'user-deleted');
|
||||||
|
|
||||||
|
undef $adb;
|
||||||
|
|
||||||
|
# Untaint the username before use in system()
|
||||||
|
$user =~ /^(\w[\-\w_\.]*)$/;
|
||||||
|
$user = $1;
|
||||||
|
if (system ("/sbin/e-smith/signal-event", "user-delete", $user))
|
||||||
|
{
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
return $c->l("ERR_OCCURRED_DELETING");
|
||||||
|
}
|
||||||
|
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
$adb->get($user)->delete;
|
||||||
|
return 'OK';
|
||||||
|
} else {
|
||||||
|
return $c->l('NO_SUCH_USER', $user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub reset_password {
|
||||||
|
my ($c, $user, $passw1) = @_;
|
||||||
|
|
||||||
|
unless (($user) = ($user =~ /^(\w[\-\w_\.]*)$/)) {
|
||||||
|
return $c->l('usr_TAINTED_USER');
|
||||||
|
}
|
||||||
|
$user = $1;
|
||||||
|
|
||||||
|
my $acct = $adb->get($user);
|
||||||
|
|
||||||
|
if ( $acct->prop('type') eq "user") {
|
||||||
|
esmith::util::setUserPassword ($user, $passw1);
|
||||||
|
|
||||||
|
$acct->set_prop("PasswordSet", "yes");
|
||||||
|
undef $adb;
|
||||||
|
|
||||||
|
if (system("/sbin/e-smith/signal-event", "password-modify", $user))
|
||||||
|
{
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
return $c->l("usr_ERR_OCCURRED_MODIFYING_PASSWORD");
|
||||||
|
}
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
} else {
|
||||||
|
return $c->l('NO_SUCH_USER', $user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sub check_password {
|
||||||
|
my $c = shift;
|
||||||
|
my $pass1 = shift;
|
||||||
|
|
||||||
|
my $check_type;
|
||||||
|
my $rec = $cdb->get('passwordstrength');
|
||||||
|
$check_type = ($rec ? ($rec->prop('Users') || 'none') : 'none');
|
||||||
|
|
||||||
|
return validate_password($c, $check_type, $pass1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_password {
|
||||||
|
my ($c, $strength, $pass) = @_;
|
||||||
|
|
||||||
|
use Crypt::Cracklib;
|
||||||
|
|
||||||
|
my $reason;
|
||||||
|
|
||||||
|
if ($strength eq "none") {
|
||||||
|
return $c->l("Passwords must be at least 7 characters long") unless (length($pass) > 6);
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
$reason = is_normal_password($c, $pass, undef);
|
||||||
|
|
||||||
|
return $reason unless ($reason eq "OK");
|
||||||
|
return "OK" unless ($strength eq "strong");
|
||||||
|
|
||||||
|
if ( -f '/usr/lib64/cracklib_dict.pwd' ) {
|
||||||
|
$reason = fascist_check($pass, '/usr/lib64/cracklib_dict');
|
||||||
|
} else {
|
||||||
|
$reason = fascist_check($pass, '/usr/lib/cracklib_dict');
|
||||||
|
}
|
||||||
|
$reason ||= "Software error: password check failed";
|
||||||
|
|
||||||
|
return "OK" if ($reason eq "ok");
|
||||||
|
|
||||||
|
return $c->l("Bad Password Choice") . ": "
|
||||||
|
. $c->l("The password you have chosen is not a good choice, because")
|
||||||
|
. " " . $c->($reason) . ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub emailForward_list {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
return [[ $c->l('usr_DELIVER_EMAIL_LOCALLY') => 'local'],
|
||||||
|
[ $c->l('usr_FORWARD_EMAIL') => 'forward'],
|
||||||
|
[ $c->l('usr_DELIVER_AND_FORWARD') => 'both']];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub max_user_name_length {
|
||||||
|
|
||||||
|
my ($c, $data) = @_;
|
||||||
|
|
||||||
|
$cdb->reload();
|
||||||
|
my $max = $cdb->get('maxuserNameLength')->value;
|
||||||
|
|
||||||
|
if (length($data) <= $max) {
|
||||||
|
return "OK";
|
||||||
|
} else {
|
||||||
|
return $c->l('usr_MAX_user_NAME_LENGTH_ERROR', $data, $max, $max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_acctName {
|
||||||
|
|
||||||
|
my ($c, $acctName) = @_;
|
||||||
|
|
||||||
|
unless ($adb->validate_account_name($acctName)) {
|
||||||
|
return $c->l('usr_ACCT_NAME_HAS_INVALID_CHARS', $acctName);
|
||||||
|
}
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub validate_acctName_length {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $acctName = shift;
|
||||||
|
|
||||||
|
my $maxAcctNameLength = ($cdb->get('maxAcctNameLength')
|
||||||
|
? $cdb->get('maxAcctNameLength')->prop('type') : "") || 12;
|
||||||
|
|
||||||
|
if ( length $acctName > $maxAcctNameLength ) {
|
||||||
|
return $c->l('usr_ACCOUNT_TOO_LONG', $maxAcctNameLength);
|
||||||
|
} else {
|
||||||
|
return ('OK');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub validate_acctName_conflict {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $acctName = shift;
|
||||||
|
|
||||||
|
my $account = $adb->get($acctName);
|
||||||
|
my $type;
|
||||||
|
|
||||||
|
if (defined $account) {
|
||||||
|
$type = $account->prop('type');
|
||||||
|
} elsif (defined getpwnam($acctName) || defined getgrnam($acctName)) {
|
||||||
|
$type = "system";
|
||||||
|
} else {
|
||||||
|
return('OK');
|
||||||
|
}
|
||||||
|
return $c->l('usr_ACCOUNT_CONFLICT', $acctName, $type);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sub get_user_name {
|
||||||
|
|
||||||
|
my ($c, $acctName) = @_;
|
||||||
|
|
||||||
|
my $usr = $adb->get($acctName);
|
||||||
|
|
||||||
|
return '' unless $usr;
|
||||||
|
|
||||||
|
return $usr->prop('FirstName') ." ". $usr->prop('LastName');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_ldap_value {
|
||||||
|
my ($c, $field) = @_;
|
||||||
|
|
||||||
|
# don't do the lookup if this is a modification of an existing user
|
||||||
|
if ($c->param('user')) {
|
||||||
|
return $c->param($field);
|
||||||
|
}
|
||||||
|
|
||||||
|
my %CGIParam2DBfield = (
|
||||||
|
Dept => 'defaultDepartment',
|
||||||
|
Company => 'defaultCompany',
|
||||||
|
Street => 'defaultStreet',
|
||||||
|
City => 'defaultCity',
|
||||||
|
Phone => 'defaultPhoneNumber'
|
||||||
|
);
|
||||||
|
|
||||||
|
return $cdb->get('ldap')->prop($CGIParam2DBfield{$field});
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_pptp_value {
|
||||||
|
return $cdb->get('pptpd')->prop('AccessDefault') || 'no';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub pseudonym_clash {
|
||||||
|
my ($c, $first) = @_;
|
||||||
|
$first ||= "";
|
||||||
|
my $last = $c->param('LastName') || "";
|
||||||
|
my $acctName = $c->param('user') || "";
|
||||||
|
|
||||||
|
my $up = "$first $last";
|
||||||
|
|
||||||
|
$up =~ s/^\s+//;
|
||||||
|
$up =~ s/\s+$//;
|
||||||
|
$up =~ s/\s+/ /g;
|
||||||
|
$up =~ s/\s/_/g;
|
||||||
|
|
||||||
|
my $dp = $up;
|
||||||
|
$dp =~ s/_/./g;
|
||||||
|
|
||||||
|
$dp = $adb->get($dp);
|
||||||
|
$up = $adb->get($up);
|
||||||
|
|
||||||
|
my $da = $dp->prop('Account') if $dp;
|
||||||
|
my $ua = $up->prop('Account') if $up;
|
||||||
|
if ($dp and $da and $da ne $acctName) {
|
||||||
|
return $c->l('usr_PSEUDONYM_CLASH',
|
||||||
|
$acctName, $da, $dp->key);
|
||||||
|
} elsif ($up and $ua and $ua ne $acctName) {
|
||||||
|
return $c->l('usr_PSEUDONYM_CLASH',
|
||||||
|
$acctName, $ua, $up->key );
|
||||||
|
} else {
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub emailforward {
|
||||||
|
my ($c, $data) = @_;
|
||||||
|
my $response = $c->email_simple($data);
|
||||||
|
if ($response eq "OK") {
|
||||||
|
return "OK";
|
||||||
|
} elsif ($data eq "") {
|
||||||
|
# Blank is ok, only if we're not forwarding, which means that the
|
||||||
|
# EmailForward param must be set to 'local'.
|
||||||
|
my $email_forward = $c->param('EmailForward') || '';
|
||||||
|
$email_forward =~ s/^\s+|\s+$//g;
|
||||||
|
return 'OK' if $email_forward eq 'local';
|
||||||
|
return $c->l('usr_CANNOT_CONTAIN_WHITESPACE');
|
||||||
|
} else {
|
||||||
|
return $c->l('usr_CANNOT_CONTAIN_WHITESPACE')
|
||||||
|
if ( $data =~ /\s+/ );
|
||||||
|
# Permit a local address.
|
||||||
|
return "OK" if $data =~ /^[a-zA-Z][a-zA-Z0-9\._\-]*$/;
|
||||||
|
return $c->l('usr_UNACCEPTABLE_CHARS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_groups {
|
||||||
|
my ($c) = shift;
|
||||||
|
|
||||||
|
my @groups = $adb->groups();
|
||||||
|
return \@groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub ipsec_for_acct {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
# Don't show ipsecrw setting unless the status property exists
|
||||||
|
return '' unless ($cdb->get('ipsec')
|
||||||
|
&& $cdb->get('ipsec')->prop('RoadWarriorStatus'));
|
||||||
|
|
||||||
|
# Don't show ipsecrw setting unless /sbin/e-smith/roadwarrior exists
|
||||||
|
return '' unless -x '/sbin/e-smith/roadwarrior';
|
||||||
|
|
||||||
|
my $user = $c->param('user');
|
||||||
|
return '' unless $user;
|
||||||
|
|
||||||
|
my $rec = $adb->get($user);
|
||||||
|
if ( $rec ) {
|
||||||
|
my $pwset = $rec->prop('PasswordSet') || 'no';
|
||||||
|
my $VPNaccess = $rec->prop('VPNClientAccess') || 'no';
|
||||||
|
if ($pwset eq 'yes' and $VPNaccess eq 'yes') {
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub is_user_in_group {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $user = shift || '';
|
||||||
|
my $group = shift || '';
|
||||||
|
|
||||||
|
return '' unless ( $user and $group );
|
||||||
|
|
||||||
|
return ( $adb->is_user_in_group($user, $group) ) ? 'OK' : '';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_ipsec_client_cert {
|
||||||
|
my $c = shift;
|
||||||
|
my $user = $c->param('user');
|
||||||
|
($user) = ($user =~ /^(.*)$/);
|
||||||
|
|
||||||
|
die "Invalid user: $user\n" unless getpwnam($user);
|
||||||
|
|
||||||
|
open (KID, "/sbin/e-smith/roadwarrior get_client_cert $user |")
|
||||||
|
or die "Can't fork: $!";
|
||||||
|
my $certfile = <KID>;
|
||||||
|
close KID;
|
||||||
|
|
||||||
|
require File::Basename;
|
||||||
|
my $certname = File::Basename::basename($certfile);
|
||||||
|
|
||||||
|
print "Expires: 0\n";
|
||||||
|
print "Content-type: application/x-pkcs12\n";
|
||||||
|
print "Content-disposition: inline; filename=$certname\n";
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
open (CERT, "<$certfile");
|
||||||
|
while (<CERT>)
|
||||||
|
{
|
||||||
|
print;
|
||||||
|
}
|
||||||
|
close CERT;
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub modify_user {
|
||||||
|
my ($c) = @_;
|
||||||
|
my $acctName = $c->param('user');
|
||||||
|
|
||||||
|
unless (($acctName) = ($acctName =~ /^(\w[\-\w_\.]*)$/)) {
|
||||||
|
return $c->l('usr_TAINTED_USER', $acctName);
|
||||||
|
}
|
||||||
|
# Untaint the username before use in system()
|
||||||
|
$acctName = $1;
|
||||||
|
|
||||||
|
my $acct = $adb->get($acctName);
|
||||||
|
my $acctType = $acct->prop('type');
|
||||||
|
|
||||||
|
if ($acctType eq "user")
|
||||||
|
{
|
||||||
|
$adb->remove_user_auto_pseudonyms($acctName);
|
||||||
|
my %newProperties = (
|
||||||
|
'FirstName' => $c->param('FirstName'),
|
||||||
|
'LastName' => $c->param('LastName'),
|
||||||
|
'Phone' => $c->param('Phone'),
|
||||||
|
'Company' => $c->param('Company'),
|
||||||
|
'Dept' => $c->param('Dept'),
|
||||||
|
'City' => $c->param('City'),
|
||||||
|
'Street' => $c->param('Street'),
|
||||||
|
'EmailForward' => $c->param('EmailForward'),
|
||||||
|
'ForwardAddress' => $c->param('ForwardAddress'),
|
||||||
|
'VPNClientAccess'=> $c->param('VPNClientAccess'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$acct->merge_props(%newProperties);
|
||||||
|
|
||||||
|
$adb->create_user_auto_pseudonyms($acctName)
|
||||||
|
if ( ($cdb->get_prop('pseudonyms','create') || 'enabled') eq 'enabled' );
|
||||||
|
|
||||||
|
my @old_groups = $adb->user_group_list($acctName);
|
||||||
|
my @new_groups = @{$c->every_param("groupMemberships")};
|
||||||
|
|
||||||
|
# $c->app->log->info($c->dumper("groups: Old " . @old_groups .' New '. @new_groups));
|
||||||
|
|
||||||
|
$adb->remove_user_from_groups($acctName, @old_groups);
|
||||||
|
$adb->add_user_to_groups($acctName, @new_groups);
|
||||||
|
|
||||||
|
undef $adb;
|
||||||
|
|
||||||
|
unless (system ("/sbin/e-smith/signal-event", "user-modify",
|
||||||
|
$acctName) == 0) {
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
return $c->l('usr_CANNOT_MODIFY_USER');
|
||||||
|
}
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
}
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub create_user {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $acctName = $c->param('user');
|
||||||
|
my %userprops;
|
||||||
|
|
||||||
|
foreach my $field ( qw( FirstName LastName Phone Company Dept
|
||||||
|
City Street EmailForward ForwardAddress VPNClientAccess) )
|
||||||
|
{
|
||||||
|
$userprops{$field} = $c->param($field);
|
||||||
|
}
|
||||||
|
$userprops{'PasswordSet'} = "no";
|
||||||
|
$userprops{'type'} = 'user';
|
||||||
|
|
||||||
|
my $acct = $adb->new_record($acctName)
|
||||||
|
or warn "Can't create new account for $acctName (does it already exist?)\n";
|
||||||
|
$acct->reset_props(%userprops);
|
||||||
|
$adb->create_user_auto_pseudonyms($acctName)
|
||||||
|
if ( ($cdb->get_prop('pseudonyms','create') || 'enabled') eq 'enabled' );
|
||||||
|
my @groups = @{$c->every_param("groupMemberships")};
|
||||||
|
|
||||||
|
$adb->add_user_to_groups($acctName, @groups);
|
||||||
|
|
||||||
|
undef $adb;
|
||||||
|
|
||||||
|
# Untaint the username before use in system()
|
||||||
|
$acctName =~ /^(\w[\-\w_\.]*)$/;
|
||||||
|
$acctName = $1;
|
||||||
|
|
||||||
|
if (system ("/sbin/e-smith/signal-event", "user-create", $acctName))
|
||||||
|
{
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
return $c->l("usr_ERR_OCCURRED_CREATING");
|
||||||
|
}
|
||||||
|
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
|
||||||
|
$c->set_groups();
|
||||||
|
return 'OK';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub set_groups {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $acctName = $c->param('user');
|
||||||
|
|
||||||
|
my @groups = @{$c->every_param("groupMemberships")};
|
||||||
|
|
||||||
|
$adb->set_user_groups($acctName, @groups);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub modify_admin {
|
||||||
|
|
||||||
|
my ($c) = @_;
|
||||||
|
|
||||||
|
my $acct = $adb->get('admin');
|
||||||
|
|
||||||
|
my %newProperties = (
|
||||||
|
'FirstName' => $c->param('FirstName'),
|
||||||
|
'LastName' => $c->param('LastName'),
|
||||||
|
'EmailForward' => $c->param('EmailForward'),
|
||||||
|
'ForwardAddress' => $c->param('ForwardAddress'),
|
||||||
|
'VPNClientAccess'=> $c->param('VPNClientAccess'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$acct->merge_props(%newProperties);
|
||||||
|
|
||||||
|
undef $adb;
|
||||||
|
|
||||||
|
my $status =
|
||||||
|
system ("/sbin/e-smith/signal-event", "user-modify-admin", 'admin');
|
||||||
|
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
|
||||||
|
if ($status == 0) {
|
||||||
|
return 'OK';
|
||||||
|
} else {
|
||||||
|
return$c->l('usr_CANNOT_MODIFY_USER', 'First');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub system_validate_password {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $pass1 = shift;
|
||||||
|
# If the password contains one or more printable character
|
||||||
|
if ($pass1 =~ /^([ -~]+)$/) {
|
||||||
|
return('OK');
|
||||||
|
} else {
|
||||||
|
return $c->l('usr_SYSTEM_PASSWORD_UNPRINTABLES_IN_PASS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub system_check_password {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $pass1 = shift;
|
||||||
|
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
my $conf = esmith::ConfigDB->open();
|
||||||
|
my ($check_type, $rec);
|
||||||
|
if ($conf) {
|
||||||
|
$rec = $conf->get('passwordstrength');
|
||||||
|
}
|
||||||
|
$check_type = ($rec ? ($rec->prop('Admin') || 'strong') : 'strong');
|
||||||
|
|
||||||
|
return $c->validate_password($check_type, $pass1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub system_authenticate_password {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
my $pass = shift;
|
||||||
|
|
||||||
|
if (esmith::util::authenticateUnixPassword( ($cdb->get_value("AdminIsNotRoot") eq 'enabled') ? 'admin' : 'root', $pass)) {
|
||||||
|
return "OK";
|
||||||
|
} else {
|
||||||
|
return $c->l("usr_SYSTEM_PASSWORD_AUTH_ERROR");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub system_change_password {
|
||||||
|
|
||||||
|
my ($c) = @_;
|
||||||
|
my $pass = $c->param('Pass');
|
||||||
|
|
||||||
|
($cdb->get_value("AdminIsNotRoot") eq 'enabled') ? esmith::util::setUnixPassword('admin',$pass) : esmith::util::setUnixSystemPassword($pass);
|
||||||
|
esmith::util::setServerSystemPassword($pass);
|
||||||
|
|
||||||
|
my $result = system("/sbin/e-smith/signal-event password-modify admin");
|
||||||
|
|
||||||
|
if ($result == 0) {
|
||||||
|
return 'OK';
|
||||||
|
} else {
|
||||||
|
return $c->l("Error occurred while modifying password for admin.", 'First');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1
|
@ -0,0 +1,38 @@
|
|||||||
|
package SrvMngr::Controller::Userpanelaccess;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : User management
|
||||||
|
# description : User Panel Access
|
||||||
|
# navigation : 2000 150
|
||||||
|
# menu :
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# name : userpanelaccess, method : get, url : /userpanelaccess, ctlact : Userpanelaccess#main
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
#use SrvMngr::Model::Main;
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('User panel access');
|
||||||
|
$c->stash( title => $title, modul => 'https://mailserver.bjsystems.co.uk/server-manager/cgi-bin/userpanelaccess', height => 600 );
|
||||||
|
$c->render(template => 'embedded');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
257
root/usr/share/smanager/lib/SrvMngr/Controller/Userpassword.pm
Normal file
257
root/usr/share/smanager/lib/SrvMngr/Controller/Userpassword.pm
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
package SrvMngr::Controller::Userpassword;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Current User
|
||||||
|
# description : Change password
|
||||||
|
# navigation : 1000 250
|
||||||
|
# menu : U
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use esmith::util;
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw( theme_list init_session is_normal_password );
|
||||||
|
|
||||||
|
our $cdb = esmith::ConfigDB->open_ro || die "Couldn't open configuration db";
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my %pwd_datas = ();
|
||||||
|
|
||||||
|
if ( $c->is_logged_in ) {
|
||||||
|
$pwd_datas{Account} = $c->session->{username};
|
||||||
|
$pwd_datas{trt} = 'NORM';
|
||||||
|
} else {
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $mess = '';
|
||||||
|
my $jwt = $c->param('jwt') || '';
|
||||||
|
my $name = $c->jwt->decode($jwt)->{username} || '';
|
||||||
|
|
||||||
|
$mess = 'Invalid state' unless ($jwt and $name and $rt eq 'upwdreset');
|
||||||
|
|
||||||
|
# request already treated or outdated
|
||||||
|
if ( $c->pwdrst->{$name}{confirmed} != 1 or $c->pwdrst->{$name}{date} < time() ) {
|
||||||
|
$mess = $c->l('use_INVALID_REQUEST').' -step 1-';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $mess ) {
|
||||||
|
$c->stash( error => $mess );
|
||||||
|
return $c->redirect_to ( $c->home_page );
|
||||||
|
}
|
||||||
|
|
||||||
|
# ok for reset password for this account - step 2
|
||||||
|
$c->pwdrst->{$name}{confirmed} = 2;
|
||||||
|
$pwd_datas{Account} = $name;
|
||||||
|
$pwd_datas{trt} = 'RESET';
|
||||||
|
$pwd_datas{jwt} = $jwt;
|
||||||
|
$c->flash( success => $c->l('use_OK_FOR_RESET') );
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( pwd_datas => \%pwd_datas );
|
||||||
|
$c->render( 'userpassword' );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub change_password {
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $result;
|
||||||
|
my $res;
|
||||||
|
my %pwd_datas = ();
|
||||||
|
|
||||||
|
my $trt = $c->param('Trt');
|
||||||
|
my $acctName = $c->param('User');
|
||||||
|
my $oldPass = $c->param('Oldpass') || '';
|
||||||
|
my $pass = $c->param('Pass');
|
||||||
|
my $passVerify = $c->param('Passverify');
|
||||||
|
|
||||||
|
my $jwt = $c->param('jwt') || '';
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $mess = ''; my $name = '';
|
||||||
|
$name = $c->jwt->decode($jwt)->{username} if $jwt;
|
||||||
|
|
||||||
|
if ( $trt eq 'RESET' ) {
|
||||||
|
$mess = 'Invalid state' unless ($jwt and $name and ($rt eq 'upwdreset2'));
|
||||||
|
# request already treated or outdated
|
||||||
|
if ( $c->pwdrst->{$name}{confirmed} != 2 or $c->pwdrst->{$name}{date} < time() ) {
|
||||||
|
$mess = $c->l('use_INVALID_REQUEST').' -step 2-';
|
||||||
|
}
|
||||||
|
if ( ! $name or $c->is_logged_in or $name ne $acctName ) {
|
||||||
|
$mess = 'Invalid reset state';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( $name or $jwt or ! $c->is_logged_in ) {
|
||||||
|
$mess = 'Invalid update state';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $mess ) {
|
||||||
|
$c->stash( error => $mess );
|
||||||
|
return $c->redirect_to ( $c->home_page );
|
||||||
|
}
|
||||||
|
|
||||||
|
$pwd_datas{Account} = $acctName;
|
||||||
|
$pwd_datas{trt} = $trt;
|
||||||
|
|
||||||
|
# common controls
|
||||||
|
if ( $acctName eq 'admin' ) {
|
||||||
|
$result .= "Admin password should not be reset here !";
|
||||||
|
} else {
|
||||||
|
unless ( $pass && $passVerify ) {
|
||||||
|
$result .= $c->l('pwd_FIELDS_REQUIRED') . "<br>";
|
||||||
|
} else {
|
||||||
|
$result .= $c->l('pwd_PASSWORD_INVALID_CHARS') . "<br>" unless (($pass) = ($pass =~ /^([ -~]+)$/ ));
|
||||||
|
$result .= $c->l('pwd_PASSWORD_VERIFY_ERROR') . "<br>" unless ( $pass eq $passVerify );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $result ne '' ) {
|
||||||
|
$c->stash( error => $result, pwd_datas => \%pwd_datas );
|
||||||
|
return $c->render( 'userpassword' );
|
||||||
|
}
|
||||||
|
|
||||||
|
# validate new password
|
||||||
|
$res = $c->check_password( $pass );
|
||||||
|
$result .= $res . "<br>" unless ( $res eq 'OK' );
|
||||||
|
|
||||||
|
# controls old password
|
||||||
|
if ( $trt ne 'RESET' ) {
|
||||||
|
unless ( $oldPass ) {
|
||||||
|
$result .= $c->l('pwd_FIELDS_REQUIRED') . "<br>" unless $trt eq 'RESET';
|
||||||
|
} else {
|
||||||
|
$result .= $c->l('pwd_PASSWORD_OLD_INVALID_CHARS') . "<br>" unless (($oldPass) = ($oldPass =~ /^(\S+)$/ ));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $result ne '' ) {
|
||||||
|
$c->stash( error => $result, pwd_datas => \%pwd_datas );
|
||||||
|
return $c->render( 'userpassword' );
|
||||||
|
}
|
||||||
|
|
||||||
|
# verify old password
|
||||||
|
if ( $trt ne 'RESET') {
|
||||||
|
$result .= $c->l('pwd_ERROR_PASSWORD_CHANGE') . "<br>"
|
||||||
|
unless (SrvMngr::Model::Main->check_credentials($acctName, $oldPass));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# $result .= 'Blocked for test (prevents updates)<br>';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
my $res = $c->reset_password( $trt, $acctName, $pass, $oldPass );
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $result ) {
|
||||||
|
record_password_change_attempt($c, 'FAILED');
|
||||||
|
$c->stash( error => $result, pwd_datas => \%pwd_datas );
|
||||||
|
return $c->render( 'userpassword' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->pwdrst->{$name}{confirmed} = 9 if $trt eq 'RESET';
|
||||||
|
record_password_change_attempt($c, 'SUCCESS');
|
||||||
|
$result .= $c->l('pwd_PASSWORD_CHANGE_SUCCESS');
|
||||||
|
$c->flash( success => $result );
|
||||||
|
$c->redirect_to( $c->home_page );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub reset_password {
|
||||||
|
|
||||||
|
my ($c, $trt, $user, $password, $oldpassword) = @_;
|
||||||
|
my $ret;
|
||||||
|
|
||||||
|
return $c->l('usr_TAINTED_USER') unless (($user) = ($user =~ /^(\w[\-\w_\.]*)$/));
|
||||||
|
$user = $1;
|
||||||
|
|
||||||
|
my $adb = esmith::AccountsDB->open();
|
||||||
|
|
||||||
|
my $acct = $adb->get($user);
|
||||||
|
return $c->l('NO_SUCH_USER', $user) unless ( $acct->prop('type') eq 'user' );
|
||||||
|
|
||||||
|
$ret = esmith::util::setUserPasswordRequirePrevious( $user, $oldpassword, $password ) if $trt ne 'RESET';
|
||||||
|
$ret = esmith::util::setUserPassword( $user, $password ) if $trt eq 'RESET';
|
||||||
|
|
||||||
|
return $c->l('pwd_ERROR_PASSWORD_CHANGE') .' '. $trt unless $ret;
|
||||||
|
|
||||||
|
$acct->set_prop("PasswordSet", "yes");
|
||||||
|
undef $adb;
|
||||||
|
|
||||||
|
if (system("/sbin/e-smith/signal-event", "password-modify", $user)) {
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
return $c->l("usr_ERR_OCCURRED_MODIFYING_PASSWORD");
|
||||||
|
}
|
||||||
|
$adb = esmith::AccountsDB->open();
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub record_password_change_attempt {
|
||||||
|
|
||||||
|
my ($c, $result) = @_;
|
||||||
|
|
||||||
|
my $user = $c->param('User');
|
||||||
|
my $ip_address = $c->tx->remote_address;
|
||||||
|
|
||||||
|
if ($result eq 'SUCCESS') {
|
||||||
|
$c->app->log->info(join "\t", "Password change succeeded: $user", $ip_address);
|
||||||
|
} else {
|
||||||
|
$c->app->log->info(join "\t", "Password change FAILED: $user", $ip_address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub check_password {
|
||||||
|
my $c = shift;
|
||||||
|
my $password = shift;
|
||||||
|
|
||||||
|
my $strength;
|
||||||
|
my $rec = $cdb->get('passwordstrength');
|
||||||
|
$strength = ($rec ? ($rec->prop('Users') || 'none') : 'none');
|
||||||
|
|
||||||
|
return validate_password( $c, $strength, $password );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_password {
|
||||||
|
|
||||||
|
my ($c, $strength, $pass) = @_;
|
||||||
|
|
||||||
|
use Crypt::Cracklib;
|
||||||
|
|
||||||
|
if ($strength eq "none") {
|
||||||
|
return $c->l("Passwords must be at least 7 characters long") unless ( length( $pass ) > 6 );
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $reason = is_normal_password($c, $pass, undef);
|
||||||
|
return $reason unless ($reason eq "OK");
|
||||||
|
return "OK" unless ($strength eq "strong");
|
||||||
|
|
||||||
|
if ( -f '/usr/lib64/cracklib_dict.pwd' ) {
|
||||||
|
$reason = fascist_check($pass, '/usr/lib64/cracklib_dict');
|
||||||
|
} else {
|
||||||
|
$reason = fascist_check($pass, '/usr/lib/cracklib_dict');
|
||||||
|
}
|
||||||
|
$reason ||= "Software error: password check failed";
|
||||||
|
|
||||||
|
return "OK" if ($reason eq "ok");
|
||||||
|
|
||||||
|
return $c->l("Bad Password Choice") . ": "
|
||||||
|
. $c->l("The password you have chosen is not a good choice, because")
|
||||||
|
. " " . $c->($reason) . ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
336
root/usr/share/smanager/lib/SrvMngr/Controller/Viewlogfiles.pm
Normal file
336
root/usr/share/smanager/lib/SrvMngr/Controller/Viewlogfiles.pm
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
package SrvMngr::Controller::Viewlogfiles;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Investigation
|
||||||
|
# description : View log files
|
||||||
|
# navigation : 7000 100
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
#use esmith::FormMagick qw(gen_locale_date_string);
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
use Time::TAI64;
|
||||||
|
use File::Basename;
|
||||||
|
use HTML::Entities;
|
||||||
|
use esmith::FormMagick qw(gen_locale_date_string);
|
||||||
|
use File::Temp qw(tempfile);
|
||||||
|
|
||||||
|
use constant TRUE => 1;
|
||||||
|
use constant FALSE => 0;
|
||||||
|
|
||||||
|
our $cdb = esmith::ConfigDB->open() || die "Couldn't open config db";
|
||||||
|
|
||||||
|
our @logfiles = (); # with array
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %log_datas = ();
|
||||||
|
my $title = $c->l('log_FORM_TITLE');
|
||||||
|
my $notif = '';
|
||||||
|
|
||||||
|
$log_datas{default_op} =
|
||||||
|
($cdb->get('viewlogfiles')->prop('DefaultOperation')) || 'view';
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $notif, log_datas => \%log_datas);
|
||||||
|
$c->render(template => 'viewlogfiles');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_action {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $title = $c->l('log_FORM_TITLE');
|
||||||
|
my $notif = '';
|
||||||
|
my $result = "";
|
||||||
|
my %log_datas = ();
|
||||||
|
|
||||||
|
$log_datas{filename} = $c->param('Filename');
|
||||||
|
$log_datas{matchpattern} = $c->param('Matchpattern');
|
||||||
|
$log_datas{highlightpattern} = $c->param('Highlightpattern');
|
||||||
|
$log_datas{operation} = $c->param('Operation');
|
||||||
|
if ($log_datas{operation} eq 'download') {
|
||||||
|
$log_datas{'trt'} = "DOWN"
|
||||||
|
} else {
|
||||||
|
$log_datas{'trt'} = "SHOW"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($log_datas{filename} =~ /^([\S\s]+)$/) {
|
||||||
|
$log_datas{filename} = $1;
|
||||||
|
} elsif ($log_datas{filename} =~ /^$/) {
|
||||||
|
$log_datas{filename} = "messages";
|
||||||
|
} else {
|
||||||
|
$result .= $c->l("log_FILENAME_ERROR", $log_datas{filename} )
|
||||||
|
. " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($log_datas{matchpattern} =~ /^(\S+)$/) {
|
||||||
|
$log_datas{matchpattern} = $1;
|
||||||
|
} else {
|
||||||
|
$log_datas{matchpattern} = ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($log_datas{highlightpattern} =~ /^(\S+)$/) {
|
||||||
|
$log_datas{highlightpattern} = $1;
|
||||||
|
} else {
|
||||||
|
$log_datas{highlightpattern} = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
my $fullpath = "/var/log/$log_datas{filename}";
|
||||||
|
if (-z $fullpath) {
|
||||||
|
$result .= $c->l("log_LOG_FILE_EMPTY", "$log_datas{filename}" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($log_datas{trt} eq "SHOW") {
|
||||||
|
if ( ! $result ) {
|
||||||
|
$result = $c->render_to_string(inline => showlogFile( $c, %log_datas ));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $result ) {
|
||||||
|
$c->stash(title => $title, modul => $result, log_datas => \%log_datas);
|
||||||
|
return $c->render(template => 'viewlogfiles2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $log_datas{trt} eq 'DOWN' ) {
|
||||||
|
|
||||||
|
my $modul = 'Log file download';
|
||||||
|
|
||||||
|
$notif = download_logFile( $c, %log_datas );
|
||||||
|
return undef unless defined $notif;
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $notif, log_datas => \%log_datas);
|
||||||
|
$c->render(template => 'viewlogfiles');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub timestamp2local
|
||||||
|
{
|
||||||
|
$_ = shift;
|
||||||
|
if (/^(\@[0-9a-f]{24})(.*)/s)
|
||||||
|
{
|
||||||
|
return Time::TAI64::tai64nlocal($1) . $2;
|
||||||
|
}
|
||||||
|
elsif (/^([0-9]{10}\.[0-9]{3})(.*)/s)
|
||||||
|
{
|
||||||
|
return localtime($1) . $2;
|
||||||
|
}
|
||||||
|
return $_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub findlogFiles {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
use File::Find;
|
||||||
|
sub findlogfiles
|
||||||
|
{
|
||||||
|
my $path = $File::Find::name;
|
||||||
|
|
||||||
|
if (-f)
|
||||||
|
{
|
||||||
|
# Remove leading /var/log/messages
|
||||||
|
$path =~ s:^/var/log/::;
|
||||||
|
# don't bother to collect files known to be non-text
|
||||||
|
# or not log files
|
||||||
|
foreach (qw(
|
||||||
|
lastlog
|
||||||
|
btmp$
|
||||||
|
wtmp
|
||||||
|
lock
|
||||||
|
(?<!qpsmtpd/)state
|
||||||
|
httpd/ssl_mutex.\d*
|
||||||
|
httpd/ssl_scache.pag
|
||||||
|
httpd/ssl_scache.dir
|
||||||
|
\/config$
|
||||||
|
))
|
||||||
|
{
|
||||||
|
return if $path =~ /$_/;
|
||||||
|
}
|
||||||
|
|
||||||
|
my ($file_base, $file_path, $file_type) = fileparse($path);
|
||||||
|
|
||||||
|
if ( $file_base =~ /@.*/ )
|
||||||
|
{
|
||||||
|
#$logfiles{$path} = $file_path . timestamp2local($file_base);
|
||||||
|
push @logfiles, [ $file_path . timestamp2local($file_base), $path ];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#$logfiles{$path} = $path;
|
||||||
|
push @logfiles, [ $path, $path ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@logfiles = ();
|
||||||
|
# Now go and find all the files under /var/log
|
||||||
|
find({wanted => \&findlogfiles, no_chdir => 1}, '/var/log');
|
||||||
|
|
||||||
|
my @logf = sort { $a->[0] cmp $b->[0] } @logfiles;
|
||||||
|
|
||||||
|
return \@logf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub showlogFile {
|
||||||
|
|
||||||
|
my ($c, %log_datas) = @_;
|
||||||
|
|
||||||
|
my $fullpath = "/var/log/$log_datas{filename}";
|
||||||
|
my $out = '';
|
||||||
|
|
||||||
|
$out .= sprintf("$fullpath: \n");
|
||||||
|
|
||||||
|
$out .= sprintf($c->l("log_VIEWING_TIME", $c->gen_locale_date_string() ));
|
||||||
|
|
||||||
|
unless ( $log_datas{matchpattern} eq '.' )
|
||||||
|
{
|
||||||
|
#$out .= sprintf("<p>\n");
|
||||||
|
$out .= sprintf($c->l("log_MATCH_HEADER", $log_datas{matchpattern} ));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $log_datas{highlightpattern} )
|
||||||
|
{
|
||||||
|
#$out .= sprintf("<p>\n");
|
||||||
|
$out .= sprintf($c->l("log_HIGHLIGHT_HEADER", "$log_datas{highlightpattern}" ));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($log_datas{filename} =~ /\.gz$/) {
|
||||||
|
my $pid = open(LOGFILE, "-|");
|
||||||
|
die "Couldn't fork: $!" unless defined $pid;
|
||||||
|
unless ($pid) {
|
||||||
|
# Child
|
||||||
|
exec("/bin/zcat", $fullpath)
|
||||||
|
|| die "Can't exec zcat: $!";
|
||||||
|
# NOTREACHED
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
open(LOGFILE, "$fullpath");
|
||||||
|
}
|
||||||
|
|
||||||
|
my $somethingMatched = 0;
|
||||||
|
my $fileEmpty = 1;
|
||||||
|
$out .= sprintf("<PRE>");
|
||||||
|
while(<LOGFILE>)
|
||||||
|
{
|
||||||
|
$fileEmpty = 0;
|
||||||
|
next unless /$log_datas{matchpattern}/;
|
||||||
|
$somethingMatched = 1;
|
||||||
|
|
||||||
|
$_ = timestamp2local($_);
|
||||||
|
$_ = HTML::Entities::encode_entities($_);
|
||||||
|
($log_datas{highlightpattern} && /$log_datas{highlightpattern}/)
|
||||||
|
? $out .= sprintf( "<b>$_</b>" )
|
||||||
|
: $out .= sprintf("$_");
|
||||||
|
}
|
||||||
|
$out .= sprintf("</PRE>");
|
||||||
|
|
||||||
|
if ($fileEmpty) {
|
||||||
|
$out .= sprintf("<p>\n");
|
||||||
|
$out .= sprintf($c->l("log_LOG_FILE_EMPTY"));
|
||||||
|
} else {
|
||||||
|
unless ($somethingMatched)
|
||||||
|
{
|
||||||
|
$out .= sprintf("<p>\n");
|
||||||
|
$out .= sprintf($c->l("log_NO_MATCHING_LINES"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close LOGFILE;
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub download_logFile {
|
||||||
|
|
||||||
|
my ($c, %log_datas) = @_;
|
||||||
|
|
||||||
|
my $fullpath = "/var/log/$log_datas{filename}";
|
||||||
|
|
||||||
|
# Save this information for later.
|
||||||
|
|
||||||
|
$cdb->get('viewlogfiles')->merge_props('DefaultOperation', $log_datas{operation});
|
||||||
|
|
||||||
|
# If the client is on windows, we must handle this a little differently.
|
||||||
|
my $win32 = FALSE;
|
||||||
|
my $mac = FALSE;
|
||||||
|
my $agent = $ENV{HTTP_USER_AGENT} || "";
|
||||||
|
if ($agent =~ /win32|windows/i) {
|
||||||
|
$win32 = TRUE;
|
||||||
|
} elsif ($agent =~ /mac/i) {
|
||||||
|
$mac = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check for errors first. Once we start sending the file it's too late to
|
||||||
|
# report them.
|
||||||
|
my $error = "";
|
||||||
|
unless (-f $fullpath) {
|
||||||
|
$error = $c->l("log_ERR_NOEXIST_FILE") . $fullpath;
|
||||||
|
}
|
||||||
|
|
||||||
|
local *FILE;
|
||||||
|
open(FILE, "<$fullpath")
|
||||||
|
or $error = $c->l("log_ERR_NOOPEN_FILE");
|
||||||
|
# Put other error checking here.
|
||||||
|
return $error if $error;
|
||||||
|
|
||||||
|
# Fix the filename, as it might have a directory prefixed to it.
|
||||||
|
my $filename = $log_datas{filename};
|
||||||
|
if ( $filename =~ m#/# ) {
|
||||||
|
$filename = (split /\//, $filename)[-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
# And send the file.
|
||||||
|
my $nl = "\n";
|
||||||
|
if ($win32) { $nl = "\r\n" }
|
||||||
|
elsif ($mac) { $nl = "\r" }
|
||||||
|
|
||||||
|
# Otherwise, send the file. Start with the headers.
|
||||||
|
# Note: The Content-disposition must be attachment, or IE will view the
|
||||||
|
# file inline like it's told. It ignores the Content-type, but it likes
|
||||||
|
# the Content-disposition (an officially unsupported header) for some
|
||||||
|
# reason. Yay Microsoft.
|
||||||
|
|
||||||
|
my $file2 = new File::Temp( UNLINK => 0 );
|
||||||
|
|
||||||
|
while (my $line = <FILE>) {
|
||||||
|
chomp $line;
|
||||||
|
my $linew = timestamp2local($line) . $nl;
|
||||||
|
print $file2 $linew;
|
||||||
|
}
|
||||||
|
close(FILE);
|
||||||
|
|
||||||
|
$c->render_file(
|
||||||
|
'filepath' => "$file2",
|
||||||
|
'filename' => "$filename",
|
||||||
|
'format' => 'x-download',
|
||||||
|
'content_disposition' => 'attachment',
|
||||||
|
'cleanup' => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
103
root/usr/share/smanager/lib/SrvMngr/Controller/Workgroup.pm
Normal file
103
root/usr/share/smanager/lib/SrvMngr/Controller/Workgroup.pm
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
package SrvMngr::Controller::Workgroup;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Network
|
||||||
|
# description : Samba workgroup
|
||||||
|
# navigation : 6000 700
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
use esmith::FormMagick::Panel::workgroup;
|
||||||
|
|
||||||
|
our $db = esmith::ConfigDB->open || die "Couldn't open config db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %wkg_datas = ();
|
||||||
|
my $title = $c->l('wkg_FORM_TITLE');
|
||||||
|
my $modul = '';
|
||||||
|
|
||||||
|
$wkg_datas{'Workgroup'} = ($db->get_prop('smb','Workgroup')) || '';
|
||||||
|
$wkg_datas{'ServerName'} = ($db->get_prop('smb','ServerName')) || '';
|
||||||
|
$wkg_datas{'ServerRole'} = ($db->get_prop('smb','ServerRole')) || '';
|
||||||
|
$wkg_datas{'RoamingProfiles'} = ($db->get_prop('smb','RoamingProfiles')) || '';
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $modul, wkg_datas => \%wkg_datas );
|
||||||
|
$c->render(template => 'workgroup');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $result = "";
|
||||||
|
|
||||||
|
my $workgroup = ($c->param('Workgroup') || 'no');
|
||||||
|
my $servername = ($c->param('ServerName') || 'WS');
|
||||||
|
my $roamingprofiles = ($c->param('RoamingProfiles') || 'no');
|
||||||
|
my $serverrole = ($c->param('ServerRole') || 'WS');
|
||||||
|
|
||||||
|
# controls
|
||||||
|
my $res = validate2_workgroup($c, $workgroup, $servername);
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
$res = validate2_servername($c, $servername);
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
|
||||||
|
if ($result eq '') {
|
||||||
|
$db->get('smb')->set_prop('Workgroup', $workgroup);
|
||||||
|
$db->get('smb')->set_prop('ServerRole', $serverrole);
|
||||||
|
$db->get('smb')->set_prop('ServerName', $servername);
|
||||||
|
$db->get('smb')->set_prop('RoamingProfiles', $roamingprofiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
system( "/sbin/e-smith/signal-event", "workgroup-update" ) == 0
|
||||||
|
or $result = $c->l('ERROR_UPDATING') . " system";
|
||||||
|
|
||||||
|
my $title = $c->l('wkg_FORM_TITLE');
|
||||||
|
|
||||||
|
if ( $result eq '' ) { $result = $c->l('wkg_SUCCESS'); }
|
||||||
|
|
||||||
|
$c->stash( title => $title, modul => $result );
|
||||||
|
$c->render(template => 'module');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub validate2_servername {
|
||||||
|
my $c = shift;
|
||||||
|
my $servername = shift;
|
||||||
|
|
||||||
|
return ('OK') if ( $servername =~ /^([a-zA-Z][\-\w]*)$/ );
|
||||||
|
|
||||||
|
return $c->l('INVALID_SERVERNAME');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub validate2_workgroup {
|
||||||
|
my $c = shift;
|
||||||
|
my $workgroup = lc(shift);
|
||||||
|
my $servername = lc(shift);
|
||||||
|
# my $workgroup = $c->l(shift);
|
||||||
|
# my $servername = $c->l(shift);
|
||||||
|
|
||||||
|
return $c->l('INVALID_WORKGROUP') unless ( $workgroup =~ /^([a-zA-Z0-9][\-\w\.]*)$/ );
|
||||||
|
return $c->l('INVALID_WORKGROUP_MATCHES_SERVERNAME') if ( $servername eq $workgroup);
|
||||||
|
return ('OK');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
560
root/usr/share/smanager/lib/SrvMngr/Controller/Yum.pm
Normal file
560
root/usr/share/smanager/lib/SrvMngr/Controller/Yum.pm
Normal file
@ -0,0 +1,560 @@
|
|||||||
|
package SrvMngr::Controller::Yum;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : System
|
||||||
|
# description : Software installer
|
||||||
|
# navigation : 4000 300
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
|
||||||
|
use SrvMngr qw(theme_list init_session ip_number_or_blank);
|
||||||
|
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
|
||||||
|
use esmith::util;
|
||||||
|
use File::Basename;
|
||||||
|
|
||||||
|
our $cdb = esmith::ConfigDB->open || die "Couldn't open config db";
|
||||||
|
|
||||||
|
#use File::stat;
|
||||||
|
|
||||||
|
our %dbs;
|
||||||
|
|
||||||
|
for ( qw(available installed updates) )
|
||||||
|
{
|
||||||
|
$dbs{$_} = esmith::ConfigDB->open_ro("yum_$_") or
|
||||||
|
die "Couldn't open yum_$_ DB\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( qw(repositories) )
|
||||||
|
{
|
||||||
|
$dbs{$_} = esmith::ConfigDB->open("yum_$_") or
|
||||||
|
die "Couldn't open yum_$_ DB\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my %yum_datas = ();
|
||||||
|
my $title = $c->l('yum_FORM_TITLE');
|
||||||
|
my $dest = 'yum';
|
||||||
|
my $notif = '';
|
||||||
|
|
||||||
|
$yum_datas{'trt'} = 'STAT';
|
||||||
|
|
||||||
|
if ( -e "/var/run/yum.pid" ) {
|
||||||
|
$yum_datas{'trt'} = 'LOGF';
|
||||||
|
$dest = 'yumlogfile';
|
||||||
|
} elsif ($cdb->get_prop('yum', 'LogFile')) {
|
||||||
|
$yum_datas{'trt'} = 'PSTU';
|
||||||
|
$yum_datas{'reconf'} = $cdb->get_value('UnsavedChanges', 'yes');
|
||||||
|
$dest = 'yumpostupg';
|
||||||
|
} else {
|
||||||
|
# normal other trt
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $notif, yum_datas => \%yum_datas );
|
||||||
|
return $c->render( template => $dest );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = ($c->param('trt') || 'STAT');
|
||||||
|
|
||||||
|
my %yum_datas = ();
|
||||||
|
my $title = $c->l('yum_FORM_TITLE');
|
||||||
|
my ($notif, $dest) = '';
|
||||||
|
|
||||||
|
$yum_datas{'trt'} = $trt;
|
||||||
|
|
||||||
|
# force $trt if current logfile
|
||||||
|
if ( -e "/var/run/yum.pid" ) {
|
||||||
|
$trt = 'LOGF';
|
||||||
|
} elsif ($cdb->get_prop('yum', 'LogFile')) {
|
||||||
|
$trt = 'PSTU';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'UPDT' ) {
|
||||||
|
$dest = 'yumupdate';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'INST' ) {
|
||||||
|
$dest = 'yuminstall';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'REMO' ) {
|
||||||
|
$dest = 'yumremove';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'CONF' ) {
|
||||||
|
$dest = 'yumconfig';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'LOGF' ) {
|
||||||
|
if (-e "/var/run/yum.pid") {
|
||||||
|
$dest = 'yumlogfile';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'PSTU') {
|
||||||
|
if ($cdb->get_prop('yum', 'LogFile')) {
|
||||||
|
$dest = 'yumpostupg';
|
||||||
|
$yum_datas{'reconf'} = $cdb->get_value('UnsavedChanges', 'yes');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $dest ) { $dest = 'yum'; }
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $notif, yum_datas => \%yum_datas );
|
||||||
|
return $c->render( template => $dest );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub do_update {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
my $rt = $c->current_route;
|
||||||
|
my $trt = $c->param('trt');
|
||||||
|
|
||||||
|
my %yum_datas = ();
|
||||||
|
$yum_datas{trt} = $trt;
|
||||||
|
|
||||||
|
my $title = $c->l('yum_FORM_TITLE');
|
||||||
|
|
||||||
|
my ($dest, $res, $result) = '';
|
||||||
|
|
||||||
|
if ( $trt eq 'UPDT' ) {
|
||||||
|
|
||||||
|
$dest = 'yumupdate';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->do_yum('update');
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$yum_datas{trt} = 'SUC';
|
||||||
|
#$result = $c->l('yum_SUCCESS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'INST' ) {
|
||||||
|
|
||||||
|
$dest = 'yuminstall';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->do_yum('install');
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$yum_datas{trt} = 'SUC';
|
||||||
|
#$result = $c->l('yum_SUCCESS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'REMO' ) {
|
||||||
|
|
||||||
|
$dest = 'yumremove';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->do_yum('remove');
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$yum_datas{trt} = 'SUC';
|
||||||
|
#$result = $c->l('yum_SUCCESS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $trt eq 'CONF' ) {
|
||||||
|
|
||||||
|
$dest = 'yumconfig';
|
||||||
|
|
||||||
|
if ( ! $result ) {
|
||||||
|
$res = $c->change_settings();
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$yum_datas{trt} = 'SUC';
|
||||||
|
$result = $c->l('yum_SUCCESS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'PSTU') {
|
||||||
|
|
||||||
|
my $reconf = $c->param('reconf') || 'yes';
|
||||||
|
$dest = 'yumpostupg';
|
||||||
|
|
||||||
|
# effective reconfigure and reboot required
|
||||||
|
if ( $reconf eq 'yes' ) {
|
||||||
|
$res = $c->post_upgrade_reboot();
|
||||||
|
$result .= $res unless $res eq 'OK';
|
||||||
|
if ( ! $result ) {
|
||||||
|
$yum_datas{trt} = 'SUC';
|
||||||
|
$result = $c->l('yum_SYSTEM_BEING_RECONFIGURED');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$yum_datas{trt} = 'SUC';
|
||||||
|
$result = $c->l('yum_UPDATE_SUCCESS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( $trt eq 'LOGF' ) {
|
||||||
|
|
||||||
|
$dest = 'yumlogfile';
|
||||||
|
if ( ! -e "/var/run/yum.pid") {
|
||||||
|
$yum_datas{trt} = 'SUC';
|
||||||
|
$result = $c->l('yum_SUCCESS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# do_yum ended (no message) --> forced to LOGFile
|
||||||
|
if ( ! $result ) {
|
||||||
|
$dest = 'yumlogfile';
|
||||||
|
$yum_datas{trt} = 'LOGF';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$c->stash( title => $title, notif => $result, yum_datas => \%yum_datas );
|
||||||
|
if ($yum_datas{trt} ne 'SUC') {
|
||||||
|
return $c->render(template => $dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
my $message = "'Yum' $trt update DONE";
|
||||||
|
$c->app->log->info($message);
|
||||||
|
$c->flash(success => $result) if $result;
|
||||||
|
|
||||||
|
$c->redirect_to("/yum");
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub is_empty {
|
||||||
|
|
||||||
|
my ($c, $yumdb) = @_;
|
||||||
|
|
||||||
|
my $groups = $dbs{$yumdb}->get_all_by_prop(type => 'group') || 'none';
|
||||||
|
my $packages = $dbs{$yumdb}->get_all_by_prop(type => 'package') || 'none';
|
||||||
|
|
||||||
|
#Show no updates if both = none
|
||||||
|
return 1 if ($packages eq $groups);
|
||||||
|
|
||||||
|
#else return here
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub non_empty {
|
||||||
|
|
||||||
|
my ($c, $yumdb, $type) = @_;
|
||||||
|
|
||||||
|
$type ||= 'both';
|
||||||
|
|
||||||
|
return 0 unless (exists $dbs{$yumdb});
|
||||||
|
|
||||||
|
my $groups = scalar $dbs{$yumdb}->get_all_by_prop(type => 'group');
|
||||||
|
return $groups if ($type eq 'group');
|
||||||
|
|
||||||
|
my $packages = scalar $dbs{$yumdb}->get_all_by_prop(type => 'package');
|
||||||
|
if ($type eq 'package')
|
||||||
|
{
|
||||||
|
return $c->package_functions_enabled ? $packages : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($c->package_functions_enabled or $yumdb eq 'updates') ?
|
||||||
|
($groups || $packages) : $groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub package_functions_enabled {
|
||||||
|
|
||||||
|
my ($c) = @_;
|
||||||
|
|
||||||
|
return ($cdb->get_prop("yum", "PackageFunctions") eq "enabled");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_status {
|
||||||
|
|
||||||
|
my ($c, $prop, $localise) = @_;
|
||||||
|
|
||||||
|
my $status = $cdb->get_prop("yum", $prop) || 'disabled';
|
||||||
|
|
||||||
|
return $status unless $localise;
|
||||||
|
|
||||||
|
return $c->l($status eq 'enabled' ? 'ENABLED' : 'DISABLED');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_options {
|
||||||
|
|
||||||
|
my ($c, $yumdb, $type) = @_;
|
||||||
|
|
||||||
|
my %options;
|
||||||
|
|
||||||
|
for ($dbs{$yumdb}->get_all_by_prop(type => $type))
|
||||||
|
{
|
||||||
|
$options{$_->key} = $_->key . " " . $_->prop("Version") . " - " .
|
||||||
|
$_->prop("Repo");
|
||||||
|
}
|
||||||
|
|
||||||
|
return \%options;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_options2 {
|
||||||
|
|
||||||
|
my ($c, $yumdb, $type) = @_;
|
||||||
|
|
||||||
|
my @options;
|
||||||
|
|
||||||
|
for ($dbs{$yumdb}->get_all_by_prop(type => $type))
|
||||||
|
{
|
||||||
|
push @options, [ $_->key . " " . $_->prop("Version") . " - " .
|
||||||
|
$_->prop("Repo") => $_->key ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return \@options;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_names {
|
||||||
|
|
||||||
|
return [ keys %{get_options(@_)} ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_names2 {
|
||||||
|
|
||||||
|
my ($c, $yumdb, $type) = @_;
|
||||||
|
my @selected;
|
||||||
|
|
||||||
|
for ($dbs{$yumdb}->get_all_by_prop(type => $type)) {
|
||||||
|
push @selected, $_->key;
|
||||||
|
}
|
||||||
|
|
||||||
|
return \@selected;
|
||||||
|
# return [ values @{get_options2(@_)} ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_repository_options2 {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my @options;
|
||||||
|
|
||||||
|
foreach my $repos (
|
||||||
|
$dbs{repositories}->get_all_by_prop(type => "repository") )
|
||||||
|
{
|
||||||
|
next unless ($repos->prop('Visible') eq 'yes'
|
||||||
|
or $repos->prop('status') eq 'enabled');
|
||||||
|
|
||||||
|
push @options, [ $repos->prop('Name') => $repos->key ];
|
||||||
|
}
|
||||||
|
|
||||||
|
my @opts = sort { $a->[0] cmp $b->[0] } @options;
|
||||||
|
|
||||||
|
return \@opts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_repository_current_options
|
||||||
|
{
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my @selected;
|
||||||
|
|
||||||
|
foreach my $repos (
|
||||||
|
$dbs{repositories}->get_all_by_prop( type => "repository" ) )
|
||||||
|
{
|
||||||
|
next unless ($repos->prop('Visible') eq 'yes'
|
||||||
|
or $repos->prop('status') eq 'enabled');
|
||||||
|
|
||||||
|
push @selected, $repos->key if ($repos->prop('status') eq 'enabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
return \@selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_avail2 {
|
||||||
|
|
||||||
|
my ($c, $yumdb, $type) = @_;
|
||||||
|
|
||||||
|
return $c->get_options2("available", "package");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_check_freq_opt {
|
||||||
|
|
||||||
|
my ($c) = @_;
|
||||||
|
|
||||||
|
return [[ $c->l('DISABLED') => 'disabled'],
|
||||||
|
[ $c->l('yum_1DAILY') => 'daily'],
|
||||||
|
[ $c->l('yum_2WEEKLY') => 'weekly'],
|
||||||
|
[ $c->l('yum_3MONTHLY') => 'monthly']];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub print_skip_header {
|
||||||
|
|
||||||
|
my ($c) = shift;
|
||||||
|
|
||||||
|
return "<INPUT TYPE=\"hidden\" NAME=\"skip_header\" VALUE=\"1\">\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub change_settings {
|
||||||
|
|
||||||
|
my ($c) = @_;
|
||||||
|
|
||||||
|
for my $param ( qw(
|
||||||
|
PackageFunctions
|
||||||
|
) )
|
||||||
|
{
|
||||||
|
$cdb->set_prop('yum', $param, $c->param("yum_$param"));
|
||||||
|
}
|
||||||
|
|
||||||
|
my $check4updates = $c->param("yum_check4updates");
|
||||||
|
my $status = 'disabled';
|
||||||
|
|
||||||
|
if ($check4updates ne 'disabled') { $status = 'enabled'; }
|
||||||
|
|
||||||
|
$cdb->set_prop('yum', 'check4updates', $check4updates);
|
||||||
|
|
||||||
|
my $deltarpm = $c->param("yum_DeltaRpmProcess");
|
||||||
|
$cdb->set_prop('yum', 'DeltaRpmProcess', $deltarpm);
|
||||||
|
|
||||||
|
my $downloadonly = $c->param("yum_DownloadOnly");
|
||||||
|
if ($downloadonly ne 'disabled') { $status = 'enabled'; }
|
||||||
|
|
||||||
|
$cdb->set_prop('yum', 'DownloadOnly', $downloadonly);
|
||||||
|
|
||||||
|
my $AutoInstallUpdates = $c->param("yum_AutoInstallUpdates");
|
||||||
|
if ($AutoInstallUpdates ne 'disabled') { $status = 'enabled'; }
|
||||||
|
|
||||||
|
$cdb->set_prop('yum', 'AutoInstallUpdates', $AutoInstallUpdates);
|
||||||
|
$cdb->set_prop('yum', 'status', $status);
|
||||||
|
|
||||||
|
my %selected = map {$_ => 1} @{$c->every_param('SelectedRepositories')};
|
||||||
|
|
||||||
|
foreach my $repos (
|
||||||
|
$dbs{repositories}->get_all_by_prop(type => "repository") )
|
||||||
|
{
|
||||||
|
$repos->set_prop("status",
|
||||||
|
exists $selected{$repos->key} ? 'enabled' : 'disabled');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$dbs{repositories}->reload;
|
||||||
|
|
||||||
|
unless ( system( "/sbin/e-smith/signal-event", "yum-modify" ) == 0 )
|
||||||
|
{
|
||||||
|
return $c->l('yum_ERROR_UPDATING_CONFIGURATION');
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub do_yum {
|
||||||
|
|
||||||
|
my ($c, $function) = @_;
|
||||||
|
|
||||||
|
for ( qw(SelectedGroups SelectedPackages) )
|
||||||
|
{
|
||||||
|
$cdb->set_prop("yum", $_, join(',', (@{$c->every_param($_)} )));
|
||||||
|
}
|
||||||
|
|
||||||
|
esmith::util::backgroundCommand(0,
|
||||||
|
"/sbin/e-smith/signal-event", "yum-$function");
|
||||||
|
|
||||||
|
for ( qw(available installed updates) ) {
|
||||||
|
$dbs{$_}->reload;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_yum_status_page {
|
||||||
|
|
||||||
|
my ($c) = @_;
|
||||||
|
my $yum_status;
|
||||||
|
|
||||||
|
open(YUM_STATUS, "</var/run/yum.status");
|
||||||
|
$yum_status = <YUM_STATUS>;
|
||||||
|
close(YUM_STATUS);
|
||||||
|
|
||||||
|
return $yum_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub format_yum_log {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
$cdb->reload;
|
||||||
|
|
||||||
|
my $filepage = $cdb->get_prop('yum', 'LogFile');
|
||||||
|
return '' unless $filepage and ( -e "$filepage" );
|
||||||
|
|
||||||
|
my $out = sprintf "<PRE>";
|
||||||
|
open (FILE, "$filepage");
|
||||||
|
while (<FILE>) {
|
||||||
|
$out .= sprintf("%s", $_);
|
||||||
|
}
|
||||||
|
close FILE;
|
||||||
|
$out .= sprintf "</PRE>";
|
||||||
|
|
||||||
|
undef $filepage;
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub post_upgrade_reboot {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
$cdb->get_prop_and_delete('yum', 'LogFile');
|
||||||
|
$cdb->reload;
|
||||||
|
|
||||||
|
if (fork == 0) {
|
||||||
|
exec "/sbin/e-smith/signal-event post-upgrade; /sbin/e-smith/signal-event reboot";
|
||||||
|
die "Exec failed";
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'OK'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub show_yum_log {
|
||||||
|
my $c = shift;
|
||||||
|
my $out = $c->format_yum_log();
|
||||||
|
my $yum_log = $cdb->get_prop_and_delete('yum', 'LogFile');
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
8
root/usr/share/smanager/lib/SrvMngr/I18N.pm
Normal file
8
root/usr/share/smanager/lib/SrvMngr/I18N.pm
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package SrvMngr::I18N;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use utf8;
|
||||||
|
use parent 'Locale::Maketext';
|
||||||
|
|
||||||
|
1;
|
@ -0,0 +1,282 @@
|
|||||||
|
'bac_BACKUP_TITLE' => 'Backup or restore server data',
|
||||||
|
'bac_BACKUP_DESC' => '<P>The server provides two ways to back up and restore
|
||||||
|
your server: using your local desktop or a tape drive.</P>
|
||||||
|
<P>The first method creates a copy of your server configuration and user
|
||||||
|
data files, and downloads it to your local desktop via your web browser.
|
||||||
|
Currently your configuration and data files total approximately
|
||||||
|
<b>[_1]</b>. The backup file will be somewhat less than this,
|
||||||
|
depending on how compressible the data are. The \"Verify desktop backup
|
||||||
|
file\" option can be used to check the integrity of a desktop backup
|
||||||
|
file.</P>
|
||||||
|
<P>The tape backup method uses a software package called <I>[_2]</I>
|
||||||
|
to back up your entire hard disk to tape every night. This requires a
|
||||||
|
supported tape drive and a tape that is not write-protected. The backup
|
||||||
|
is performed automatically at the selected time every night (with a
|
||||||
|
reminder automatically e-mailed to the administrator during the day).
|
||||||
|
Currently your hard disk contains <b>[_3]</b> of data.</P>
|
||||||
|
<P>Both restore methods allow you to restore your configuration and user
|
||||||
|
data files. <b>Ideally, the restore should be performed on a freshly
|
||||||
|
installed server</b>.</P>',
|
||||||
|
'bac_BACKUP_DESC_DAR' => '<P>Three ways are provided to back up and restore your
|
||||||
|
server: using a tape drive, using a network share or a local
|
||||||
|
removable disk, or using your local desktop.</P>
|
||||||
|
<P>Tape Backup. This method uses a software package called <I>[_1]</I>
|
||||||
|
to back up your entire hard disk to tape every night. This requires a
|
||||||
|
supported tape drive and a tape that is not write-protected. The backup
|
||||||
|
is performed automatically at the selected time every night (with a
|
||||||
|
reminder automatically e-mailed to the administrator during the day).
|
||||||
|
Currently your hard disk contains <b>[_2]</b> of data.</P>
|
||||||
|
<P>Workstation backup. This method uses a software package called <I>dar</I>
|
||||||
|
to back up your server configuration and data files to a network share
|
||||||
|
or a local removable disk such as a USB disk.
|
||||||
|
You can manage how many rotating sets of backups are kept,
|
||||||
|
and how many incremental backups to have in each set.
|
||||||
|
The backup is performed automatically at the selected time every day. Currently
|
||||||
|
configuration and data files total approximately <b>[_3]</b> uncompressed.
|
||||||
|
Twice the compressed data size must be available on the backup share.</P>
|
||||||
|
<P>Backup to Desktop. This method creates a copy of your server
|
||||||
|
configuration and user data files, and downloads it to your
|
||||||
|
local desktop via your web browser.
|
||||||
|
Currently your configuration and data files total approximately
|
||||||
|
<b>[_3]</b>. The backup file will be somewhat less than this,
|
||||||
|
depending on how much the data can be compressed.
|
||||||
|
This file can be used to restore the server from the console if you
|
||||||
|
copy it to a local removable disk such as a USB disk.</P>
|
||||||
|
<P>All backup methods allow you to restore your configuration and user
|
||||||
|
data files. Workstation backup provides individual file restore. <b>Ideally,
|
||||||
|
full restore should be performed on a freshly installed server</b>.</P>',
|
||||||
|
'bac_BACKUP_CONFIG_STATUS' => 'Backup configuration and status',
|
||||||
|
'bac_BACKUPS_RUN_AT' => 'Regular tape backups will run at: ',
|
||||||
|
'bac_REMINDER_MESSAGE_AT' => 'Reminder messages will be sent at: ',
|
||||||
|
'bac_TAPE_BACKUPS' => 'Tape backups are ',
|
||||||
|
'bac_DESKTOP_BACKUP' => 'Backup to desktop',
|
||||||
|
'bac_DESKTOP_RESTORE' => 'Restore from desktop',
|
||||||
|
'bac_DESKTOP_VERIFY' => 'Verify desktop backup file',
|
||||||
|
'bac_TAPE_CONFIGURE' => 'Configure tape backup',
|
||||||
|
'bac_TAPE_RESTORE' => 'Restore from tape',
|
||||||
|
'bac_RESTORE_IN_PROGRESS_BEGAN_AT' => 'A system restore is in progress. It began at: ',
|
||||||
|
'bac_REFRESH_THIS_DISPLAY' => 'Refresh this display',
|
||||||
|
'bac_CONFIGURE_TAPE_BACKUP' => 'Configure tape backup',
|
||||||
|
'bac_RESTORE_COMPLETED' => 'A system restore has completed',
|
||||||
|
'bac_STARTED_AT' => 'It began at: ',
|
||||||
|
'bac_FINISHED_AT' => 'and finished at: ',
|
||||||
|
'bac_YOU_MUST_REBOOT' => 'You must reboot the server to activate any configuration changes that were
|
||||||
|
made as a result of this restore.',
|
||||||
|
'bac_REBOOT' => 'Reboot',
|
||||||
|
'bac_SELECT_AN_ACTION' => 'Select an action',
|
||||||
|
'bac_X_BACKUP_OR_RESTORE' => 'X Backup or restore server data',
|
||||||
|
'bac_ERR_PRE_BACKUP' => 'Error occurred during pre-backup actions.',
|
||||||
|
'bac_ERR_PRE_RESTORE' => 'Error occurred during pre-restore actions.',
|
||||||
|
'bac_ERR_POST_BACKUP' => 'Error occurred during post-backup actions.',
|
||||||
|
'bac_RESTORE_SERVER_CONFIG' => 'Restore server configuration',
|
||||||
|
'bac_DESKTOP_RESTORE_DESC' => 'This process will upload a server backup file from your local desktop to your server and restore the configuration and user data files. <B>The restore should be performed on a freshly installed server</B>.',
|
||||||
|
'bac_FREE_SPACE' => 'You have approximately [_1] free space on the server.
|
||||||
|
Check that desktop backup file is less than [_2] before
|
||||||
|
commencing the restore.',
|
||||||
|
'bac_MUST_REBOOT_AFTER_RESTORE' => 'After the restore completes you must reboot the server.',
|
||||||
|
'bac_FILE_TO_RESTORE' => 'Backup file to restore from',
|
||||||
|
'bac_VERIFY_BACKUP_DESC' => '
|
||||||
|
<p>This option will display the names of all files
|
||||||
|
in a previously created desktop backup file. You
|
||||||
|
can use this option to verify the contents of the
|
||||||
|
backup file.</p> ',
|
||||||
|
'bac_SELECT_BACKUP_FILE' => 'Select backup file',
|
||||||
|
'bac_VERIFY' => 'Verify',
|
||||||
|
'bac_RESTORE_CANNOT_PROCEED' => 'Unable to proceed with restore of server configuration',
|
||||||
|
'bac_ANOTHER_RESTORE_IN_PROGRESS' => 'Another restore is in progress. Please try again later.',
|
||||||
|
'bac_RESTORE_IN_PROGRESS' => 'Restore in progress',
|
||||||
|
'bac_RESTORE_IN_PROGRESS_DESC' => 'After the restore completes you must reboot the server. Your restore is
|
||||||
|
complete when the words "Restore complete" appear at the bottom of your screen.
|
||||||
|
',
|
||||||
|
'bac_FILES_HAVE_BEEN_RESTORED' => 'The following files and directories have been restored:',
|
||||||
|
'bac_RESTORE_FAILED_MSG' => 'Restore failed! There was an error in reading the backup file.',
|
||||||
|
'bac_RESTORE_COMPLETE' => 'Restore complete',
|
||||||
|
'bac_ERR_RESTORING_GID' => 'Error occurred while restoring gid of \'www\'',
|
||||||
|
'bac_ERR_RESTORING_INITIAL_GRP' => 'Error occurred while restoring initial group of \'www\'.',
|
||||||
|
'bac_RESTORE_FAILED' => 'Restore failed! The backup file was incomplete.',
|
||||||
|
'bac_COULD_NOT_EXEC_PIPELINE' => 'Could not execute backup pipeline: ',
|
||||||
|
'bac_COULD_NOT_DECODE' => 'Could not decode backup file: ',
|
||||||
|
'bac_FILES_IN_BACKUP' => 'The following files are considered in the backup :',
|
||||||
|
'bac_VERIFY_COMPLETE' => 'Verification is complete',
|
||||||
|
'bac_BACKUP_FILE_INCOMPLETE' => 'The backup file was incomplete',
|
||||||
|
'bac_ERR_READING_FILE' => 'There was an error in reading the backup file.',
|
||||||
|
'bac_ENABLE_DISABLE_TAPE' => 'Enable/Disable Nightly Tape Backup',
|
||||||
|
'bac_TAPE_CONFIG_DESC' => '<p>Select whether you wish to enable nightly backups. Then indicate the
|
||||||
|
desired times for the backup and the load tape reminder.</p> <p>The tape
|
||||||
|
backup requires a supported tape drive. A warning message will be sent to
|
||||||
|
the administrator at the designated reminder time if the tape drive is
|
||||||
|
empty.</p>',
|
||||||
|
'bac_ENABLE_TAPE_BACKUP' => 'Enable tape backup',
|
||||||
|
'bac_TAPE_BACKUP_TIME' => 'Tape backup time of day (hour/min)',
|
||||||
|
'bac_LOAD_TAPE_REMINDER_TIME' => 'Load tape reminder time of day (hour/min)',
|
||||||
|
'bac_AM/PM' => 'AM/PM',
|
||||||
|
'bac_AM' => 'AM',
|
||||||
|
'bac_PM' => 'PM',
|
||||||
|
'bac_UPDATE_CONF' => 'Update',
|
||||||
|
'bac_UPDATING_TAPE_CONF' => 'Updating tape backup configuration',
|
||||||
|
'bac_ERR_INVALID_HOUR' => 'Error: invalid backup hour: ',
|
||||||
|
'bac_BETWEEN_0_AND_12' => 'Please choose an hour between 0 and 12.',
|
||||||
|
'bac_ERR_INVALID_MINUTE' => 'Error: invalid backup minute: ',
|
||||||
|
'bac_BETWEEN_0_AND_59' => 'Please choose a minute between 0 and 59.',
|
||||||
|
'bac_ERR_INVALID_REMINDER_HOUR' => 'Error: invalid reminder hour: ',
|
||||||
|
'bac_ERR_INVALID_REMINDER_MINUTE' => 'Error: invalid reminder minute: ',
|
||||||
|
'bac_ERR_CONF_BACKUP' => 'Error occurred during conf-backup event.',
|
||||||
|
'bac_SUCCESSFULLY_ENABLED_TAPE' => 'Successfully enabled tape backups',
|
||||||
|
'bac_WITH_BACKUP_TIME' => 'with backup time: ',
|
||||||
|
'bac_WITH_REMINDER_TIME' => 'and load tape reminder time: ',
|
||||||
|
'bac_SUCCESSFULLY_DISABLED' => 'Successfully disabled tape backups',
|
||||||
|
'bac_RESTORE_CONF_FROM_TAPE' => 'Restore server configuration from tape backup',
|
||||||
|
'bac_RESTORE_CONF_FROM_TAPE_DESC' => '<P>This process will restore the configuration and user data files from a
|
||||||
|
server tape backup. <B>The restore should be performed on a freshly installed server</B>.</P>
|
||||||
|
<P>Ensure that you have loaded the desired backup tape into the tape drive
|
||||||
|
before proceeding.</P>
|
||||||
|
<P>After the restore completes you must reboot the server.</P>',
|
||||||
|
'bac_RESTORE_FROM_TAPE' => 'Restore From Tape',
|
||||||
|
'bac_UNABLE_TO_RESTORE_CONF' => 'Unable to restore server configuration',
|
||||||
|
'bac_RESTORING_FROM_TAPE' => 'Restoring From Tape',
|
||||||
|
'bac_NOW_RESTORING_FROM_TAPE' => 'Your server configuration and user data
|
||||||
|
files are now being restored from tape.',
|
||||||
|
'bac_ERR_RESTORING_FROM_TAPE' => 'Error occurred restoring files from tape.',
|
||||||
|
'bac_ERR_UPDATING_CONF_AFTER_TAPE_RESTORE' => 'Error occurred while updating system configuration after tape
|
||||||
|
restore.',
|
||||||
|
'bac_COULD_NOT_FORK' => 'Could not fork: ',
|
||||||
|
'bac_SERVER_REBOOT' => 'Server reboot',
|
||||||
|
'bac_SERVER_WILL_REBOOT' => 'Your server will now reboot.',
|
||||||
|
'bac_NO_UID_FOR_NAME' => 'Could not get uid for user named: ',
|
||||||
|
'bac_PAGE_REFRESH_IN' => 'This page will refresh to the status display in [_1] seconds, or
|
||||||
|
click <a href="/server-manager/cgi-bin/backup">here</a>.',
|
||||||
|
'Backup or restore' => 'Backup or restore',
|
||||||
|
'bac_BACKUP_DESKTOP_TOO_BIG' => 'Your server has too much data for a reliable backup to desktop.',
|
||||||
|
'bac_WORKSTN_BACKUPS' => 'Workstation backups are ',
|
||||||
|
'bac_WKBACKUPS_RUN_AT' => 'Regular workstation backups will run at: ',
|
||||||
|
'bac_WORKSTN_CONFIGURE' => 'Configure workstation backup',
|
||||||
|
'bac_WORKSTN_VERIFY' => 'Verify workstation backup',
|
||||||
|
'bac_WORKSTN_RESTORE' => 'Restore from workstation',
|
||||||
|
'bac_CONFIGURE_WORKSTN_BACKUP' => 'Configure Workstation Backup',
|
||||||
|
'bac_ENABLE_DISABLE_WORKSTN' => 'Enable/Disable Daily Workstation Backup',
|
||||||
|
'bac_ENABLE_WORKSTN_BACKUP' => 'Enable Workstation Backup',
|
||||||
|
'bac_WORKSTN_BACKUP_TIME' => 'Workstation backup time of day (hour/min)',
|
||||||
|
'bac_UPDATING_WORKSTN_CONF' => 'Updating workstation backup configuration',
|
||||||
|
'bac_SUCCESSFULLY_ENABLED_WORKSTN' => 'Successfully enabled workstation backups',
|
||||||
|
'bac_SUCCESSFULLY_DISABLED_WORKSTN' => 'Successfully disabled workstation backups',
|
||||||
|
'bac_VERIFY_WORKSTN_BACKUP_FILE' => 'Verify workstation backup',
|
||||||
|
'bac_VERIFY_WORKSTN_BACKUP_DESC' => '<p>This option will display the names of all files
|
||||||
|
in a previously created workstation daily backup. You
|
||||||
|
can use this option to verify the contents of the
|
||||||
|
backup.<b>You must choose the backup you want to verify</b></p>
|
||||||
|
<p>Only files flagged with (Saved) are contained in the backup.</p>
|
||||||
|
<br/>Backup files are verified from shared folder :',
|
||||||
|
'bac_RESTORE_CONF_FROM_WORKSTN' => 'Restore server configuration from workstation backup',
|
||||||
|
'bac_RESTORE_CONF_FROM_WORKSTN_DESC' => '<p>This process will restore the configuration and user data files from a
|
||||||
|
Server workstation backup. <b>The restore
|
||||||
|
should be performed on a freshly installed Server</b>.</p>
|
||||||
|
<p>Ensure that choose the right backup to restore below
|
||||||
|
before proceeding.</p>
|
||||||
|
<p>After the restore completes you must reboot the server.</p>
|
||||||
|
Backup will be restored from : ',
|
||||||
|
'bac_RESTORE_FROM_WORKSTN' => 'Restore From Workstation',
|
||||||
|
'bac_RESTORING_FROM_WORKSTN' => 'Restoring From Workstation',
|
||||||
|
'bac_NOW_RESTORING_FROM_WORKSTN' => 'Your server configuration and user data
|
||||||
|
files are now being restored from workstation shared folder.',
|
||||||
|
'bac_ERR_RESTORING_FROM_WORKSTN' => 'Error occurred restoring files from workstation.',
|
||||||
|
'bac_ERR_UPDATING_CONF_AFTER_WORKSTN_RESTORE' => 'Error occurred while updating system configuration after workstation
|
||||||
|
restore.',
|
||||||
|
'bac_WORKSTN_NAME' => 'Workstation IP or hostname',
|
||||||
|
'bac_WORKSTN_BACKUP_SETTINGS' => 'Workstation Backup Settings',
|
||||||
|
'bac_SHARED_FOLDER_NAME' => 'Backup share',
|
||||||
|
'bac_WORKSTN_LOGIN' => 'Login name',
|
||||||
|
'bac_WORKSTATION_BACKUP_DEST' => 'Backup workstation settings',
|
||||||
|
'bac_CONFIGURE_WORKSTN_BACKUP_DESC' => 'You can set the number of
|
||||||
|
successive backup sets to keep on the workstation, with automatic rotation.
|
||||||
|
Each set may contain saved data for several consecutive days.
|
||||||
|
In this case first backup of the set is full backup, others daily backups are
|
||||||
|
incremental. You can also set a time limit for each backup session or for incremental
|
||||||
|
backups only. When this limit occurs, backup is cleanly stopped and the next
|
||||||
|
incremental backup will safely continue with unsaved and modified datas.',
|
||||||
|
'bac_ERR_INVALID_WORKSTN' => 'Invalid Workstation IP or Hostname ',
|
||||||
|
'bac_ERR_INVALID_FOLDER' => 'Invalid share name',
|
||||||
|
'bac_ERR_INVALID_LOGIN' => 'Invalid Login',
|
||||||
|
'bac_ERR_INVALID_PASSWORD' => 'Invalid Password',
|
||||||
|
'bac_ERR_ALREADY_MOUNTED' => 'Backup directory is already mounted',
|
||||||
|
'bac_ERR_MOUNTING_SMBSHARE' => 'Unable to mount workstation shared folder',
|
||||||
|
'bac_ERR_NOT_MOUNTED' => 'Backup directory is not mounted',
|
||||||
|
'bac_WORKSTN_NOT_SET' => 'You must first correctly configure your workstation backup',
|
||||||
|
'bac_NO_BACKUPS_TO_RESTORE' => 'There is no backup set on configured workstation shared folder. Verify your configuration settings.',
|
||||||
|
'bac_NUMBER_OF_SETS' => 'Number of rotating backup sets',
|
||||||
|
'bac_NUMBER_OF_FILES_IN_SET' => 'Daily backups in each set',
|
||||||
|
'bac_ERR_INVALID_SETS_NUMBER' => 'Sets number must be 1 or greater',
|
||||||
|
'bac_ERR_INVALID_FILES_IN_SET_NUMBER' => 'This number must be 1 or greater. First backup in set is <b>full</b> others are <b>incrementals</b>',
|
||||||
|
'bac_WORKSTN_TIMEOUT' => 'Optional backup session timeout (hours)',
|
||||||
|
'bac_INC_ONLY_TIMEOUT' => 'Don\'t timeout full backup sessions',
|
||||||
|
'bac_ERR_INVALID_TIMEOUT' => 'Maximum backup time must be set between 1 and 24 hours',
|
||||||
|
'bac_ERR_NO_HOST_DIR' => 'No directory for your host in shared folder. Maybe your host name is different from backup ones',
|
||||||
|
'bac_ERROR_READING_FILE' => 'Error while reading files from',
|
||||||
|
'bac_WORKSTN_SEL_RESTORE' => 'Selective file restore from workstation',
|
||||||
|
'bac_WORKSTN_SELECTIVE_RESTORE' => 'Workstation selective file restore',
|
||||||
|
'bac_ALL_BACKUPS' => 'All backups',
|
||||||
|
'bac_WORKSTN_SEL_REST_DESC' => 'This process will restore only specified files and directories. You must first choose
|
||||||
|
the backup from which the files will be restored. If you don\'t know in which backup
|
||||||
|
are the required files, you can select \'All backups\' option. <br/><br/>
|
||||||
|
The next panel will display available files and directories,
|
||||||
|
so you can choose the ones to restore. To restrict the number of files and directories
|
||||||
|
displayed in this panel, you have the option to give now a filtering expression,
|
||||||
|
applied as a regular expression to the displayed names.<br/><br/>
|
||||||
|
You have the responsibility not to restore files which could break the
|
||||||
|
functioning of your server.<br/> <br/>Currently, files will be restored from :',
|
||||||
|
'bac_BACKUP_CHOICE' => 'Selecting files to display',
|
||||||
|
'bac_SELECT_DATE_BEFORE' => 'Restore most recent before',
|
||||||
|
'bac_FILTER_EXPRESSION' => 'Names filtered by',
|
||||||
|
'bac_READ_COMPLETE' => 'You can choose all the directories and files you want to restore in the displayed list
|
||||||
|
(use ctrl or shift for multiple selection). <br/> <b>Warning :</b> If you select a directory,
|
||||||
|
all contained files and directories will be restored.<p/>
|
||||||
|
By default the most recent version of selected files is restored, but if you specify a date
|
||||||
|
in the format <i>~[~[~[yyyy/~]mm/~]dd-~]hh:mm~[:ss~]</i> the process
|
||||||
|
will restore only the most recent version modified <b>before the given date</b>.',
|
||||||
|
'bac_ERR_INVALID_SELDATE' => 'Date format is invalid, must be ~[~[~[yyyy/~]mm/~]dd-~]hh:mm~[:ss~]. ie: 2005/12/31-08:23:32 or
|
||||||
|
10-08:32 or 08:32',
|
||||||
|
'bac_SELECT_FILES_TO_RESTORE' => 'Select files to restore',
|
||||||
|
'bac_ERR_WHILE_UNMOUNTING' => 'Error occurs when unmounting distant share',
|
||||||
|
'bac_ERR_DAR_CATALOG' => 'Error when using Dar catalog',
|
||||||
|
'bac_COMPRESSION_LEVEL' => 'Backup compression level ~[0-9~]',
|
||||||
|
'bac_FULL_ONLY_ON' => 'Full backup is allowed on',
|
||||||
|
'bac_ERR_INVALID_COMPRESSION' => 'Compression level must be set between 0 (no compression) and 9 (maximum compression)',
|
||||||
|
'bac_DOW' => 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday Everyday',
|
||||||
|
'bac_CONFIGURATION_TO_BE_DONE' => 'Please configure the backup settings.',
|
||||||
|
'bac_WORKSTN_BACKUP_DESC' => '<p>This panel displays the present workstation backup configuration. You can
|
||||||
|
change it in this panel and the next one.</p><p/>',
|
||||||
|
'bac_WORKSTN_BACKUP_NOT_CONFIGURED' => '<p>Presently, workstation backup is not configured. You can set this configuration
|
||||||
|
with this panel and the next one.</p><p/>',
|
||||||
|
'bac_WORKSTN_BACKUP_ENABLED' => 'Backup is ',
|
||||||
|
'bac_WORKSTN_BACKUP_USB' => 'Backup is made on local removable disk',
|
||||||
|
'bac_WORKSTN_BACKUP_MNT' => 'Backup is made on mounted disk',
|
||||||
|
'bac_WORKSTN_BACKUP_HOST' => 'Backup is made on LAN workstation ',
|
||||||
|
'bac_WORKSTN_BACKUP_VFSTYPE' => ' via ',
|
||||||
|
'bac_WORKSTN_BACKUP_SHARE' => 'Destination backup share folder is ',
|
||||||
|
'bac_WORKSTN_BACKUP_TOD' => 'Daily backup occurs at ',
|
||||||
|
'bac_LOGIN' => 'Login is ',
|
||||||
|
'bac_PASSWORD' => 'Password is ',
|
||||||
|
'bac_WORKSTN_BACKUP_SETSNUM' => 'Number of rotating backup sets is ',
|
||||||
|
'bac_WORKSTN_BACKUP_DAYSINSET' => 'Number of daily backups contained in each set is ',
|
||||||
|
'bac_WORKSTN_BACKUP_COMPRESSION' => 'Compression level (0-9) of backup is ',
|
||||||
|
'bac_WORKSTN_BACKUP_TIMEOUT' => 'Each daily backup session is cleanly timed out after ',
|
||||||
|
'bac_WORKSTN_BACKUP_INCONLY_TIMEOUT' => 'except full backups which are cleanly timed out after 24 hours',
|
||||||
|
'bac_WORKSTN_FULL_BACKUP_EVERYDAY' => 'Full backup sessions (new backup set) are allowed everyday',
|
||||||
|
'bac_WORKSTN_FULL_BACKUP_DAY' => 'Full backup session (new backup sets) is allowed only on',
|
||||||
|
'bac_WORKSTATION_BACKUP_SETCONF' => 'Create or modify workstation backup configuration',
|
||||||
|
'bac_SELECT_VFS_TYPE' => 'Select the type of share for backup destination',
|
||||||
|
'bac_ERR_NO_USB_DISK' => 'Error : No removable disk available. Please connect a removable disk or select another type of workstation backup.',
|
||||||
|
'bac_ERR_NO_MOUNTED_DISK' => 'Error : No mounted disk available. Please mount a disk or select another type of workstation backup.',
|
||||||
|
'bac_HOURS' => 'hours.',
|
||||||
|
'bac_ERR_NO_FULL_BACKUP' => 'Aborting restore because needed full backup is missing or unreadable.',
|
||||||
|
'bac_ERR_NO_INC_BACKUP' => 'Aborting restore because the set has missing or unreadable incremental backup number',
|
||||||
|
'bac_CHECK_TO_VERIFY_FULL_RESTORE' => 'Check here to test integrity of all backups needed for a full restore with the selected backup ',
|
||||||
|
'bac_TESTING_NEEDED_BACKUPS_FOR_RESTORE' => 'Testing all backups needed for a full restore with selected backup',
|
||||||
|
'bac_TESTED_BACKUP' => 'Testing integrity of backup',
|
||||||
|
'bac_RESTORE_VERIFY_FAILED' => 'Verify integrity failed',
|
||||||
|
'bac_CHECK_INTEGRITY_WARNING' => 'Warning : For large backups, checking integrity may be a long task and should be made with daily workstation backup disabled.',
|
||||||
|
'bac_cifs' => 'cifs',
|
||||||
|
'bac_nfs' => 'nfs',
|
||||||
|
'bac_local removable disk' => 'Local removable disk',
|
||||||
|
'bac_Mounted disk' => 'Mounted disk',
|
||||||
|
'bac_ERROR_WHEN_TESTING_REMOTE_SERVER' => 'The parameters have been saved, however the remote host is not reachable, please check your settings.',
|
||||||
|
'bac_ERR_EXTRACT' => 'Error when extracting with Dar',
|
@ -0,0 +1,24 @@
|
|||||||
|
'bugr_FORM_TITLE' => 'Report a Bug',
|
||||||
|
'bugr_DO_NOT_PANIC' => 'Don\'t Panic!',
|
||||||
|
'bugr_SME_EXPERIENCE' => 'Unfortunately there is no software without bugs, and you probably came to this page because of an issue you are experiencing with your SME-server installation.',
|
||||||
|
'bugr_PLEASE_REPORT_HERE' => 'In order to help developers to diagnose and fix your issue, please download one of the following text templates, fill it out and paste it into your bug report at',
|
||||||
|
'bugr_USE_TEMPLATE' => 'Please refer to the following link on how to report efficiency a bug and use its template',
|
||||||
|
'bugr_FOLLOWING_REPORT_MIGHT_HELP' => 'It will also help if you provide some vital information on the configuration of your SME-server in your bug report. By clicking on the "Create configuration report" button below, you can create and download a text file containing this information. Please attach this file to your bug report as well.',
|
||||||
|
'bugr_REPORT_CONTENT' => 'The report will contain the following information',
|
||||||
|
'bugr_SME_VERSION' => 'Koozali SME Server version',
|
||||||
|
'bugr_SERVER_MODE' => 'Server mode',
|
||||||
|
'bugr_PREVIOUS_SERVER_MODE' => 'Previous server mode',
|
||||||
|
'bugr_KERNEL_AND_ARCH' => 'Current running kernel version and architecture',
|
||||||
|
'bugr_INSTALLED_RPMS' => 'A list of additional RPMs installed on your server',
|
||||||
|
'bugr_ALTERED_TEMPLATES' => 'A list of SME templates that have been altered on your server from a base install',
|
||||||
|
'bugr_ALTERED_EVENTS' => 'A list of SME events that have been altered on your server from a base install',
|
||||||
|
'bugr_YUM_REPOS' => 'A list of additional software repositories configured on your server',
|
||||||
|
'bugr_PRIVACY' => 'No privacy related data (ie. users, passwords, IP addresses) will be included in the report.',
|
||||||
|
'bugr_CREATE_REPORT' => 'Create configuration report',
|
||||||
|
'bugr_DONATING' => 'Have you considered donating?',
|
||||||
|
'bugr_AWARE_SME' => 'You are probaly aware that SME server is developed and supported by a collaborative community of volunteers from all over the world. While SME server is free to download and use, maintaining the infrastructure behind the project (eg. hosting the forums and wiki, providing repositories and build servers etc.) costs real money in the real world.',
|
||||||
|
'bugr_YOUR_HELP' => 'In very much the same way you need us to address your current issue, we need YOUR help to keep this project alive!',
|
||||||
|
'bugr_CONSIDER_DONATING' => 'Please consider donating to the project by clicking on the image link below:',
|
||||||
|
'bugr_THANK_YOU' => 'Thank you for your support!',
|
||||||
|
'bugr_Download this report' => 'Download this report !',
|
||||||
|
'Report a bug' => 'Report a bug',
|
@ -0,0 +1,12 @@
|
|||||||
|
'clm_FORM_TITLE' => 'Antivirus settings',
|
||||||
|
'clm_LABEL_FILESYSTEM_SCAN_PERIOD' => 'Scan filesystem',
|
||||||
|
'clm_DESC_FILESYSTEM_SCAN_PERIOD' => '<h2>General Settings</h2>
|
||||||
|
If this option is enabled then the filesystem will be
|
||||||
|
scanned for viruses.A report of any found viruses will be
|
||||||
|
emailed to the administrator.',
|
||||||
|
'clm_LABEL_QUARANTINE' => 'Quarantine infected files',
|
||||||
|
'clm_LABEL_CLAM_VERSIONS' => 'ClamAV and db versions',
|
||||||
|
'clm_WEEKLY' => 'Weekly',
|
||||||
|
'clm_NEVER' => 'Never',
|
||||||
|
'clm_DAILY' => 'Daily',
|
||||||
|
'clm_SUCCESS' => 'The new clamav antivirus settings have been saved.',
|
@ -0,0 +1,59 @@
|
|||||||
|
|
||||||
|
'dat_FORM_TITLE' => 'Date and time configuration',
|
||||||
|
'dat_INITIAL_DESC' => 'This is where you configure the date and time of this server. You may use an existing network time server or
|
||||||
|
manually set the date and time for your time zone.',
|
||||||
|
'dat_SET_DATE_TITLE' => 'Set Date and Time',
|
||||||
|
'dat_COULD_NOT_OPEN_TZ_FILE' => 'Error: Could not open timezone file for reading: ',
|
||||||
|
'dat_JANUARY' => 'January',
|
||||||
|
'dat_FEBRUARY' => 'February',
|
||||||
|
'dat_MARCH' => 'March',
|
||||||
|
'dat_APRIL' => 'April',
|
||||||
|
'dat_MAY' => 'May',
|
||||||
|
'dat_JUNE' => 'June',
|
||||||
|
'dat_JULY' => 'July',
|
||||||
|
'dat_AUGUST' => 'August',
|
||||||
|
'dat_SEPTEMBER' => 'September',
|
||||||
|
'dat_OCTOBER' => 'October',
|
||||||
|
'dat_NOVEMBER' => 'November',
|
||||||
|
'dat_DECEMBER' => 'December',
|
||||||
|
'dat_NEW_M/D/Y' => 'New month/day/year:',
|
||||||
|
'dat_NEW_H/M/S' => 'New hour/min/sec:',
|
||||||
|
'dat_AM/PM_AND_TZ' => 'AM/PM and time zone:',
|
||||||
|
'dat_NTP_ENABLE_DESC' => 'The server can periodically synchronize the system clock to a network time protocol (NTP) server. If you select this option, enter the hostname or IP address of the NTP server below.',
|
||||||
|
'dat_NTP_CONFIGURE_DESC' => 'The server is periodically synchronizing the system clock to the network time protocol (NTP) server specified below. To synchronize to a different NTP server, enter a different hostname or IP address in the field below.',
|
||||||
|
'dat_NTP_DISABLE_DESC' => 'Choose this option to stop syncronizing the system clock to the NTP
|
||||||
|
server.When the NTP service is disabled, you can set the system date and time manually from this page.',
|
||||||
|
'dat_NTP_SERVER' => 'NTP Server',
|
||||||
|
'dat_VERIFY_DATE_AND_TIME' => 'Verify date and time',
|
||||||
|
'dat_NEW_DATE_AND_TIME' => 'New date and time setting:',
|
||||||
|
'dat_SETTING_DATE_AND_TIME' => 'Setting date and time',
|
||||||
|
'dat_INVALID_DAY' => 'Error: invalid day of month: ',
|
||||||
|
'dat_BETWEEN_1_AND_31' => 'Please choose a day between 1 and 31.',
|
||||||
|
'dat_INVALID_YEAR' => 'Error: invalid year: ',
|
||||||
|
'dat_FOUR_DIGIT_YEAR' => 'Please choose a four-digit year between 1900 and 2200.',
|
||||||
|
'dat_INVALID_HOUR' => 'Error: invalid hour: ',
|
||||||
|
'dat_BETWEEN_1_AND_12' => 'Please choose an hour between 1 and 12.',
|
||||||
|
'dat_INVALID_MINUTE' => 'Error: invalid minute: ',
|
||||||
|
'dat_BETWEEN_0_AND_59' => 'Please choose a minute between 0 and 59.',
|
||||||
|
'dat_INVALID_SECOND' => 'Error: invalid second',
|
||||||
|
'dat_MONTH_BETWEEN_1_AND_12' => 'Please choose a month value between 1 and 12.',
|
||||||
|
'dat_INVALID_MONTH' => 'Error: invalid month',
|
||||||
|
'dat_UPDATING_CLOCK' => 'System clock is being updated. Please wait for a few seconds,
|
||||||
|
then click <A HREF="datetime?page=1&wherenext=Verify" TARGET="main">here</A>
|
||||||
|
to verify changes.',
|
||||||
|
'dat_ERR_SETTING_CLOCK' => 'Error occurred while setting system time and hardware clock.',
|
||||||
|
'dat_SERVER_DISABLED' => 'Network time server disabled successfully',
|
||||||
|
'dat_SERVER_DISABLED_DESC' => 'You have disabled this service: The server will rely on its internal
|
||||||
|
clock, and <b>will not</b> try to synchronize from a time server.',
|
||||||
|
'dat_ERR_CHANGING_TS' => 'Error while changing network time server setting',
|
||||||
|
'dat_INVALID_NTP_ADDR' => 'Invalid NTP server address: ',
|
||||||
|
'dat_SETTINGS_CHANGED' => 'Network time server setting changed successfully',
|
||||||
|
'dat_SYNC_WITH' => 'This server is now configured to synchronize periodically
|
||||||
|
(via the Internet) with:',
|
||||||
|
'dat_INVALID_NTP_SERVER' => 'Invalid NTP server, the server <b>will not</b> try to synchronize from a time server.',
|
||||||
|
'dat_NETWORK_TIME_SERVER' => 'Network Time Server',
|
||||||
|
'dat_NTP_CONFIGURE_TITLE' => 'Configure Network Time Server',
|
||||||
|
'dat_NTP_ENABLE_TITLE' => 'Enable Network Time Server',
|
||||||
|
'dat_NTP_DISABLE_TITLE' => 'Disable Network Time Server',
|
||||||
|
'dat_CURRENT_SETTING' => 'Current setting',
|
||||||
|
'Date and time' => 'Date and time',
|
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
'dir_FORM_TITLE' => 'Change LDAP directory settings',
|
||||||
|
'dir_LABEL_ROOT' => 'Server root',
|
||||||
|
'dir_DESCRIPTION' => 'The LDAP server provides a network-available listing of the user accounts
|
||||||
|
and groups on your server, and can be accessed using an LDAP client such as the Address Book feature
|
||||||
|
in Netscape Communicator. Configure your LDAP client with the local IP address of your server,
|
||||||
|
port number 389, and the server root parameter shown below.',
|
||||||
|
'dir_DESC_DIRECTORY_ACCESS' => ' You can control access to your LDAP directory:
|
||||||
|
the private setting allows access only from your local network, and the public setting allows access from anywhere on the Internet. ',
|
||||||
|
'dir_DIRECTORY_ACCESS' => 'LDAP directory access',
|
||||||
|
'dir_DESC_DEPARTMENT' => 'These fields are the LDAP defaults for your organization.
|
||||||
|
Whenever you create a new user account, you will be prompted
|
||||||
|
to enter all of these fields (they can be different for each
|
||||||
|
user) but the values you set here
|
||||||
|
will show up as defaults. This is a convenience to make it
|
||||||
|
faster to create user accounts.',
|
||||||
|
'dir_DEPARTMENT' => 'Default department',
|
||||||
|
'dir_COMPANY' => 'Default company',
|
||||||
|
'dir_STREET' => 'Default Street address',
|
||||||
|
'dir_CITY' => 'Default City',
|
||||||
|
'dir_PHONENUMBER' => 'Default Phone Number',
|
||||||
|
'dir_DESC_EXISTING' => 'You can either leave existing user accounts as they are, using the above defaults only for
|
||||||
|
new users, or you can apply the above defaults to all existing users as well.',
|
||||||
|
'dir_EXISTING' => 'Existing users',
|
||||||
|
'dir_SUCCESS' => 'The new LDAP default settings have been saved.',
|
||||||
|
'dir_LEAVE' => 'Leave as they are',
|
||||||
|
'dir_UPDATE' => 'Update with new defaults',
|
||||||
|
'Directory' => 'Directory',
|
@ -0,0 +1,59 @@
|
|||||||
|
|
||||||
|
'dom_ADD_DOMAIN' => 'Add domain',
|
||||||
|
'dom_FORM_TITLE' => 'Manage domains',
|
||||||
|
'dom_FORM_DESCRIPTION' => 'When you create a domain, your server will be able to
|
||||||
|
receive e-mail for that domain and will also be able to host a
|
||||||
|
web site for that domain.',
|
||||||
|
'dom_ADD_DOMAIN' => 'Add domain',
|
||||||
|
'dom_NO_VIRTUAL_DOMAINS' => 'There are no domains in the system',
|
||||||
|
'dom_CURRENT_DOMAINS' => 'Current list of domains',
|
||||||
|
'dom_PRIMARY_SITE' => 'primary site',
|
||||||
|
'dom_CONTENT' => '[_1] i-bay',
|
||||||
|
'dom_CREATE_TITLE' => 'Create a new domain',
|
||||||
|
'dom_CONTENT_FIELD_DESCRIPTION' => 'For the web site, you may choose your primary web site or any
|
||||||
|
i-bay as the content.',
|
||||||
|
'dom_DOMAIN_NAME_VALIDATION_ERROR' => 'Error: unexpected or missing characters in domain name
|
||||||
|
[_1].The domain name should contain one or more
|
||||||
|
letters, numbers, periods and minus signs.Did not create new domain.',
|
||||||
|
'dom_DOMAIN_DESCRIPTION_VALIDATION_ERROR' => 'Error: unexpected or missing characters in domain description
|
||||||
|
[_1]. Did not create new domain.',
|
||||||
|
'dom_DOMAIN_IN_USE_ERROR' => 'Error: domain [_1] is already in use.Did not create
|
||||||
|
new domain.',
|
||||||
|
'dom_SYSTEM_DOMAIN_ERROR' => 'Error: domain [_1] is your system domain name.You
|
||||||
|
cannot have a domain with the same name.Did not create new domain.',
|
||||||
|
'dom_SUCCESSFULLY_CREATED' => 'Successfully created domain [_1].Your web
|
||||||
|
server is now being restarted.The links on this page will be
|
||||||
|
inactive until the web server restart is complete.',
|
||||||
|
'dom_MODIFY_TITLE' => 'Modify domain',
|
||||||
|
'dom_NONEXISTENT_DOMAIN_ERROR' => 'Error: [_1] is not an existing domain.',
|
||||||
|
'dom_SUCCESSFULLY_MODIFIED' => 'Successfully modified domain [_1].Your web
|
||||||
|
server is now being restarted.The links on this page will be inactive until the web server restart is complete.',
|
||||||
|
'dom_REMOVE_TITLE' => 'Remove domain',
|
||||||
|
'dom_REMOVE_DESCRIPTION' => 'You are about to remove the domain "[_1]" ([_2]).',
|
||||||
|
'dom_ABOUT_TO_REMOVE' => 'Are you sure you wish to remove this domain ?',
|
||||||
|
'dom_ERROR_WHILE_REMOVING_DOMAIN' => 'Error: internal failure while removing domain [_1].',
|
||||||
|
'dom_SUCCESSFULLY_DELETED' => 'Successfully deleted domain [_1]. Your web server
|
||||||
|
is now being restarted.The links on this page will be inactive
|
||||||
|
until the web server restart is complete.',
|
||||||
|
'dom_DESC_CORPORATE_DNS_CURRENT' => 'Corporate DNS Settings',
|
||||||
|
'dom_DOMAINS_PAGE_CORPORATE_DNS' => 'Modify corporate DNS settings',
|
||||||
|
'dom_DESC_CORPORATE_DNS' => 'If this server does not have access to the Internet, or
|
||||||
|
you have special requirements for DNS resolution,
|
||||||
|
enter the DNS server IP addresses here.
|
||||||
|
These fields should be left blank unless
|
||||||
|
you have a specific reason to configure other DNS servers.
|
||||||
|
You should not enter the address of your ISP\'s DNS servers
|
||||||
|
here, as the server is capable of resolving all
|
||||||
|
Internet DNS names without this additional configuration.',
|
||||||
|
'dom_LABEL_CORPORATE_DNS_PRIMARY' => 'Primary corporate DNS server',
|
||||||
|
'dom_LABEL_CORPORATE_DNS_SECONDARY' => 'Secondary corporate DNS server',
|
||||||
|
'dom_DESC_NAMESERVERS' => 'You can select whether this domain is resolved locally,
|
||||||
|
passed to the corporate DNS servers, or resolved by
|
||||||
|
the Internet DNS servers. The default will be correct
|
||||||
|
for most networks.',
|
||||||
|
'dom_LABEL_NAMESERVERS' => 'Domain DNS servers',
|
||||||
|
'dom_localhost' => 'Resolve locally',
|
||||||
|
'dom_internet' => 'Internet DNS servers',
|
||||||
|
'dom_corporate' => 'Corporate DNS servers',
|
||||||
|
'dom_REMOVE_DESC' => 'You are about to remove the domain ',
|
||||||
|
'dom_REMOVE_DESC2' => ' Are you sure you wish to remove this Domain ? ',
|
@ -0,0 +1,154 @@
|
|||||||
|
|
||||||
|
'mai_FORM_TITLE' => 'E-mail settings',
|
||||||
|
'E-mail' => 'E-mail',
|
||||||
|
'mai_SUCCESS' => 'The new e-mail settings have been saved.',
|
||||||
|
'mai_NEVER' => 'not at all',
|
||||||
|
'mai_EVERY5MIN' => 'Every 5 minutes',
|
||||||
|
'mai_EVERY15MIN' => 'Every 15 minutes',
|
||||||
|
'mai_EVERY30MIN' => 'Every 30 minutes',
|
||||||
|
'mai_EVERYHOUR' => 'Every hour',
|
||||||
|
'mai_EVERY2HRS' => 'Every 2 hours',
|
||||||
|
'mai_STANDARD' => 'Standard (SMTP)',
|
||||||
|
'mai_ETRN' => 'ETRN (SMTP with client request)',
|
||||||
|
'mai_DEFAULT' => 'Default',
|
||||||
|
'mai_SPECIFY_BELOW' => 'Specify below',
|
||||||
|
'mai_MULTIDROP' => 'multi-drop',
|
||||||
|
'mai_LABEL_MODE' => 'E-mail retrieval mode',
|
||||||
|
'mai_DESC_MODE' => 'The e-mail retrieval mode can be set to
|
||||||
|
standard (for dedicated Internet connections), ETRN (recommended
|
||||||
|
for dialup connections), or multi-drop (for dialup connections if
|
||||||
|
ETRN is not supported by your Internet provider). Note that
|
||||||
|
multi-drop mode is the only option available when the server is
|
||||||
|
configured in private server and gateway mode.',
|
||||||
|
'mai_LABEL_DELEGATE' => 'Address of internal mail server',
|
||||||
|
'mai_TITLE_DELEGATE' => 'Delegate mail servers',
|
||||||
|
'mai_DESC_DELEGATE' => 'Your server includes a complete, full-featured e-mail server. However,
|
||||||
|
if for some reason you wish to delegate e-mail processing to
|
||||||
|
another system, specify the IP address of the delegate system
|
||||||
|
here. For normal operation, leave this field blank.',
|
||||||
|
'mai_LABEL_SECONDARY' => 'Secondary mail server',
|
||||||
|
'mai_TITLE_SECONDARY' => 'ETRN or multi-drop settings',
|
||||||
|
'mai_DESC_SECONDARY' => 'For ETRN or multi-drop, specify the hostname or IP address of your
|
||||||
|
secondary mail server. (If using the standard e-mail setup, this
|
||||||
|
field can be left blank.)',
|
||||||
|
'mai_DESC_FETCH_PERIOD' => 'For ETRN or multi-drop, you can control how frequently this server
|
||||||
|
contacts your secondary e-mail server to fetch e-mail. More
|
||||||
|
frequent connections mean that you receive your e-mail more
|
||||||
|
quickly, but also cause Internet requests to be sent more often,
|
||||||
|
possibly increasing your phone and Internet charges.',
|
||||||
|
'mai_LABEL_FETCH_PERIOD' => 'During office hours (8:00 AM to 6:00 PM) on weekdays',
|
||||||
|
'mai_LABEL_FETCH_PERIOD_NIGHTS' => 'Outside office hours (6:00 PM to 8:00 AM) on weekdays',
|
||||||
|
'mai_LABEL_FETCH_PERIOD_WEEKENDS' => 'During the weekend',
|
||||||
|
'mai_DESC_POP_ACCOUNT' => 'For multi-drop e-mail, specify the POP user account and password.
|
||||||
|
(If using standard or ETRN e-mail, these fields can be blank.)
|
||||||
|
Also, for multi-drop, you can either use the default mail sorting
|
||||||
|
method, or you can specify a particular message header to use for
|
||||||
|
mail sorting.',
|
||||||
|
'mai_LABEL_POP_PASS' => 'POP user password (for multi-drop)',
|
||||||
|
'mai_LABEL_POP_ACCOUNT' => 'POP user account (for multi-drop)',
|
||||||
|
'mai_LABEL_SORT_METHOD' => 'Select sort method (for multi-drop)',
|
||||||
|
'mai_LABEL_SORT_HEADER' => 'Select sort header (for multi-drop)',
|
||||||
|
'mai_LABEL_FETCH_PROTO' => 'Protocol (for multi-drop)',
|
||||||
|
'mai_LABEL_FETCH_SECURE' => 'Tunnel over SSL (for multi-drop)',
|
||||||
|
'mai_AUTO' => 'Automatic',
|
||||||
|
'mai_ENABLED_BOTH' => 'Allow both HTTP and HTTPS',
|
||||||
|
'mai_ENABLED_SECURE_ONLY' => 'Allow HTTPS (secure)',
|
||||||
|
'mai_ONLY_LOCAL_NETWORK_SSL' => 'Allow HTTPS (secure) from local networks',
|
||||||
|
'mai_INSECURE_POP3' => 'Allow both POP3 and POP3S',
|
||||||
|
'mai_ALLOW_PRIVATE' => 'Allow private',
|
||||||
|
'mai_SECURE_POP3' => 'Allow private and public (secure POP3S)',
|
||||||
|
'mai_INSECURE_IMAP' => 'Allow both IMAP and IMAPS',
|
||||||
|
'mai_SECURE_IMAP' => 'Allow private and public (secure IMAPS)',
|
||||||
|
'mai_INSECURE_SMTP' => 'Allow both SMTP and SSMTP',
|
||||||
|
'mai_SECURE_SMTP' => 'Allow SSMTP (secure)',
|
||||||
|
'mai_LABEL_POP_ACCESS_CONTROL' => 'POP3 server access',
|
||||||
|
'mai_LABEL_IMAP_ACCESS_CONTROL' => 'IMAP server access',
|
||||||
|
'mai_LABEL_SMTP_AUTH_CONTROL' => 'SMTP authentication',
|
||||||
|
'mai_FORWARD_TO_ADMIN' => 'Send to administrator',
|
||||||
|
'mai_FORWARD_TO' => 'Send to',
|
||||||
|
'mai_RETURN_TO_SENDER' => 'Reject',
|
||||||
|
'mai_LABEL_UNKNOWN' => 'E-mail to unknown users',
|
||||||
|
'mai_TITLE_UNKNOWN' => 'Unknown Users',
|
||||||
|
'mai_DESC_UNKNOWN' => 'Selecting Reject (recommended setting) will configure the server to only
|
||||||
|
accept mail for valid email addresses (for example users, groups, pseudonyms).
|
||||||
|
Mail for other addresses will be rejected.',
|
||||||
|
'mai_LABEL_SMARTHOST' => 'Address of Internet provider\'s mail server',
|
||||||
|
'mai_TITLE_SMARTHOST' => 'SMTP server',
|
||||||
|
'mai_DESC_SMARTHOST' => 'The server can deliver outgoing messages directly to their
|
||||||
|
destination (recommended in most cases) or can deliver them via
|
||||||
|
your Internet provider\'s SMTP server (recommended if you have an
|
||||||
|
unreliable Internet connection or are using a residential Internet
|
||||||
|
service). If using your Internet provider\'s SMTP server, specify
|
||||||
|
its hostname or IP address below. Otherwise leave this field
|
||||||
|
blank.',
|
||||||
|
'mai_INVALID_SMARTHOST' => 'The smarthost name you entered is not a valid internet domain name
|
||||||
|
and is not blank',
|
||||||
|
'mai_DESC_POP_ACCESS_CONTROL' => 'You can control POP3 server access. The setting \'Allow access
|
||||||
|
only from local networks\' allows POP3 access only from your
|
||||||
|
local network(s). The POP3S setting can be used to provide
|
||||||
|
encrypted external access to your POP3 server. We recommend
|
||||||
|
leaving this setting \'Allow access only from local networks\'
|
||||||
|
unless you have a specific reason to do otherwise.',
|
||||||
|
'mai_DESC_IMAP_ACCESS_CONTROL' => 'You can control IMAP server access. The setting \'Allow access
|
||||||
|
only from local networks\' allows IMAP access only from your
|
||||||
|
local network(s). The IMAPS setting can be used to provide
|
||||||
|
encrypted external access to your IMAP server. We recommend
|
||||||
|
leaving this setting \'Allow access only from local networks\'
|
||||||
|
unless you have a specific reason to do otherwise.',
|
||||||
|
'mai_DESC_SMTP_AUTH_CONTROL' => 'You can provide authenticated access to your SMTP server, or
|
||||||
|
set it to Disabled.
|
||||||
|
The SSMTP setting requires <b>all</b> users to use SSL/TLS
|
||||||
|
authentication. The SMTP and SSMTP option additionally allows
|
||||||
|
STARTTLS to be used to ensure secure authentication.',
|
||||||
|
'mai_DESC_WEBMAIL' => 'You can enable or disable webmail on this system. Webmail allows
|
||||||
|
users to access their mail through a regular web browser by
|
||||||
|
pointing the browser to https://[_1]/webmail,and
|
||||||
|
logging in to their account.',
|
||||||
|
'mai_LABEL_WEBMAIL' => 'Webmail access',
|
||||||
|
'mai_LABEL_BLOCK_EXECUTABLE_CONTENT' => 'Executable content blocking',
|
||||||
|
'mai_LABEL_CONTENT_TO_BLOCK' => 'Content to block',
|
||||||
|
'mai_DESC_BLOCK_EXECUTABLE_CONTENT' => 'You can block executable content in e-mail attachments
|
||||||
|
by highlighting the executable attachment types you wish to
|
||||||
|
block. E-mail containing these attachment types will
|
||||||
|
be automatically returned to the sender.',
|
||||||
|
'mai_UNACCEPTABLE_CHARS' => 'This field requires a valid e-mail address, which must include
|
||||||
|
the @ symbol and a domain name.',
|
||||||
|
'mai_DESC_STATE_ACCESS' => 'E-mail access',
|
||||||
|
'mai_DESC_STATE_ACCESS_BUTTON' => 'Change e-mail access settings',
|
||||||
|
'mai_DESC_STATE_RECEPTION' => 'E-mail reception',
|
||||||
|
'mai_DESC_STATE_RECEPTION_BUTTON' => 'Change e-mail reception settings',
|
||||||
|
'mai_DESC_STATE_DELIVERY' => 'E-mail delivery',
|
||||||
|
'mai_DESC_STATE_DELIVERY_BUTTON' => 'Change e-mail delivery settings',
|
||||||
|
'mai_DESC_STATE_FILTERING_BUTTON' => 'Change e-mail filtering settings',
|
||||||
|
'mai_LABEL_VIRUS_SCAN' => 'Virus scanning',
|
||||||
|
'mai_DESC_VIRUS_SCAN' => 'You can scan incoming and outgoing e-mail for viruses. If scanning is enabled and a virus is detected, the e-mail will be rejected and returned to the
|
||||||
|
sender.',
|
||||||
|
'mai_LABEL_SPAM_SCAN' => 'Spam filtering',
|
||||||
|
'mai_DESC_SPAM_SCAN' => 'You can scan e-mail for spam. If Spam filtering is
|
||||||
|
enabled, an X-Spam-Status: header is added to each
|
||||||
|
message, which can be used for filtering spam.
|
||||||
|
You can adjust the sensitivity of the Spam detection
|
||||||
|
process from the default of medium. For fine-grained
|
||||||
|
control, you can set the Spam sensitivity to Custom
|
||||||
|
and then choose a custom tagging level, and
|
||||||
|
optionally a level at which to reject the message.',
|
||||||
|
'mai_LABEL_SPAM_SUBJECT' => 'SPAM subject prefix',
|
||||||
|
'mai_DESC_SPAM_SUBJECT' => 'You can enable to add a tag to the subject of each
|
||||||
|
message that is classified as SPAM.
|
||||||
|
The value for this tag can be defined below.',
|
||||||
|
'mai_LABEL_SPAM_SENSITIVITY' => 'Spam sensitivity',
|
||||||
|
'mai_LABEL_SPAM_TAGLEVEL' => 'Custom spam tagging level',
|
||||||
|
'mai_LABEL_SPAM_REJECTLEVEL' => 'Custom spam rejection level',
|
||||||
|
'mai_LABEL_SPAM_SUBJECTTAG' => 'Modify subject of spam messages',
|
||||||
|
'mai_LABEL_SORTSPAM' => 'Sort spam into junkmail folder',
|
||||||
|
'mai_VERYHIGH' => 'Very high',
|
||||||
|
'mai_HIGH' => 'High',
|
||||||
|
'mai_MEDIUM' => 'Medium',
|
||||||
|
'mai_LOW' => 'Low',
|
||||||
|
'mai_VERYLOW' => 'Very low',
|
||||||
|
'mai_CUSTOM' => 'Custom',
|
||||||
|
'mai_LABEL_SMARTHOST_SMTPAUTH_STATUS' => 'SMTP Authentication for Internet provider',
|
||||||
|
'mai_LABEL_SMARTHOST_SMTPAUTH_USERID' => 'Mail server user id',
|
||||||
|
'mai_LABEL_SMARTHOST_SMTPAUTH_PASSWD' => 'Mail server password',
|
||||||
|
'mai_VALIDATION_SMTPAUTH_NONBLANK' => 'This field cannot be left blank if SMTP Authentication is
|
||||||
|
enabled.',
|
@ -0,0 +1,154 @@
|
|||||||
|
'edit' => 'edit',
|
||||||
|
'del' => 'del',
|
||||||
|
'exit' => 'Exit',
|
||||||
|
'cancel' => 'Cancel',
|
||||||
|
'hello' => 'hello',
|
||||||
|
'All rights reserved' => 'All Rights Reserved',
|
||||||
|
'Collaboration' => 'Collaboration',
|
||||||
|
'Administration' => 'Administration',
|
||||||
|
'Security' => 'Security',
|
||||||
|
'Configuration' => 'Configuration',
|
||||||
|
'Miscellaneous' => 'Miscellaneous',
|
||||||
|
'Your Settings' => 'Your Settings',
|
||||||
|
'SAVE' => 'Save',
|
||||||
|
'CANCEL' => 'Cancel',
|
||||||
|
'ENABLED' => 'Enabled',
|
||||||
|
'DISABLED' => 'Disabled',
|
||||||
|
'NO' => 'No',
|
||||||
|
'YES' => 'Yes',
|
||||||
|
'ADD' => 'Add',
|
||||||
|
'CREATE' => 'Create',
|
||||||
|
'MODIFY' => 'Modify',
|
||||||
|
'REMOVE' => 'Remove',
|
||||||
|
'COMMENT' => 'Comment',
|
||||||
|
'NEXT' => 'Next',
|
||||||
|
'SELF' => 'Self',
|
||||||
|
'REMOTE' => 'Remote',
|
||||||
|
'LOCAL' => 'Local',
|
||||||
|
'ACTION' => 'Action',
|
||||||
|
'NETWORK' => 'Network',
|
||||||
|
'ROUTER' => 'Router',
|
||||||
|
'OPERATION_STATUS_REPORT' => 'Operation status report',
|
||||||
|
'ACCOUNT' => 'Account',
|
||||||
|
'GROUP' => 'Group',
|
||||||
|
'DESC_SECTIONBAR' => '<hr class="sectionbar"/>',
|
||||||
|
'NO_PIPES_ALLOWED' => 'Pipe symbols (|) are not permitted in this field',
|
||||||
|
'ERROR_BELOW' => 'ERROR: There was an error in the validation of this page. Please scroll down and find the specific problem.',
|
||||||
|
'ACCESS' => 'Access',
|
||||||
|
'ACCOUNT_LOCKED' => 'Account is locked',
|
||||||
|
'GROUP_ADD' => 'Add group',
|
||||||
|
'NETWORKS_ALLOW_LOCAL' => 'Allow access only from local networks',
|
||||||
|
'NETWORKS_ALLOW_PUBLIC' => 'Allow public access (entire Internet)',
|
||||||
|
'ERROR_PASSWORD_CHANGE' => 'An error occurred while attempting to change your password. Please make sure that the old password entered is correct.',
|
||||||
|
'BACK' => 'Back',
|
||||||
|
'BACKUP' => 'Backup',
|
||||||
|
'DESCRIPTION_BRIEF' => 'Brief description',
|
||||||
|
'PASSWORD_CHANGE' => 'Change Password',
|
||||||
|
'RESET_PASSWORD_TITLE' => 'Reset user password',
|
||||||
|
'ACCOUNT_PASSWORD_CHANGE' => 'Change account password',
|
||||||
|
'CONTENT' => 'Content',
|
||||||
|
'CREATE_GROUP' => 'Create user group',
|
||||||
|
'USER_LIST_CURRENT' => 'Current list of users',
|
||||||
|
'DESCRIPTION' => 'Description',
|
||||||
|
'DESTINATION' => 'Destination',
|
||||||
|
'DOMAIN_NAME' => 'Domain name',
|
||||||
|
'DOMAIN' => 'Domain',
|
||||||
|
'DOMAINS' => 'Domains',
|
||||||
|
'DOWNLOAD' => 'Download',
|
||||||
|
'ERROR_UPDATING_CONFIGURATION' => 'Error occurred while updating system configuration.',
|
||||||
|
'GROUP_MEMBERS' => 'Group Members',
|
||||||
|
'GROUP_NAME' => 'Group Name',
|
||||||
|
'GROUPS' => 'Groups',
|
||||||
|
'IP_ADDRESS' => 'IP Address',
|
||||||
|
'IP_ADDRESS_OR_FQDN' => 'IP Address or FQDN',
|
||||||
|
'USER_INVALID' => 'Invalid user',
|
||||||
|
'LOCATION' => 'Location',
|
||||||
|
'MB' => 'Mb',
|
||||||
|
'MODIFY_USER_GROUP' => 'Modify user group',
|
||||||
|
'NAME' => 'Name',
|
||||||
|
'PASSWORD_VERIFY_NEW' => 'New password (verify):',
|
||||||
|
'PASSWORD_NEW' => 'New password:',
|
||||||
|
'OFF' => 'Off',
|
||||||
|
'OK' => 'Ok',
|
||||||
|
'PASSWORD_OLD' => 'Old password:',
|
||||||
|
'ON' => 'On',
|
||||||
|
'PASSWORD' => 'Password',
|
||||||
|
'PERFORM' => 'Perform',
|
||||||
|
'RECONFIGURE' => 'Reconfigure',
|
||||||
|
'REMOVE_USER_GROUP' => 'Remove user group',
|
||||||
|
'PASSWORD_RESET' => 'Reset password',
|
||||||
|
'RESTORE' => 'Restore',
|
||||||
|
'SHUTDOWN' => 'Shutdown',
|
||||||
|
'SUCCESS' => 'Success',
|
||||||
|
'ACCOUNT_NAME_INVALID' => 'The account name entered is invalid.',
|
||||||
|
'ACCOUNT_NAME_INVALID_CHARS' => 'The account name you entered contained invalid characters.',
|
||||||
|
'PASSWORD_OLD_INVALID_CHARS' => 'The old password you entered contained invalid characters.',
|
||||||
|
'PASSWORD_INVALID_CHARS' => 'The password you entered contained invalid characters.',
|
||||||
|
'PASSWORD_VERIFY_ERROR' => 'The passwords you entered did not match.',
|
||||||
|
'ACCOUNT_USER_NONE' => 'There are no user accounts in the system.',
|
||||||
|
'ACCOUNT_GROUP_NONE' => 'There are no user groups in the system.',
|
||||||
|
'ERROR_INVALID_CHARS' => 'Unexpected characters in description.',
|
||||||
|
'USER_NAME' => 'User Name',
|
||||||
|
'YOUR_ACCOUNT' => 'Your account:',
|
||||||
|
'YOUR_ACCOUNT_INVALID' => 'The account name entered is invalid.',
|
||||||
|
'PASSWORD_CHANGE_SUCCESS' => 'Your password has been successfully changed.',
|
||||||
|
'FM_NONBLANK' => 'This field must not be left blank',
|
||||||
|
'FM_INTEGER' => 'This field must contain a positive integer',
|
||||||
|
'FM_NUMBER' => 'This field must contain a number',
|
||||||
|
'FM_WORD' => 'This field must look like a single word.',
|
||||||
|
'FM_DATE' => 'The data entered could not be parsed as a date',
|
||||||
|
'FM_CREDIT_CARD_NUMBER1' => 'You must enter a credit card number',
|
||||||
|
'FM_CREDIT_CARD_NUMBER2' => 'Credit card numbers shouldn\'t have anything but numbers, spaces or dashes',
|
||||||
|
'FM_CREDIT_CARD_NUMBER3' => 'Must be at least 14 characters in length',
|
||||||
|
'FM_CREDIT_CARD_NUMBER4' => 'Doesn\'t appear to be a valid credit card number',
|
||||||
|
'FM_CREDIT_CARD_EXPIRY1' => 'No expiry date entered.',
|
||||||
|
'FM_CREDIT_CARD_EXPIRY2' => 'Expiry date must be in the format MM/YY or MM/YYYY',
|
||||||
|
'FM_CREDIT_CARD_EXPIRY3' => 'This expiry date appears to have already passed',
|
||||||
|
'FM_CREDIT_CARD_EXPIRY4' => 'This expiry date appears to be too far in the future',
|
||||||
|
'FM_ISO_COUNTRY_CODE1' => 'You must provide a country code',
|
||||||
|
'FM_ISO_COUNTRY_CODE2' => 'This field does not contain an ISO country code',
|
||||||
|
'FM_US_STATE' => 'This doesn\'t appear to be a valid 2-letter US state abbreviation',
|
||||||
|
'FM_US_ZIPCODE' => 'US zip codes must contain 5 or 9 numbers',
|
||||||
|
'FM_MINLENGTH1' => 'Minimum length has been specified meaninglessly as [_1]',
|
||||||
|
'FM_MINLENGTH2' => 'This field must be at least [_1] characters',
|
||||||
|
'FM_MAXLENGTH1' => 'Maximum length has been specified meaninglessly as [_1]',
|
||||||
|
'FM_MAXLENGTH2' => 'This field must be no more than [_1] characters',
|
||||||
|
'FM_EXACTLENGTH1' => 'You must specify the length for the field.',
|
||||||
|
'FM_EXACTLENGTH2' => 'You must specify the exactlength of the field with an integer',
|
||||||
|
'FM_EXACTLENGTH3' => 'This field must be exactly [_1] characters',
|
||||||
|
'FM_LENGTHRANGE1' => 'You must specify the maximum and minimum length for the field.',
|
||||||
|
'FM_LENGTHRANGE2' => 'You must specify the maximum and minimum lengths of the field with an integer',
|
||||||
|
'FM_LENGTHRANGE3' => 'This field must be between [_1] and [_2] characters',
|
||||||
|
'FM_URL' => 'This field must contain a URL starting with http:// or ftp://',
|
||||||
|
'FM_EMAIL_SIMPLE1' => 'You must enter an email address.',
|
||||||
|
'FM_EMAIL_SIMPLE2' => 'This field doesn\'t look like an RFC822-compliant email address',
|
||||||
|
'FM_DOMAIN_NAME' => 'This field doesn\'t look like a valid Internet domain name or hostname.',
|
||||||
|
'FM_IP_NUMBER1' => 'This field must contain a valid IP number and can not be left blank.',
|
||||||
|
'FM_IP_NUMBER2' => 'Invalid IP address format (expected X.X.X.X)',
|
||||||
|
'FM_IP_NUMBER3' => '[_1] is more than 255',
|
||||||
|
'FM_USERNAME' => 'This field must look like a valid username (3 to 8 letters and numbers)',
|
||||||
|
'FM_PASSWORD1' => 'You must provide a password.',
|
||||||
|
'FM_PASSWORD2' => 'The password you provided was not a good password.A good password must contain all of the following: upper case letter, lower case letter, number, non-alphanumeric character, be at least 7 characters long.',
|
||||||
|
'FM_MAC_ADDRESS1' => 'You must provide a MAC address.',
|
||||||
|
'FM_MAC_ADDRESS2' => 'The MAC address you provided was not valid.',
|
||||||
|
'FM_ERR_UNEXPECTED_DESC' => 'Error: unexpected or missing characters in description',
|
||||||
|
swt_THEME => 'Theme',
|
||||||
|
swt_LOGIN_AGAIN => 'You may need to login again to see the choosed theme',
|
||||||
|
acs_NO => 'Not Authorized',
|
||||||
|
acs_LOGIN => 'Login required',
|
||||||
|
acs_ADMIN => 'Admin rights required',
|
||||||
|
'User password' => 'User password',
|
||||||
|
Logout => 'Logout',
|
||||||
|
Home => 'Home',
|
||||||
|
CSRF_VALIDATION_FAILURE => 'Error: CSRF token is invalid or outdated.',
|
||||||
|
Empty => 'Empty',
|
||||||
|
Active => 'Active',
|
||||||
|
MINUTE => 'Minute',
|
||||||
|
MINUTES => 'Minutes',
|
||||||
|
HOUR => 'Hour',
|
||||||
|
HOURS => 'Hours',
|
||||||
|
SMALL => 'Small',
|
||||||
|
MEDIUM => 'Medium',
|
||||||
|
LARGE => 'Large',
|
||||||
|
FIELD_INVALID_CHARS => 'A field you entered contains invalid characters.',
|
||||||
|
|
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
'grp_FORM_TITLE' => 'Create, modify, or remove user groups',
|
||||||
|
'grp_GROUP_TOO_LONG' => 'Error: group name is too long. The maximum is [_1] characters.',
|
||||||
|
'grp_ACCOUNT_CONFLICT' => 'Error: the group "[_1]" can\'t be created because there is
|
||||||
|
already a [_2] account of that name.',
|
||||||
|
'grp_INVALID_GROUP_DESCRIPTION' => 'Error: unexpected or missing characters in group description',
|
||||||
|
'grp_NO_MEMBERS' => 'Error: no members in group.Did not create new group.',
|
||||||
|
'grp_CREATED_GROUP' => 'Successfully created user group',
|
||||||
|
'grp_DELETED_GROUP' => 'Successfully removed user group',
|
||||||
|
'grp_MODIFIED_GROUP' => 'Successfully modifed user group',
|
||||||
|
'grp_CREATE_ERROR' => 'An error occurred while creating user group.',
|
||||||
|
'grp_DELETE_ERROR' => 'An error occurred while removing user group.',
|
||||||
|
'grp_MODIFY_ERROR' => 'An error occurred while modifying user group.',
|
||||||
|
'grp_GROUP_NAMING' => 'The group name should contain only lower-case
|
||||||
|
letters, numbers, hyphens, periods, and underscores,
|
||||||
|
and should start with a lower-case letter. For
|
||||||
|
example "sales", "beta5", and "reseller_partners" are
|
||||||
|
all valid group names, but "3rd-event", "Marketing Team"
|
||||||
|
and "lost&found" are not.',
|
||||||
|
'grp_GROUP_HAS_MEMBERS' => 'This group contains the following members:',
|
||||||
|
'grp_NOT_A_GROUP' => 'Error: That is not an existing group account.',
|
||||||
|
'grp_GROUP_DESC' => 'Brief Description/Windows Group Alias',
|
||||||
|
'grp_GROUP_DESC_EXPL' => 'Input a brief group description in the field below.
|
||||||
|
This field also designates the group name viewable by
|
||||||
|
Windows clients.',
|
||||||
|
'grp_IBAYS_WILL_BE_CHANGED' => 'The following information bays were assigned to this group and
|
||||||
|
will be changed to the Administrator group (you can change them to
|
||||||
|
something else afterward):',
|
||||||
|
'grp_CONFIRM_DELETE_GROUP' => 'Are you sure you wish to remove this group?',
|
||||||
|
'grp_CURRENT_LIST' => 'Current list of User Groups',
|
||||||
|
'grp_DELETE_DESCRIPTION' => 'You are about to remove the user group "[_1]."',
|
||||||
|
|
@ -0,0 +1,74 @@
|
|||||||
|
|
||||||
|
'hos_FORM_TITLE' => 'Hostnames and addresses',
|
||||||
|
'hos_UNABLE_TO_OPEN_CONFIGDB' => 'Unable to open configuration database',
|
||||||
|
'hos_DNS_FORWARDER_ENABLED' => 'A DNS forwarder has been configured. This means that all DNS
|
||||||
|
lookups will be handled by the DNS forwarder. Hostnames
|
||||||
|
and addresses cannot be modified on this server while
|
||||||
|
a DNS forwarder is configured.',
|
||||||
|
'hos_ADD_HOSTNAME' => 'Add hostname',
|
||||||
|
'hos_HOSTNAME' => 'Hostname',
|
||||||
|
'hos_HOSTTYPE' => 'Location',
|
||||||
|
'hos_LOCAL_IP' => 'Local IP',
|
||||||
|
'hos_ETHERNET_ADDRESS' => 'Ethernet address',
|
||||||
|
'hos_CURRENT_HOSTNAMES_FOR_DOMAIN' => 'Current list of hostnames for [_1].',
|
||||||
|
'hos_NO_HOSTNAMES_FOR_SERVICENAME' => 'There are no hostnames in the system for [_1].',
|
||||||
|
'hos_CURRENT_HOSTNAMES_FOR_LOCAL_DOMAIN' => 'Current list of hostnames for [_1]',
|
||||||
|
'hos_NO_HOSTNAMES_FOR_LOCAL_DOMAIN' => 'There are no hostnames in the system for [_1].',
|
||||||
|
'hos_STATIC_HOST_MESSAGE' => '- This host represents your system name and cannot be modifiedor removed.',
|
||||||
|
'hos_CREATE_LOCAL_HOST_TITLE' => 'Create a new hostname for this server',
|
||||||
|
'hos_HOSTNAME_VALIDATION_ERROR' => 'Error: unexpected characters in host name: "[_1]".
|
||||||
|
The host name should contain only
|
||||||
|
letters, numbers, and hyphens and must start
|
||||||
|
with a letter or a number.',
|
||||||
|
'hos_HOSTNAME_LENGTH_ERROR' => 'Error: account name [_1] is too long. The
|
||||||
|
maximum is 32 characters.',
|
||||||
|
'hos_DOMAIN_VALIDATION_ERROR' => 'Error: unexpected or missing characters in domain name
|
||||||
|
[_1]. The domain name should contain one or more
|
||||||
|
letters, numbers, periods and minus signs. Did not create new
|
||||||
|
domain.',
|
||||||
|
'hos_HOSTNAME_EXISTS_ERROR' => 'Error: account [_1] hostname.',
|
||||||
|
'hos_SUCCESSFULLY_CREATED' => 'Successfully created hostname.',
|
||||||
|
'hos_HOSTNAME_DESCRIPTION' => 'The hostname must contain only letters, numbers, and hyphens, and must start with a letter or number. ',
|
||||||
|
'hos_LOCAL_IP_DESCRIPTION' => 'The Local IP address is the IP address of another machine on
|
||||||
|
the local network. Please enter a valid IP address in the
|
||||||
|
format "aaa.bbb.ccc.ddd".',
|
||||||
|
'hos_ETHERNET_ADDRESS_DESCRIPTION' => 'The ethernet address is optional and causes the DHCP server to
|
||||||
|
statically bind the local IP address to the computer with this
|
||||||
|
ethernet address.If specified, it must be of the form
|
||||||
|
"AA:BB:CC:DD:EE:FF" and must contain only the numbers 0-9 and
|
||||||
|
the letters A-F.',
|
||||||
|
'hos_CREATE_LOCAL_HOST_TITLE' => 'Create a new hostname referring to a local host.',
|
||||||
|
'hos_DIDNT_ENTER_LOCAL_IP' => 'Error: You did not specify a Local IP address.IP
|
||||||
|
addresses must contain only numbers and periods and
|
||||||
|
be in the form "aaa.bbb.ccc.ddd".Did not create hostname.',
|
||||||
|
'hos_IP_VALIDATION_ERROR' => 'Error: IP Address [_1] is
|
||||||
|
invalid. IP Addresses must contain only numbers and periodsand be in the form "aaa.bbb.ccc.ddd". Did not create hostname.',
|
||||||
|
'hos_MAC_ADDRESS_VALIDATION_ERROR' => 'Error: Ethernet address [_1]
|
||||||
|
is invalid.Ethernet addresses must be in the
|
||||||
|
form "AA:BB:CC:DD:EE:FF" and only contain the
|
||||||
|
numbers 0-9 and the letters A-F. Did not create
|
||||||
|
hostname.',
|
||||||
|
'hos_CREATE_REMOTE_HOST_TITLE' => 'Create a new hostname referring to a remote host',
|
||||||
|
'hos_CREATE_TITLE' => 'Create or modify hostname',
|
||||||
|
'hos_MODIFY_TITLE' => 'Modify hostname',
|
||||||
|
'hos_LOCAL_PAGE_DESCRIPTION' => 'Please enter the following additional details for a localhost:',
|
||||||
|
'hos_REMOTE_PAGE_DESCRIPTION' => 'Please enter the following additional details for a remotehost:',
|
||||||
|
'hos_SUCCESSFULLY_DELETED' => 'Successfully deleted host.',
|
||||||
|
'hos_SUCCESSFULLY_MODIFIED' => 'Successfully modified host.',
|
||||||
|
'hos_REMOVE_TITLE' => 'Remove hostname',
|
||||||
|
'hos_REMOVE_PAGE_DESCRIPTION' => 'You are about to remove the hostname "[_1]"',
|
||||||
|
'hos_ABOUT_TO_REMOVE' => 'Are you sure you wish to remove this hostname?',
|
||||||
|
'hos_CONFIRM_DESCRIPTION' => 'Please confirm the following details.',
|
||||||
|
'hos_NO_HOSTS_FOR_THIS_DOMAIN' => 'There are no hosts for this domain.',
|
||||||
|
'hos_ADDR_IN_DHCP_RANGE' => 'Address is inside the DHCP assigned dynamic range',
|
||||||
|
'hos_ERROR_WHILE_CREATING_HOST' => 'Error occurred while creating hostname.',
|
||||||
|
'hos_ERROR_WHILE_MODIFYING_HOST' => 'Error occurred while modifying hostname.',
|
||||||
|
'hos_ERROR_WHILE_DELETING_HOST' => 'Error occurred while deleting hostname.',
|
||||||
|
'hos_ERR_IP_IS_LOCAL_OR_GATEWAY' => 'Error: IP cannot be server IP or Gateway IP.',
|
||||||
|
'hos_ERR_IP_NOT_LOCAL' => 'Error: This IP address is not on any of our local networks.',
|
||||||
|
'hos_MUST_BE_VALID_HOSTNAME_OR_IP' => 'Must be a valid hostname or IP number',
|
||||||
|
'hos_HOSTNAME_COMMENT_ERROR' => 'Error: unexpected characters in the comment of "[_1]".
|
||||||
|
The comment must contain only letters, spaces, numbers, dots, commas, undescores, hyphens and must start with a letter or number.',
|
||||||
|
'hos_HOSTNAME_VALIDATOR_ERROR' => 'Error: unexpected characters in host name: "[_1]". The host name should contain only
|
||||||
|
letters, numbers, and hyphens and must start with a letter or a number. ',
|
||||||
|
'Hostnames and addresses' => 'Hostnames and addresses',
|
@ -0,0 +1,71 @@
|
|||||||
|
|
||||||
|
'iba_FORM_TITLE' => 'Create, modify, or remove i-bays',
|
||||||
|
'iba_ADD_IBAY' => 'Add ibay',
|
||||||
|
'iba_FIRSTPAGE_DESC' => 'You can remove any information bay or reset its password by
|
||||||
|
clicking on the corresponding command
|
||||||
|
next to the information bay. If the information bay shows up
|
||||||
|
in red, that means that the password has not
|
||||||
|
yet been changed from the default, and should be changed
|
||||||
|
soon.',
|
||||||
|
'iba_ADD_TITLE' => 'Create or modify an i-bay',
|
||||||
|
'iba_NAME_FIELD_DESC' => 'The information bay name should contain only lower-case
|
||||||
|
letters, numbers, periods, hyphens and underscores, and
|
||||||
|
should start with a lower-case letter. For example
|
||||||
|
"johnson", "intra", and "cust3.prj12" are all valid
|
||||||
|
names, but "3associates", "John Smith" and
|
||||||
|
"Bus!Partner" are not. The name is limited to [_1] characters.',
|
||||||
|
'iba_NAME_LABEL' => 'Information bay name',
|
||||||
|
'iba_USER_ACCESS' => 'User access via file sharing or user ftp',
|
||||||
|
'iba_PUBLIC_ACCESS' => 'Public access via web or anonymous ftp',
|
||||||
|
'iba_PUBLIC_ACCESS_DESCRIPTION' => 'The public access mode "password required outside local
|
||||||
|
network" is not supported by the FTP server component. If
|
||||||
|
you select this mode, the FTP server will require a
|
||||||
|
password both inside and outside the local network for this
|
||||||
|
i-bay.',
|
||||||
|
'iba_ALLOW_DYNAMIC_CONTENT' => 'Execution of dynamic content (CGI, PHP, SSI)',
|
||||||
|
'iba_HTTPS_Only' => 'Force secure connections',
|
||||||
|
'iba_REMOVE_TITLE' => 'Remove information bay',
|
||||||
|
'iba_REMOVE_DESC' => '<p>You are about to remove the information bay [_1] ([_2]).
|
||||||
|
</p><p>All files belonging to this information bay will be deleted.
|
||||||
|
</p><p>Are you sure you wish to remove this information bay?
|
||||||
|
</p>',
|
||||||
|
'iba_ERROR_WHILE_CREATING_IBAY' => 'An error occurred while creating the i-bay.',
|
||||||
|
'iba_SUCCESSFULLY_CREATED_IBAY' => 'Successfully created i-bay.',
|
||||||
|
'iba_NO_IBAYS' => 'There are no i-bays currently configured.',
|
||||||
|
'iba_CANT_FIND_IBAY' => 'Can\'t find account for [_1] (does it exist?)',
|
||||||
|
'iba_CANT_CREATE_IBAY' => 'Can\'t create new account for [_1] (does it already exist?)',
|
||||||
|
'iba_ERROR_WHILE_MODIFYING_IBAY' => 'An error occurred while modifying the i-bay.',
|
||||||
|
'iba_SUCCESSFULLY_MODIFIED_IBAY' => 'Successfully modified i-bay.',
|
||||||
|
'iba_VIRTUAL_HOST_MESSAGE' => 'The following virtual domains were using this information
|
||||||
|
bay as their content and will be changed to the primary web
|
||||||
|
site (you can change them to something else afterward).',
|
||||||
|
'iba_SUCCESSFULLY_DELETED_IBAY' => 'Successfully deleted i-bay.',
|
||||||
|
'iba_ERROR_WHILE_DELETING_IBAY' => 'An error occurred while deleting the i-bay.',
|
||||||
|
'iba_PASSWORD_DESC' => 'You are about to change the password for the i-bay [_1].',
|
||||||
|
'iba_IBAY_PASSWD_VALIDATION_ERROR' => 'The password may contain only letters and numbers.',
|
||||||
|
'iba_IBAY_PASSWD_VERIFY_ERROR' => 'The passwords do not match.',
|
||||||
|
'iba_SUCCESSFULLY_RESET_PASSWORD' => 'Successfully reset password.',
|
||||||
|
'iba_ERROR_WHILE_RESETTING_PASSWORD' => 'Error while resetting password.',
|
||||||
|
'iba_VHOST_MESSAGE' => '<P>The following virtual domains were using this information bay
|
||||||
|
as their content and will be changed to the primary web site
|
||||||
|
(you can change them to something else afterward):</P>',
|
||||||
|
'Information bays' => 'Information bays',
|
||||||
|
'WGRG' => 'Write = group, Read = group',
|
||||||
|
'WGRE' => 'Write = group, Read = everyone',
|
||||||
|
'WARG' => 'Write = admin, Read = group',
|
||||||
|
'NONE' => 'No access',
|
||||||
|
'LOCAL_NETWORK_NO_PASSWORD' => 'Local network (no password required)',
|
||||||
|
'LOCAL_NETWORK_PASSWORD' => 'Local network (password required)',
|
||||||
|
'ENTIRE_INTERNET_NO_PASSWORD' => 'Entire Internet (no password required)',
|
||||||
|
'ENTIRE_INTERNET_PASSWORD' => 'Entire Internet (password required)',
|
||||||
|
'ENTIRE_INTERNET_PASSWORD_REMOTE' => 'Entire Internet (password required outside local network)',
|
||||||
|
'INVALID_IBAY_DESCRIPTION' => 'Error: unexpected or missing characters in i-bay description',
|
||||||
|
'iba_ACCT_NAME_HAS_INVALID_CHARS' => 'The i-bay name "[_1]" contains invalid characters.
|
||||||
|
I-bay names must start with a lower case letter and contain
|
||||||
|
only lower case letters, numbers, and hyphens.',
|
||||||
|
'iba_MAX_IBAY_NAME_LENGTH_ERROR' => 'The i-bay name "[_1]" is too long. The maximum is
|
||||||
|
[_2] characters.',
|
||||||
|
'iba_ACCT_CLASHES_WITH_PSEUDONYM' => 'The account "[_1]" clashes with pseudonym
|
||||||
|
details for [_2] account "[_3]".
|
||||||
|
<p>[_1] is a pseudonym for [_2].</p>',
|
||||||
|
'iba_ACCOUNT_EXISTS' => 'The account "[_1]" is an existing [_2] account.',
|
@ -0,0 +1,57 @@
|
|||||||
|
|
||||||
|
initial_FORM_TITLE => 'Welcome to the server manager',
|
||||||
|
initial_FRAMES_BODY => '<p>
|
||||||
|
Welcome to SME Server, the leading Linux distribution for
|
||||||
|
small and medium enterprises. SME Server is brought to
|
||||||
|
you by <A HREF="https://www.koozali.org/" TARGET="_blank">Koozali Foundation, Inc.</A>,
|
||||||
|
a non-profit corporation that exists to provide marketing and
|
||||||
|
legal support for SME Server.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
SME Server is freely available under the GNU General Public
|
||||||
|
License and is only possible through the efforts of the SME
|
||||||
|
Server community. However, the availability and quality of SME
|
||||||
|
Server is dependent on meeting our expenses, such as hosting
|
||||||
|
costs, server hardware, etc.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
As such, we ask for a donation to offset costs and fund
|
||||||
|
further development.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
a) If you are a school, a church, a non-profit organisation or an
|
||||||
|
individual using SME for private purposes, we would appreciate you to
|
||||||
|
contribute within your means toward the costs associated with hosting,
|
||||||
|
maintenance and development.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
b) If you are a company or an integrator and you are deploying SME in
|
||||||
|
the course of your work to generate revenue, we expect you to make a
|
||||||
|
donation commensurate with the level of revenue you generate and the
|
||||||
|
number of servers your have in the field. Please, help the project
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a href="https://wiki.koozali.org/Donate" target="_blank">
|
||||||
|
<img src="images/btn_donateCC_LG.gif" alt="https://wiki.koozali.org/Donate"
|
||||||
|
align="middle"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This software comes with ABSOLUTELY NO WARRANTY.
|
||||||
|
Please <A HREF="support" TARGET="_self">click here</A>
|
||||||
|
to view detailed support, warranty and licensing information.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
To perform a system administration function, click one of the links in the menu on the left of your screen.
|
||||||
|
</p>',
|
@ -0,0 +1,30 @@
|
|||||||
|
'ln_LOCAL NETWORKS' => 'Local networks',
|
||||||
|
'Local networks' => 'Local networks',
|
||||||
|
'ln_FIRSTPAGE_DESC' => 'For security reasons, several services on your server are available only to your local network. However you can grant these local access privileges to additional networks by listing them below. Most installations should leave this list empty.',
|
||||||
|
'ln_ADD_TITLE' => 'Add a local network ',
|
||||||
|
'ln_ADD_DESC' =>'Each parameter must be in the form #.#.#.# (each # is a number from 0 to 255). The server software will zero out the ending (host identifier) part of the network address according to the subnet mask, to ensure that the network address is valid. </P><P> "Router" should be the IP address of the router on your local network via which the additional network is reached.',
|
||||||
|
'ln_NETWORK_ADDRESS' => 'Network address',
|
||||||
|
'ln_SUBNET_MASK' => 'Subnet mask',
|
||||||
|
'ln_INVALID_IP_ADDRESS' => 'Invalid IP address - [_1]',
|
||||||
|
'ln_INVALID_SUBNET_MASK' => 'Invalid subnet mask',
|
||||||
|
'ln_REMOVE_TITLE' => 'Remove local network',
|
||||||
|
'ln_REMOVE_DESC' => 'You are about to remove the following local network.',
|
||||||
|
'ln_REMOVE_CONFIRM' => 'Are you sure you wish to remove this network?',
|
||||||
|
'ln_DEFAULT' => 'default',
|
||||||
|
'ln_NUMBER_OF_HOSTS' => 'Number of hosts',
|
||||||
|
'ln_NOT_ACCESSIBLE_FROM_LOCAL_NETWORK' => 'Error: router address {$networkRouter} is not accessible from local network. Did not add network.',
|
||||||
|
'ln_LOCALNETWORK_ADD'=>'Add network',
|
||||||
|
'ln_NETWORK_ALREADY_LOCAL' => ' Error: network {$network} (derived from network {$networkAddress} and subnet mask {$networkMask}) is already considered local. Did not add new network. ',
|
||||||
|
'ln_NETWORK_ALREADY_ADDED' => 'Error: network {$network} (derived from network {$networkAddress} and subnet mask {$networkMask}) has already been added. Did not add new network.',
|
||||||
|
'ln_ERROR_CREATING_NETWORK' => 'Error occurred while creating network.',
|
||||||
|
'ln_SUCCESS' =>'Successfully added network [_1]/[_2] via router [_3].',
|
||||||
|
'ln_SUCCESS_SINGLE_ADDRESS' =>'Successfully added network {$network}/{$networkMask} via router {$networkRouter}. Your server will grant local access privileges to the single IP address {$network}. ',
|
||||||
|
'ln_SUCCESS_NETWORK_RANGE' =>'Successfully added network [_1]/[_2] via router [_3]. Your server will grant local access privileges to [_4] IP addresses in the range [_5] to [_6]. ',
|
||||||
|
'ln_NO_SUCH_NETWORK' =>'Network not found in network db',
|
||||||
|
'ln_SUCCESS_REMOVED_NETWORK' =>'Successfully removed network [_1]/[_2] via router [_3].',
|
||||||
|
'ln_ERROR_DELETING_NETWORK' => 'Error occurred while deleting network.',
|
||||||
|
'ln_NO_ADDITIONAL_NETWORKS' => 'No additional networks',
|
||||||
|
'ln_REMOVE_HOSTS_DESC' => 'Local hosts configured on the network you are about to remove have been detected. By default, they will also be removed. Uncheck this box if, for some reason, you do not wish this to happen. Note that they will not be treated as local, and may not even be reachable, after this network is removed. ',
|
||||||
|
'ln_REMOVE_HOSTS_LABEL' => 'Remove hosts on network',
|
||||||
|
'ln_extra' => '{$network}/{$networkMask} via router $networkRouter}.',
|
||||||
|
'ln_SUCCESS_NONSTANDARD_RANGE' =>'<p>Successfully added network [_1]/[_2] via router [_3].</p><p> Your server will grant local access privileges to [_4] IP addresses in the range [_5] to [_6].</p><p> Warning: the ProFTPd FTP server cannot handle this nonstandard subnet mask. The simpler specification <b>[_7]</b> will be used instead.</p>',
|
@ -0,0 +1,23 @@
|
|||||||
|
use_TITLE => 'User login',
|
||||||
|
use_SIGNIN => 'Sign in',
|
||||||
|
use_FORGOT => 'Forgot password ?',
|
||||||
|
use_RESET_REGISTERED => 'A password reset message has been sent to the e-mail address of this account.<br>
|
||||||
|
If you do not receive it, check your spam/junk folders or ask your local administrator for help.<br>
|
||||||
|
If it is not there ask your local administrator.',
|
||||||
|
use_TOO_MANY_LOGIN => 'Login access blocked !!<br>Too many failed login attempts. Try again later',
|
||||||
|
use_INVALID_DATA => 'Invalid input data, Try again',
|
||||||
|
use_WELCOME => 'Welcome Back!',
|
||||||
|
use_SORRY => 'Sorry try again',
|
||||||
|
use_ERR_NAME => 'Enter a valid account name',
|
||||||
|
use_NOT_THAT_OPER => 'Operation not allowed for this account.',
|
||||||
|
use_CONFIRM_RESET => 'Confirm Password Reset',
|
||||||
|
use_GO_TO_URL => 'Password reset
|
||||||
|
|
||||||
|
Click the following link to reset your password. If you have not requested the password reset, then ignore this email.
|
||||||
|
|
||||||
|
[_1]',
|
||||||
|
use_BYE => 'Goodbye !',
|
||||||
|
use_DESC_RESET => 'Please enter an account name for a password reset !',
|
||||||
|
use_RESET => 'Reset Password',
|
||||||
|
use_OK_FOR_RESET => 'You are about to reset your user account password',
|
||||||
|
use_INVALID_REQUEST => 'Error: your request is invalid or outdated',
|
@ -0,0 +1,5 @@
|
|||||||
|
manual_FORM_TITLE => 'Online manual and other documentation',
|
||||||
|
manual_DESCRIPTION => '<ul><li><a target="new" href="https://wiki.koozali.org/documentation/manual/"> Online manual</a> <li><a target="new" href="https://wiki.koozali.org/documentation/FAQ/"> FAQs</a> </ul> <H2>Support and licensing</H2> This software is released under the terms listed in the <a href="/smanager/support"> Support and Licensing</a> page.',
|
||||||
|
Documentation => 'Documentation',
|
||||||
|
'Online manual' => 'Online manual',
|
||||||
|
|
@ -0,0 +1,56 @@
|
|||||||
|
'pf_FORM_TITLE' => 'Configure Port Forwarding',
|
||||||
|
'pf_FIRST_PAGE_DESCRIPTION' => '<p>
|
||||||
|
You can use this panel to modify your firewall rules so
|
||||||
|
as to open a specific port on this server and forward it
|
||||||
|
to another port on another host. Doing so will permit
|
||||||
|
incoming traffic to directly access a private host on
|
||||||
|
your LAN.
|
||||||
|
</p><p>
|
||||||
|
WARNING: Misuse of this feature can seriously compromise the
|
||||||
|
security of your network. Do not use this feature
|
||||||
|
lightly, or without fully understanding the implications
|
||||||
|
of your actions.
|
||||||
|
</p>',
|
||||||
|
'pf_CREATE_RULE' => 'Create portforwarding rule',
|
||||||
|
'pf_SUMMARY_ADD_DESC' => 'The following summarizes the port-forwarding rule
|
||||||
|
that you are about to add. If you are satisfied with the rule,
|
||||||
|
click the \'Add\' button.',
|
||||||
|
'pf_SUMMARY_REMOVE_DESC' => 'The following summarizes the port-forwarding rule
|
||||||
|
that you are about to remove. If you are sure you want to
|
||||||
|
remove the rule, click the \'Remove\' button.',
|
||||||
|
'pf_SHOW_FORWARDS' => 'Below you will find a table summarizing the current
|
||||||
|
port-forwarding rules installed on this server. Click on the
|
||||||
|
\'Remove\' link to remove the corresponding rule.',
|
||||||
|
'pf_NO_FORWARDS' => 'There are currently no forwarded ports on the system.',
|
||||||
|
'pf_CREATE_PAGE_DESCRIPTION' => '<p>Select the protocol, the port you wish to forward, the
|
||||||
|
destination host, and the port on the destination host
|
||||||
|
that you wish to forward to. If you wish to specify a port
|
||||||
|
range, enter the lower and upper boundaries separated by a
|
||||||
|
hyphen. The destination port may be left blank, which will
|
||||||
|
instruct the firewall to leave the source port
|
||||||
|
unaltered.</p>',
|
||||||
|
'pf_LABEL_SOURCE_PORT' => 'Source Port(s)',
|
||||||
|
'pf_LABEL_PROTOCOL' => 'Protocol',
|
||||||
|
'pf_LABEL_DESTINATION_PORT' => 'Destination Port(s)',
|
||||||
|
'pf_LABEL_DESTINATION_HOST' => 'Destination Host IP Address',
|
||||||
|
'pf_LABEL_RULE_COMMENT' => 'Rule Comment',
|
||||||
|
'pf_LABEL_ALLOW_HOSTS' => 'Allow Hosts',
|
||||||
|
'Port forwarding' => 'Port forwarding',
|
||||||
|
'pf_SUCCESS' => 'Your change to the port forwarding rules has been successfully saved.',
|
||||||
|
'pf_RULE_COMMENT' => 'Rule Comment',
|
||||||
|
'pf_ALLOW_HOSTS' => 'Allow Hosts',
|
||||||
|
'pf_ERR_NO_MASQ_RECORD' => 'Cannot retrieve masq record from the configuration database.',
|
||||||
|
'pf_ERR_UNSUPPORTED_MODE' => 'Unsupported mode.',
|
||||||
|
'pf_ERR_CANNOT_REMOVE_NORULE' => 'Cannot remove non-existant rule.',
|
||||||
|
'pf_ERR_NONZERO_RETURN_EVENT' => 'Event returned a non-zero return value.',
|
||||||
|
'pf_ERR_BADPORT' => 'The ports must be a positive integer less than 65536.',
|
||||||
|
'pf_ERR_BADIP' => 'This does not appear to be an IP address. You must use
|
||||||
|
dotted-quad notation, and each of the four numbers should be less
|
||||||
|
than 256. ie: 192.168.0.5',
|
||||||
|
'pf_ERR_DUPRULE' => 'This rule has already been added, it cannot be added twice.',
|
||||||
|
'pf_ERR_PORT_COLLISION' => 'ERROR: This port or port range conflicts with an existing
|
||||||
|
rule. Please modify this new rule, or remove the old rule.',
|
||||||
|
'pf_ERR_BADAHOST' => 'This does not appear to be a valid IP address list.
|
||||||
|
ie: 192.168.0.1,192.168.1.1/24',
|
||||||
|
'pf_IN_SERVERONLY' => 'This server is currently in serveronly mode and portforwarding
|
||||||
|
is possible only to localhost.',
|
@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
'prt_FORM_TITLE' => 'Add or remove printers',
|
||||||
|
'prt_INITIAL_BTN' => 'Add printer',
|
||||||
|
'prt_INITIAL_DESC' => '<P><A class="button-like" HREF="printers?page=0&Next=Add">Add printer</A></P>',
|
||||||
|
'prt_NO_PRINTERS' => 'There are no printers in the system.',
|
||||||
|
'prt_CURRENT_LIST' => 'Current List of printers',
|
||||||
|
'prt_REMOTE_ADDRESS' => 'Remote address',
|
||||||
|
'prt_REMOTE_NAME' => 'Remote name',
|
||||||
|
'prt_CREATE_NEW_PRINTER' => 'Create a new printer',
|
||||||
|
'prt_CREATE_NEW_DESC' => 'Please choose a unique name for the printer and enter a brief
|
||||||
|
description. The printer name should contain only lower-case
|
||||||
|
letters and numbers, and should start with a lower-case
|
||||||
|
letter. For example "hplaser", "epsonlp", and
|
||||||
|
"canonbj" are valid choices, but "HP Laser Jet",
|
||||||
|
"Canon BubbleJet", and
|
||||||
|
"HP JetDirect Printer" are not.
|
||||||
|
Avoid names and descriptions that contain these terms,
|
||||||
|
"offline", "disabled", "down", "off", "waiting", "jam",
|
||||||
|
"paper", "error" and "responding". ',
|
||||||
|
'prt_PRINTER_NAME' => 'Printer name',
|
||||||
|
'prt_LOCAL_PRINTER_0' => 'Local printer port 0 (LPT1)',
|
||||||
|
'prt_LOCAL_PRINTER_1' => 'Local printer port 1 (LPT2)',
|
||||||
|
'prt_LOCAL_PRINTER_2' => 'Local printer port 2 (LPT3)',
|
||||||
|
'prt_NET_PRINTER' => 'Network printer ...',
|
||||||
|
'prt_FIRST_USB_PRINTER' => 'First USB attached printer',
|
||||||
|
'prt_SECOND_USB_PRINTER' => 'Second USB attached printer',
|
||||||
|
'prt_ERR_UNEXPECTED_NAME' => '<P>Error: unexpected characters in printer name.</P>
|
||||||
|
<P>The printer name should contain only lower-case
|
||||||
|
letters and numbers, and should start with a lower-case
|
||||||
|
letter. For example "hplaser", "epsonlp", and
|
||||||
|
"canonbj" are valid names.</P>',
|
||||||
|
'prt_ERR_UNEXPECTED_DESC' => 'Error: unexpected or missing characters in description.
|
||||||
|
Did not create new printer.',
|
||||||
|
'prt_ERR_EXISTS' => 'Error: An account with the same name exists with type: ',
|
||||||
|
'prt_ERR_INVALID_ADDRESS' => 'Error: invalid network address. Did not create new printer.',
|
||||||
|
'prt_ERR_INVALID_REMOTE_NAME' => 'Error: invalid network printer name. Did not create new printer.',
|
||||||
|
'prt_ERR_CREATING' => 'Error occurred while creating printer.',
|
||||||
|
'prt_CREATED_SUCCESSFULLY' => 'Successfully created printer: ',
|
||||||
|
'prt_CREATE_NETWORK_PRINTER' => 'Create a new network printer',
|
||||||
|
'prt_ERR_OPENING_DB' => 'Error occurred while opening accounts database.',
|
||||||
|
'prt_CREATE_NETWORK_DESC' => 'Please enter the address and name of the network printer',
|
||||||
|
'prt_HOSTNAME_OR_IP' => 'Hostname or IP address of the network printer',
|
||||||
|
'prt_REMOTE_NAME_DESC' => 'Network printer name (enter raw if not sure)',
|
||||||
|
'prt_REMOVE_PRINTER' => 'Remove printer',
|
||||||
|
'prt_ABOUT_TO_REMOVE' => 'You are about to remove the printer: ',
|
||||||
|
'prt_SPOOL_FILE_WARNING' => 'All the spool files for this printer will be deleted.',
|
||||||
|
'prt_ARE_YOU_SURE' => 'Are you sure you wish to remove this printer?',
|
||||||
|
'prt_ERR_INTERNAL_FAILURE' => 'Error: internal failure while removing printer: ',
|
||||||
|
'prt_ERR_DELETING' => 'Error occurred while deleting printer.',
|
||||||
|
'prt_DELETED_SUCCESSFULLY' => 'Successfully deleted printer: ',
|
||||||
|
'prt_MUST_BE_VALID_HOSTNAME_OR_IP' => 'Must be a valid hostname or IP number',
|
||||||
|
'Printers' => 'Printers',
|
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
'prx_TITLE' => 'Proxy settings',
|
||||||
|
'prx_FIRST_PAGE_DESCRIPTION' => 'This page allows configuration of the server\'s
|
||||||
|
proxy settings.
|
||||||
|
The server includes a transparent proxy and cache for
|
||||||
|
HTTP traffic. This is enabled by default, but not enforced
|
||||||
|
if the server is in "serveronly" mode.
|
||||||
|
If this server is acting as an e-mail server, connections
|
||||||
|
from local network clients to external SMTP servers
|
||||||
|
will default to being redirected to the local e-mail server.',
|
||||||
|
'prx_HTTP_PROXY_STATUS_DESCRIPTION' => 'The server\'s HTTP proxy works to reduce overall uplink usage by
|
||||||
|
caching recently-visited pages. It is transparent to web browsers
|
||||||
|
using this server as their gateway. Enable or disable this proxy
|
||||||
|
with the following toggle.',
|
||||||
|
'prx_HTTP_PROXY_STATUS_LABEL' => 'HTTP proxy status',
|
||||||
|
'prx_SMTP_PROXY_STATUS_DESCRIPTION' => 'The server\'s transparent SMTP proxy works to reduce virus traffic
|
||||||
|
from infected client hosts by forcing all outgoing SMTP traffic
|
||||||
|
through this server if set to "enabled".
|
||||||
|
If you wish to use an alternate SMTP server, and this server is
|
||||||
|
your gateway to it, set this proxy to "disabled". Setting the
|
||||||
|
proxy to "blocked" prevents all SMTP traffic to other servers,
|
||||||
|
this is the default. The proxy only intercepts/blocks normal smtp
|
||||||
|
(port 25) traffic.',
|
||||||
|
'prx_SMTP_PROXY_STATUS_LABEL' => 'SMTP proxy status',
|
||||||
|
'prx_ERR_PROXY_UPDATE_FAILED' => 'ERROR: The proxy-update event returned an error.',
|
||||||
|
'prx_ERR_NO_SQUID_REC' => 'ERROR: There is no squid record in the configuration database.',
|
||||||
|
'prx_SUCCESS' => 'The new proxy settings were applied successfully.',
|
||||||
|
'prx_BLOCKED' => 'Blocked',
|
||||||
|
'Proxy settings' => 'Proxy settings',
|
||||||
|
|
@ -0,0 +1,67 @@
|
|||||||
|
|
||||||
|
'pse_NO_PSEUDONYMS' => ' <b>There are no pseudonyms in the system.</b> ',
|
||||||
|
'pse_REMOVE_PSEUDONYM' => 'Remove pseudonym',
|
||||||
|
'pse_ABOUT_TO_REMOVE' => 'You are about to remove the pseudonym: [_1]<br>
|
||||||
|
<b>Are you sure you wish to continue?</b>',
|
||||||
|
'pse_FORM_TITLE' => 'Create, modify, or remove pseudonyms',
|
||||||
|
'pse_DESCRIPTION' => '<p>The server automatically creates
|
||||||
|
an e-mail alias for each group. If you want to define an e-mail
|
||||||
|
alias for a list of users, simply create a group and the
|
||||||
|
list will automatically be maintained by the server.</p>
|
||||||
|
<p>Pseudonyms allow you to
|
||||||
|
create other names for existing users or groups.
|
||||||
|
For example, you may wish to create a pseudonym
|
||||||
|
"webmaster" for your "webdevelopers" group or a
|
||||||
|
pseudonym "joe" for the user "joseph".</p>
|
||||||
|
<p>The server automatically creates pseudonyms of the form
|
||||||
|
firstname.lastname and firstname_lastname for every user
|
||||||
|
on the system and a pseudonym "everyone" which contains
|
||||||
|
all users on the system.</p>
|
||||||
|
<p>Pseudonyms also allow you to create e-mail aliases for valid
|
||||||
|
(virtual) domains & users. For example you can forward
|
||||||
|
"sales@virtualdomain1.com" to user "mary" and
|
||||||
|
"sales@virtualdomain2.com" to user "john".
|
||||||
|
You must create the domains and user accounts before creating
|
||||||
|
the email aliases.</p>
|
||||||
|
<p>Pseudonyms can also forward to other pseudonyms, although this
|
||||||
|
is limited to one further level. For example the pseudonym
|
||||||
|
"webmaster" can forward to the pseudonym "techsupport" which
|
||||||
|
then forwards to a specified user "ray". This is useful where
|
||||||
|
one user is responsiblefor multiple roles and saves having
|
||||||
|
to change the pseudonym\'s associated with that user many times
|
||||||
|
in the event that the user departs the organisation.</p>
|
||||||
|
<p>You can modify or remove a
|
||||||
|
pseudonym by clicking on the corresponding
|
||||||
|
command next to the pseudonym.</p>',
|
||||||
|
'pse_LOCAL_ONLY' => '(local network only)',
|
||||||
|
'pse_SELECT_ACCOUNT' => 'Select account or group',
|
||||||
|
'pse_SELECT_INTERNAL' => 'Local network only',
|
||||||
|
'pse_CLICK_TO_CREATE' => 'Add pseudonym',
|
||||||
|
'pse_PSEUDONYM' => 'Pseudonym',
|
||||||
|
'pse_USER_OR_GROUP' => 'User or group',
|
||||||
|
'pse_CURRENT_PSEUDONYMS' => 'Current List of Pseudonyms',
|
||||||
|
'pse_TITLE_CREATE' => 'Create a pseudonym',
|
||||||
|
'pse_DESC_PSEUDONYM_NAME' => ' Please select an existing account or group for the pseudonym from the pulldown menu below',
|
||||||
|
'pse_MODIFY_PSEUDONYM' => 'Modify Pseudonym',
|
||||||
|
'pse_PSEUDONYM_NAME' => 'Pseudonym name',
|
||||||
|
'pse_VALID_PSEUDONYM_NAMES' => ' The pseudonym
|
||||||
|
should contain only lower-case letters, numbers, period,
|
||||||
|
hyphen and underscore
|
||||||
|
and should start with a lower-case letter or
|
||||||
|
number. For example "sales", "john.holland", "123"
|
||||||
|
and "email-administrator" are all valid pseudonyms,
|
||||||
|
but "John Smith" and "Henry Miller" are not.
|
||||||
|
<p>You can also create email aliases for accounts and (virtual)
|
||||||
|
domains that are valid on this server. For example
|
||||||
|
"fred@virtualdomain.com" can be forwarded to "mary"
|
||||||
|
(or to another valid user account).</p> ',
|
||||||
|
'pse_NAME_IN_USE' => 'Error: That name is in use You cannot create a pseudonym with that name.',
|
||||||
|
'pse_NOT_A_PSEUDONYM' => 'That account is not a pseudonym',
|
||||||
|
'pse_PSEUDONYM_INVALID_DOMAIN' => 'That domain is not hosted on this server',
|
||||||
|
'pse_PSEUDONYM_INVALID_NOACCT' => 'That account is not hosted on this server',
|
||||||
|
'pse_PSEUDONYM_INVALID_SAMEACCT' => 'A pseudonym cannot point to the same account',
|
||||||
|
'pse_CREATE_SUCCEEDED' => 'Successfully created pseudonym',
|
||||||
|
'pse_MODIFY_SUCCEEDED' => 'Successfully modified pseudonym',
|
||||||
|
'pse_REMOVE_SUCCEEDED' => 'Successfully removed pseudonym',
|
||||||
|
'pse_EVERYONE' => 'Everyone',
|
||||||
|
'Pseudonyms' => 'Pseudonyms',
|
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
'qma_FORM_TITLE' => 'Mail Log File Analysis',
|
||||||
|
'qma_INITIAL_DESC' => '<P>Analysing the mail system log files can aid both in
|
||||||
|
understanding how your system is performing and in
|
||||||
|
diagnosing delivery problems. Several different
|
||||||
|
reports are available.</P>
|
||||||
|
<P>Please note that it may take several minutes to generate
|
||||||
|
these reports</P>',
|
||||||
|
'qma_REPORT_TYPE' => 'Choose a report type',
|
||||||
|
'qma_GENERATE_REPORT' => 'Generate report',
|
||||||
|
'qma_LIST_OUTGOING' => 'List outgoing messages and recipients',
|
||||||
|
'qma_SUMMARIZE_QUEUE' => 'Summarize status of mail queue',
|
||||||
|
'qma_SUCCESSFUL_DELIVERY_DELAY' => 'Successful delivery delay distribution',
|
||||||
|
'qma_REASONS_DEFERRAL' => 'Reasons for deferral',
|
||||||
|
'qma_REASONS_FAILURE' => 'Reasons for failure',
|
||||||
|
'qma_BASIC_STATS' => 'Basic statistics',
|
||||||
|
'qma_RECIP_STATS' => 'Recipients statistics',
|
||||||
|
'qma_RECIP_HOSTS' => 'Recipient hosts',
|
||||||
|
'qma_RECIP_ORDERED' => 'Recipients in best order for mailing lists',
|
||||||
|
'qma_SENDER_STATS' => 'Sender statistics',
|
||||||
|
'qma_SENDMAIL_STYLE' => 'Sendmail style log',
|
||||||
|
'qma_REASONS_SUCCESS' => 'Reasons for success',
|
||||||
|
'qma_SENDER_UIDS' => 'Sender uids',
|
||||||
|
'qma_INVALID_REPORT_TYPE' => 'Invalid report type: ',
|
||||||
|
'qma_REPORT_GENERATED' => 'Report generated: ',
|
||||||
|
'qma_END_OF_REPORT' => 'End of Report',
|
||||||
|
'Mail log file analysis' => 'Mail log file analysis',
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
'quo_FORM_TITLE' => 'Create, modify, or remove user account quotas',
|
||||||
|
'quo_UNABLE_TO_OPEN_ACCOUNTS' => 'Unable to open accounts db',
|
||||||
|
'quo_QUOTA_DESC' => '<p>You can set filesystem quotas for users on your system by clicking
|
||||||
|
the "Modify" button next to the user you wish to update.
|
||||||
|
<p>If the user exceeds the "Limit with grace period", warnings will be
|
||||||
|
generated. If this limit is exceeded for longer than a week or if the
|
||||||
|
"Absolute limit" is reached, the user will be unable to store any more
|
||||||
|
files or receive any more e-mail.
|
||||||
|
<p>A setting of \'0\' for either limit disables that limit for the
|
||||||
|
corresponding user.
|
||||||
|
<p>The disk space for each user includes the user\'s home directory,
|
||||||
|
e-mail, and any files owned by the user in information bays.',
|
||||||
|
'quo_CURRENT_USAGE_AND_SETTINGS' => 'Current Quota Usage and Settings',
|
||||||
|
'quo_LIMIT_WITH_GRACE' => 'Limit with grace period',
|
||||||
|
'quo_LIMIT_WITH_GRACE_MB' => 'Limit with grace period (MB)',
|
||||||
|
'quo_ABS_LIMIT' => 'Absolute limit',
|
||||||
|
'quo_ABS_LIMIT_MB' => 'Absolute limit (MB)',
|
||||||
|
'quo_CURRENT_USAGE' => 'Current usage (MB)',
|
||||||
|
'quo_COULD_NOT_GET_UID' => 'Could not determine the uid for user: ',
|
||||||
|
'quo_ERR_NO_SUCH_ACCT' => 'Error: there is no account named: ',
|
||||||
|
'quo_ERR_NOT_A_USER_ACCT' => 'Error: the account is not a user account: ',
|
||||||
|
'quo_ACCOUNT_IS_TYPE' => 'It is an account of type: ',
|
||||||
|
'quo_MODIFY_USER_TITLE' => 'Modify user quota limits',
|
||||||
|
'quo_USER' => 'User: ',
|
||||||
|
'quo_CURRENTLY_HAS' => 'currently has: ',
|
||||||
|
'quo_FILES' => 'files',
|
||||||
|
'quo_OCCUPYING' => 'occupying: ',
|
||||||
|
'quo_MEGABYTES' => 'megabytes',
|
||||||
|
'quo_INSTRUCTIONS' => 'Enter the quota with optional unit suffix of \'K\' for kilobytes, \'M\' for megabytes,
|
||||||
|
\'G\' for gigabytes or \'T\' for terabytes.
|
||||||
|
Entries with no suffix are assumed to be in megabytes. A setting of \'0\'
|
||||||
|
for either limit disables that limit for the corresponding user.',
|
||||||
|
'quo_SOFT_VAL_MUST_BE_NUMBER' => 'Error: limit with grace period must be a number, optionally followed by one of the unit suffixes K, M, G, or T.',
|
||||||
|
'quo_HARD_VAL_MUST_BE_NUMBER' => 'Error: absolute limit must be a number, optionally followed by one of the unit suffixes K, M, G, or T.',
|
||||||
|
'quo_ERR_HARD_LT_SOFT' => ' Error: absolute limit must be greater than limit with grace time. ',
|
||||||
|
'quo_ERR_MODIFYING' => 'Error occurred while modifying user.',
|
||||||
|
'quo_SUCCESSFULLY_MODIFIED' => 'Successfully modified quota for user account: ',
|
||||||
|
'Quotas' => 'Quotas',
|
||||||
|
|
@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
'rbo_FORM_TITLE' => 'Shutdown or reboot',
|
||||||
|
'rbo_REBOOT' => 'Reboot',
|
||||||
|
'rbo_REBOOT_SUCCEEDED' => 'Reboot request initiated successfully.',
|
||||||
|
'rbo_DESC_REBOOT' => 'Your server has initiated the reboot process.',
|
||||||
|
'rbo_RECONFIGURE_SUCCEEDED' => 'Reconfiguration request initiated successfully.',
|
||||||
|
'rbo_DESC_RECONFIGURE' => 'Your server has initiated a full system reconfiguration and reboot.',
|
||||||
|
'rbo_SHUTDOWN_SUCCEEDED' => 'Shutdown request initiated successfully.',
|
||||||
|
'rbo_DESC_SHUTDOWN' => 'Your server has initiated the shutdown process.
|
||||||
|
The process will take several minutes to complete, after which
|
||||||
|
you can switch off the power.',
|
||||||
|
'rbo_LABEL_REBOOT' => 'Select Shutdown, Reboot or Reconfigure',
|
||||||
|
'rbo_DESCRIPTION' => 'You can reboot, shut down your server or perform a full system
|
||||||
|
reconfiguration from this screen. You must perform a shutdown
|
||||||
|
before switching the power off. All of these functions take
|
||||||
|
several minutes to complete.
|
||||||
|
When you click <b>perform</b> the operation will be initiated immediately, so be ready!',
|
||||||
|
'Reboot or shutdown' => 'Reboot or shutdown',
|
||||||
|
|
@ -0,0 +1,93 @@
|
|||||||
|
|
||||||
|
'rma_FORM_TITLE' => 'Change remote access settings',
|
||||||
|
'rma_DESCRIPTION' => 'For each of the options below, the private setting allows anyone
|
||||||
|
from your local network to access your server. The
|
||||||
|
public setting allows access from anywhere on the Internet. The no
|
||||||
|
access setting disables access. To understand the security
|
||||||
|
implications of changing these options from the default settings, you
|
||||||
|
should read the user\'s guide section on remote access.',
|
||||||
|
'rma_SUCCESS' => 'The new remote access settings have been saved.',
|
||||||
|
'rma_NO_ACCESS' => 'No Access',
|
||||||
|
'rma_PASSWORD_LOGIN_PRIVATE' => 'Accept passwords only from local networks',
|
||||||
|
'rma_PASSWORD_LOGIN_PUBLIC' => 'Accept passwords from anywhere',
|
||||||
|
'rma_LABEL_TELNET_ACCESS' => 'Telnet access',
|
||||||
|
'rma_LABEL_FTP_ACCESS' => 'FTP access',
|
||||||
|
'rma_LABEL_FTP_LOGIN' => 'FTP password access',
|
||||||
|
'rma_LABEL_PPTP' => 'Number of PPTP clients',
|
||||||
|
'rma_NUMBER_OF_PPTP_CLIENTS_MUST_BE_LESSER_THAN_NUMBER_OF_IP_IN_DHCP_RANGE' => 'The number of pptp clients is greater than the number of reserved IP for DHCP. You should take a smaller number.',
|
||||||
|
'rma_LABEL_SSH_PORT' => 'TCP Port for secure shell access',
|
||||||
|
'rma_LABEL_SSH' => 'Secure shell access',
|
||||||
|
'rma_LABEL_SSH_ADMIN' => 'Allow administrative command line access over secure shell',
|
||||||
|
'rma_LABEL_SSH_PASSWORD_ACCESS' => 'Allow secure shell access using standard passwords',
|
||||||
|
'rma_TITLE_SSH' => 'Secure Shell Settings',
|
||||||
|
'rma_DESC_SSH' => 'You can control Secure Shell access to your server.
|
||||||
|
The public setting should only be enabled by
|
||||||
|
experienced administrators
|
||||||
|
for remote problem diagnosis and resolution.
|
||||||
|
We recommend leaving this
|
||||||
|
parameter set to "No Access"
|
||||||
|
unless you have a specific reason to do otherwise.',
|
||||||
|
'rma_TITLE_FTP_ACCESS' => 'FTP Settings',
|
||||||
|
'rma_DESC_FTP_ACCESS' => 'You can also control <b>FTP</b> access to your server. We
|
||||||
|
recommend leaving this parameter set to \'no access\' unless you
|
||||||
|
have a specific reason to do otherwise.
|
||||||
|
<p>
|
||||||
|
Note: these settings limit access to the server and override other
|
||||||
|
settings, including those for individual information bays.</p>',
|
||||||
|
'rma_DESC_FTP_LOGIN' => 'You can also control authenticated FTP access to information
|
||||||
|
bays and user accounts. We strongly recommend leaving this
|
||||||
|
parameter set to private unless you have a specific reason to
|
||||||
|
do otherwise.
|
||||||
|
<p>
|
||||||
|
Note: a secure shell sftp client can also be used to access the
|
||||||
|
server, if remote access via the secure shell is enabled.
|
||||||
|
This method of access protects the
|
||||||
|
passwords and data of the FTP session, whereas standard FTP
|
||||||
|
provides no protection.</p>',
|
||||||
|
'rma_TITLE_PPTP' => 'PPTP Settings',
|
||||||
|
'rma_DESC_PPTP' => 'You can allow PPTP access to your server.
|
||||||
|
You should leave this feature disabled by setting the value
|
||||||
|
to the number 0 unless you require PPTP access.',
|
||||||
|
'rma_VALUE_ZERO_OR_POSITIVE' => 'Value must be zero or a positive integer',
|
||||||
|
'rma_REMOTE_MANAGEMENT' => 'Remote Management',
|
||||||
|
'rma_VALIDFROM_TITLE' => '[_1]',
|
||||||
|
'rma_VALIDFROM_DESC' => 'It is possible to allow hosts on remote networks to access the
|
||||||
|
server manager by entering those networks here. Use a subnet
|
||||||
|
mask of 255.255.255.255 to limit the access to the specified host.
|
||||||
|
Any hosts within the specified range will be able to access the
|
||||||
|
server manager using HTTPS.',
|
||||||
|
'rma_DESC_VALID_FROM_ENTRIES' => 'To add a new remote management network,
|
||||||
|
enter the details below.',
|
||||||
|
'rma_SUBNET_MASK' => 'Subnet mask',
|
||||||
|
'rma_NUM_OF_HOSTS' => 'Number of hosts',
|
||||||
|
'rma_NO_ENTRIES_YET' => 'There are no entries yet',
|
||||||
|
'rma_INVALID_SUBNET_MASK' => 'Invalid subnet mask',
|
||||||
|
'rma_ERR_INVALID_PARAMS' => 'Either provide both a network and subnet mask, or leave both
|
||||||
|
fields blank.',
|
||||||
|
'rma_ERR_NO_RECORD' => 'Unable to locate httpd-admin record in configuration db',
|
||||||
|
'Remote access' => 'Remote access',
|
||||||
|
'rma_LABEL_SERIAL_CONSOLE_ACCESS' => 'Serial console',
|
||||||
|
'rma_DESC_SERIAL_CONSOLE_ACCESS' => ' <hr class="sectionbar" /><h2>Serial console</h2>
|
||||||
|
You can allow access to the server console from a terminal
|
||||||
|
connected to a server serial port.',
|
||||||
|
'rma_PORT1_ENABLED' => 'Enabled on serial port 1',
|
||||||
|
'rma_PORT2_ENABLED' => 'Enabled on serial port 2',
|
||||||
|
'rma_LABEL_PPTP_ACCESS' => 'PPTP default user access',
|
||||||
|
'rma_TITLE_TELNET_ACCESS' => 'Telnet Settings',
|
||||||
|
'rma_DESC_TELNET_ACCESS' => 'WARNING:Telnet is currently enabled, but this feature is
|
||||||
|
no longer supported.Telnet is inherently insecure and should only
|
||||||
|
be used in circumstances where no practical alternative exists. You
|
||||||
|
should change option to [_1] and use
|
||||||
|
secure shell if remote access is
|
||||||
|
required.Once disabled, telnet will no longer appear on this
|
||||||
|
screen. ',
|
||||||
|
'rma_TITLE_IPSECRW' => 'IPSEC Client (Roadwarrior) Settings',
|
||||||
|
'rma_DESC_IPSECRW' => 'You can allow IPSEC client access to your server, authenticated by
|
||||||
|
digital certificates. You should leave this feature disabled by setting the value
|
||||||
|
to the number 0 unless you require IPSEC client access.',
|
||||||
|
'rma_LABEL_IPSECRW_SESS' => 'Number of IPSEC clients',
|
||||||
|
'rma_DESC_IPSECRW_RESET' => 'If you wish to reset all digital certificates, you
|
||||||
|
can do so here.<br>Any old certificates will no longer
|
||||||
|
authenticate against the server, so <b><i>all IPSEC clients will
|
||||||
|
need to import a new certificate!</i></b>.',
|
||||||
|
'rma_LABEL_IPSECRW_RESET' => 'Reset digital certificates',
|
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
'rvw_FORM_TITLE' => 'Review configuration',
|
||||||
|
'rvw_DESCRIPTION' => 'This report summarizes the networking, server, and domain
|
||||||
|
parameters on this server relevant to configuring
|
||||||
|
the client computers on your network.You may wish to print this
|
||||||
|
page and use it as a reference.',
|
||||||
|
'rvw_NETWORKING_PARAMS' => 'Networking Parameters',
|
||||||
|
'rvw_SERVER_MODE' => 'Server Mode',
|
||||||
|
'rvw_LOCAL_IP_ADDRESS_SUBNET_MASK' => 'Local IP address / subnet mask',
|
||||||
|
'rvw_EXTERNAL_IP_ADDRESS_SUBNET_MASK' => 'External IP address / subnet mask',
|
||||||
|
'rvw_GATEWAY' => 'Gateway',
|
||||||
|
'rvw_ADDITIONAL_LOCAL_NETWORKS' => 'Additional local networks',
|
||||||
|
'rvw_DHCP_SERVER' => 'DHCP server',
|
||||||
|
'rvw_BEGINNING_OF_DHCP_ADDRESS_RANGE' => 'Beginning of DHCP address range',
|
||||||
|
'rvw_END_OF_DHCP_ADDRESS_RANGE' => 'End of DHCP address range',
|
||||||
|
'rvw_SERVER_NAMES' => 'Server names',
|
||||||
|
'rvw_DNS_SERVER' => 'DNS server',
|
||||||
|
'rvw_WEB_SERVER' => 'Web server',
|
||||||
|
'rvw_PROXY_SERVER' => 'Proxy server',
|
||||||
|
'rvw_FTP_SERVER' => 'FTP server',
|
||||||
|
'rvw_SMTP_POP_AND_IMAP_MAIL_SERVERS' => 'SMTP, POP, and IMAP mail servers',
|
||||||
|
'rvw_HOSTS' => 'Hosts',
|
||||||
|
'rvw_DOMAIN_INFORMATION' => 'Domain information',
|
||||||
|
'rvw_PRIMARY_DOMAIN' => 'Primary domain',
|
||||||
|
'rvw_VIRTUAL_DOMAINS' => 'Virtual domains',
|
||||||
|
'rvw_PRIMARY_WEB_SITE' => 'Primary web site',
|
||||||
|
'rvw_SERVER_MANAGER' => 'Server manager',
|
||||||
|
'rvw_USER_PASSWORD_PANEL' => 'User password panel',
|
||||||
|
'rvw_EMAIL_ADDRESSES' => 'Email Addresses',
|
||||||
|
'rvw_EMAIL_USERACCOUNT' => 'useraccount',
|
||||||
|
'rvw_EMAIL_FIRSTNAME' => 'firstname',
|
||||||
|
'rvw_EMAIL_LASTNAME' => 'lastname',
|
||||||
|
'rvw_NO_VIRTUAL_DOMAINS' => 'No virtual domains defined',
|
||||||
|
'rvw_NO_NETWORKS' => 'No additional networks defined',
|
||||||
|
'rvw_INTERNET_VISIBLE_ADDRESS' => 'Internet Visible IP Address',
|
||||||
|
'Review configuration' => 'Review configuration',
|
||||||
|
|
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
support_FORM_TITLE => 'Support, warranty and licensing information',
|
||||||
|
'Support and licensing' => 'Support and licensing',
|
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
'swt_THEME' => 'Theme',
|
@ -0,0 +1,62 @@
|
|||||||
|
|
||||||
|
'usr_FORM_TITLE' => 'Create, modify, or remove user accounts',
|
||||||
|
'usr_FIRSTPAGE_DESC' => '<p>You can modify, lock or remove any account or reset the account\'s password by clicking on the corresponding command next to the account. </p><p>If the account is marked as locked, that means that the user\'s password needs to be reset. Please note that newly created accounts are automatically locked until the password is changed. </p>',
|
||||||
|
'usr_P2_TITLE' => 'Create or modify',
|
||||||
|
'usr_CREATE_MODIFY_DESC' => '<p>The account name should contain only lower-case letters, numbers, hyphens, periods, underscores and should start with a lower-case letter. For example "betty","hjohnson", and "mary-jane" are all valid account names, but "3friends", "John Smith", and "henry:miller" are not. </p><p>Note that two special pseudonyms will be created for each new account. These pseudonyms provide the ability to have alternative mail accounts for that user which include their first name and last name separated with a period (.) and underscore (_). So, for the account "betty" with first name "Betty" and last name "Rubble" two pseudonyms are created as betty.rubble and betty_rubble. </p><p>The directory information (department, company, etc.) can be changed from the defaults shown below. The changes will apply only to this user. </p>',
|
||||||
|
'usr_ADD_USER' => 'Add user account',
|
||||||
|
'usr_MODIFY_ADMIN_TITLE' => 'Modify the admin account',
|
||||||
|
'usr_USER_CREATED' => 'Successfully created user account. ',
|
||||||
|
'usr_USER_MODIFIED' => 'Successfully modified user account. ',
|
||||||
|
'usr_CANNOT_MODIFY_USER' => 'Error: an internal error occurred while attempting to modify the user "[_1]".',
|
||||||
|
'usr_CANNOT_MODIFY_USER_GROUPS' =>'Error: an internal error occurred while attempting to modify the group "[_1]" for user "[_2]".',
|
||||||
|
'usr_TAINTED_USER' => 'The account name "[_1]" contains invalid characters.',
|
||||||
|
'usr_ACCOUNT_NAME' => 'Account name',
|
||||||
|
'usr_FIRSTNAME' => 'First name',
|
||||||
|
'usr_LASTNAME' => 'Last name',
|
||||||
|
'usr_DEPARTMENT' => 'Department',
|
||||||
|
'usr_COMPANY' => 'Company',
|
||||||
|
'usr_STREET_ADDRESS' => 'Street address',
|
||||||
|
'usr_CITY' => 'City',
|
||||||
|
'usr_PHONE_NUMBER' => 'Phone number',
|
||||||
|
'usr_EMAIL_DELIVERY' => 'Email delivery',
|
||||||
|
'usr_DELIVER_EMAIL_LOCALLY' => 'Deliver email locally',
|
||||||
|
'usr_FORWARD_EMAIL' => 'Forward email to address below',
|
||||||
|
'usr_DELIVER_AND_FORWARD' => 'Both deliver locally and forward',
|
||||||
|
'usr_FORWARDING_ADDRESS' => 'Forwarding address',
|
||||||
|
'usr_GROUP_MEMBERSHIPS' => 'Group memberships',
|
||||||
|
'usr_RESET_DESC' => 'You are about to change the password for the user account "[_1]" ([_2])',
|
||||||
|
'usr_RESET_DESC2' => 'Enter the new password in the fields below',
|
||||||
|
'usr_ERR_OCCURRED_MODIFYING_PASSWORD' => 'An error occurred while updating the password',
|
||||||
|
'usr_PASSWORD_CHANGE_SUCCEEDED' => 'Successfully changed password for user "[_1]".',
|
||||||
|
'usr_LOCK_DESC' => 'You are about to lock the user account "[_1]" ([_2])',
|
||||||
|
'usr_LOCKED_ACCOUNT' => 'Successfully locked account for user "[_1]".',
|
||||||
|
'usr_NO_SUCH_USER' => 'Error: the user account "[_1]" does not exist.',
|
||||||
|
'usr_PSEUDONYM_CLASH' => 'Error: the pseudonym "[_1]" is already taken by the existing user account "[_1]".To differentiate, add initials to this field.',
|
||||||
|
'usr_LOCK_ACCOUNT' => 'Lock account',
|
||||||
|
'usr_LOCK_ACCOUNT_TITLE' => 'Lock user account',
|
||||||
|
'usr_LOCK_DESC2' => 'This user account will be locked. This means that this user will not be able to log in, and will not be able to collect e-mail. Any e-mail arriving will still be stored and/or forwarded to an external e-mail address, as configured. The account may be activated in the future by setting a new password. The current password will not be retained.</p><p><b>Are you sure you wish to lock this account?</b>',
|
||||||
|
'usr_REMOVE_ACCOUNT_TITLE' => 'Remove user account',
|
||||||
|
'usr_REMOVE_DESC' => 'You are about to remove the user account "[_1]" ([_2])',
|
||||||
|
'usr_REMOVE_DESC2' => 'All files belonging to this user account will be deleted. Also, any e-mail for this user account still remaining on the server (i.e. that has not yet been retrieved by the user) will be discarded. </p><p><b>Are you sure you wish to remove this account?</b>',
|
||||||
|
'usr_LOCK' => 'Lock',
|
||||||
|
'usr_NO_USER_ACCOUNTS' => 'There are no user accounts on this system.',
|
||||||
|
'Users' => 'Users',
|
||||||
|
'usr_ACCT_NAME_HAS_INVALID_CHARS' => 'The account name "[_1]" contains invalid characters. Account names must start with a lower case letter and contain only lower case letters, numbers, hyphens, periods and underscores.',
|
||||||
|
'usr_ACCOUNT_TOO_LONG' => 'Error: account name is too long. The maximum is [_1] characters.',
|
||||||
|
'usr_ACCOUNT_CONFLICT' => 'Error: the account "[_1]" can\'t be created because there is already a [_1] account of that name.',
|
||||||
|
'usr_ERR_OCCURRED_CREATING' => 'An error occurred creating the user.',
|
||||||
|
'usr_CANNOT_CONTAIN_WHITESPACE' => 'This field cannot contain white-space',
|
||||||
|
'usr_UNACCEPTABLE_CHARS' => 'This field must contain only letters, numbers, dots, hypens and underscores and start with a letter',
|
||||||
|
'usr_MEMBER' => 'Member?',
|
||||||
|
'usr_VPN_CLIENT_ACCESS' => 'VPN Client Access',
|
||||||
|
'usr_SYSTEM_PASSWORD_FORM_TITLE' => 'Change system password',
|
||||||
|
'usr_SYSTEM_PASSWORD_DESCRIPTION' => 'Certain services on this server installation require a username and password (for example this web page for the server manager application). The username is always admin. You can change the system password using the fields below.',
|
||||||
|
'usr_SYSTEM_PASSWORD_UNPRINTABLES_IN_PASS' => 'Password must contain only printable characters',
|
||||||
|
'usr_SYSTEM_PASSWORD_VERIFY_ERROR' => 'The two passwords are not identical.',
|
||||||
|
'usr_SYSTEM_PASSWORD_AUTH_ERROR' => 'The current password is incorrect.',
|
||||||
|
'usr_SYSTEM_PASSWORD_CHANGED' => 'The system password has been changed.',
|
||||||
|
'usr_CURRENT_SYSTEM_PASSWORD' => 'Current system password',
|
||||||
|
'usr_NEW_SYSTEM_PASSWORD' => 'New system password',
|
||||||
|
'usr_NEW_SYSTEM_PASSWORD_VERIFY' => 'New system password (verify)',
|
||||||
|
'usr_LABEL_IPSECRW_DOWNLOAD' => 'Download digital certificate to IPSec client',
|
||||||
|
'usr_ERR_OCCURRED_DELETING' => 'An error occurred while trying to delete the user.',
|
@ -0,0 +1,21 @@
|
|||||||
|
'pwd_FIELDS_REQUIRED' => 'All fields are required',
|
||||||
|
'pwd_ERROR_PASSWORD_CHANGE' => 'An error occurred while attempting to change your password. Please make sure that the old password entered is correct.',
|
||||||
|
'pwd_PASSWORD_CHANGE' => 'Change Password',
|
||||||
|
'pwd_RESET_PASSWORD_TITLE' => 'Reset user password',
|
||||||
|
'pwd_ACCOUNT_PASSWORD_CHANGE' => 'Change account password',
|
||||||
|
'pwd_PASSWORD_VERIFY_NEW' => 'New password (verify):',
|
||||||
|
'pwd_PASSWORD_NEW' => 'New password:',
|
||||||
|
'pwd_PASSWORD_OLD' => 'Old password:',
|
||||||
|
'pwd_PASSWORD_RESET' => 'Reset password',
|
||||||
|
'pwd_ACCOUNT_NAME_INVALID' => 'The account name entered is invalid.',
|
||||||
|
'pwd_ACCOUNT_NAME_INVALID_CHARS' => 'The account name you entered contained invalid characters.',
|
||||||
|
'pwd_PASSWORD_OLD_INVALID_CHARS' => 'The old password you entered contained invalid characters.',
|
||||||
|
'pwd_PASSWORD_INVALID_CHARS' => 'The password you entered contained invalid characters.',
|
||||||
|
'pwd_PASSWORD_VERIFY_ERROR' => 'The new passwords you entered did not match.',
|
||||||
|
'pwd_ACCOUNT_USER_NONE' => 'There are no user accounts in the system.',
|
||||||
|
'pwd_ACCOUNT_GROUP_NONE' => 'There are no user groups in the system.',
|
||||||
|
'pwd_YOUR_ACCOUNT' => 'Your account:',
|
||||||
|
'pwd_YOUR_ACCOUNT_INVALID' => 'The account name entered is invalid.',
|
||||||
|
'pwd_PASSWORD_CHANGE_SUCCESS' => 'Your password has been successfully changed.',
|
||||||
|
'pwd_DESCRIPTION' => '<P>To change your account password, please fill out the following form. You will need to provide the name of your account, your old password, and your desired new password. (You must type the new password twice.)</P><P>If you cannot change your password because you have forgotten the old one, your local system administrator can reset your password using the <EM>server manager</EM>.</P>',
|
||||||
|
'pwd_DESCRIPTION_RESET' => '<P>To reset your account password, please fill out the following form. You will need to provide your desired new password. (You must type it twice.)</P><P>In cas of problem, your local system administrator can reset your password using the <EM>server manager</EM>.</P>',
|
@ -0,0 +1,39 @@
|
|||||||
|
|
||||||
|
'log_FORM_TITLE' => 'View log files',
|
||||||
|
'log_FIRSTPAGE_DESC' => 'This panel allows you to view or download the log files generated
|
||||||
|
by the services running on your server.',
|
||||||
|
'log_LOG_FILE_SELECT_DESC' => 'Choose a log file to view',
|
||||||
|
'log_FILTER_PATTERN_DESC' => 'You may optionally specify a filter pattern to display only the
|
||||||
|
lines from the log file which match this pattern.If you leave
|
||||||
|
this field blank, all available lines of the log file will be
|
||||||
|
displayed. Note that this option is not used if you download the
|
||||||
|
logfile.',
|
||||||
|
'log_FILTER_PATTERN_LABEL' => 'Filter Pattern (optional)',
|
||||||
|
'log_MATCH_PATTERN_DESC' => 'You may also optionally specify a highlight pattern to mark in bold
|
||||||
|
any lines from the log file which match the highlight pattern. The
|
||||||
|
highlight pattern is applied to any lines which have already
|
||||||
|
matched the filter pattern. Note that this option is not used if
|
||||||
|
you download the logfile.',
|
||||||
|
'log_MATCH_PATTERN_LABEL' => 'Highlight Pattern (optional)',
|
||||||
|
'log_END_DESC' => 'Please note that it may take quite some time to generate these
|
||||||
|
reports.',
|
||||||
|
'log_VIEW' => 'View log file',
|
||||||
|
'log_LOG_FILE_EMPTY' => 'Log file "[_1]" is empty!',
|
||||||
|
'log_VIEWING_TIME' => 'Viewed at [_1].',
|
||||||
|
'log_MATCH_HEADER' => 'Displaying lines matching: "[_1]".',
|
||||||
|
'log_HIGHLIGHT_HEADER' => 'Highlighting lines matching: "[_1]".',
|
||||||
|
'log_NO_MATCHING_LINES' => 'No matching lines displayed.',
|
||||||
|
'log_FILENAME_ERROR' => '<p>Error while specifying log file name.</p>
|
||||||
|
<p>Invalid report type "[_1]".</p>',
|
||||||
|
'log_REFRESH' => 'Refresh this logfile',
|
||||||
|
'log_OP_DESC' => 'You must choose between viewing the logfile in your browser, or
|
||||||
|
downloading the logfile to your computer. If the logfile is
|
||||||
|
particularly large, you may wish to download it instead of
|
||||||
|
attempting to open it in your browser, as this is a problem for
|
||||||
|
some web browsers.',
|
||||||
|
'log_OP_LABEL' => 'Operation',
|
||||||
|
'log_DOWNLOAD_PAGE_DESC' => 'Your logfile download is now prepared. It will proceed as soon
|
||||||
|
as you click on the "Next" button below, and instruct
|
||||||
|
your browser to accept the download via the pop-up window that
|
||||||
|
will appear.',
|
||||||
|
'log_DOWNLOAD_FILE' => 'Preparing to download the logfile [_1].',
|
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
'wkg_FORM_TITLE' => 'Change workgroup settings',
|
||||||
|
'wkg_DESC_WORKGROUP' => 'Enter the name of the Windows workgroup that this server should appear in.',
|
||||||
|
'wkg_LABEL_WORKGROUP' => 'Windows workgroup',
|
||||||
|
'wkg_DESC_SERVERNAME' => 'Enter the name that this server should use for
|
||||||
|
Windows and Macintosh file sharing.',
|
||||||
|
'wkg_LABEL_SERVERNAME' => 'Server Name',
|
||||||
|
'wkg_DESC_PDC' => 'Should this server act as the workgroup
|
||||||
|
and domain controller on your Windows network? You should leave
|
||||||
|
this set to <b>No</b> if another server is already performing this
|
||||||
|
role on your network.',
|
||||||
|
'wkg_LABEL_PDC' => 'Workgroup and Domain Controller',
|
||||||
|
'wkg_DESC_ROAM' => 'Should this server support roaming profiles?
|
||||||
|
You should leave this set to the default of <b>No</b> unless you have
|
||||||
|
experience administering server-based Windows roaming profiles and
|
||||||
|
know that this feature is required.',
|
||||||
|
'wkg_LABEL_ROAM' => 'Roaming profiles',
|
||||||
|
'wkg_SUCCESS' => 'The new workgroup settings have been saved',
|
||||||
|
'wkg_INVALID_WORKGROUP' => 'The workgroup name must begin with a letter (upper or lower
|
||||||
|
case), followed by any combination of letters, numbers,
|
||||||
|
underscores, periods and hyphens.',
|
||||||
|
'wkg_INVALID_SERVERNAME' => 'The server name must begin with a letter (upper or lower case),
|
||||||
|
followed by any combination of letters, numbers, underscores and
|
||||||
|
hyphens.',
|
||||||
|
'wkg_INVALID_WORKGROUP_MATCHES_SERVERNAME' => 'The server and workgroup names match, when compared in lower case.
|
||||||
|
These values must be different in order for filesharing to be turned on. ',
|
||||||
|
'Workgroup' => 'Workgroup',
|
||||||
|
|
@ -0,0 +1,79 @@
|
|||||||
|
|
||||||
|
'yum_FORM_TITLE' => 'Software installer',
|
||||||
|
'yum_SUCCESS' => 'The new settings have been saved.',
|
||||||
|
'yum_LABEL_YUM_STATUS' => 'Check for updates',
|
||||||
|
'yum_LABEL_YUM_AUTOINSTALLUPDATES' => 'Automatically install updates',
|
||||||
|
'yum_DESC_YUM_AUTOINSTALLUPDATES' => 'If enabled this will take precedence over the simple check for updates notification and predownload features. Instead it will install the available updates from enabled repositories. For more information refer to yum and yum-cron manual page.',
|
||||||
|
'yum_LABEL_YUM_PACKAGEFUNCTIONS' => 'Manage individual packages',
|
||||||
|
'yum_DESC_YUM_PACKAGEFUNCTIONS' => 'The software installer can manage groups of
|
||||||
|
related package or individual packages. By
|
||||||
|
default, only groups of packages are presented.
|
||||||
|
If you wish to manage individual packages,
|
||||||
|
enable this option. This should only be done
|
||||||
|
by experienced administrators.',
|
||||||
|
'yum_LABEL_ENABLED_REPOSITORIES' => 'Enabled repositories',
|
||||||
|
'yum_DESC_ENABLED_REPOSITORIES' => 'The software installer can install software
|
||||||
|
from any of enabled repositories. To enable
|
||||||
|
a repository, select it from the list.
|
||||||
|
To disable a repository, de-select it from the list.
|
||||||
|
By default, only stable, tested software is available
|
||||||
|
for installation.',
|
||||||
|
'yum_TITLE_UPTODATE' => 'This system is up to date.',
|
||||||
|
'yum_DESC_UPTODATE' => 'All updates have been installed.',
|
||||||
|
'yum_TITLE_UPDATES_AVAILABLE' => 'Updates Available',
|
||||||
|
'yum_DESC_UPDATES_AVAILABLE' => 'There are updates available for your system. These updates
|
||||||
|
should be installed as soon as possible.',
|
||||||
|
'yum_LABEL_AVAILABLE_UPDATES' => 'Updates available',
|
||||||
|
'yum_DESC_AVAILABLE_UPDATES' => 'The following updates are available for your system.
|
||||||
|
You should normally install all available updates.
|
||||||
|
If there are updates you do not wish to install, de-select
|
||||||
|
them from the list below.',
|
||||||
|
'yum_INSTALL_UPDATES' => 'Install selected updates',
|
||||||
|
'yum_BUTTON_INSTALL_UPDATES' => 'List available updates',
|
||||||
|
'yum_HEADER_AVAILABLE_SOFTWARE' => 'The following software is available to be installed
|
||||||
|
onto your system. You should only install additional
|
||||||
|
software onto this system if you are aware
|
||||||
|
of the consequences of doing so.',
|
||||||
|
'yum_DESC_AVAILABLE_GROUPS' => 'You can select software groups
|
||||||
|
to install from the list below.',
|
||||||
|
'yum_LABEL_AVAILABLE_GROUPS' => 'Available groups',
|
||||||
|
'yum_DESC_AVAILABLE_PACKAGES' => 'You can also select individual packages
|
||||||
|
to install from the list below.',
|
||||||
|
'yum_LABEL_AVAILABLE_PACKAGES' => 'Available packages',
|
||||||
|
'yum_INSTALL_SOFTWARE' => 'Install',
|
||||||
|
'yum_HEADER_INSTALLED_SOFTWARE' => 'The following software is installed
|
||||||
|
on this system. You should only remove
|
||||||
|
software from this system if you are aware
|
||||||
|
of the consequences of doing so.',
|
||||||
|
'yum_DESC_INSTALLED_GROUPS' => 'You can select software groups
|
||||||
|
to remove from the list below.',
|
||||||
|
'yum_LABEL_INSTALLED_GROUPS' => 'Installed groups',
|
||||||
|
'yum_DESC_INSTALLED_PACKAGES' => 'You can also select individual packages
|
||||||
|
you wish to remove from the list below.',
|
||||||
|
'yum_LABEL_INSTALLED_PACKAGES' => 'Installed packages',
|
||||||
|
'yum_BUTTON_CONFIGURATION' => 'Change software installer settings',
|
||||||
|
'yum_BUTTON_INSTALL_AVAILABLE' => 'Install additional software',
|
||||||
|
'yum_BUTTON_REMOVE' => 'Remove installed software',
|
||||||
|
'yum_HEADER_POSTUPGRADE_REQUIRED' => ' The system needs to be reconfigured
|
||||||
|
after adding or removing software,
|
||||||
|
or applying updates.
|
||||||
|
<p>
|
||||||
|
Please click on the Reconfigure button at the bottom of
|
||||||
|
this page to start the reconfiguration process.
|
||||||
|
<b>An automatic reboot will be
|
||||||
|
initiated as part of this reconfiguration process</b>
|
||||||
|
</p> ',
|
||||||
|
'yum_SYSTEM_BEING_RECONFIGURED' => 'Your system is being automatically rebooted to
|
||||||
|
complete the reconfiguraton process.',
|
||||||
|
'yum_1DAILY' => 'Daily',
|
||||||
|
'yum_2WEEKLY' => 'Weekly',
|
||||||
|
'yum_3MONTHLY' => 'Monthly',
|
||||||
|
'yum_LABEL_YUM_DELTARPMPROCESS' => 'Delta Rpm Update',
|
||||||
|
'yum_DESC_YUM_DELTARPMPROCESS' => 'A deltarpm contains the difference between an old and a new version of a rpm,
|
||||||
|
which can save bandwith. The drawback is that update
|
||||||
|
operations consume considerably more CPU cycles',
|
||||||
|
'yum_LABEL_YUM_DOWNLOADONLY' => 'Predownload updates',
|
||||||
|
'yum_DESC_YUM_DOWNLOADONLY' => 'The rpm updates can be downloaded during the night,
|
||||||
|
this will ease and give faster the yum update process
|
||||||
|
(only enabled repositories will be used).',
|
||||||
|
'yum_UPDATE_SUCCESS' => 'The requested changes have been successfully implemented.',
|
108
root/usr/share/smanager/lib/SrvMngr/Model/Main.pm
Normal file
108
root/usr/share/smanager/lib/SrvMngr/Model/Main.pm
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
package SrvMngr::Model::Main;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use utf8;
|
||||||
|
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
use esmith::util;
|
||||||
|
|
||||||
|
use Net::LDAP qw/LDAP_INVALID_CREDENTIALS/;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sub init_data {
|
||||||
|
|
||||||
|
my %datas = ();
|
||||||
|
|
||||||
|
my $cdb = esmith::ConfigDB->open_ro() or die("can't open Config DB");
|
||||||
|
my $sysconfig = $cdb->get("sysconfig");
|
||||||
|
|
||||||
|
$datas{'lang'} = $sysconfig->prop('Language') || 'en_US';
|
||||||
|
|
||||||
|
## convert xx_XX lang format to xx-xx + delete .UTFxx + lowercase
|
||||||
|
$datas{'lang'} =~ s/_(.*)\..*$/-${1}/; # just keep 'en-us'
|
||||||
|
# $datas{'lang'} = lc( substr( $datas{'lang'},0,2 )); # just keep 'en'
|
||||||
|
|
||||||
|
$datas{'releaseVersion'} = $sysconfig->prop("ReleaseVersion") || '??';
|
||||||
|
$datas{'copyRight'} = 'All rights reserved';
|
||||||
|
|
||||||
|
$datas{'PwdSet'} = ($cdb->get('PasswordSet')->value eq "yes") || '0' ;
|
||||||
|
|
||||||
|
$datas{'SystemName'} = $cdb->get("SystemName")->value;
|
||||||
|
$datas{'DomainName'} = $cdb->get("DomainName")->value;
|
||||||
|
|
||||||
|
my $rec = $cdb->get("smanager");
|
||||||
|
$datas{'Access'} = $rec->prop('access') || 'private';
|
||||||
|
|
||||||
|
return \%datas;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub reconf_needed {
|
||||||
|
|
||||||
|
my $cdb = esmith::ConfigDB->open_ro() or die("can't open Config DB");
|
||||||
|
my $unsafe = ($cdb->get('bootstrap-console') and $cdb->get('bootstrap-console')->prop('Run') eq 'yes') ||
|
||||||
|
($cdb->get('UnsavedChanges') and $cdb->get('UnsavedChanges')->value eq 'yes') || '0';
|
||||||
|
return $unsafe;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub check_credentials {
|
||||||
|
|
||||||
|
my ($c, $username, $password) = @_;
|
||||||
|
return unless $username || $password;
|
||||||
|
|
||||||
|
my $cdb = esmith::ConfigDB->open_ro() or die("can't open Configuration DB");
|
||||||
|
my $l = $cdb->get('ldap');
|
||||||
|
my $status = $l->prop('status') || "disabled";
|
||||||
|
unless ($status eq "enabled" ) {
|
||||||
|
warn "Couldn't connect. LDAP service not enabled!\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $domain = $cdb->get('DomainName')->value;
|
||||||
|
my $base = esmith::util::ldapBase ($domain);
|
||||||
|
|
||||||
|
# secure & localhost !?
|
||||||
|
my $LDAP_server = 'ldaps://localhost';
|
||||||
|
|
||||||
|
my $ldap = Net::LDAP->new( $LDAP_server )
|
||||||
|
or warn("Couldn't connect to LDAP server $LDAP_server: $@"), return;
|
||||||
|
|
||||||
|
# this is where we check the password
|
||||||
|
my $DN = "uid=$username,ou=Users,$base";
|
||||||
|
|
||||||
|
my $login = $ldap->bind( $DN, password => $password );
|
||||||
|
|
||||||
|
# return 1 on success, 0 on failure with the ternary operator
|
||||||
|
return $login->code == LDAP_INVALID_CREDENTIALS ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub check_adminalias {
|
||||||
|
|
||||||
|
# is an alias required for admin ? return it or undef
|
||||||
|
my $c = shift;
|
||||||
|
|
||||||
|
my $alias;
|
||||||
|
my $cdb = esmith::ConfigDB->open_ro() or die("can't open Configuration DB");
|
||||||
|
if (defined $cdb->get('AdminAlias')) {
|
||||||
|
$alias = $cdb->get('AdminAlias')->value;
|
||||||
|
}
|
||||||
|
return undef unless $alias;
|
||||||
|
|
||||||
|
my $adb = esmith::AccountsDB->open_ro() or die("can't open Accounts DB");
|
||||||
|
my $arec = $adb->get( $alias );
|
||||||
|
return undef unless $arec;
|
||||||
|
|
||||||
|
# $alias pseudo exists AND points to admin AND is removable (not known pseudos) => OK
|
||||||
|
return ( $arec && $arec->prop('type') eq 'pseudonym' && $arec->prop('Account') eq 'admin'
|
||||||
|
&& ($arec->prop('Removable') || 'yes') ne 'no' ) ? $alias : undef;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user