phpMyAdminの簡単にできるセキュリティ対策【Apache】

Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1434
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1434
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1434
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1434
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1451
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1451
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1451
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1451
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1216
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1216
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1216
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1216
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1226
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1226
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1226
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1226
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1239
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1239
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1239
Warning: Undefined array key 3 in /home/octo8/dainamo.jp/public_html/wp/wp-content/themes/surfing/lib/table-of-contents-plus/surfing_toc.php on line 1239
ブラウザ上からサーバーのデータベースにアクセスすることができ、大変便利なphpMyAdminですが、
簡単な分、もしURLがバレた時には不特定多数の人から直接ページが見られてしまったりします。
セキュリティ対策がパスワードだけですと怖いですよね。
今回は、phpMyAdminのセキュリティを高める方法を書いていきます。
エイリアスの変更
URLが、ドメイン + phpmyadminのままだとすぐバレてしまいますので、
まずはURLを変えましょう。
configファイルをいじっていきます。
# cd /etc/httpd/conf.d/ # vim phpMyAdmin.conf
以下のようにAliasに関する2行をコメントアウト又は削除し、新しいAliasの定義を追加します。
#Alias /phpMyAdmin /usr/share/phpMyAdmin #Alias /phpmyadmin /usr/share/phpMyAdmin Alias /phpMyAdmin_abc /usr/share/phpMyAdmin
設定が終わったら、Apacheを再起動します。
service httpd restart
又は、CentOS7の場合は
systemctl restart httpd
Basic認証を入れる
万が一URLがバレた時のことを考えて、Basic認証を入れておきます。
htpasswdコマンドで.htpasswdを作成する
.htpasswdファイルと、パスワードを暗号化して記述しておくファイル
まずは、以下のコマンドでパスワードファイルの作成を行います
htpasswd -c /etc/httpd/conf/.htpasswd USER
Configファイルの設定をする
httpd.confに以下のように記述を追加します
<Directory "/usr/share/phpMyAdmin/"> AuthType Basic AuthName "Secret Zone" AuthUserFile /etc/httpd/conf/.htpasswd Require valid-user </Directory>
これで設定が完了です。
かなり簡易的なものにはなりますが、ないよりあったほうがセキュリティは高くなりますので設定はしておいたほうがいいでしょう
ユーザーには、phpMyAdminのページそのものを見せないというところが肝です
制作のご依頼・ご相談はこちら
dainamoでは魅力的なWEBサイトや、アプリ、ツール、ポスター、パンフレット、チラシなど幅広く承っております。ご相談、見積もり、お問い合わせなど、お気軽にご連絡ください。