commit
e77fa51fba
10 changed files with 192 additions and 0 deletions
@ -0,0 +1,13 @@ |
||||
#!/usr/bin/perl -w |
||||
|
||||
use esmith::Build::CreateLinks qw(:all); |
||||
|
||||
foreach my $event (qw/bootstrap-console-save webapps-update ipasserelle-update/){ |
||||
templates2events("/etc/phpMyAdmin/config.inc.php", $event); |
||||
event_link("ipasserelle-pma-init-domain", "$event", "25"); |
||||
} |
||||
|
||||
# PHP header and footer |
||||
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/phpMyAdmin/config.inc.php/template-begin"); |
||||
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/etc/phpMyAdmin/config.inc.php/template-end"); |
||||
|
@ -0,0 +1,57 @@ |
||||
%define version 0.1.0 |
||||
%define release 1 |
||||
%define name ipasserelle-phpmyadmin |
||||
|
||||
Name: %{name} |
||||
Version: %{version} |
||||
Release: %{release}%{?dist} |
||||
Summary: phpMyAdmin for iPasserelle |
||||
Group: System Environment/Applications |
||||
License: GPLv3+ |
||||
URL: http://www.ipasserelle.com |
||||
Source0: %{name}-%{version}.tar.gz |
||||
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
||||
BuildArch: noarch |
||||
|
||||
BuildRequires: e-smith-devtools |
||||
|
||||
Requires: ipasserelle-base |
||||
Requires: smeserver-webapps-common >= 0.2.7 |
||||
Requires: smeserver-lemonldap-ng >= 0.2.3 |
||||
Requires: phpMyAdmin3 |
||||
|
||||
Obsoletes: phpmyadmin |
||||
Obsoletes: smeserver-phpmyadmin |
||||
|
||||
%description |
||||
phpMyAdmin integration for iPasserelle |
||||
|
||||
%changelog |
||||
* Tue Oct 9 2012 Daniel Berteaud <daniel@firewall-services.com> - 0.1.0-1.sme |
||||
- Initial release |
||||
|
||||
%prep |
||||
%setup -q |
||||
|
||||
%build |
||||
perl ./createlinks |
||||
|
||||
%install |
||||
rm -rf $RPM_BUILD_ROOT |
||||
rm -f %{name}-%{version}-filelist |
||||
(cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) |
||||
/sbin/e-smith/genfilelist \ |
||||
$RPM_BUILD_ROOT > %{name}-%{version}-%{release}-filelist |
||||
echo "%doc CHANGELOG.git" >> %{name}-%{version}-%{release}-filelist |
||||
|
||||
%files -f %{name}-%{version}-%{release}-filelist |
||||
|
||||
%clean |
||||
rm -rf $RPM_BUILD_ROOT |
||||
|
||||
%post |
||||
|
||||
%postun |
||||
|
||||
|
@ -0,0 +1 @@ |
||||
private |
@ -0,0 +1 @@ |
||||
enabled |
@ -0,0 +1 @@ |
||||
webapp |
@ -0,0 +1,29 @@ |
||||
#!/usr/bin/perl -w |
||||
|
||||
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 = $d->get("sql.$domain"); |
||||
|
||||
exit(0) if ($vhost); |
||||
|
||||
|
||||
$d->new_record("sql.$domain",{ |
||||
type => 'domain', |
||||
Description => 'phpMyAdmin', |
||||
Content => 'Primary', |
||||
TemplatePath => 'WebAppVirtualHost', |
||||
DocumentRoot => '/usr/share/phpMyAdmin', |
||||
Authentication => 'LemonLDAP', |
||||
RequireSSL => 'yes' |
||||
}); |
||||
|
||||
die "Failed to create domain sql.$domain\n" |
||||
unless ( system("/sbin/e-smith/signal-event", "domain-create" , "sql.$domain") == 0 ); |
@ -0,0 +1,3 @@ |
||||
UID="root" |
||||
GID="www" |
||||
PERMS=0640 |
@ -0,0 +1,28 @@ |
||||
{ |
||||
|
||||
my $status = $phpmyadmin{'status'} || 'disabled'; |
||||
|
||||
if ($status eq 'enabled'){ |
||||
|
||||
my $access = (($phpmyadmin{'access'} || 'private') eq 'public') ? 'all':"$localAccess $externalSSLAccess"; |
||||
|
||||
$OUT .=<<"END"; |
||||
|
||||
<Directory /usr/share/phpMyAdmin> |
||||
SSLRequireSSL |
||||
Options -Indexes |
||||
AllowOverride None |
||||
order deny,allow |
||||
deny from all |
||||
allow from $access |
||||
AddType application/x-httpd-php .php .php3 |
||||
php_admin_value openbase_dir /usr/share/phpMyAdmin:/etc/phpMyAdmin:/var/lib/phpMyAdmin |
||||
</Directory> |
||||
|
||||
END |
||||
} |
||||
else { |
||||
$OUT .= "# phpmyadmin is disabled"; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,31 @@ |
||||
{ |
||||
use esmith::util; |
||||
|
||||
# MySQL uses the same password as LDAP |
||||
our $pw = esmith::util::LdapPassword(); |
||||
|
||||
$OUT .= ''; |
||||
|
||||
} |
||||
|
||||
/* Servers configuration */ |
||||
$i = 0; |
||||
|
||||
/* Server: iPasserelle [1] */ |
||||
$i++; |
||||
$cfg['Servers'][$i]['verbose'] = 'iPasserelle'; |
||||
$cfg['Servers'][$i]['host'] = 'localhost'; |
||||
$cfg['Servers'][$i]['port'] = ''; |
||||
$cfg['Servers'][$i]['socket'] = '/var/lib/mysql/mysql.sock'; |
||||
$cfg['Servers'][$i]['connect_type'] = 'socket'; |
||||
$cfg['Servers'][$i]['extension'] = 'mysqli'; |
||||
$cfg['Servers'][$i]['auth_type'] = 'config'; |
||||
$cfg['Servers'][$i]['user'] = 'root'; |
||||
$cfg['Servers'][$i]['password'] = '{$pw}'; |
||||
|
||||
/* End of servers configuration */ |
||||
|
||||
$cfg['DefaultLang'] = 'fr'; |
||||
$cfg['ServerDefault'] = 1; |
||||
$cfg['UploadDir'] = '/var/lib/phpMyAdmin/upload'; |
||||
$cfg['SaveDir'] = '/var/lib/phpMyAdmin/save'; |
@ -0,0 +1,28 @@ |
||||
{ |
||||
|
||||
$conf->{'exportedHeaders'}->{"sql.$domain"} = { |
||||
'Auth-User' => '$uid', |
||||
} unless ($conf->{'exportedHeaders'}->{"sql.$domain"}); |
||||
|
||||
|
||||
$conf->{'locationRules'}->{"sql.$domain"} = { |
||||
'default' => '$groups =~ /\\badmins\\b/', |
||||
} unless ($conf->{'locationRules'}->{"sql.$domain"}); |
||||
|
||||
|
||||
$conf->{'applicationList'}->{'030admin'}->{'phpmyadmin'} = { |
||||
'options' => { |
||||
'logo' => 'database.png', |
||||
'name' => 'Gestionnaire de base de donnée', |
||||
'description' => 'phpMyAdmin', |
||||
'uri' => "https://sql.$domain", |
||||
'display' => 'auto' |
||||
}, |
||||
'type' => 'application' |
||||
} unless ($conf->{'applicationList'}->{'030admin'}->{'phpmyadmin'}); |
||||
|
||||
|
||||
$OUT = ''; |
||||
|
||||
} |
||||
|
Loading…
Reference in new issue