From 4a60784199d326e59dc794ab8537022b74970e6e Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 10 Oct 2012 16:14:54 +0200 Subject: [PATCH] =?UTF-8?q?Acc=C3=A8s=20MySQL=20root=20pour=20les=20admins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- root/etc/e-smith/db/accounts/defaults/admin/SqlLogin | 1 - root/etc/e-smith/db/accounts/migrate/98AdminSqlPass | 12 ------------ .../templates/etc/phpMyAdmin/sso.inc.php/10All | 8 +++++++- .../var/lib/lemonldap-ng/conf/lmConf/075phpMyadmin | 2 +- 4 files changed, 8 insertions(+), 15 deletions(-) delete mode 100644 root/etc/e-smith/db/accounts/defaults/admin/SqlLogin delete mode 100644 root/etc/e-smith/db/accounts/migrate/98AdminSqlPass diff --git a/root/etc/e-smith/db/accounts/defaults/admin/SqlLogin b/root/etc/e-smith/db/accounts/defaults/admin/SqlLogin deleted file mode 100644 index d8649da..0000000 --- a/root/etc/e-smith/db/accounts/defaults/admin/SqlLogin +++ /dev/null @@ -1 +0,0 @@ -root diff --git a/root/etc/e-smith/db/accounts/migrate/98AdminSqlPass b/root/etc/e-smith/db/accounts/migrate/98AdminSqlPass deleted file mode 100644 index 5f2f804..0000000 --- a/root/etc/e-smith/db/accounts/migrate/98AdminSqlPass +++ /dev/null @@ -1,12 +0,0 @@ -{ - -use esmith::util; - -my $admin = $DB->get('admin') || return; -my $pw = $admin->prop('SqlPassword'); - -unless ($pw){ - $admin->set_prop('SqlPassword', esmith::util::LdapPassword()); -} - -} diff --git a/root/etc/e-smith/templates/etc/phpMyAdmin/sso.inc.php/10All b/root/etc/e-smith/templates/etc/phpMyAdmin/sso.inc.php/10All index f510273..1a6c975 100644 --- a/root/etc/e-smith/templates/etc/phpMyAdmin/sso.inc.php/10All +++ b/root/etc/e-smith/templates/etc/phpMyAdmin/sso.inc.php/10All @@ -1,7 +1,7 @@ { -use Digest::SHA1 qw(sha1_hex); use esmith::AccountsDB; +use esmith::util; my $a = esmith::AccountsDB->open_ro or die "Couldn't open AccountsDB\n"; $OUT .= "// login and password for MySQL access\n"; @@ -10,6 +10,12 @@ foreach my $u ($a->users,$a->get('admin')){ my $user = $u->key; my $login = $u->prop('SqlLogin') || ''; my $pass = $u->prop('SqlPassword') || ''; + # Members of the admins group automatically have + # full privileges on MySQL + if (($a->is_user_in_group($user,'admins')) || ($a->is_user_in_group($user,'mysqladmins'))){ + $login = 'root'; + $pass = esmith::util::LdapPassword(); + } next unless (($login ne '') && ($pass ne '')); $OUT .= "// Credentials for $user\n"; $OUT .= '$login["'.$user.'"] = "'.$login."\";\n"; diff --git a/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/075phpMyadmin b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/075phpMyadmin index 04b2fce..f3b3136 100644 --- a/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/075phpMyadmin +++ b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/075phpMyadmin @@ -6,7 +6,7 @@ $conf->{'exportedHeaders'}->{"sql.$domain"} = { $conf->{'locationRules'}->{"sql.$domain"} = { - 'default' => '$groups =~ /\\badmins\\b/', + 'default' => '$groups =~ /\\badmins|mysqladmins\\b/', } unless ($conf->{'locationRules'}->{"sql.$domain"}); $conf->{'applicationList'}->{'030admin'}->{'phpmyadmin'} = {