Merge pull request #66 from amoiseiev/master

Treating LDAP_NO_SUCH_OBJECT as soft error, updating example.conf
main
Valery 10 years ago
commit 7de94294e6
  1. 70
      example.conf
  2. 2
      ngx_http_auth_ldap_module.c

@ -11,32 +11,48 @@ http {
sendfile on; sendfile on;
keepalive_timeout 65; keepalive_timeout 65;
auth_ldap_url ldap://ldap.example.com/dc=example,dc=com?uid?sub?(objectClass=person); # define ldap server
auth_ldap_binddn cn=nginx,ou=service,dc=example,dc=com; ldap_server ad_1 {
auth_ldap_binddn_passwd mYsUperPas55W0Rd; # user search base.
url "ldap://<YOUR LDAP SERVER>:3268/OU=Offices,DC=company,DC=com?sAMAccountName?sub?(objectClass=person)";
auth_ldap_group_attribute uniquemember; # default 'member' # bind as
auth_ldap_group_attribute_is_dn on; # default on binddn "CN=Operator,OU=Service Accounts,DC=company,DC=com";
# bind pw
server { binddn_passwd <PUT Operator's PASSWORD HERE>;
listen 8081; # group attribute name which contains member object
server_name localhost; group_attribute member;
# search for full DN in member object
location / { group_attribute_is_dn on;
auth_ldap "Closed content"; # matching algorithm (any / all)
satisfy any;
#auth_ldap_require valid_user; # list of allowed groups
auth_ldap_require user 'cn=Super User,ou=user,dc=example,dc=com'; require group "CN=Admins,OU=My Security Groups,DC=company,DC=com";
auth_ldap_require group 'cn=admins,ou=group,dc=example,dc=com'; require group "CN=New York Users,OU=My Security Groups,DC=company,DC=com";
auth_ldap_require group 'cn=user,ou=group,dc=example,dc=com'; # list of allowed users
auth_ldap_satisfy any; # require 'valid_user' cannot be used together with 'user' as valid user is a superset
root html; # require valid_user;
index index.html index.htm; require user "CN=Batman,OU=Users,OU=New York Office,OU=Offices,DC=company,DC=com";
} require user "CN=Robocop,OU=Users,OU=New York Office,OU=Offices,DC=company,DC=com";
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
} }
}
server {
listen 8081;
server_name localhost;
location / {
# adding ldap authentication
auth_ldap "Closed content";
auth_ldap_servers ad_1;
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
} }

@ -1898,7 +1898,7 @@ ngx_http_auth_ldap_check_group(ngx_http_request_t *r, ngx_http_auth_ldap_ctx_t *
ctx->outcome = OUTCOME_ALLOW; ctx->outcome = OUTCOME_ALLOW;
return NGX_OK; return NGX_OK;
} }
} else if (ctx->error_code == LDAP_COMPARE_FALSE || ctx->error_code == LDAP_NO_SUCH_ATTRIBUTE) { } else if (ctx->error_code == LDAP_COMPARE_FALSE || ctx->error_code == LDAP_NO_SUCH_ATTRIBUTE || ctx->error_code == LDAP_NO_SUCH_OBJECT) {
if (ctx->server->satisfy_all == 1) { if (ctx->server->satisfy_all == 1) {
ctx->outcome = OUTCOME_DENY; ctx->outcome = OUTCOME_DENY;
return NGX_DECLINED; return NGX_DECLINED;

Loading…
Cancel
Save