Sponsor:

Server and Web Integrator
Link:
Kloxo-MR logo
6.5.0 or 7.0.0
Click for "How to install"
Donation/Sponsorship:
Kloxo-MR is open-source.
Donate and or Sponsorship always welcome.
Click to:
Click Here
Please login or register. 2024-04-29, 01:26:30

Author Topic: Removing user or database does not remove mysql.user !!!  (Read 7051 times)

0 Members and 1 Guest are viewing this topic.

Offline Spacedust

  • Super Grand Master
  • ****
  • Posts: 4,050
  • Karma: +1/-0
    • View Profile
We are now in process of converting all users to new 41-char passwords and guess what ?

There are still mysql.users from accounts removed few years ago ! This is just crazy :/

Offline insanity

  • Senior Member
  • *
  • Posts: 215
  • Karma: +0/-0
    • View Profile
Re: Removing user or database does not remove mysql.user !!!
« Reply #1 on: 2014-03-09, 18:20:29 »
@Spacedust,
I already wrote about this problem. When you remove some database, the user assigned to this db is not removed.
Here is the topic: http://forum.mratwork.com/kloxo-mr-development/mysql-db-remove

Offline Spacedust

  • Super Grand Master
  • ****
  • Posts: 4,050
  • Karma: +1/-0
    • View Profile
Re: Removing user or database does not remove mysql.user !!!
« Reply #2 on: 2014-03-09, 19:24:06 »
@Spacedust,
I already wrote about this problem. When you remove some database, the user assigned to this db is not removed.
Here is the topic: http://forum.mratwork.com/kloxo-mr-development/mysql-db-remove

Now we have hundreds of non-existing customer password that needs to be checked if they exist before converting to 41-chars :/ Same with PowerDNS entries !

Offline chrisf

  • Senior Master
  • **
  • Posts: 883
  • Karma: +11/-1
  • Gender: Male
  • Be the change that you wish to see in the world.
    • View Profile
    • Conviction's Hosting
Re: Removing user or database does not remove mysql.user !!!
« Reply #3 on: 2014-03-09, 19:55:16 »
+1.  @spacedust and @insanity.   The mysql users need to be removed, this is a very BIG problem as time goes on.
Christopher

Knowledge in: PHP, Perl, MySQL, Javascript, Actionscript, FLASH, HTML, CSS
Server Administrator / Developer: https://convictionshosting.com

Offline insanity

  • Senior Member
  • *
  • Posts: 215
  • Karma: +0/-0
    • View Profile
Re: Removing user or database does not remove mysql.user !!!
« Reply #4 on: 2014-03-09, 20:15:04 »
Yes it is same and with all folders. We have so much removed domains, but files and folders still exist :)

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: Removing user or database does not remove mysql.user !!!
« Reply #5 on: 2014-03-10, 03:47:01 »
It's not simple remove domain also remove document root of domain. The same issue with database.

The reason is it's possible document root not using by 1 domain (in case parking domain). The same issue with database where 1 username have privileges to more than 1 database.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: Removing user or database does not remove mysql.user !!!
« Reply #6 on: 2014-03-10, 04:34:02 »
For document will be implementing delete docroot if this docroot only use by 1 web.

This is the logic:
Code: [Select]
// MR -- also delete docroot if only refer to 1 web
$c = db_get_count("web", "customer_name = '{$this->customer_name}' AND docroot = '$this->docroot'");

if ((int)$c === 1) {
recursively_remove($this->getFullDocRoot());
}

Note:
- function db_get_count is a new function and only ready in Kloxo-MR 6.5.1 since alpha
- ready for next upload of 6.5.1.b
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline chrisf

  • Senior Master
  • **
  • Posts: 883
  • Karma: +11/-1
  • Gender: Male
  • Be the change that you wish to see in the world.
    • View Profile
    • Conviction's Hosting
Re: Removing user or database does not remove mysql.user !!!
« Reply #7 on: 2014-03-10, 10:39:54 »
In KloxoMR every database a new user is created, why not delete that user when the database is deleted?
Christopher

Knowledge in: PHP, Perl, MySQL, Javascript, Actionscript, FLASH, HTML, CSS
Server Administrator / Developer: https://convictionshosting.com

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: Removing user or database does not remove mysql.user !!!
« Reply #8 on: 2014-03-10, 10:44:04 »
Original code is not include delete username if database deleted.

Delete database also delete database username still dangerously. It's not easy to detect privileges.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: Removing user or database does not remove mysql.user !!!
« Reply #9 on: 2014-03-10, 14:00:44 »
Original code already have a code for delete user but wrong code:
Code: [Select]
function deleteDatabase()
{
$rdb = $this->lx_mysql_connect('localhost', $this->main->__var_dbadmin, $this->main->__var_dbpassword);

$rdb->query("drop database {$this->main->dbname};");

$this->log_error_messages(false);

$rdb->query("delete from mysql.user where user = '{$this->main->username}';");

$this->log_error_messages(false);

$rdb->query("flush privileges;");
}

Need modified to:
Code: [Select]
function deleteDatabase()
{
$rdb = $this->lx_mysql_connect('localhost', $this->main->__var_dbadmin, $this->main->__var_dbpassword);

$rdb->query("drop database {$this->main->dbname};");

$this->log_error_messages(false);

// MR -- fix delete database username
// $rdb->query("delete from mysql.user where user = '{$this->main->username}';");
$rdb->query("drop user '{$this->main->username}'@'%';");
$rdb->query("drop user '{$this->main->username}'@'localhost';");

$this->log_error_messages(false);

$rdb->query("flush privileges;");
}
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline chrisf

  • Senior Master
  • **
  • Posts: 883
  • Karma: +11/-1
  • Gender: Male
  • Be the change that you wish to see in the world.
    • View Profile
    • Conviction's Hosting
Re: Removing user or database does not remove mysql.user !!!
« Reply #10 on: 2014-03-10, 17:03:08 »
That is good!  Which file to make that change, or wait for next upload?
Christopher

Knowledge in: PHP, Perl, MySQL, Javascript, Actionscript, FLASH, HTML, CSS
Server Administrator / Developer: https://convictionshosting.com

Offline insanity

  • Senior Member
  • *
  • Posts: 215
  • Karma: +0/-0
    • View Profile
Re: Removing user or database does not remove mysql.user !!!
« Reply #11 on: 2014-03-10, 17:58:13 »
Mustafa, that is perfect. Finally we can delete all docroots and db users :)

@chrisf: in usr/local/lxlabs/kloxo/httpdocs/driver/pserver/mysqldb__mysqllib.php

 


MRatWork Affiliates:    BIGRAF(R) Inc.    House of LMAR    EFARgrafix
Click Here

Page created in 0.079 seconds with 22 queries.

web stats analysis