プロキシサーバsquidで、BASIC認証を設定する
SquidでBASIC認証します。
プロキシサーバsquidの設定 - undiscoの日記のつづき。
- BASIC認証のための機能追加
squidのソースディレクトリに、"/helpers/basic_auth/NCSA"というディレクトリがあるので、そこへ移動して
# make # make install
すると、squidのインストールディレクトリ直下"libexec"というディレクトリに"ncsa_auth"というプログラムが追加されます。
- パスワードの設定
Apacheのhtpasswdを使用します。プログラムのディレクトリと、パスワードファイルの保存先は適宜
# /usr/local/apache2/bin/htpasswd -c /usr/local/squid/etc/passwd username
- squid.confの編集
下記を設定します。auth_paramのディレクトリは適宜。http_accessのallow設定では、ネットワークのallow設定(例:http_access allow mylocal)はコメントアウトしておく。
# TAG: auth_param auth_param basic program /usr/local/squid/libexec/ncsa_auth /usr/local/squid/etc/passwd # TAG: acl acl password proxy_auth REQUIRED # TAG: http_access http_access allow password