Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 25th January 2012, 01:04
branov branov is offline
Junior Member
 
Join Date: Aug 2009
Posts: 24
Thanks: 0
Thanked 1 Time in 1 Post
Unhappy Bug and Help: API database add

Hi all,

I found little bug in ISPConfig. When I add a new mysql database and user from API (sites_databas_add), database is created successfuly, but problem is with mysql user creation. The password inserted to web_database table is hashed and the mysql user is creating whith second time hashed password like:

Code:
GRANT ALL ON user.* TO 'user'@'%' IDENTIFIED BY PASSWORD 'dfba8efa6df7c40e47231401ae555594'
So, password is stored hashed and is hashing second time while inserting new sql user. This cause problem, mysql user is not created. First hashed password string is too long for sql passwd format.

I hope, you understand what I mean

Please, could you help me where I can fix this problem?
Reply With Quote
Sponsored Links
  #2  
Old 25th January 2012, 11:27
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 34,610
Thanks: 792
Thanked 4,986 Times in 3,905 Posts
Default

The problem is in your script, if you update a mysql database without settings a new password, then the mysql password field in the params array has to be empty.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 25th January 2012, 12:55
branov branov is offline
Junior Member
 
Join Date: Aug 2009
Posts: 24
Thanks: 0
Thanked 1 Time in 1 Post
Default

sorry, but I dont undestand what you mean

Here is my code to create a NEW mysql database:

Code:
$params = array(
                'server_id' => $server_id,
                'type' => 'mysql',
                'database_name' => 'd'.$domain_id.$mysql_login,
                'database_user' => 'd'.$domain_id.$mysql_login,
                'database_password' => $mysql_heslo,
                'database_charset' => $mysql_charset,
                'remote_access' => 'y',
                'remote_ips' => '%',
                'active' => $mysql_aktivne,
);

try {
  $first = $client->client_get_id($session_id,$ADM_User->ispid);
  $res = $client->sites_database_add($session_id, $first, $params);
  return $res;     
} catch (SoapFault $e) {
	return $e->getMessage();
}
where is the problem? I posting a database_password in PLAIN TEXT, wthout any hash, but in ispcp database (domain_database) is insering hashed
Reply With Quote
  #4  
Old 25th January 2012, 14:02
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 34,610
Thanks: 792
Thanked 4,986 Times in 3,905 Posts
Default

Ok, then I misunderstood you. If you enter a plaintext password in the api, then it is ok.

Quote:
I posting a database_password in PLAIN TEXT, wthout any hash, but in ispcp database (domain_database) is insering hashed
Thats correct and working fine, as the password is stored hashed in the database for security reasons. This has been changed in ISPConfig 3.0.4.2, so its ok that it is hashed now as the code that craetes the database has been modified too to use hashed passwords. The mysql user is not created with a second time hashed password, please see mysql manual for details of the grant command syntax. If you provide the keyword "PASSWORD" in front of the password, then mysql is expecting a already hashed password and is not hashing it again. So what you posted here and what ispconfig is doing is correct:

GRANT ALL ON user.* TO 'user'@'%' IDENTIFIED BY PASSWORD 'dfba8efa6df7c40e47231401ae555594'

while this would be wrong:

GRANT ALL ON user.* TO 'user'@'%' IDENTIFIED BY 'dfba8efa6df7c40e47231401ae555594'

as it would instruct mysql to hash the password again.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 25th January 2012, 15:00
branov branov is offline
Junior Member
 
Join Date: Aug 2009
Posts: 24
Thanks: 0
Thanked 1 Time in 1 Post
Default

The result of this GRANT command is:

Password hash should be a 41-digit hexadecimal number (in Phpmyadmin entered by hand)

So, is problem in mysql settings or somewhere else?
Reply With Quote
  #6  
Old 25th January 2012, 15:26
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 34,610
Thanks: 792
Thanked 4,986 Times in 3,905 Posts
Default

Which ISPConfig version do you use for your development? Therew as a bug in the sites_database_add encryption which has been fixed in svn stable already. You might want to update your system to the 3.0.4 svn stable branch:

svn export svn://svn.ispconfig.org/ispconfig3/branches/ispconfig-3.0.4
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #7  
Old 25th January 2012, 15:45
branov branov is offline
Junior Member
 
Join Date: Aug 2009
Posts: 24
Thanks: 0
Thanked 1 Time in 1 Post
Default

I try to update first ispconfig on mysql server (I have separately mysql server and webserver with ispconfig) and if this not solve the problem, I try to update master ispconfig version...

Thanks for tip
Reply With Quote
  #8  
Old 25th January 2012, 15:59
branov branov is offline
Junior Member
 
Join Date: Aug 2009
Posts: 24
Thanks: 0
Thanked 1 Time in 1 Post
Default

Update of ispconfig master server solved this problem. I had last 3.0.4.2 version, but I download svn version and update current instalation and problem was solved.

Thanks for your help!
Reply With Quote
  #9  
Old 1st February 2012, 02:12
holykim holykim is offline
Member
 
Join Date: Jan 2009
Posts: 48
Thanks: 14
Thanked 3 Times in 2 Posts
 
Default

I had exactly the same problem on ISPConfig 3.0.4.2 that upgraded on 15th January 2012.

I downloaded svn and replaced three files below.

remoting.inc.php
remoting_lib.inc.php
functions.inc.php

The above files are stored in /usr/local/ispconfig/interface/lib/classes/

Hope this helps.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:00.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.