質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

proxy

proxy(プロキシー)は、企業などの内部コンピュータとインターネットの中間に位置し、例えば直接インターネットに接続できない内部コンピュータの代理としてインターネットに接続する等をするシステム、もしくは代理として機能を実行するソフトウェアです。内部ネットワークへのアクセスを一元管理し、内部からの特定の種類の接続以外を遮断すること、外部からの不正アクセスを拒否することなどに用いられます。

Q&A

1回答

1720閲覧

認証付きproxy がうまく機能しない

oit1234

総合スコア17

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

proxy

proxy(プロキシー)は、企業などの内部コンピュータとインターネットの中間に位置し、例えば直接インターネットに接続できない内部コンピュータの代理としてインターネットに接続する等をするシステム、もしくは代理として機能を実行するソフトウェアです。内部ネットワークへのアクセスを一元管理し、内部からの特定の種類の接続以外を遮断すること、外部からの不正アクセスを拒否することなどに用いられます。

0グッド

0クリップ

投稿2018/10/16 03:37

前提・実現したいこと

認証付きproxyにしたいのですが,なぜかうまくいきません
AWSでcentos7のAMIを使用しております。
http access deny all
の上の行に
http_access allow all
にするとブラウザを通しての接続はできます。

http_port 3128はコメントアウトして
http_port 8080にしています。

AWSのセキュリティーグループのインバウンドルールは
カスタムTCPで8080ポート範囲8080とデフォルトのSSHでポート範囲22
に設定しています。

発生している問題・エラーメッセージ

http_access allow pasword
にして認証付きのproxyにするとブラウザで認証の画面も出てこない状況です。


squidをインストールしただけのsquid.confの中身です。

# # Recommended minimum configuration: # # Example rule allowing access from your local networks. # Adapt to list your (internal) IP networks from where browsing # should be allowed acl localnet src 10.0.0.0/8 # RFC1918 possible internal network acl localnet src xxx.xx.0.0/12 # RFC1918 possible internal network acl localnet src xxx.xxx.0.0/16 # RFC1918 possible internal network acl localnet src fc00::/7 # RFC 4193 local private network range acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines acl SSL_ports port 443 acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 # https acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl CONNECT method CONNECT # # Recommended minimum Access Permission configuration: # # Deny requests to certain unsafe ports http_access deny !Safe_ports # Deny CONNECT to other than secure SSL ports # Deny CONNECT to other than secure SSL ports http_access deny CONNECT !SSL_ports # Only allow cachemgr access from localhost http_access allow localhost manager http_access deny manager # We strongly recommend the following be uncommented to protect innocent # web applications running on the proxy server who think the only # one who can access services on "localhost" is a local user #http_access deny to_localhost # # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS # # Example rule allowing access from your local networks. # Adapt localnet in the ACL section to list your (internal) IP networks # from where browsing should be allowed http_access allow localnet http_access allow localhost # And finally deny all other access to this proxy http_access deny all # Squid normally listens to port 3128 http_port 3128 # Uncomment and adjust the following to add a disk cache directory. #cache_dir ufs /var/spool/squid 100 16 256 # Leave coredumps in the first cache dir coredump_dir /var/spool/squid # # Add any of your own refresh_pattern entries above these. # refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|?) 0 0% 0 refresh_pattern . 0 20% 4320

上のコードの下に追記したコード

auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/.htpasswd auth_param basic children 5 auth_param basic realm Squnewid Basic Authentication auth_param basic credentialsttl 24 hours acl password proxy_auth REQUIRED http_access allow password forwarded_for off request_header_access Referer deny all request_header_access X-Forwarded-For deny all request_header_access Via deny all request_header_access Cache-Control deny all visible_hostname unknown no_cache deny all http_port 8080

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

otn

2018/10/16 05:01

どういう状況になるのでしょうか?
oit1234

2018/10/17 05:03

プロキシのログイン画面が出てくるのですが、ユーザー名とパスワードを打っても、認証されない状況です。
otn

2018/10/17 05:51

状況説明は、「どうならないか」じゃなくて、「どうなるか」を書いてください。正しいはずのユーザ名とパスワードを入れても再度聞いてくると言う事ですか?
guest

回答1

0

confで、下にまとめて追記したとおっしゃっていますが、
http_access allow password
は、
http_access deny all
よりも上に書かないとだめなのでは?

(追記)

たぶん
http_access allow localnet でネットワークアドレスによる制限を指定し、
さらにpasswordでも認証したい場合、

http_access allow localnet password

の様に書かないとだめ、ってことだと思うのですが、
試してみてもらえますか。

投稿2018/10/16 09:54

編集2018/10/17 06:35
taka-saan

総合スコア665

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

oit1234

2018/10/17 05:04

書き直して見て全てまとめて上にしたのですが、ログイン画面は表示されるようになったのですが、ログイン認証がうまくできません。
taka-saan

2018/10/17 05:15

「全部まとめて上」じゃなくて、各々の行を正しい場所に書かないといけませんよ。 元からある設定に似たものは揃えて近くに書く、場所は英文のコメントにしたがう、順序に意味のあるものは順序を意識して並べる(allow/denyの順番など)、依存性のある記述は参照している行よりも参照される行を上に書く。
taka-saan

2018/10/17 06:36

回答追記しました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問