使用NTLM的Windows身份验证的nginx反向代理

mat*_*eus 12 ntlm reverse-proxy nginx

任何人都知道是否可以使用NTLM的Windows身份验证进行反向代理?我找不到任何这方面的例子.more_set_headers字段的值应该是多少?

location / {
            proxy_http_version      1.1;
            proxy_pass_request_headers on;
            proxy_set_header        Host            $host;
            proxy_set_header        X-Real-IP       $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;


            more_set_input_headers  'Authorization: $http_authorization';

            proxy_set_header  Accept-Encoding  "";

            proxy_pass              http://host/;
            proxy_redirect          default;
            #This is what worked for me, but you need the headers-more mod
            more_set_headers        -s 401 'WWW-Authenticate: Basic realm="host.local"';
}
Run Code Online (Sandbox Code Playgroud)

如果我直接访问主机,则如果我使用反向代理访问身份验证,则每次身份验证都会失败.

小智 14

使用Nginx启用NTLM传递 -

upstream http_backend {
    server 2.3.4.5:80;
    keepalive 16;
}
server {
    ...
    location / {
       proxy_pass http://http_backend/;
       proxy_http_version 1.1;
       proxy_set_header Connection "";
    ...
    }
 }
Run Code Online (Sandbox Code Playgroud)

- 拉蒙

  • 这看起来很有效,但事实上却没有。就我而言,它导致用户会话混合(!!!),即用户可能突然以另一个用户身份登录。请参阅此回复http://mailman.nginx.org/pipermail/nginx/2016-February/049889.html (3认同)

Ton*_*rtz 4

据我所知,目前 nginx 还无法做到这一点。不久前我自己对此进行了深入研究。基本问题是 NTLM 身份验证将要求在后续请求中使用相同的套接字,但代理不会这样做。在 nginx 开发团队为这种行为提供某种支持之前,我处理此问题的方法是在反向代理本身中进行身份验证。我目前正在使用 apache 2.2、mod_proxy、mod_auth_sspi (不完美,但有效)来执行此操作。祝你好运!抱歉,nginx,我爱你,但我们确实可以为这个常见用例提供一些帮助。