Quantcast
Channel: プログラム の個人的なメモ
Viewing all articles
Browse latest Browse all 860

【Linux】プロキシサーバソフト ~ Squid / Basic認証編 ~

$
0
0

■ 前提条件

 * 以下の関連記事を参考に、Squid を設定しておくこと
https://blogs.yahoo.co.jp/dk521123/36956970.html

■ 準備

htpasswdコマンドを使う設定を行う

Basic認証の場合、パスワードファイルはハッシュ化する必要があるため
sudo yum -y install httpd-tools
http://tanihiro.hatenablog.com/entry/2014/02/05/172938

■ 構築手順

 * Basic認証のための設定を行う

[1] 設定ファイル「squid.conf」を修正する

sudo vi /etc/squid/squid.conf
~~~~
acl CONNECT method CONNECT

auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/.htpasswd
auth_param basic children 5
auth_param basic realm Squid Basic Authentication

auth_param basic credentialsttl 5 hours
acl password proxy_auth REQUIRED
http_access allow password
~~~~
設定の説明は、以下のサイトを参照
http://www.satlab-gineiden.com/pc-soft/proxy_server.html/2

[2] Basic認証用のパスワードファイル「.htpasswd」を作成

sudo htpasswd -c /etc/squid/.htpasswd 【ユーザ名】
# 新規作成
sudo htpasswd -c /etc/squid/.htpasswd admin
New password: 【パスワードを入力(例:「password」)】
Re-type new password: 【パスワードを入力(例:「password」)】
Adding password for user admin

# ユーザー追加
sudo htpasswd -b /etc/squid/.htpasswd guest password

# ユーザー削除
sudo htpasswd -D /etc/squid/.htpasswd guest

[3] Squid を再起動する

# 再起動
sudo systemctl restart squid

# 「active (running) 」であることを確認
sudo systemctl status squid

[4] 動作確認

 * Firefoxなどのブラウザで「yahoo.co.jp」をアクセスする

 => ダイアログ表示「・・・"Squid Basic Authentication"・・・」が表示されるはず。
 => 以下を入力する
  + ユーザ名 :【[2] で設定したユーザ名を入力(例:「admin」)】
  + パスワード:【[2] で設定したパスワードを入力(例:「password」)】


関連記事

プロキシサーバソフト ~ Squid / 初期設定編 ~

https://blogs.yahoo.co.jp/dk521123/36956970.html

プロキシサーバソフト ~ Squid / SSLプロキシ構築編 ~

https://blogs.yahoo.co.jp/dk521123/36958786.html

Viewing all articles
Browse latest Browse all 860

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>