Problems with change_sqlpass

Discussion in 'Installation/Configuration' started by sergio.arnaldo, Sep 30, 2008.

  1. sergio.arnaldo

    sergio.arnaldo New Member

    Hi everyone,

    I've followed the great Falko's HowTo to install Postfix+Mysql+SMTP-AUT+Quota+Spamassassin... {thank you so much}. I followed it carefully and added some extra from <> and then I installed Squirrelmail webmail and at the end of the day I had a working system.

    The problem I am facing for a week now,is that I installed the change_sqlpass plugin but I cannot get it to work. whenever I try to change a user's password I get the following errors:
    From mysql log: Connect Access denied for user 'user'@ 'localhost (using password: YES)

    From the Squirrelmail window: Error: could not make database connection

    I guess these have to be with database connection. This last week I have googled so much to work around this, but I have been unsuccessful.

    The error that I get from mysql.log doesn't show the real user that its attempting to change is /her password. It just says 'user'@...

    Details of my system are:

    Distro: Debian Etch 2.6.18-4-686
    MySQL: 5.0.32-Debian-7etch6.log
    Squirrelmail: 1.4.8
    PEAR: 1.4.11 stable
    DB: 1.7.13 stable
    Console_Getopt: 1.2 stable
    change_sqlpass: 3.3-1.2
    compatibility: 1.0

    I am really sorry for the long text, but the intention was to be very specific.
    I appreciate your help.
    NB: I am very newbie with Linux
  2. baldur2630

    baldur2630 New Member

    I don't know change_sqlpass from a box of washing powder, but I do know MySQL

    Sounds to me like the users passwords are all restricted to localhost (i.e the box running MySQL. rather than to either a specific address or % (anywhere)

    Suggest you go along to the MySQL site and download and install the MySQL GUI tools on the server holding the MySQL databases. Makes life a LOT easier and it's FREE

    Then use MySQL Administrator, login as root and make sure that the users passwords are either pointing to a specific address (lots of support hassles) or to % so they can access the system from anywhere
  3. sergio.arnaldo

    sergio.arnaldo New Member

    >> .... good enough.... thanks for your reply.

    >> Actually I forgot to mention that I have phpMyAdmin installed... does it help?

    >> From phpMyAdmin I have granted privileges to users connecting from % as well as to users connecting from localhost. I thought this would help me, but I didn't go any further. It may be possible that I did not set the privileges in the right manner since I almost know nothing about MySQL. Is there any thing more you could tell me regarding your suggestion to have MySQL GUI tools? Please help!
  4. baldur2630

    baldur2630 New Member

    I'm sorry, I don't know or use phpMyAdmin. Seems it's one of the first thing the acne-ridden would-be hackers who don't have a life, try to break into, so it's the first thing I get rid of!

    You may also have a firewall problem, check if Port 3306 is open. Again, not sure how Ubuntu Firewall works, but if users have % access, it may well be that Port 3306 (or whatever you changed it to if you did), isn't allowing traffic,

    If that fails, use something like Wireshark and see where the packets are getting lost. You can obviously connect on the server and other than % and Firewall I can't think of anything else it could be
  5. sergio.arnaldo

    sergio.arnaldo New Member

    >> thanks for the quick reply again... I'll surely take that into consideration.

    >> Actually I have a local firewall on this machine, with iptables, and I gave access to port 3306.
    This is my iptables -L output:
    Chain INPUT (policy ACCEPT)
    target prot opt source destination
    FIREWALL 0 -- anywhere anywhere

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination
    FIREWALL 0 -- anywhere anywhere

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination

    Chain FIREWALL (2 references)
    target prot opt source destination
    ACCEPT tcp -- anywhere anywhere tcp dpt:smtp flags:FIN,SYN,RST,ACK/SYN
    ACCEPT tcp -- anywhere anywhere tcp dpt:pop3
    ACCEPT tcp -- anywhere anywhere tcp dpt:www
    ACCEPT tcp -- anywhere anywhere tcp dpt:mysql
    ACCEPT tcp -- localnet/24 anywhere tcp dpt:ssh flags:FIN,SYN,RST,ACK/SYN
    ACCEPT 0 -- anywhere anywhere
    ACCEPT udp -- anywhere anywhere udp spt:domain
    ACCEPT tcp -- anywhere anywhere tcp spt:domain
    ACCEPT udp -- anywhere anywhere udp dpt:ntp
    ACCEPT udp -- anywhere anywhere udp spt:6277
    ACCEPT udp -- anywhere anywhere udp spt:24441
    REJECT tcp -- anywhere anywhere tcp flags:FIN,SYN,RST,ACK/SYN reject-with icmp-port-unreachable
    REJECT udp -- anywhere anywhere udp reject-with icmp-port-unreachable

    >>Following your suggestion I have just installed Wireshark (I confess this is the first time ever that I hear about this package) and I will see if packets are getting lost during the connection open and where it happens... if I ever manage to use this..

    Would you tell me (this may be stupid) how to see the mysql_connect () function? I would like to see how the connection to mysql is made, meaning what is the first argument. Where should I locate it?
  6. sergio.arnaldo

    sergio.arnaldo New Member

    Well, I couldn't use Wireshark in my machine because I don't have X at all. So I installed it in other machine in the network and It seems Wireshark only analyze packets to and from this machine. I guess it won't be of much help to me now.

    But I got some developments. I have been believing that there was this "mysql_connect()" function which would be called to connect to the database. But I as wrong. The change_sqlpass plugin has a file called functions.php which in fact includes among other functions the csp_get_database_connection() that is responsible to make a connection to mysql. Here's the code:
    function csp_get_database_connection()

    global $csp_db_connection, $csp_dsn;

    load_config('change_sqlpass', array('config.php'));

    // make a new connection if needed; exit if failure
    if (empty($csp_db_connection))

    $csp_db_connection = DB::connect($csp_dsn);
    if (DB::isError($csp_db_connection))
    global $color;
    bindtextdomain('change_sqlpass', SM_PATH . 'locale');
    $text = _("Could not make database connection");
    bindtextdomain('squirrelmail', SM_PATH . 'locale');
    plain_error_message($text, $color);


    // return connection
    return $csp_db_connection;


    When I try to change a user's password I get the "Could not make database connection" in Squirrelmail. And not even that user trying to change his /her password is parsed since the connection is never established.
    I don't know if I am still far or near the solution, but I believe that this function may be the key or part of solution.

    Please don't give up helping me. I am almost dead with this not working.
    <please forget my bad English since I am a Portuguese native speake>
  7. baldur2630

    baldur2630 New Member

    Yes, I think you are correct, I would love to be able to help you sort it, but I don't know change_sqlpass and my PHP is almost non-existent.

    At least we eliminated most of the other possibilities. I'm pretty sure this isn't a MySQL problem and we've eliminated the firewall. so I guess we have to hope that someone on this forum knows PHP better than I and can help you.

    If not you could try a PHP Forum or You could try to put some debug code into the program (ie. print out the values of all the variables that are being passed by the program).

    Hope you get an answer, sorry I couldn't be of more help on this one, but if there is anything else - let me know
  8. falko

    falko Super Moderator ISPConfig Developer

    Did you configure config.php as shown on ? Make sure you use the correct MySQL user and password.
  9. sergio.arnaldo

    sergio.arnaldo New Member

    Falko you're "the man"... you really are!!

    Now the change_sqlpass works!!

    The problem is that when I configured this plugin I didn't follow the instructions in the link you provided. To be more specific I had the very wrong values to $lookup_password_query, $password_update_queries, $password_encryption, $csp_salt_static, and $scp_salt_query variables.

    I changed them accordingly to your suggest and... voila!! The plugin is working fine now.
    Thank you very much Falko.
    Thank you baldur2630 for your support.
    Thank you all that at least read my post.
  10. spinn_gd

    spinn_gd New Member

    ould not make database connection

    Hello every one

    I did step by step as described in this tutorial, I copied and pasted content into config.php file of change_sqlpass plugin, changed the password (of course) to the database mail in the $csp_dsn section; and when I try to change the password in squirrelmail, I get the ERROR: Could not make database connection . I will be appreciate for help... Thanx
  11. falko

    falko Super Moderator ISPConfig Developer

    Do you use the correct MySQL details in config.php?

    Is MySQL running? What's the output of
    netstat -tap
  12. spinn_gd

    spinn_gd New Member

    Yes, I've pasted the example of Yours file and I have changed the password mail_admin_password to my password; I also tried witch $csp_dsn = 'mysql://root:rootpassword@localhost/mail';
    ...the same

    There is the output of
    netstat -tap
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 localhost:10024 *:* LISTEN 2144/amavisd (maste
    tcp 0 0 localhost:10025 *:* LISTEN 6182/master
    tcp 0 0 localhost:mysql *:* LISTEN 963/mysqld
    tcp 0 0 *:submission *:* LISTEN 6182/master
    tcp 0 0 localhost:spamd *:* LISTEN 2343/
    tcp 0 0 *:ftp *:* LISTEN 3769/proftpd: (acce
    tcp 0 0 *:* LISTEN 2090/named
    tcp 0 0 *:* LISTEN 2090/named
    tcp 0 0 localhost:domain *:* LISTEN 2090/named
    tcp 0 0 *:ssh *:* LISTEN 2127/sshd
    tcp 0 0 *:smtp *:* LISTEN 6182/master
    tcp 0 0 localhost:953 *:* LISTEN 2090/named
    tcp 0 192 84-10-175-233.dyn:56981 ESTABLISHED 31969/sshd: spinn [
    tcp6 0 0 [::]:imaps [::]:* LISTEN 3269/couriertcpd
    tcp6 0 0 [::]:pop3s [::]:* LISTEN 3292/couriertcpd
    tcp6 0 0 [::]:pop3 [::]:* LISTEN 3280/couriertcpd
    tcp6 0 0 [::]:imap2 [::]:* LISTEN 3244/couriertcpd
    tcp6 0 0 [::]:www [::]:* LISTEN 4199/apache2
    tcp6 0 0 [::]:domain [::]:* LISTEN 2090/named
    tcp6 0 0 [::]:ssh [::]:* LISTEN 2127/sshd
    tcp6 0 0 ip6-localhost:953 [::]:* LISTEN 2090/named
    tcp6 0 0 [::]:https [::]:* LISTEN 4199/apache2
    tcp6 0 0 bda-178-239-87-19:33347 ESTABLISHED 3928/couriertls
    tcp6 0 0 84-10-175-233.dyn:36669 ESTABLISHED 31609/imapd
    tcp6 0 0 i53876AC0.versanet:2657 TIME_WAIT -
    tcp6 0 0 84-10-175-233.dyn:43515 ESTABLISHED 17781/imapd
    tcp6 0 0 84-10-175-233.dyn:58525 ESTABLISHED 31894/imapd

    netstat -tap |grep mysql
    tcp 0 0 localhost:mysql *:* LISTEN 963/mysqld
  13. falko

    falko Super Moderator ISPConfig Developer

    Can you try and make MySQL listen on all interfaces instead of just localhost? You can find the setting in /etc/mysql/my.cnf.

Share This Page