Current time: 04-19-2024, 04:46 PM Hello There, Guest! (LoginRegister)


Post Reply 
Autologin for PMA in trunk #1521 doesn´t work ?
Author Message
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #1
Question Autologin for PMA in trunk #1521 doesn´t work ?
I did upgrade ispCP form an older NighlyBuild to the trunk #1521 yesterday evening.
ispCP just runs fine, but the autologin for PMA doesn´t work anymore Rolleyes
I try to fix it on my own and compared it with my other Servers - but could not find the error.

When i click on Databases -> phpMyAdmin which links to this URL:
Code:
https://admin.domain.tld/client/sql_auth.php?id=34
i come out here:
Code:
https://admin.domain.tldpma/
There is no "/" between domain.tld and pma !?
Also there is no key or cookie session in the link to auth.
I checked the the "sql_auth.php" about the Path and only see that we use the 'BASE_SERVER_VHOST'. This is set correct in the ispcp.conf like
Code:
BASE_SERVER_VHOST = admin.domain.tld

Can somebody confirm this Error or went something wrong during my Upgrade ?
// EDIT: PMA itself works fine.

Greez BeNe
(This post was last modified: 02-18-2009 06:14 PM by BeNe.)
02-18-2009 06:13 PM
Visit this user's website Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #2
RE: Autologin for PMA in trunk #1521 doesn´t work ?
(02-18-2009 06:13 PM)BeNe Wrote:  
Code:
[b]https[/b]://admin.domain.tld/client/sql_auth.php?id=34

HTTPS is the problem. If you use ssl you need to modify
Code:
$fp = fsockopen(Config::get('BASE_SERVER_IP'), 80, $errno, $errstr, 5);
in
Code:
$fp = fsockopen(Config::get('BASE_SERVER_IP'), 443, $errno, $errstr, 5);
Line 51
(This post was last modified: 02-18-2009 07:09 PM by sci2tech.)
02-18-2009 07:08 PM
Visit this user's website Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #3
RE: Autologin for PMA in trunk #1521 doesn´t work ?
I understand, thank you!
After the change i get this Error in ispCP:
Code:
Error while authenticating!
with enabled SSL.

I tested it now with non SSL. There the URL is ok, but the auth doesn´t also not work. I only get the PMA Loginpage.
But no Error in ispCP. Checked my config.inc.php which is up2date with the trunk.
Code:
/* Parameters set by ispCP */
$cfg['Servers'][$i]['user']                     = $_POST['pma_username'];
$cfg['Servers'][$i]['password']                 = $_POST['pma_password'];
....
$cfg['Servers'][$i]['controluser']              = 'pma';
$cfg['Servers'][$i]['controlpass']              = 'mypassword';
Looks ok for me. Maybe the controlpass is the Problem ?
I copied it simple from my old config.inc.php to the new one from the trunk.

Is this the same "pma" user in my MySQL DB that we use?
If so, i can set it again in the MySQL DB an in the Config.
Or better, what is exactly needed for the autologin ? So i can take a look about it.
Saw that a Ticket is open about the PMA User --> http://www.isp-control.net/ispcp/ticket/1676[/code]
But i did the Update manually so this could not be the problem in my case.

