Commit Graph

118 Commits

Author SHA1 Message Date
Valery Komarov 8f7c1f3cbb Merge pull request #139 from victorhahncastell/master
Supress escalating manual warnings to errors for clang
2016-09-22 13:38:26 +04:00
Valery Komarov 39e59fadaf Merge pull request #147 from eramoto/not-insert-same-request
Not insert the same request at ngx_http_auth_ldap_get_connection()
2016-09-22 13:37:48 +04:00
ERAMOTO Masaya 0e919ab838 Not insert the same request at ngx_http_auth_ldap_get_connection()
When inserting the same request to waiting_requests queue twice, the queue will be broken.
In addition, the following segmentation fault occurs at the second ngx_http_auth_ldap_return_connection()
if the nginx binary was compiled with --with-debug.

By this fix, ngx_http_auth_ldap_get_connection() will not insert the same request.

  * debug messages at the moment nginx dumped core

    ====
    2016/07/26 13:19:09 [debug] 4299#0: *2 http_auth_ldap: Authentication loop (phase=0, iteration=0)
    2016/07/26 13:19:09 [debug] 4299#0: *2 event timer add: 3: 10000:1469506759827
    2016/07/26 13:19:09 [debug] 4299#0: *2 http_auth_ldap: request_timeout=10000
    2016/07/26 13:19:09 [debug] 4299#0: *2 http_auth_ldap: Authentication loop (phase=1, iteration=0)
    2016/07/26 13:19:09 [debug] 4299#0: *2 http_auth_ldap: Wants a free connection to "test_ldap"
    2016/07/26 13:19:09 [debug] 4299#0: *2 http_auth_ldap: No connection available at the moment, waiting...
    2016/07/26 13:19:09 [debug] 4299#0: *2 http run request: "/portal/Image?"
    2016/07/26 13:19:09 [debug] 4299#0: *2 access phase: 6
    2016/07/26 13:19:09 [debug] 4299#0: *2 http_auth_ldap: Authentication loop (phase=1, iteration=0)
    2016/07/26 13:19:09 [debug] 4299#0: *2 http_auth_ldap: Wants a free connection to "test_ldap"
    2016/07/26 13:19:09 [debug] 4299#0: *2 http_auth_ldap: No connection available at the moment, waiting...
    <snip>
    2016/07/26 13:19:09 [debug] 4299#0: *5 http_auth_ldap: Authentication loop (phase=6, iteration=1)
    2016/07/26 13:19:09 [debug] 4299#0: *5 event timer del: 12: 1469506759826
    2016/07/26 13:19:09 [debug] 4299#0: http_auth_ldap: Marking the connection to "test_ldap" as free
    <snip>
    2016/07/26 13:19:09 [debug] 4299#0: *2 http_auth_ldap: Authentication loop (phase=6, iteration=1)
    2016/07/26 13:19:09 [debug] 4299#0: *2 event timer del: 3: 1469506759827
    2016/07/26 13:19:09 [debug] 4299#0: http_auth_ldap: Marking the connection to "test_ldap" as free
    2016/07/26 13:19:09 [notice] 4298#0: signal 17 (SIGCHLD) received
    2016/07/26 13:19:09 [alert] 4298#0: worker process 4299 exited on signal 11 (core dumped)
    ====

  * backtrace

    ====
    Program terminated with signal SIGSEGV, Segmentation fault.
    #0  0x0000000000491b73 in ngx_http_auth_ldap_return_connection (c=0x26a84e8) at /tmp/test/nginx-1.11.2/../nginx-auth-ldap/ngx_http_auth_ldap_module.c:1117
    1117                ngx_queue_remove(q);
    (gdb) bt
    #0  0x0000000000491b73 in ngx_http_auth_ldap_return_connection (c=0x26a84e8) at /tmp/test/nginx-1.11.2/../nginx-auth-ldap/ngx_http_auth_ldap_module.c:1117
    #1  0x000000000049496a in ngx_http_auth_ldap_authenticate (conf=<optimized out>, ctx=0x26e4698, r=0x26e35a0)
        at /tmp/test/nginx-1.11.2/../nginx-auth-ldap/ngx_http_auth_ldap_module.c:1902
    #2  ngx_http_auth_ldap_handler (r=0x26e35a0) at /tmp/test/nginx-1.11.2/../nginx-auth-ldap/ngx_http_auth_ldap_module.c:1717
    #3  0x0000000000446c38 in ngx_http_core_access_phase (r=<optimized out>, ph=0x26a7f48) at src/http/ngx_http_core_module.c:1071
    #4  0x00000000004428a3 in ngx_http_core_run_phases (r=r@entry=0x26e35a0) at src/http/ngx_http_core_module.c:845
    #5  0x0000000000491ab7 in ngx_http_auth_ldap_wake_request (r=0x26e35a0) at /tmp/test/nginx-1.11.2/../nginx-auth-ldap/ngx_http_auth_ldap_module.c:1063
    #6  0x0000000000491c44 in ngx_http_auth_ldap_reply_connection (c=c@entry=0x26a84e8, error_code=0, error_msg=<optimized out>)
        at /tmp/test/nginx-1.11.2/../nginx-auth-ldap/ngx_http_auth_ldap_module.c:1141
    #7  0x00000000004956b8 in ngx_http_auth_ldap_read_handler (rev=0x265d500) at /tmp/test/nginx-1.11.2/../nginx-auth-ldap/ngx_http_auth_ldap_module.c:1486
    #8  0x00000000004384fe in ngx_epoll_process_events (cycle=0x26594e0, timer=<optimized out>, flags=<optimized out>) at src/event/modules/ngx_epoll_module.c:900
    #9  0x000000000042ea85 in ngx_process_events_and_timers (cycle=cycle@entry=0x26594e0) at src/event/ngx_event.c:242
    #10 0x0000000000435fe0 in ngx_worker_process_cycle (cycle=0x26594e0, data=<optimized out>) at src/os/unix/ngx_process_cycle.c:753
    #11 0x0000000000434942 in ngx_spawn_process (cycle=cycle@entry=0x26594e0, proc=proc@entry=0x435f3d <ngx_worker_process_cycle>, data=data@entry=0x0,
        name=name@entry=0x49abb7 "worker process", respawn=respawn@entry=-3) at src/os/unix/ngx_process.c:198
    #12 0x000000000043613d in ngx_start_worker_processes (cycle=cycle@entry=0x26594e0, n=1, type=type@entry=-3) at src/os/unix/ngx_process_cycle.c:358
    #13 0x0000000000436bd6 in ngx_master_process_cycle (cycle=cycle@entry=0x26594e0) at src/os/unix/ngx_process_cycle.c:130
    #14 0x000000000041168b in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:367
    ====
