大网数据广告活动
服务器运维问答

Authenticate NTLM at reverse proxy in front of unauthenticated web servers

· 52CE 我爱测

I have several Linux HTTP servers setup with no authentication required to access the web content. I would like for my Windows users to be able to access these sites with pass-through authentication. I don't want to have to try a…

问题原文

原帖链接 · getsauce · CC BY-SA 4.0

I have several Linux HTTP servers setup with no authentication required to access the web content. I would like for my Windows users to be able to access these sites with pass-through authentication.

I don't want to have to try and set this up on every web server though. My idea is that I could NTLM authenticate them at a reverse proxy and then the proxy could make the unauthenticated request and the web servers would only accept connections from said reverse proxy. Ideally I would be able to restrict access to certain sites/urls based on the users AD group but that is not a requirement.

Most examples/tutorials I have come across in searching are about proxying the credentials all the way to the destination web server but I want the proxy to do the authentication itself. I'm fine with running the proxy in Windows if I need. Whatever is easiest to setup is what I'm looking for.

已采纳解答

原帖链接 · getsauce · CC BY-SA 4.0

I ended up with 2 viable solutions to this problem. Hopefully this will be helpful to anyone trying to setup something similar.

  1. Set up IIS with ARR (Application Request Routing) and enable Windows authentication globally. Then, configure a global authorization rule to allow whichever users you want to be able to authenticate through the reverse proxy. The downsides to this method were that you can't easily set different permissions to different sites if you're proxying more than one. You can specify a "location path" in a URL authorization rule but you can't say server1 allow these users server2 allow these users.

  2. The option I chose to use was running Apache 2.4 w/ a newer NTLM plugin I found on Github (https://github.com/TQsoft-GmbH/mod_authn_ntlm). I didn't come across any drawbacks using this method. Config below.

    <VirtualHost *:*>
      ProxyPass / http://server1/
      ProxyPassReverse / http://server1
    
      ServerName proxy1
    
      <Location /* >
        AuthType SSPI
        NTLMAuth On
        NTLMAuthoritative On
        NTLMOfferBasic On
        <RequireAny>
          Require sspi-user contoso\johnsmith
        </RequireAny>
      </Location>
    </VirtualHost>
    
    <VirtualHost *:*>
      ProxyPass / http://server2/
      ProxyPassReverse / http://server2
    
      ServerName proxy2
    
      <Location /* >
        AuthType SSPI
        NTLMAuth On
        NTLMAuthoritative On
        NTLMOfferBasic On
        <RequireAny>
          Require sspi-group "contoso\Domain Users"
        </RequireAny>
      </Location>
    </VirtualHost>
    

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-07-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。