Greez BeNe
02-18-2009 07:35 PM
Visit this user's website Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #4
RE: Autologin for PMA in trunk #1521 doesn´t work ?
Lets clarify a little Smile.
sql_auth.php perform like a proxy. It take from ispcp.conf BASE_SERVER_IP, (previvios was BASE_SERVER_VHOST), username and password is taken from database (password is decrypted) then using POST method with fsockopen sent to BASE_SERVER_IP/pma/ login data. If BASE_SERVER_IP is wrong (previous BASE_SERVER_VHOST, I droped this because it need to convert first into IP so I took BASE_SERVER_IP instead) or it cannot connect to it you will get an Error while authenticating!. If everything was ok server will return some cookies and a redirect. This are passed via setcookie and header functions to browser and you get are logged in. If something go wrong you also get a nice Error while authenticating!. If you alter some way how pma is default handled, you get errors (like you did with a port).
I did explain this to eliminate every "custom errors". Anyway I`ll check it today / tonight and see what else can make it to fail. Maybe some characters from password and username? Can you provide some examples that do fail.
Thank you for helping me with this.
That ticket seems to be another problem.
(This post was last modified: 02-18-2009 07:53 PM by sci2tech.)
02-18-2009 07:50 PM
Visit this user's website Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #5
RE: Autologin for PMA in trunk #1521 doesn´t work ?
Thank you for that detailed info, sci2tech!

So lets talk about the non-ssl case to get a more default ispCP situation.
The MySQL Users in the ispCP table "sql_user" are there and the passwords are crypted. Here is an example:
Code:
sqlu_id     sqld_id     sqlu_name     sqlu_pass
12              11              v126XXX     dOGgYRoKXAtmeXXXXXXXXX
The Password has no special chars. The PhpMyAdmin Link is also Ok with the ID=12
Code:
http://admin.domain.tld/client/sql_auth.php?id=12
Username and dbName are also v126XXX.
After a click on this PMA Link the URL is:
Code:
http://admin.domain.tld/pma/index.php?lang=de-utf-8&convcharset=utf-8&collation_connection=utf8_general_ci&token=a39395b51c7241e541edd0b04XXXXXX&phpMyAdmin=xzFfmqN57pXiRpzLKIAL-XXXXXX
and i´m on the PMA Loginsite but not in PMA.
The Username is directly in the Form "v126XXX" - correct!
The Password is empty! Of course i can now type the password into the field and Login.
[Image: unbenannt3nb1.th.jpg]
This happend with _every_ Login, so the problem can´t be any special chars in the Password/Username/DBName

Here is the access.log
Code:
62.75.XX.XX - - [18/Feb/2009:10:46:58 +0000] "POST /pma/ HTTP/1.1" 302 -
88.79.1.XX.XX - - [18/Feb/2009:10:46:58 +0000] "GET /client/sql_auth.php?id=12 HTTP/1.1" 302 126
88.79.1.XX.XX - - [18/Feb/2009:10:46:58 +0000] "GET /pma/index.php?lang=de-utf-8&convcharset=utf-8&collation_connection=utf8_general_ci&token=a39395b51c7241e541edd0b04XXXXXX&phpMyAdmin=xzFfmqN57pXiRpzLKIAL-xBw3nb HTTP/1.1" 200 2500
88.79.1.XX.XX - - [18/Feb/2009:10:46:58 +0000] "GET /pma/phpmyadmin.css.php?token=dfd79635efa4ef27e7fc3d9cbbcXXXXX&js_frame=right&nocache=3704755039 HTTP/1.1" 200 23181

Greez BeNe
02-18-2009 09:00 PM
Visit this user's website Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #6
RE: Autologin for PMA in trunk #1521 doesn´t work ?
Can you please test this file:
Code:
<?php
/**
* ispCP ω (OMEGA) a Virtual Hosting Control System
*
* @copyright     2001-2006 by moleSoftware GmbH
* @copyright     2006-2008 by ispCP | http://isp-control.net
* @version     SVN: $Id$
* @link         http://isp-control.net
* @author         ispCP Team
*
* @license
*   This program is free software; you can redistribute it and/or modify it under
*   the terms of the MPL General Public License as published by the Free Software
*   Foundation; either version 1.1 of the License, or (at your option) any later
*   version.
*   You should have received a copy of the MPL Mozilla Public License along with
*   this program; if not, write to the Open Source Initiative (OSI)
*   http://opensource.org | osi@opensource.org
*/

require '../include/ispcp-lib.php';

check_login(__FILE__);

// page functions.
function get_db_user_passwd(&$sql, $db_user_id) {
    $query = "
        SELECT
            `sqlu_name`, `sqlu_pass`
        FROM
            `sql_user`
        WHERE
            `sqlu_id` = ?
    ";

    $rs = exec_query($sql, $query, $db_user_id);

    $user_mysql = $rs->fields['sqlu_name'];
    $pass_mysql = decrypt_db_password($rs->fields['sqlu_pass']);
    $data="pma_username=".rawurlencode($user_mysql)."&pma_password=".rawurlencode(stripslashes($pass_mysql));

    $out  = "POST /pma/ HTTP/1.0\r\n";
    $out .= "Host: ".Config::get('BASE_SERVER_VHOST')."\r\n";
    $out .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $out .= "Content-length: ".strlen($data)."\r\n";
    $out .= "Connection: Close\r\n\r\n";
    $out .= $data;

    $rs='';

    $fp = fsockopen(Config::get('BASE_SERVER_IP'), 80, $errno, $errstr, 5);
    if (!$fp) {
        auth_error();
    } else {
        fwrite($fp, $out);
        $header=null;
        while (!feof($fp)) {
            $line = fgets($fp, 2048);
            $rs.=$line;
            if (preg_match("/^Location.+/",$line,$results)) $header=$line;
        }
        fclose($fp);
        preg_match_all("/(?:Set-Cookie: )(?:(?U)(.+)=(.+)(?:;))(?:(?U)( expires=)(.+)(?:;))?(?:( path=)(.+))?/",$rs,$results,PREG_SET_ORDER);
        foreach ($results as $result) {
            setcookie(rawurldecode($result[1]),rawurldecode($result[2]),strtotime(rawurldecode($result[4])),rawurldecode($result[6]));
        }
        if ($header) {
            header($header);
            die();
        } else {
            auth_error();
        }
    }
}

function auth_error() {
    set_page_message(tr("Error while authenticating!"));
    header("Location: sql_manage.php");
    die();
}

// check User sql permision
if (isset($_SESSION['sql_support']) && $_SESSION['sql_support'] == "no") {
    header("Location: index.php");
    exit;
}

if (isset($_GET['id'])) {
    $db_user_id = $_GET['id'];
} else {
    user_goto('sql_manage.php');
}

check_usr_sql_perms($sql, $db_user_id);
get_db_user_passwd($sql, $db_user_id);

?>
02-18-2009 09:05 PM
Visit this user's website Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #7
RE: Autologin for PMA in trunk #1521 doesn´t work ?
Tested, but this does not solve the problem.
Same situation.

Greez BeNe
02-18-2009 09:27 PM
Visit this user's website Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #8
RE: Autologin for PMA in trunk #1521 doesn´t work ?
Bene do you have time to track this down? If yes add me to yahoo messenger (sci2tech). BTW delete browsers cookies si cache.
(This post was last modified: 02-18-2009 09:30 PM by sci2tech.)
02-18-2009 09:29 PM
Visit this user's website Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #9
RE: Autologin for PMA in trunk #1521 doesn´t work ?
Yes, i have time!
But the only messanger i use every half year is ICQ.
Maybe we can get there togehter ? Or in a other chat ?

Greez BeNe
02-18-2009 09:32 PM
Visit this user's website Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #10
RE: Autologin for PMA in trunk #1521 doesn´t work ?
Do not have icq. maibe irc? chat.freenode.net ? http://www.isp-control.net/documentation/chat
02-18-2009 09:40 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)