2016-07-28 11:40:43 +09:00
Victor Hahn ac3e805216 Merge branch 'master' of github.com:kvspb/nginx-auth-ldap 2016-05-27 14:08:25 +02:00
Victor Hahn df18cf0a41 Supress escalating manual warnings to errors for clang 2016-05-27 14:06:41 +02:00
Valery Komarov dbcef31beb Merge pull request #131 from gringus/master
Support for building as dynamic module
2016-04-28 18:48:18 +03:00
Marcin Deranek c8d8678368 Support for building as dynamic module 2016-04-28 14:32:05 +02:00
Valery Komarov 8517bb05ec Merge pull request #121 from victorhahncastell/master
Verify certificate CN/SAN
2016-02-05 22:28:15 +03:00
Victor Hahn 2e3e8a9e14 Verify certificate CN/SAN 2016-02-05 17:18:01 +01:00
Valery Komarov d0f2f829f7 Merge pull request #100 from victorhahncastell/master
Provide SSL certificate verification
2016-01-13 22:08:10 +03:00
Valery Komarov 256cafe826 Merge pull request #109 from rascal-hats/patch-1
Update ngx_http_auth_ldap_module.c - Initialize variable before use.
2016-01-13 22:07:26 +03:00
Valery Komarov d0058d6930 Merge pull request #89 from denji/darwin
darwin requires lber
2016-01-13 22:06:59 +03:00
Valery Komarov d7d67710c0 Merge pull request #95 from petrovich-ua/master
change confuging emergency error message to notice
2016-01-13 22:06:53 +03:00
rascal-hats 878da132fb Update ngx_http_auth_ldap_module.c
Initialize count on line 806. Prevents compilation errors.

```
nginx-auth-ldap/ngx_http_auth_ldap_module.c:815:26: error: variable 'count' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
    cache->num_buckets = count;
                         ^~~~~
nginx-auth-ldap/ngx_http_auth_ldap_module.c:793:27: note: initialize the variable 'count' to silence this warning
    ngx_uint_t want, count, i;
                          ^
                           = 0
```
2015-12-16 13:22:45 -06:00
Victor Hahn acb13cffaf Amend documentation 2015-09-29 13:01:19 +02:00
Victor Hahn 6389f806d5 Expose SSL certificate verification as config option 2015-09-29 12:41:20 +02:00
Victor Hahn 65522703ae Verify remote SSL certificate 2015-09-29 02:19:00 +02:00
Victor Hahn Castell 7802d53f0a Fix typo 2015-09-28 18:39:02 +02:00
Petrovich 3f7ab7f81f change confuging emergency error message to notice 2015-08-04 16:06:21 +03:00
Denis Denisov aaa629866a darwin requires lber 2015-06-20 01:09:56 +03:00
Valery Komarov be8ff8eecb Merge pull request #85 from denji/debug
Added some debug
2015-06-03 09:31:29 +03:00
Jakub Podeszwik e5ec574249 Added some debug 2015-06-03 04:09:47 +03:00
Valery Komarov 928856aa95 Merge pull request #81 from MarkusMattinen/master
avoid crashes comparing groups
2015-05-21 15:52:54 +03:00
Valery Komarov b3f6b86583 Merge pull request #83 from jbq/issue_80
Fix #80 LDAP connection failures are silently swallowed
2015-05-21 15:50:02 +03:00
Jean-Baptiste Quenot bd58ee3c75 Fix #80 LDAP connection failures are silently swallowed 2015-05-20 17:48:55 +02:00
Donald Huang febe91256f avoid crashes comparing groups 2015-05-14 10:42:08 +03:00
Valery Komarov 0d6ba9a12e Merge pull request #79 from sonnius/master
Compile cleanly on FreeBSD
2015-04-30 13:31:09 +03:00
sonnius dab16a5f62 Compile cleanly on FreeBSD
Compile cleanly on FreeBSD

