From 53b0e0e7d915ac1201bba327636d863d0b9d10fb Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 18 Oct 2012 09:40:12 +0200 Subject: [PATCH] Initial commit --- createlinks | 8 ++ ipasserelle-webapps.spec | 69 +++++++++++ .../defaults/ajaxplorer/AliasOnPrimary | 1 + .../defaults/ajaxplorer/Authentication | 1 + .../defaults/ajaxplorer/DefaultLanguage | 1 + .../configuration/defaults/ajaxplorer/Title | 1 + .../defaults/ajaxplorer/WelcomMessage | 1 + .../defaults/dokuwiki/AliasOnPrimary | 1 + .../defaults/dokuwiki/Authentication | 1 + .../defaults/openupload/AliasOnPrimary | 1 + .../defaults/openupload/Authentication | 1 + .../defaults/tt-rss/AliasOnPrimary | 1 + .../db/configuration/migrate/90Ajaxplorer | 11 ++ .../actions/ipasserelle-webapps-init-domains | 110 ++++++++++++++++++ .../www/config.inc.php/99iPasserelle | 11 ++ .../lemonldap-ng/conf/lmConf/035openupload | 32 +++++ .../lemonldap-ng/conf/lmConf/040ajaxplorer | 27 +++++ .../var/lib/lemonldap-ng/conf/lmConf/045ttrss | 30 +++++ .../lib/lemonldap-ng/conf/lmConf/050dokuwiki | 33 ++++++ 19 files changed, 341 insertions(+) create mode 100644 createlinks create mode 100644 ipasserelle-webapps.spec create mode 100644 root/etc/e-smith/db/configuration/defaults/ajaxplorer/AliasOnPrimary create mode 100644 root/etc/e-smith/db/configuration/defaults/ajaxplorer/Authentication create mode 100644 root/etc/e-smith/db/configuration/defaults/ajaxplorer/DefaultLanguage create mode 100644 root/etc/e-smith/db/configuration/defaults/ajaxplorer/Title create mode 100644 root/etc/e-smith/db/configuration/defaults/ajaxplorer/WelcomMessage create mode 100644 root/etc/e-smith/db/configuration/defaults/dokuwiki/AliasOnPrimary create mode 100644 root/etc/e-smith/db/configuration/defaults/dokuwiki/Authentication create mode 100644 root/etc/e-smith/db/configuration/defaults/openupload/AliasOnPrimary create mode 100644 root/etc/e-smith/db/configuration/defaults/openupload/Authentication create mode 100644 root/etc/e-smith/db/configuration/defaults/tt-rss/AliasOnPrimary create mode 100644 root/etc/e-smith/db/configuration/migrate/90Ajaxplorer create mode 100644 root/etc/e-smith/events/actions/ipasserelle-webapps-init-domains create mode 100644 root/etc/e-smith/templates/usr/share/openupload/www/config.inc.php/99iPasserelle create mode 100644 root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/035openupload create mode 100644 root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/040ajaxplorer create mode 100644 root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/045ttrss create mode 100644 root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/050dokuwiki diff --git a/createlinks b/createlinks new file mode 100644 index 0000000..a9c26ee --- /dev/null +++ b/createlinks @@ -0,0 +1,8 @@ +#!/usr/bin/perl -w + +use esmith::Build::CreateLinks qw(:all); + +foreach my $event (qw/webapps-update ipasserelle-update bootstrap-ldap-save/){ + event_link("ipasserelle-webapps-init-domains", "$event", "55"); +} + diff --git a/ipasserelle-webapps.spec b/ipasserelle-webapps.spec new file mode 100644 index 0000000..3cbc55b --- /dev/null +++ b/ipasserelle-webapps.spec @@ -0,0 +1,69 @@ +Summary: iPasserelle web applications +%define name ipasserelle-webapps +Name: %{name} +%define version 0.2.0 +%define release 1 +Version: %{version} +Release: %{release}%{?dist} +License: GPL +URL: http://www.ipasserelle.com/ +Group: SMEserver/addon +Source: %{name}-%{version}.tar.gz + +BuildArch: noarch +BuildRoot: /var/tmp/%{name}-%{version} + +Requires: ipasserelle-base >= 0.1-14 +Requires: smeserver-openupload +Requires: smeserver-tt-rss +Requires: smeserver-ajaxplorer +Requires: smeserver-dokuwiki +Requires: dokuwiki-plugins + +BuildRequires: e-smith-devtools + +%description +Integrate commonly used web applications + +%changelog +* Thu Oct 17 2012 Daniel Berteaud 0.2.0-1 +- Import in GIT + +* Wed Nov 24 2011 Daniel Berteaud 0.1-3 +- Set ajaxplorer LogoutUrl to LL::NG portal address +- Use more friendly names in LL::NG portal + +* Tue Oct 11 2011 Daniel Berteaud 0.1-2 +- Fix dokuwiki domain in LL::NG menu + +* Wed Jun 28 2011 Daniel Berteaud 0.1-1 +- initial release + + +%prep +%setup + +%build +perl createlinks + +%install +rm -rf $RPM_BUILD_ROOT +(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) +rm -f %{name}-%{version}-filelist +/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist + +%clean +cd .. +rm -rf %{name}-%{version} + +%pre + +%preun + +%post + +%postun + +%files -f %{name}-%{version}-filelist +%defattr(-,root,root) + diff --git a/root/etc/e-smith/db/configuration/defaults/ajaxplorer/AliasOnPrimary b/root/etc/e-smith/db/configuration/defaults/ajaxplorer/AliasOnPrimary new file mode 100644 index 0000000..7a68b11 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/ajaxplorer/AliasOnPrimary @@ -0,0 +1 @@ +disabled diff --git a/root/etc/e-smith/db/configuration/defaults/ajaxplorer/Authentication b/root/etc/e-smith/db/configuration/defaults/ajaxplorer/Authentication new file mode 100644 index 0000000..dda507f --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/ajaxplorer/Authentication @@ -0,0 +1 @@ +LemonLDAP diff --git a/root/etc/e-smith/db/configuration/defaults/ajaxplorer/DefaultLanguage b/root/etc/e-smith/db/configuration/defaults/ajaxplorer/DefaultLanguage new file mode 100644 index 0000000..527e861 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/ajaxplorer/DefaultLanguage @@ -0,0 +1 @@ +fr diff --git a/root/etc/e-smith/db/configuration/defaults/ajaxplorer/Title b/root/etc/e-smith/db/configuration/defaults/ajaxplorer/Title new file mode 100644 index 0000000..e2db8f6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/ajaxplorer/Title @@ -0,0 +1 @@ +iPasserelle diff --git a/root/etc/e-smith/db/configuration/defaults/ajaxplorer/WelcomMessage b/root/etc/e-smith/db/configuration/defaults/ajaxplorer/WelcomMessage new file mode 100644 index 0000000..88b0faa --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/ajaxplorer/WelcomMessage @@ -0,0 +1 @@ +Firewall-Services: la sécurité des réseaux diff --git a/root/etc/e-smith/db/configuration/defaults/dokuwiki/AliasOnPrimary b/root/etc/e-smith/db/configuration/defaults/dokuwiki/AliasOnPrimary new file mode 100644 index 0000000..7a68b11 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/dokuwiki/AliasOnPrimary @@ -0,0 +1 @@ +disabled diff --git a/root/etc/e-smith/db/configuration/defaults/dokuwiki/Authentication b/root/etc/e-smith/db/configuration/defaults/dokuwiki/Authentication new file mode 100644 index 0000000..dda507f --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/dokuwiki/Authentication @@ -0,0 +1 @@ +LemonLDAP diff --git a/root/etc/e-smith/db/configuration/defaults/openupload/AliasOnPrimary b/root/etc/e-smith/db/configuration/defaults/openupload/AliasOnPrimary new file mode 100644 index 0000000..7a68b11 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/openupload/AliasOnPrimary @@ -0,0 +1 @@ +disabled diff --git a/root/etc/e-smith/db/configuration/defaults/openupload/Authentication b/root/etc/e-smith/db/configuration/defaults/openupload/Authentication new file mode 100644 index 0000000..dda507f --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/openupload/Authentication @@ -0,0 +1 @@ +LemonLDAP diff --git a/root/etc/e-smith/db/configuration/defaults/tt-rss/AliasOnPrimary b/root/etc/e-smith/db/configuration/defaults/tt-rss/AliasOnPrimary new file mode 100644 index 0000000..7a68b11 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/tt-rss/AliasOnPrimary @@ -0,0 +1 @@ +disabled diff --git a/root/etc/e-smith/db/configuration/migrate/90Ajaxplorer b/root/etc/e-smith/db/configuration/migrate/90Ajaxplorer new file mode 100644 index 0000000..46a1644 --- /dev/null +++ b/root/etc/e-smith/db/configuration/migrate/90Ajaxplorer @@ -0,0 +1,11 @@ +{ + my $rec = $DB->get('ajaxplorer') + || $DB->new_record('ajaxplorer', {type => 'webapp'}); + + my $url = $rec->prop('LogoutUrl'); + + if (not $url){ + $url = 'https://auth.' . $DomainName; + $rec->set_prop('LogoutUrl', $url); + } +} diff --git a/root/etc/e-smith/events/actions/ipasserelle-webapps-init-domains b/root/etc/e-smith/events/actions/ipasserelle-webapps-init-domains new file mode 100644 index 0000000..f2fec0b --- /dev/null +++ b/root/etc/e-smith/events/actions/ipasserelle-webapps-init-domains @@ -0,0 +1,110 @@ +#!/usr/bin/perl -w +#---------------------------------------------------------------------- +# copyright (C) 2010-2011 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 +# +#---------------------------------------------------------------------- + +use strict; +use warnings; +use esmith::DomainsDB; +use esmith::ConfigDB; + +my $d = esmith::DomainsDB->open or die "Couldn't open DomainsDB\n"; +my $c = esmith::ConfigDB->open_ro() or die "Couldn't open ConfigDB\n"; + +my $domain = $c->get('DomainName')->value; +my $vhost; + +$vhost = $d->get("upload.$domain"); + +if (!$vhost){ + $d->new_record("upload.$domain",{ + type => 'domain', + Content => 'Primary', + Description => "OpenUpload", + Nameservers => 'internet', + TemplatePath => 'WebAppVirtualHost', + DocumentRoot => '/usr/share/openupload/www', + Removable => 'yes', + LemonLDAP => 'enabled' + }); + + unless ( system("/sbin/e-smith/signal-event", "domain-create", "upload.$domain") == 0 ){ + die "Failed to create domain upload.$domain\n"; + } +} + +$vhost = $d->get("rss.$domain"); + +if (!$vhost){ + $d->new_record("rss.$domain",{ + type => 'domain', + Content => 'Primary', + Description => "Tiny Tiny RSS", + Nameservers => 'internet', + TemplatePath => 'WebAppVirtualHost', + DocumentRoot => '/usr/share/tt-rss', + Removable => 'yes', + LemonLDAP => 'enabled' + }); + + unless ( system("/sbin/e-smith/signal-event", "domain-create", "rss.$domain") == 0 ){ + die "Failed to create domain rss.$domain\n"; + } +} + +$vhost = $d->get("echange.$domain"); + +if (!$vhost){ + $d->new_record("echange.$domain",{ + type => 'domain', + Content => 'Primary', + Description => "Ajaxplorer", + Nameservers => 'internet', + TemplatePath => 'WebAppVirtualHost', + DocumentRoot => '/usr/share/ajaxplorer', + Removable => 'yes', + LemonLDAP => 'enabled' + }); + + unless ( system("/sbin/e-smith/signal-event", "domain-create", "echange.$domain") == 0 ){ + die "Failed to create domain echange.$domain\n"; + } +} + + +$vhost = $d->get("wiki.$domain"); + +if (!$vhost){ + $d->new_record("wiki.$domain",{ + type => 'domain', + Content => 'Primary', + Description => "Dokuwiki", + Nameservers => 'internet', + TemplatePath => 'WebAppVirtualHost', + DocumentRoot => '/usr/share/dokuwiki', + Removable => 'yes', + LemonLDAP => 'enabled' + }); + + unless ( system("/sbin/e-smith/signal-event", "domain-create", "wiki.$domain") == 0 ){ + die "Failed to create domain wiki.$domain\n"; + } +} + + diff --git a/root/etc/e-smith/templates/usr/share/openupload/www/config.inc.php/99iPasserelle b/root/etc/e-smith/templates/usr/share/openupload/www/config.inc.php/99iPasserelle new file mode 100644 index 0000000..c6f1c78 --- /dev/null +++ b/root/etc/e-smith/templates/usr/share/openupload/www/config.inc.php/99iPasserelle @@ -0,0 +1,11 @@ + +# iPasserelle overrides + +$CONFIG['WWW_SERVER'] = 'http://upload.{"$DomainName";}'; +$CONFIG['WWW_ROOT'] = '/'; + +$CONFIG['site']['title'] = 'Hébergement de fichiers'; +$CONFIG['site']['footer'] = 'iPasserelle © une solution Firewall-Services'; + +$CONFIG['defaultlang'] = 'fr'; + diff --git a/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/035openupload b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/035openupload new file mode 100644 index 0000000..c44b53f --- /dev/null +++ b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/035openupload @@ -0,0 +1,32 @@ +{ + +$conf->{'exportedHeaders'}->{"upload.$domain"} = { + 'Auth-User' => '$uid', +} unless ($conf->{'exportedHeaders'}->{"upload.$domain"}); + +$conf->{'locationRules'}->{"upload.$domain"} = { + '(?#21login)(a|action)=login' => "logout_app https://upload.$domain/", + '(?#13unprotect_captcha)^/plugins/captcha\\.php' => 'unprotect', + '(?#14unprotect_index)^/index\\.php$' => 'unprotect', + '(?#12unprotect_templates)^/templates/' => 'unprotect', + '(?#20logout)(a|action)=logout' => "logout_app https://auth.$domain", + '(?#10unprotect_dl)(a|action)=[dgr]' => 'unprotect', + '(?#01deny_double_action)(a|action)=.*(a|action)=.*' => 'deny', + 'default' => '$groups =~ /\\b(equipe|admins)\\b/' +} unless ($conf->{'locationRules'}->{"upload.$domain"}); + +$conf->{'applicationList'}->{'010apps'}->{'openupload'} = { + 'options' => { + 'logo' => 'folder.png', + 'name' => 'Fichiers temporaires', + 'description' => 'Service d\'hébergement de fichiers temporaires', + 'uri' => "https://upload.$domain", + 'display' => 'auto' + }, + 'type' => 'application' +} unless ($conf->{'applicationList'}->{'010apps'}->{'openupload'}); + + +$OUT = ''; + +} diff --git a/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/040ajaxplorer b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/040ajaxplorer new file mode 100644 index 0000000..952e109 --- /dev/null +++ b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/040ajaxplorer @@ -0,0 +1,27 @@ +{ + +$conf->{'exportedHeaders'}->{"echange.$domain"} = { + 'Auth-User' => '$uid' +} unless ($conf->{'exportedHeaders'}->{"echange.$domain"}); + + +# TODO: $localAcccess en fonction de access == (public|private) +$conf->{'locationRules'}->{"echange.$domain"} = { + 'default' => 'accept' +} unless ($conf->{'locationRules'}->{"echange.$domain"}); + + +$conf->{'applicationList'}->{'010apps'}->{'ajaxplorer'} = { + 'options' => { + 'logo' => 'folder.png', + 'name' => 'Gestion des fichiers', + 'description' => 'Gestionnaire de fichiers web Ajaxplorer', + 'uri' => "https://echange.$domain/", + 'display' => 'auto' + }, + 'type' => 'application' +} unless ($conf->{'applicationList'}->{'010apps'}->{'ajaxplorer'}); + +$OUT = ''; + +} diff --git a/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/045ttrss b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/045ttrss new file mode 100644 index 0000000..fa6c57a --- /dev/null +++ b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/045ttrss @@ -0,0 +1,30 @@ +{ + +$conf->{'exportedHeaders'}->{"rss.$domain"} = { + 'User-Name' => '$cn', + 'Auth-User' => '$uid', + 'User-Mail' => '$mail' +} unless ($conf->{'exportedHeaders'}->{"rss.$domain"}); + + +$conf->{'locationRules'}->{"rss.$domain"} = { + '(?#10logout)^/logout\\.php' => 'logout_app', + 'default' => '$groups =~ /\\b(equipe|admins)\\b/' +} unless ($conf->{'locationRules'}->{"rss.$domain"}); + + +$conf->{'applicationList'}->{'010apps'}->{'ttrss'} = { + 'options' => { + 'logo' => 'bookmark.png', + 'name' => 'Lecteur de flux RSS', + 'description' => 'Tiny Tiny RSS', + 'uri' => "https://rss.$domain", + 'display' => 'auto' + }, + 'type' => 'application' +} unless ($conf->{'applicationList'}->{'010apps'}->{'ttrss'}); + + +$OUT = ''; + +} diff --git a/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/050dokuwiki b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/050dokuwiki new file mode 100644 index 0000000..201961e --- /dev/null +++ b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/050dokuwiki @@ -0,0 +1,33 @@ +{ + +$conf->{'exportedHeaders'}->{"wiki.$domain"} = { + 'User-Name' => '$cn', + 'Auth-User' => '$uid', + 'User-Mail' => '$mail', + 'User-Groups' => '$groups', +} unless ($conf->{'exportedHeaders'}->{"wiki.$domain"}); + + +$conf->{'locationRules'}->{"wiki.$domain"} = { + '(?#02login)^/doku.php(/start)?\\?(.*)do=login' => '$groups =~ /\\b(equipe|admins)\\b/', + 'default' => 'unprotect', + '(?#01data)^/data(.*)' => 'deny', + '(?#10logout)^/doku.php(/start)?\\?(.*)do=logout' => 'logout_app' +} unless ($conf->{'locationRules'}->{"wiki.$domain"}); + + +$conf->{'applicationList'}->{'010apps'}->{'dokuwiki'} = { + 'options' => { + 'logo' => 'help.png', + 'name' => 'Wiki', + 'description' => 'Site collaboratif', + 'uri' => "https://wiki.$domain", + 'display' => 'auto' + }, + 'type' => 'application' +} unless ($conf->{'applicationList'}->{'010apps'}->{'dokuwiki'}); + + +$OUT = ''; + +}