2010-11-30 2 views
0

들어오는 요청마다 사용자 정의 인증 도우미를 사용하여 역방향 프록시로 Squid를 구성해야합니다. 오징어에 대한 모든 요청은 기본 인증으로 간주됩니다. 인증에 실패한 모든 연결은 종료되어야합니다. 나는 오징어에서 초보자입니다. 다음은 내가 사용한 설정 스크립트이다. 이 샘플은, "mindofaprogrammer.blog.com"에 접근을 나는 PHP 스크립트에서 사용자 정의 인증 도우미를 작성했습니다액셀러레이터 모드 (역방향 프록시)에서 사용자 정의 인증 도우미로 squid 구성

acl all src all 
acl manager proto cache_object 

http_port 80 accel defaultsite=mindofaprogrammer.blog.com 
cache_peer mindofaprogrammer.blog.com parent 80 0 no-query originserver name=myAccel 

acl myblog dstdomain mindofaprogrammer.blog.com 
http_access allow myblog 
cache_peer_access myAccel allow myblog 
cache_peer_access myAccel deny all 


auth_param basic program C:/wamp/bin/php/php5.3.0/php.exe "c:/squid/libexec/authhelper.php" 
auth_param basic children 2 
auth_param basic realm eReader 
auth_param basic credentialsttl 5 hours 

acl AuthUsers proxy_auth REQUIRED 
http_access allow AuthUsers 

access_log c:/squid/var/logs/access.log squid 
coredump_dir c:/squid/var/cache 

입니다. 다음과 같은 목록이

<?php 
$f = fopen("php://stdin", "r"); 
while ($line = fgets($f)) { 
     $line = trim($line); 
     $fields = explode(' ', $line); 
     $username = rawurldecode($fields[0]); //1738 
     $password = rawurldecode($fields[1]); //1738 
     if ($username == 'hello' 
      and $password == 'world') { 
       fwrite(STDOUT, "OK\n"); 
     } else if ($username == 'fo' 
      and $password == 'bar') { 
       fwrite(STDOUT, "OK\n"); 
     } else { 
       // failed miserably 
       fwrite(STDOUT, "ERR\n"); 
     } 
} 
?> 

심지어이를 구성한 후, IS 직면하고 문제 만 리버스 프록시 설정이 인증되지 노력하고있다. 내가 여기서 뭔가 잘못하고있는거야?

+0

주제가 아닙니다. 수퍼 유저/관리자 질문입니다. – leppie

답변

0

먼저 바닥에 http_access deny all을 추가해야한다고 생각합니다.

그런 다음이 같은 (이하 ""연산자로) 하나의 선으로 두 http_access'es을 결합해야합니다

http_access allow AuthUsers myblog 

오징어가 항상 일치하는 첫 번째 줄를 사용하는 기억하고 처리를 더 이상 중지합니다. 귀하의 라인에서 http_access allow myblog은 단순히 모든 요청을 수락하고 인증 부분으로 이동하는 것을 중지합니다.

관련 문제