FreeBSD 10.1 (tested version) needs the lber during linking.
2015-04-30 15:23:48 +12:00
Valery Komarov a8b5948e0e Merge pull request #75 from cryptogopher/master
Checking if ldap_server is defined before auth_ldap_servers.
2015-03-01 09:51:47 +03:00
cryptogopher 91f951ecd9 Checking if ldap_server is defined before auth_ldap_servers. Getting segfault without this check. 2015-02-28 14:33:10 +01:00
Valery b365771d2a Merge pull request #65 from pweiskircher/master
Authentication timeout and segmentation fault fix on multiple, concurrent requests being processed at the same time
2015-01-19 18:07:01 +03:00
Valery 7de94294e6 Merge pull request #66 from amoiseiev/master
Treating LDAP_NO_SUCH_OBJECT as soft error, updating example.conf
2015-01-19 17:46:57 +03:00
Valery 8d95546cf2 Merge pull request #68 from lucamilanesio/ldap-configurable-connection-timeout
Configurable timeouts on a per-LDAP server basis
2015-01-19 17:45:49 +03:00
Luca Milanesio 8e92526458 Configurable timeouts on a per-LDAP basis
Enable configure timeouts for LDAP connections and queries
on ldap_server section.

Example config:

ldap_server myldap {
    url ldap://myldap.org/CN=users,CN=accounts,DC=myorg?uid?sub?(objectClass=person);
    connections 10;
    connect_timeout 30s;
    reconnect_timeout 5s;
    bind_timeout 15s;
    request_timeout 20s;
    require valid_user;
}

When timeout settings are not defined, the previous hardcoded values are used as
default : 5s (bind), 10s (connect, reconnect, request).
2015-01-14 12:51:52 +00:00
Andrii Moiseiev 4b7f989831 replacing tabs with spaces to fix example.conf formating 2015-01-12 14:10:42 -05:00
Andrii Moiseiev c8a1b733c3 replacing tabs with spaces to fix example.conf formating 2015-01-12 14:07:10 -05:00
Andrii Moiseiev a54a7b8971 replacing tabs with spaces to fix example.conf formating 2015-01-12 14:05:37 -05:00
Andrii Moiseiev d1dbca7d0d fixing auth failure issue when CN of user or group doesn't exist 2015-01-12 14:02:44 -05:00
Patrik Weiskircher 95d64f0797 don't return the connection after every LDAP reply.
This makes the connection more sticky to one request and prevents auth timeouts and lost requests.
2014-12-23 10:46:20 -05:00
Patrik Weiskircher a471062903 remove quick and dirty hack to rebind to the search user. it has been implemented correctly already. 2014-12-23 10:45:04 -05:00
Patrik Weiskircher 20f279f0f9 Fix requests that were waiting on a LDAP connection getting lost and timing out after 10 seconds. 2014-12-22 12:52:28 -05:00
Valery cc76ecbd33 Merge pull request #58 from nyoxi/master
Fix: Passed incorrect pointer to SSL handshake handler.
2014-09-19 21:43:08 +04:00
Tomáš Golembiovský fae9e215c6 Passed incorrect pointer to SSL handshake handler. 2014-09-18 14:16:58 +02:00
Valery 7aa2414c76 Merge pull request #45 from nyoxi/master
Removed recursion during ssl handshake (should fix #34)
2014-09-17 21:48:37 +04:00
Valery 8a2e128ba7 Merge pull request #54 from huangsam/patch-1
config: Fix compilation for Linux
2014-09-17 21:47:46 +04:00
Samuel Huang eaae4dac6f config: Fix compilation for Linux
Attempt to resolve https://github.com/kvspb/nginx-auth-ldap/issues/23
2014-09-08 23:55:23 -07:00
Valery 8f2b5f86f4 Merge pull request #39 from pmenglund/readme
updated README
2014-06-09 15:15:45 +04:00
Valery a8a5cd233e Merge pull request #41 from davidjb/master
Fix authentication for user/group validations - passwords fail to be checked
2014-06-09 15:13:52 +04:00
Valery 687b0a5af0 Merge pull request #37 from prune998/patch-1
Update ngx_http_auth_ldap_module.c
2014-06-09 15:12:55 +04:00
Tomáš Golembiovský 930918b6c9 Fixed compilation without SSL (fixes #22) 2014-05-15 19:56:27 +02:00