LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-12-2012, 08:27 AM   #1
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Rep: Reputation: Disabled
What is the right method to install phpMyAdmin on my centos 6.2


Dear All,
Currently I get the latest phpMyAdmin unzip and load into my www folder and just run it. Recently there was an attack via phpMyAdmin. So what is the correct method I should install to avoid this type of vulnerable attack ony my server in future? My os is centos and the attack was due to this PhpMyAdmin vulnerability CVE-2011-2505 (http://www.cve.mitre.org/cgi-bin/cve...=CVE-2011-2505)
 
Old 05-13-2012, 08:20 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,167
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
Hi,

Apart from always using the latest version, you can obscure the phpMyAdmin url, by using something known only to you. So rename the phpMyAdmin-x.y.z directory to "cannot-be-found" for example. You can then use http://hostname/cannot-be-found to do your job, while bots scanning for vulnerable installations cannot find it.
Of course you can deploy mod_security and/or fail2ban and maybe other security measures to reduce risks even more.

Regards
 
Old 05-13-2012, 08:27 AM   #3
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Dear Bathory,
I have another idea is that to keep the whole folder cannot-be-found in another location and only copy into /var/www/html when I need to use then delete? Ok next thing I am trying this .htaccess method. I did this first I set .htaccess folder and type this in it.

Quote:
AuthUserFile /var/www/html/phpMyAdmin-3.4/.htpasswd
AuthName "phpMyAdmin Login Page"
AuthType Basic
Require valid-user
The I created the username and password using this command

sudo htpasswd -c .htpasswd iamadmin
...and I could see both the .htaccess and .htpasswd files are in the folder.


Another thing done is the httpd.conf.

Quote:
<Directory />
Options FollowSymLinks
AllowOverride AuthConfig
</Directory>
But when I go my link it never prompt for the additional username and password. My OS is centos 6.2
 
Old 05-13-2012, 08:42 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,167
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
Quote:
I have another idea is that to keep the whole folder cannot-be-found in another location and only copy into /var/www/html when I need to use then delete?
You could, but I think it's a waste of time copying and deleting that directory.

Quote:
<Directory />
Options FollowSymLinks
AllowOverride AuthConfig
</Directory>
You should do this for the docroot (or just for the phpMyAdmin (or whatever you want to call it) directory). E.g.
Code:
<Directory /var/www/html/cannot-be-found>
Options FollowSymLinks
AllowOverride AuthConfig
And of course place the .htaccess into that directory
Attn: The .htpasswd should be located into a directory not accessible from the web (e.g. in /var/www)
 
Old 05-13-2012, 08:46 AM   #5
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Dear Bathory,
So should I add this into my httpd config file is it?
Quote:
<Directory /var/www/html/cannot-be-found>
Options FollowSymLinks
AllowOverride AuthConfig
</Directory>
Why is this <Directory /> not taking effect ya? Now I saw the .htpasswd is also in the same location in the phpMyAdmin directory. So should I move it to where is best location? If I move will it be able to detect then the password?
 
Old 05-13-2012, 09:05 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,167
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
Quote:
So should I add this into my httpd config file is it?
Yup


Quote:
Why is this <Directory /> not taking effect ya?
I'm not familiar with centos apache configuration, but I guess that there is another "AllowOverride None" for docroot.


Quote:
So should I move it to where is best location? If I move will it be able to detect then the password?
You should move it to somewhere not accessible from the web (that is outside the docroot). It's just a precaution, as the default apache configuration prohibits access to .ht* files.
Don't forget to change AuthUserFile with the new path to .htpasswd. Also make sure both .htaccess and .htpasswd are owned by the apache user and can be read only from it
 
Old 05-13-2012, 09:38 AM   #7
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Dear Bathory,
I managed to solve the problem was in my httpd.conf. But when I do ls-ls I dont find both my .htaccess and .htpasswd file any reason for it? When I created both the file I was under the root account is that ok?
 
Old 05-13-2012, 09:52 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,167
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
You need to run ls -la to see files starting with a dot
Anyways if you were root, then chances are that both files are in /root
 
Old 05-14-2012, 12:24 AM   #9
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
Quote:
/var/www/html/phpMyAdmin-3.4
i would not have installed it there
the html folder is ALWAYS a problem

something like this with the doc root set to "html"
/var/www/cgi-bin
/var/www/html/"your CMS" -- and all it's folders
/var/www/MySql
/var/www/phpMyAdmin

then set the permissions, this way you can not edit "/var/www/phpMyAdmin" from within the "/var/www/html/" folder

This is how i set up a Cent / RHEL server and Apache 2
I do not use the rhel or cent rpm's . Because i like to keep things together and not scattered all over the place

Last edited by John VV; 05-14-2012 at 12:28 AM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Install phpMyAdmin on Linux Centos 6.2 without EPEL repo rewards Linux - Software 6 03-21-2012 03:51 PM
Installing phpMyAdmin on a Centos 6.0 rewards Linux - Software 3 01-09-2012 04:26 PM
How to install PHPMYADMIN in centos 6? agriz Linux - Software 4 11-28-2011 12:00 AM
CentOS phpmyAdmin keleas Linux - Server 2 10-27-2010 05:13 AM
setup PHPMYADMIN on CENTOS bradsmiley Linux - Server 1 08-30-2006 03:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration