【问题标题】:Apache2 Reverse Proxy with authentication over OpenID Connect and authorization over ldapApache2 反向代理,通过 OpenID Connect 进行身份验证并通过 ldap 进行授权
【发布时间】:2016-11-25 10:23:58
【问题描述】:

我正在尝试设置一个反向代理,该代理需要针对 OpenID Connect 身份提供者进行身份验证。

然后用户授予反向代理访问他的数据。

代理背后的某些应用程序只有在用户是特定 LDAP 组的成员时才能访问。遗憾的是,应用程序是转储,无法自行授权,因此反向代理必须处理该部分。

使用mod_auth_openidc 设置身份验证部分并不难。 我纠结的是授权部分。我有一个 mod_authnz_ldap 的工作示例,它需要用户名和密码而不是 BasicAuth

OpenID Connect 的想法是资源服务器(在我的例子中是代理)永远不会知道用户的密码,也不必检查它。这是委托给 OpenID Connect 身份提供者的。

所以我没有这种方法所需的密码。我的想法是创建一个带有 oidc auth 的虚拟主机,它拒绝来自客户端的 x-my-oidc-username 之类的标头,在经过身份验证后设置此标头,并将请求传递给 127.0.0.1 上的另一个 vhost 绑定,因此无法绕过身份验证直接访问它。该虚拟主机仅将标头作为经过身份验证的用户名并运行 LDAP 授权。

我还没有看到跳过 ldap 模块的 Authentication Phase 并从其他地方(例如 OpenID Connect ID 令牌)或我的自定义标头获取用户名的方法。

有什么想法/建议/方法/提示?

【问题讨论】:

    标签: apache2 authorization reverse-proxy openid-connect mod-auth-openidc


    【解决方案1】:

    这里有一篇文章展示了如何结合mod_auth_openidcmod_authnz_ldaphttps://github.com/pingidentity/mod_auth_openidc/wiki/Authorization#2-mod_authnz_ldap:

    OIDCProviderMetadataURL https://accounts.google.com/.well-known/openid-configuration
    OIDCClientID <client_id>
    OIDCClientSecret <client_secret>
    OIDCRedirectURI http://example.com/example/redirect_uri
    OIDCScope "openid email profile"
    
    # Set REMOTE_USER to the email address.
    # this is the value that mod_authnz_ldap leverages as the first parameter after basedn. 
    # in the example below, REMOTE_USER = email = mail attribute in LDAP.
    
    OIDCRemoteUserClaim email
    <Location /example/>
      AuthType openid-connect
      AuthLDAPURL "ldap://example.com/ou=people,dc=example,dc=com?mail?sub?(objectClass=*)"
      AuthLDAPGroupAttribute member
      Require ldap-group cn=myTestAccesss,ou=Groups,dc=example,dc=com
    </Location>
    

    【讨论】:

      猜你喜欢
      • 2018-04-12
      • 1970-01-01
      • 1970-01-01
      • 2010-12-11
      • 2014-09-10
      • 2019-05-03
      • 2014-06-12
      • 2018-01-01
      • 2014-02-19
      相关资源
      最近更新 更多