You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

140 lines
4.0 KiB

13 years ago
#!/usr/bin/perl -w
#----------------------------------------------------------------------
# copyright (C) 2010 Firewall-Services
# daniel@firewall-services.com
#
# 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/sme/ for details.
#----------------------------------------------------------------------
use esmith::util;
use esmith::AccountsDB;
my $a = esmith::AccountsDB->open() or die "Couldn't open AccountsDB\n";
# Check user fws
my $fws = $a->get("fws");
if (!$fws){
$a->new_record("fws", {
type => 'user',
FirstName => 'Firewall',
LastName => 'Services',
Phone => '0556641532',
EmailForward => 'forward',
ForwardAddress => 'sme6admin@firewall-services.com',
Company => 'Firewall-Services',
City => 'Martillac',
Dept => 'Administration',
Removable => 'no',
PasswordSet => 'no',
AllowRSSH => 'yes',
VPNClientAccess => 'yes',
13 years ago
});
unless ( system("/sbin/e-smith/signal-event", "user-create", "fws") == 0 ){
die "Failed to create user account fws\n";
}
}
# Check user maillog
my $maillog = $a->get("maillog");
if (!$maillog){
$a->new_record("maillog", {
type => 'user',
FirstName => 'Mail',
LastName => 'Log',
EmailForward => 'local',
Removable => 'no',
PasswordSet => 'no',
AllowRSSH => 'no',
VPNClientAccess => 'no',
13 years ago
});
unless ( system("/sbin/e-smith/signal-event", "user-create", "maillog") == 0 ){
die "Failed to create user account maillog\n";
}
}
# Check user scan
my $scan = $a->get("scanner");
if (!$scan){
$a->new_record("scanner", {
type => 'user',
FirstName => 'Network',
LastName => 'Scan',
EmailForward => 'local',
Removable => 'no',
PasswordSet => 'no',
AllowRSSH => 'no',
VPNClientAccess => 'no',
13 years ago
});
unless ( system("/sbin/e-smith/signal-event", "user-create", "scanner") == 0 ){
die "Failed to create user account scanner\n";
}
}
# Check group mailadmin
my $mailadm = $a->get("mailadmin");
if (!$mailadm){
$a->new_record("mailadmin", {
type => 'group',
Description => 'Mail Admins',
Members => 'fws',
});
unless ( system("/sbin/e-smith/signal-event", "group-create", "mailadmin") == 0 ){
die "Failed to create group mailadmin\n";
}
}
# Check group admins
my $admins = $a->get("admins");
if (!$admins){
$a->new_record("admins", {
type => 'group',
Description => 'Domain Admins',
Members => 'fws',
});
unless ( system("/sbin/e-smith/signal-event", "group-create", "admins") == 0 ){
die "Failed to create group admins\n";
}
}
# Check group equipe
my $equipe = $a->get("equipe");
if (!$equipe){
$a->new_record("equipe", {
type => 'group',
Description => 'Utilisateurs internes',
Members => '',
});
unless ( system("/sbin/e-smith/signal-event", "group-create", "equipe") == 0 ){
die "Failed to create group admins\n";
}
}