проблема с satisfy any;

Igor Sysoev is at rambler-co.ru
Fri Sep 18 11:56:31 MSD 2009


On Fri, Sep 18, 2009 at 10:25:14AM +0300, Andrew Sitnikov wrote:

> Hello Nginx-ru,
> 
> http {
>     include       /etc/nginx/mime.types;
>     default_type  application/octet-stream;
> 
>     sendfile  on;
>     gzip  on;
> 
>     server {
>         listen  8000;
> 
>             satisfy any;
>             allow 1.2.3.4/32;
>             deny all;
>                                                                                                                                              
>             auth_basic "Restricted Zone";                                                                                                            
>             auth_basic_user_file  /etc/nginx/.htpasswd;
>     
>             location / {
>             root   /var/www/nginx/htdocs;
>             index  index.html;
>         }
>     }
> }
> 
> пускает всех без пароля
> 
> 
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http keepalive handler
> 2009/09/18 10:21:56 [debug] 18407#0: *1 recv: fd:7 741 of 1024
> 2009/09/18 10:21:56 [debug] 18407#0: *1 malloc: 0000000019846680:1256
> 2009/09/18 10:21:56 [debug] 18407#0: *1 malloc: 0000000019846B70:4096
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http process request line
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http request line: "GET / HTTP/1.1"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http uri: "/"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http args: ""
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http exten: ""
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http process request header line
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http header: "Host: si.infonet.ee:8000"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http header: "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729) FirePHP/0.3"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http header: "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http header: "Accept-Language: ru,et;q=0.8,en-us;q=0.5,en;q=0.3"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http header: "Accept-Encoding: gzip,deflate"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http header: "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http header: "Keep-Alive: 300"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http header: "Connection: keep-alive"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http header: "Cookie: __utma=249880286.2222220113037372700.1212130890.1252321395.1252671946.114; __utmz=249880286.1248688649.100.7.utmcsr=netinfo.ee|utmccn=(referral)|utmcmd=referral|utmcct=/smi/; use_remote=1; debug_session_id=50870850; __utmc=249880286"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http header: "If-Modified-Since: Tue, 05 Feb 2008 10:27:30 GMT"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http header: "Cache-Control: max-age=0"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http header done
> 2009/09/18 10:21:56 [debug] 18407#0: *1 event timer del: 7: 1253258571507
> 2009/09/18 10:21:56 [debug] 18407#0: *1 generic phase: 0
> 2009/09/18 10:21:56 [debug] 18407#0: *1 add cleanup: 0000000019847550
> 2009/09/18 10:21:56 [debug] 18407#0: *1 generic phase: 1
> 2009/09/18 10:21:56 [debug] 18407#0: *1 test location: "/"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 using configuration "/"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http cl:-1 max:1048576
> 2009/09/18 10:21:56 [debug] 18407#0: *1 generic phase: 3
> 2009/09/18 10:21:56 [debug] 18407#0: *1 post rewrite phase: 4
> 2009/09/18 10:21:56 [debug] 18407#0: *1 generic phase: 5
> 2009/09/18 10:21:56 [debug] 18407#0: *1 add cleanup: 0000000019847588
> 2009/09/18 10:21:56 [debug] 18407#0: *1 generic phase: 6
> 2009/09/18 10:21:56 [debug] 18407#0: *1 generic phase: 7
> 2009/09/18 10:21:56 [debug] 18407#0: *1 access phase: 8
> 2009/09/18 10:21:56 [debug] 18407#0: *1 content phase: 12
> 2009/09/18 10:21:56 [debug] 18407#0: *1 open index "/var/www/nginx/htdocs/index.html"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 internal redirect: "/index.html?"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 generic phase: 1
> 2009/09/18 10:21:56 [debug] 18407#0: *1 test location: "/"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 using configuration "/"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http cl:-1 max:1048576
> 2009/09/18 10:21:56 [debug] 18407#0: *1 generic phase: 3
> 2009/09/18 10:21:56 [debug] 18407#0: *1 post rewrite phase: 4
> 2009/09/18 10:21:56 [debug] 18407#0: *1 generic phase: 5
> 2009/09/18 10:21:56 [debug] 18407#0: *1 add cleanup: 00000000198475E8
> 2009/09/18 10:21:56 [debug] 18407#0: *1 generic phase: 6
> 2009/09/18 10:21:56 [debug] 18407#0: *1 generic phase: 7
> 2009/09/18 10:21:56 [debug] 18407#0: *1 access phase: 8
> 2009/09/18 10:21:56 [debug] 18407#0: *1 content phase: 12
> 2009/09/18 10:21:56 [debug] 18407#0: *1 content phase: 13
> 2009/09/18 10:21:56 [debug] 18407#0: *1 content phase: 14
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http filename: "/var/www/nginx/htdocs/index.html"
> 2009/09/18 10:21:56 [debug] 18407#0: *1 add cleanup: 0000000019847648
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http static fd: 10
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http set discard body
> 2009/09/18 10:21:56 [debug] 18407#0: *1 http ims:1202207250 lm:1202207250
> 2009/09/18 10:21:56 [debug] 18407#0: *1 HTTP/1.1 304 Not Modified
> Server: nginx/0.7.62
> Date: Fri, 18 Sep 2009 07:21:56 GMT
> Last-Modified: Tue, 05 Feb 2008 10:27:30 GMT
> Connection: keep-alive

У меня эта конфигурация на 0.7.62 выдало такое:

2009/09/18 11:37:38 [debug] 98153#0: *1 access phase: 8
2009/09/18 11:37:38 [debug] 98153#0: *1 access: 935A1351 FFFFFFFF 04030201
2009/09/18 11:37:38 [debug] 98153#0: *1 access: 935A1351 00000000 00000000
2009/09/18 11:37:38 [debug] 98153#0: *1 access phase: 9
2009/09/18 11:37:38 [error] 98153#0: *1 no user/password was provided for basic authentication, ...
2009/09/18 11:37:38 [debug] 98153#0: *1 post access phase: 10

Если же все access директивы убрать, то будет так:

2009/09/18 11:44:22 [debug] 98178#0: *1 access phase: 8
2009/09/18 11:44:22 [debug] 98178#0: *1 access phase: 9
2009/09/18 11:44:22 [debug] 98178#0: *1 post access phase: 10

Есть ощущение, что не собран один из модулей - ngx_http_access_module
или ngx_http_auth_basic_module. Что показывает "nginx -t" ?


-- 
Игорь Сысоев
http://sysoev.ru







More information about the nginx-ru mailing list