1

我正在嘗試設置需要使用OpenID Connect身份提供程序進行身份驗證的反向代理服務器。Apache2反向代理服務器,通過OpenID連接進行身份驗證並通過ldap進行授權

然後,用戶授予其數據的反向代理訪問權限。

代理背後的一些應用程序只有在用戶是特定LDAP組的成員時纔可以訪問。可悲的是,應用程序是轉儲並且無法授權,因此反向代理必須處理該部分。

mod_auth_openidc設置認證部分並不困難。 我與之奮鬥的是授權部分。我有一個mod_authnz_ldap工作示例,需要用戶名和密碼BasicAuth

與OpenID Connect的想法是資源服務器(在我的情況下代理)永遠不會知道用戶的密碼,不必檢查它。這被委託給OpenID Connect身份提供商。

所以我沒有這種方法所需的密碼。我的想法是創建一個帶有oidc auth的虛擬主機,它拒絕來自客戶端的一些標頭,如x-my-oidc-username,設置此標頭一旦通過驗證並將請求傳遞給127.0.0.1上的另一個虛擬主機綁定,因此無法直接通過身份驗證直接訪問它。該虛擬主機僅將頭部作爲經過身份驗證的用戶名並運行LDAP授權。

我還沒有看到一種方法可以跳過ldap模塊的Authentication Phase,並從其他地方(比如OpenID Connect ID令牌)或從我的自定義標頭獲取用戶名。

任何想法/建議/方法/提示?

回答

1

有一篇文章,介紹如何結合mod_auth_openidcmod_authnz_ldap這裏: https://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> 
相關問題