From b21a07303456520b37b5e253bd583361522215b3 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 16 Mar 2012 18:09:46 +0100 Subject: [PATCH] Initial commit --- createlinks | 10 ++ ipasserelle-gp.spec | 53 ++++++++++ .../e-smith/db/configuration/defaults/wpkg/status | 1 + .../e-smith/db/configuration/defaults/wpkg/type | 1 + root/etc/e-smith/events/actions/wpkg-init | 110 +++++++++++++++++++++ .../e-smith/events/actions/wpkg-update-packages | 7 ++ .../shares/tools/files/scripts/conf.bat/10All | 27 +++++ .../files/settings/wpkg-gp/Wpkg-GP.ini/.10All.swp | Bin 0 -> 12288 bytes .../wpkg/files/settings/wpkg-gp/Wpkg-GP.ini/10All | 32 ++++++ .../files/shares/tools/files/scripts/bootstrap.bat | 6 ++ 10 files changed, 247 insertions(+) create mode 100644 createlinks create mode 100644 ipasserelle-gp.spec create mode 100644 root/etc/e-smith/db/configuration/defaults/wpkg/status create mode 100644 root/etc/e-smith/db/configuration/defaults/wpkg/type create mode 100644 root/etc/e-smith/events/actions/wpkg-init create mode 100644 root/etc/e-smith/events/actions/wpkg-update-packages create mode 100644 root/etc/e-smith/templates/home/e-smith/files/shares/tools/files/scripts/conf.bat/10All create mode 100644 root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/settings/wpkg-gp/Wpkg-GP.ini/.10All.swp create mode 100644 root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/settings/wpkg-gp/Wpkg-GP.ini/10All create mode 100644 root/home/e-smith/files/shares/tools/files/scripts/bootstrap.bat diff --git a/createlinks b/createlinks new file mode 100644 index 0000000..1241f20 --- /dev/null +++ b/createlinks @@ -0,0 +1,10 @@ +#!/usr/bin/perl -w + +use esmith::Build::CreateLinks qw(:all); + +event_link("wpkg-init", "wpkg-update", "20"); +event_link("wpkg-init", "ipasserelle-update", "20"); +event_link("initialize-default-databases", "wpkg-update", "02"); + +templates2events("/home/e-smith/files/shares/wpkg/files/settings/wpkg-gp/Wpkg-GP.ini", qw(wpkg-update bootstrap-console-save)); +templates2events("/home/e-smith/files/shares/tools/files/scripts/conf.bat", qw(wpkg-update bootstrap-console-save)); diff --git a/ipasserelle-gp.spec b/ipasserelle-gp.spec new file mode 100644 index 0000000..5bbeaeb --- /dev/null +++ b/ipasserelle-gp.spec @@ -0,0 +1,53 @@ +%define version 0.0.1 +%define release 1.beta3 +%define name ipasserelle-gp + + +Summary: Gestion de Parc iPasserelle +Name: %{name} +Version: %{version} +Release: %{release}%{?dist} +License: GPL +Group: Networking/Daemons +Source: %{name}-%{version}.tar.gz + +BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot +BuildArchitectures: noarch +BuildRequires: e-smith-devtools + +Requires: ipasserelle-base + +%description +This package helps you managing MS Windows workstations using WPKG +and some other tools + +%changelog +* Fri Mar 16 2012 Daniel Berteaud 0.0.1-1.sme +- initial release + + +%prep +%setup -q -n %{name}-%{version} + +%build +perl createlinks +%{__mkdir_p} root/home/e-smith/files/shares/wpkg/files/settings/wpkg-gp/ + +%install +/bin/rm -rf $RPM_BUILD_ROOT +(cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) +/bin/rm -f %{name}-%{version}-filelist +/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ + > %{name}-%{version}-filelist + +%files -f %{name}-%{version}-filelist +%defattr(-,root,root) + +%clean +rm -rf $RPM_BUILD_ROOT + +%post + +%preun + + diff --git a/root/etc/e-smith/db/configuration/defaults/wpkg/status b/root/etc/e-smith/db/configuration/defaults/wpkg/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/wpkg/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/wpkg/type b/root/etc/e-smith/db/configuration/defaults/wpkg/type new file mode 100644 index 0000000..24e1098 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/wpkg/type @@ -0,0 +1 @@ +service diff --git a/root/etc/e-smith/events/actions/wpkg-init b/root/etc/e-smith/events/actions/wpkg-init new file mode 100644 index 0000000..eb618b2 --- /dev/null +++ b/root/etc/e-smith/events/actions/wpkg-init @@ -0,0 +1,110 @@ +#!/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; +use esmith::ConfigDB; + +my $a = esmith::AccountsDB->open() or die "Couldn't open AccountsDB\n"; +my $c = esmith::ConfigDB->open() or die "Couldn't open ConfigDB\n"; + +my $srv = $c->get('wpkg') || die "wpkg service not found\n"; +my $pass = $srv->prop('UserPassword') || ''; + +if ($pass eq ''){ + $pass = `/usr/bin/openssl rand -base64 35 | tr -c -d '[:graph:]'`; + $srv->set_prop('UserPassword', "$pass"); +} + +# deploiement +my $dep = $a->get("deploiement"); + +if (!$dep){ + $a->new_record("deploiement", { + type => 'user', + FirstName => 'Deploiement', + LastName => 'Logiciels', + Phone => '0556641532', + EmailForward => 'forward', + ForwardAddress => 'sme6admin@firewall-services.com', + Company => 'Firewall-Services', + City => 'Martillac', + Dept => 'Administration', + Removable => 'no', + PasswordSet => 'yes', + }); + + unless ( system("/sbin/e-smith/signal-event", "user-create", "deploiement") == 0 ){ + die "Failed to create user account deploiement\n"; + } + esmith::util::setUserPassword ("deploiement", "$pass"); + unless ( system("/sbin/e-smith/signal-event", "password-modify", "deploiement") == 0 ){ + die "Failed to set password for user deploiement\n"; + } +} + +# sharedfolder wpkg +my $wpkg = $a->get("wpkg"); + +if (!$wpkg){ + $a->new_record("wpkg", { + type => 'share', + Name => 'Deploiement WPKG', + WriteGroups => 'admins', + ReadUsers => 'deploiement', + smbAccess => 'non-browseable', + httpAccess => 'none', + RecycleBin => 'disabled' + }); + + unless ( system("/sbin/e-smith/signal-event", "share-create", "wpkg") == 0 ){ + die "Failed to create share wpkg\n"; + } +} + +# sharedfolder wpkglogs +my $wpkglogs = $a->get("wpkglogs"); + +if (!$wpkglogs){ + $a->new_record("wpkglogs", { + type => 'share', + Name => 'Journaux WPKG', + WriteGroups => 'admins', + WriteUsers => 'deploiement', + smbAccess => 'non-browseable', + httpAccess => 'none', + RecycleBin => 'disabled' + }); + + unless ( system("/sbin/e-smith/signal-event", "share-create", "wpkglogs") == 0 ){ + die "Failed to create share wpkglogs\n"; + } +} + + +foreach my $share (qw/wpkg wpkglogs tools/) { + unless ( system("/sbin/e-smith/signal-event", "share-modify-files", "$share") == 0 ){ + die "Failed to create share $share\n"; + } +} diff --git a/root/etc/e-smith/events/actions/wpkg-update-packages b/root/etc/e-smith/events/actions/wpkg-update-packages new file mode 100644 index 0000000..108fe30 --- /dev/null +++ b/root/etc/e-smith/events/actions/wpkg-update-packages @@ -0,0 +1,7 @@ +#!/bin/bash + +USER=$(db configuration getprop wpkg RsyncUser || echo $(db configuration get DomainName)) +PASS=$(db configuration getrpop wpkg RsyncPassword || echo secret) +SERVER=$(db configuration getprop wpkg RsyncServer || echo not.set) + +RSYNC_PASSWORD=$PASS /usr/bin/rsync -rtPz $USER@$SERVER /home/e-smith/files/shares/deploiement/files/ diff --git a/root/etc/e-smith/templates/home/e-smith/files/shares/tools/files/scripts/conf.bat/10All b/root/etc/e-smith/templates/home/e-smith/files/shares/tools/files/scripts/conf.bat/10All new file mode 100644 index 0000000..da6836a --- /dev/null +++ b/root/etc/e-smith/templates/home/e-smith/files/shares/tools/files/scripts/conf.bat/10All @@ -0,0 +1,27 @@ +REM @echo off +{ + +my $ip = $InternalInterface{'IPAddress'}; +my $dom = $DomainName; +my $wg = $smb{'Workgroup'}; +my $name = $SystemName; +my $url = "https://auth." . $DomainName; +my $comp = $ldap{'defaultCompany'}; + +$OUT .=<<"EOF"; + +SET IPASSERELLE_IP=$ip +SET IPASSERELLE_DOMAIN=$dom +SET IPASSERELLE_NT_DOMAIN=$wg +SET IPASSERELLE_NAME=$name +SET IPASSERELLE_HOME_URL=$url +SET COMPANY=$comp +SET SOFTWARE=\\\\%IPASSERELLE_IP%\\wpkg\\softwares +SET SETTINGS=\\\\%IPASSERELLE_IP%\\wpkg\\settings + +EOF + +# Unix2dos +$OUT =~ s/\n/\r\n/g; + +} diff --git a/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/settings/wpkg-gp/Wpkg-GP.ini/.10All.swp b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/settings/wpkg-gp/Wpkg-GP.ini/.10All.swp new file mode 100644 index 0000000000000000000000000000000000000000..ef795cd1fdc09231d263c22bee67fb535a4c0cd1 GIT binary patch literal 12288 zcmeI2PjAyO6u`ZmH$dGjK&5K|H5nhcSsW>{hp`^_e(BS-=NZMY&*Bh%LK+1Lee9@ zN#=|5<|ZKl72JmZHbSOi$^|P&G~qI0WvRmRt~s$AdRqA&PpH;Ru_$7tF!7X>#$(3! zSV_m+j6B2QB%+3CZzN-O8XocpLV83MOq1kc=;aY+3>V=nW;g7?TB+VDbGYA9r5Z)& z9S37*;DQ-gB+Iv!Dz@kwh3n3>tDOs0KbDII&;S}h184vZpaC?11}?S%lgyFFpkO}N z;NS4Vd9etGhyVYbyoR5b z3Hbqh20j8$fhWKLFa}0I52ykq;Oiwqz5pM9XTSuw4{QJ~um~&w-{C%=fcL;V;4Sb5 zcn!P)UIO+k&jB2001co4G=K)s02)98XaEhMf&baSF(Jifr|qnrINIwAudm=ETp^^^ z+$3bL)^0a;>U++b(}z*yNxyIVp!O&o9~Ma+ch zQpM>2`l|224?5VY>KlH*P1+Cv_oAvTbI`JIqX^df0;YaF_$gFZdCo>P}HJUolh2 zuFSLS5d@7HWECgiAYe%(IkQz|XAB0q>zRWQ*xJUtEy_&p`uO#+f+y+6jHIelH=sG#tNwko7m-atKQ1)zHi-b zNHOFgh|V5yd2MyI0FSi*Pd84Tyh6w>+S5#3Ti$OG?y+-p