Quote:
Originally Posted by mousepad111
The problem is these changes are not having any effect after restarting mysql and apache. Sorry, if this is a basic question, but how am I suppose to load pma's config to have the changes take affect.
|
Just for grins, I purged my install of phpmyadmin and started over. Here is what I did to make it work. Note that I run debian etch. It should be similar in ubuntu, but no guarantees. I think that I noted all the steps.
- Uninstall. "aptitude purge phpmyadmin"
- Clean all cruft from /etc/apache2. There were some symlinks to /etc/phpmyadmin in there
- Install. "aptitude install phpmyadmin"
- Add symlink so apache can find phpmyadmin's config file. At a shell run
Code:
ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
- Add an alias to phpmyadmin's apache.conf so that phpmyadmin is visible on the net. Using your favorite editor, add the following line to the end of /etc/phpmyadmin/apache.conf:
Code:
Alias /myadmin /var/www/phpmyadmin
Note that the /myadmin can be anything you want. This is where you might use security by obscurity.
- Modify config.inc.php to force ssl (thanks, skavoovie - I didn't know about that one). Note that I do not use the 'http' auth_type control because I don't want to fill in the control_user fields, potentially exposing the password. My file /etc/phpmyadmin/config.inc.php contains:
Code:
<?php
$cfg['ForceSSL'] = true;
$i = 0;
$i++;
$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address
$cfg['Servers'][$i]['auth_type'] = 'cookie'; // Authentication method (config, http or cookie based)?
?>
- Test to see if it works. Restart appache, then access your site using a browser. https://your.domain.com/myadmin/ You should be asked to login by phpmyadmin using a mysql user name & password. Accessing the site by http://... should automatically redirect you to the https://... version
- For fun, add a second layer of security, forcing http authentication before mysql authentication.
- Add the following to /etc/mysqladmin/apache.conf
Code:
AuthType Basic
AuthName "phpMyAdmin"
AuthUserFile /etc/phpmyadmin/htpasswd
Require valid-user
The AuthUserFile can be any path you want.
- Create an http-authenticated user
Code:
cd /etc/phpmyadmin
htpasswd -c htpasswd someUser
(enter a password, twice)
The name following the -c must be the same as in the AuthUserFile directive. Restart apache because you changed the apache.conf file.
- Test it again. This time you should be required to authenticate twice. The first time will be with someUser, the second with the mysql user name
Quote:
Originally Posted by mousepad111
My second question relates to the recommendations to use ssh to access pma. This is similar to using putty to connect to my server via command line, correct?
|
No. What is being suggested is to use an SSH tunnel to use your VPS as an http proxy. You are not using SSH to talk to phpmyadmin, but are instead telling your browser to talk to phpmyadmin through the tunnel+proxy.
There are several ways of setting up a proxy. See
Setting up private proxy for some of them. If you go this route, then you want to restrict phpmyadmin to use from localhost. You do this by adding the following lines to /etc/phpmyadmin/htaccess
Code:
Satisfy All
Order Deny,Allow
Allow from 127.0.0.1
Deny from all
You will also need to remove the $cfg['ForceSSL'] = true; line, because connection IP addresses are passed through the ssl connection protocol.
IMO: the security of the SSL + double authentication scheme is equal to the tunnel. Both require you to know the credentials of a user. Both permit multiple users. The SSL+double permits/forces a second user space, which I think is good, but you might not. Using the SSL tunnel permits any user that can open an ssh session to get to phpmyadmin. Of course, you could go for triple authentication (tunnel + http + mysql).