From 17c79f21d5168219846b973973d423911c91eca6 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 16 Mar 2012 18:09:46 +0100 Subject: [PATCH] Initial commit --- createlinks | 11 + ipasserelle-gp.spec | 59 + .../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/shares/wpkg/files/config.xml/10debug | 9 + .../files/shares/wpkg/files/config.xml/120dry | 9 + .../files/shares/wpkg/files/config.xml/30lang | 12 + .../shares/wpkg/files/config.xml/template-begin | 17 + .../shares/wpkg/files/config.xml/template-end | 1 + .../wpkg/files/settings/wpkg-gp/Wpkg-GP.ini/10All | 32 + .../files/shares/tools/files/scripts/bootstrap.bat | 6 + .../home/e-smith/files/shares/wpkg/files/hosts.xml | 17 + .../e-smith/files/shares/wpkg/files/packages.xml | 5 + .../e-smith/files/shares/wpkg/files/profiles.xml | 54 + .../wpkg/files/settings/tightvnc/tightvnc_x64.reg | Bin 0 -> 2470 bytes .../wpkg/files/settings/tightvnc/tightvnc_x86.reg | Bin 0 -> 2446 bytes root/home/e-smith/files/shares/wpkg/files/wpkg.js | 10676 +++++++++++++++++++ 20 files changed, 11054 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/config.xml/10debug create mode 100644 root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/120dry create mode 100644 root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/30lang create mode 100644 root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/template-begin create mode 100644 root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/template-end 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 create mode 100644 root/home/e-smith/files/shares/wpkg/files/hosts.xml create mode 100644 root/home/e-smith/files/shares/wpkg/files/packages.xml create mode 100644 root/home/e-smith/files/shares/wpkg/files/profiles.xml create mode 100755 root/home/e-smith/files/shares/wpkg/files/settings/tightvnc/tightvnc_x64.reg create mode 100755 root/home/e-smith/files/shares/wpkg/files/settings/tightvnc/tightvnc_x86.reg create mode 100644 root/home/e-smith/files/shares/wpkg/files/wpkg.js diff --git a/createlinks b/createlinks new file mode 100644 index 0000000..3ad24a0 --- /dev/null +++ b/createlinks @@ -0,0 +1,11 @@ +#!/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)); +templates2events("/home/e-smith/files/shares/wpkg/files/config.xml", qw(wpkg-update bootstrap-console-save)); diff --git a/ipasserelle-gp.spec b/ipasserelle-gp.spec new file mode 100644 index 0000000..c62d374 --- /dev/null +++ b/ipasserelle-gp.spec @@ -0,0 +1,59 @@ +%define version 0.0.1 +%define release 1.beta4 +%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 +Ce paquet permet de gérer un parc de machines sous MS Windows +Basé sur WPKG et d'autres outils + +%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/ +%{__mkdir_p} root/home/e-smith/files/shares/wpkg/files/{packages,softwares} + +%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 \ + --file /home/e-smith/files/shares/wpkg/files/profiles.xml 'attr(0770,root,admin) %config(noreplace)' \ + --file /home/e-smith/files/shares/wpkg/files/hosts.xml 'attr(0770,root,admin) %config(noreplace)' \ + --file /home/e-smith/files/shares/wpkg/files/packages.xml 'attr(0770,root,admin) %config(noreplace)' \ + --file /home/e-smith/files/shares/wpkg/files/settings/tightvnc/tightvnc_x86.reg 'attr(0660,root,admin) %config(noreplace)' \ + --file /home/e-smith/files/shares/wpkg/files/settings/tightvnc/tightvnc_x64.reg 'attr(0660,root,admin) %config(noreplace)' \ + > %{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/config.xml/10debug b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/10debug new file mode 100644 index 0000000..b6906ab --- /dev/null +++ b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/10debug @@ -0,0 +1,9 @@ +{ +my $debug = $wpkg{'Debug'} || 'disabled'; +if ($dry eq 'enabled'){ + $OUT .= "\t\n"; +} +else{ + $OUT .= "\t\n"; +} +} diff --git a/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/120dry b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/120dry new file mode 100644 index 0000000..ad3869e --- /dev/null +++ b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/120dry @@ -0,0 +1,9 @@ +{ +my $dry = $wpkg{'DryRun'} || 'disabled'; +if ($dry eq 'enabled'){ + $OUT .= "\t\n"; +} +else{ + $OUT .= "\t\n"; +} +} diff --git a/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/30lang b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/30lang new file mode 100644 index 0000000..04e9218 --- /dev/null +++ b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/30lang @@ -0,0 +1,12 @@ + + + + Déploiement de mises à jour en cours, veuillez sauvegarder tous vos documents ouverts, car un redémarrage peut être nécessaire. + + Le déploiement des mises à jour est terminé. + + Le déploiement des mises à jour a échoué. + + Un rédémarrage est nécessaire pour compléter l'installation ou la mise à jour. + + diff --git a/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/template-begin b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/template-begin new file mode 100644 index 0000000..3f2b05f --- /dev/null +++ b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/template-begin @@ -0,0 +1,17 @@ + + + + diff --git a/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/template-end b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/template-end new file mode 100644 index 0000000..35f30ec --- /dev/null +++ b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/config.xml/template-end @@ -0,0 +1 @@ + diff --git a/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/settings/wpkg-gp/Wpkg-GP.ini/10All b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/settings/wpkg-gp/Wpkg-GP.ini/10All new file mode 100644 index 0000000..72b3d7c --- /dev/null +++ b/root/etc/e-smith/templates/home/e-smith/files/shares/wpkg/files/settings/wpkg-gp/Wpkg-GP.ini/10All @@ -0,0 +1,32 @@ +{ + +my $ip = $InternalInterface{'IPAddress'}; +my $wg = $smb{'Workgroup'}; +my $secret = $wpkg{'UserPassword'} || 'secret'; + +$OUT .=<<"EOF"; + +[WpkgConfig] +EnableViaLGP = 1 +IgnoreGroupPolicy = 0 +DisableAtBootUp = 0 +WpkgCommand = \\\\$ip\\wpkg\\wpkg.js /synchronize /debug /nonotify +WpkgVerbosity = 1 +WpkgNetworkUsername = $wg\\deploiement +WpkgNetworkPassword = "clear:$secret" +WpkgMaxReboots = 10 +WpkgRebootPolicy = force +WpkgExecuteByNonAdmins = 0 +WpkgExecuteByLocalUsers = 1 +WpkgActivityIndicator = 1 + +[EnvironmentVariables] +SOFTWARE = \\\\$ip\\wpkg\\softwares +SETTINGS = \\\\$ip\\wpkg\\settings + +EOF + +$OUT =~ s/\n/\r\n/g; + +} + diff --git a/root/home/e-smith/files/shares/tools/files/scripts/bootstrap.bat b/root/home/e-smith/files/shares/tools/files/scripts/bootstrap.bat new file mode 100644 index 0000000..9f0e1f4 --- /dev/null +++ b/root/home/e-smith/files/shares/tools/files/scripts/bootstrap.bat @@ -0,0 +1,6 @@ +:: Script d'initialisation d'une station de travail + +cd "%~dp0" +call conf.bat +cscript "\\%IPASSERELLE_IP%\wpkg\wpkg.js" /debug /install:wpkg-gp + diff --git a/root/home/e-smith/files/shares/wpkg/files/hosts.xml b/root/home/e-smith/files/shares/wpkg/files/hosts.xml new file mode 100644 index 0000000..217ae25 --- /dev/null +++ b/root/home/e-smith/files/shares/wpkg/files/hosts.xml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/root/home/e-smith/files/shares/wpkg/files/packages.xml b/root/home/e-smith/files/shares/wpkg/files/packages.xml new file mode 100644 index 0000000..92235d5 --- /dev/null +++ b/root/home/e-smith/files/shares/wpkg/files/packages.xml @@ -0,0 +1,5 @@ + + + diff --git a/root/home/e-smith/files/shares/wpkg/files/profiles.xml b/root/home/e-smith/files/shares/wpkg/files/profiles.xml new file mode 100644 index 0000000..b0d0c7b --- /dev/null +++ b/root/home/e-smith/files/shares/wpkg/files/profiles.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/root/home/e-smith/files/shares/wpkg/files/settings/tightvnc/tightvnc_x64.reg b/root/home/e-smith/files/shares/wpkg/files/settings/tightvnc/tightvnc_x64.reg new file mode 100755 index 0000000000000000000000000000000000000000..22c9acda36ad026d916737e317387d8801a69dea GIT binary patch literal 2470 zcmb`JZEq4m6ov0+6aPcQ=f;S&FPiuPv9*obR-h20rUAO8q_Eq-R?44OpEI-Lf?;t{ zv)NsCX6~7D&wUwweDB!MV!N`$W;V4gYgl9h#-^6q#O90~GCSle;d{&4%ukpd@*VTN zYftPc*JFF+?$35?@38q~m-gPytZp^lm-c~oow*Y`W%i3TnLDzUbr^5Bk&ffAXU}cN zp0O%n--wkh_8Qm?4BCv=ovk>0b4+COD+7w~tF}*U`E%LF;_>>Iv z9df-#L1opM>~86ZeJ~=fve~0vt;$p;+HN&^9V*WS_UjHFAK3@3l2p%vd)Evk8*;MD(on zY(jKSS?kY+&23jzbsaWCFjYt86;W@JUCh~~uBq;+GfPn__G5=tp~FZ8_28L1Ef#C0 z*nY8A+U%|qG;tkVooWCNoh`nrlxNi=*8{7!E;o7$`L2vpeB|TuzlrrcLk2dnSG?32 z2H+<2E_v>|nf_}izf$sGJzj`^gU%QKc1q;FUW296dp%a*mTRai@L3*ZS&*MP%RTb{ IR)Z?yCyVxh9RL6T literal 0 HcmV?d00001 diff --git a/root/home/e-smith/files/shares/wpkg/files/settings/tightvnc/tightvnc_x86.reg b/root/home/e-smith/files/shares/wpkg/files/settings/tightvnc/tightvnc_x86.reg new file mode 100755 index 0000000000000000000000000000000000000000..4e266ee133867af3ab671dcc40364b10697b8eab GIT binary patch literal 2446 zcmb`JTW`}q5QXO%iT_aLxk5x$FCg&{LQ5;4ElHXP0jhFw)2N9ZC8lluJn)@eFHTS# z96*-scz5UQnVB=Q`SHDDBa3Zdi9OidcC2BM4H=tTYBO6fa?I?AuY~U%YcoG%cEoqg z_r5)|=Uh+iiMv1BslCJIlU>_;yRf>|cwgHG-gV~A?3~#z)@1I)TGnB_;YM0u4(*nm z+N`O&HQMXm?fBK9S6KPzn04*aF-qZ5u~*!cY{f_W<}4PVk8Hy4gpt&(8sMe;7}!h4 zTFiA-StSoDmRr}X&lTAe+Y5Xxj~3!l!Se)+u8r|K21z_F*5fFk^= z9g^FA7PC{ZQuYYCDYiNwV@H|Q8?rP9LtJ7a(+5K=QK2fw5x&)s_$5Pday zB^T$cnsK^560M?5L>-l=&{TA90mGLxY?r+W!0JN?&y4d zFe0w9>QPTtWvUZ)KpAsQc~AMC{UM@Z|7BmUuo_bbUFXXLU&{F)3sq+5p|Xs!4K}VSgx63`{i0`v-<$N#C33W zsv$gdw)n16o>dR62Uc&LHhN2Xm*SKk`MCP8VKdL5z$W&}mpa1`+=SjG&wV%3e+ua< uMF*SlLjD_czWBFOBKP$MES=t)u>!X|hEjo7d6cOjKXq1n + * Copyright 2005 Aleksander Wysocki
+ * Copyright 2005-2006 Tomasz Chmielewski
+ * Copyright 2007-2011 Rainer Meier
+ * + * Please report your issues to the list on http://wpkg.org/ + */ + +/** + * Displays command usage. + */ +function showUsage() { +var message = "" + +"If you cannot read this since it is displayed within a dialog-window please \n" + +"execute 'cscript wpkg.js /help' on the command line. This will print all \n" + +"messages to the console. \n\n" + +"Command Line Switches \n" + +"===================== \n" + +"Note: These command line switches overwrite parameters within config.xml. For \n" + +"example the /quiet flag overwrites an eventually present quiet parameter within \n" + +"config.xml. \n" + +"Usually you should specify as few parameters as possible since changing \n" + +"config.xml on the server might be much easier than changing all client-side \n" + +"stored parameters. Typically you would use the following command-line in \n" + +"production: \n" + +" wpkg.js /synchronize \n" + +"\n" + +"Frequently used parameters (package operations, you need to choose one): \n" + +"======================================================================== \n" + +"\n" + +"/install:[,package2[,package3,[...]]] \n" + +" Install the specified package(s) on the system. \n" + +"\n" + +"/query: