여러 가상 호스트 환경에서 작업하고 있습니다. Mysql Remote Control 용 PhpMyadmin을 설치했습니다.
환경은 다음과 같이 구성됩니다.
one.domain.com
two.domain.com
onlyphpmyadmin.domain.com
이제 세 도메인 중 하나에 액세스하면
http://one.domain.com/phpmyadmin/
http://two.domein.com/phpmyadmin/
http://onlyphpmyadmin.domain.com/phpmyadmin/
결과는 동일하며 Phpmyadmin에 대한 액세스가 허용됩니다.
목표는 아래와 같은 상황을 얻는 것입니다
http://one.domain.com/phpmyadmin/ --> access denied
http://two.domein.com/phpmyadmin/ --> access denied
http://onlyphpmyadmin.domain.com/phpmyadmin/ -->access allowed
비슷한 해킹이 없습니다
<?php
if($_SERVER['HTTP_HOST'] != 'onlyphpmyadmin.domain.com')
die('access denied');
...
?>
일부 Phpmyadmin 파일에.
여기 내 Phpmyadmin 구성 파일
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_admin_flag allow_url_fopen Off
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/
</IfModule>
</Directory>
# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
<IfModule mod_authn_file.c>
AuthType Basic
AuthName "phpMyAdmin Setup"
AuthUserFile /etc/phpmyadmin/htpasswd.setup
</IfModule>
Require valid-user
</Directory>
# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/libraries>
Order Deny,Allow
Deny from All
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
Order Deny,Allow
Deny from All
</Directory>