Nucleus

phpMyAdmin のインストール

2005年8月24日

 MySQLの管理を容易にするため、phpMyAdminをインストールした。このツールは諸刃の剣で、便利な反面セキュリティーをしっかりしておかないとデータベースの内容を不正アクセスにより書き換えられてしまう可能性がある。そこで、次のような3つのセキュリティーでphpMyAdminを保護することにした。

1)phpMyAdminインストールディレクトリを第3者に知られないようなものにする

2)自分のコンピューターからのみphpMyAdminインストールディレクトリへアクセスできるようにする

3)アクセス用のパスワードを設定する

(以下、phpMyAdminインストールメモ)

http://www.phpmyadmin.net/からphpMyAdmin-2.6.1-pl3.tar.gzをダウンロードし、サーバーにアップロード。

# vi /etc/apache2/sites-enabled/000-default
(次のコードを追加)
<Directory /var/www/xxxxxxxx/>
require valid-user
AuthUserFile /root/.htpasswd
AuthName "Authorized User Only"
AuthType Basic
Options Indexes FollowSymLinks MultiViews
Order deny,allow
Deny from all
Allow from xxxxxxxx
</Directory>

# htpasswd -c .htpasswd xxxxxxxx
New password:
Re-type new password:
Adding password for user xxxxxxxx
# /etc/init.d/apache2 force-reload
# tar xvzf phpMyAdmin-2.6.1-pl3.tar.gz
# mv phpMyAdmin-2.6.1-pl3 xxxxxxxx
# mv xxxxxxxx/ /var/www/
# cd /var/www/xxxxxxxx
# vi config.inc.php
(次のように変更)
$cfg['Servers'][$i]['password'] = 'xxxxxxxx'; // MySQL password (only needed
$cfg['PmaAbsoluteUri'] = 'http://fkmac01.phc.chalmers.se/xxxxxxxx/';

ついでに、以下のようにして、ログが閲覧できるようにしておいた。
# vi /etc/apache2/sites-enabled/000-default
(次のコードを追加)
Alias /xxxxxxxx/ "/var/log/apache2/"
<Directory /var/log/apache2/>
ForceType image/gif
require valid-user
AuthUserFile /root/.htpasswd
AuthName "Authorized User Only"
AuthType Basic
Options Indexes FollowSymLinks MultiViews
Order deny,allow
Deny from all
Allow from xxxxxxxx
</Directory>
# /etc/init.d/apache2 force-reload

コメント

コメントはありません

コメント送信