nginx-auth-ldap
nginx-auth-ldap copied to clipboard
fix segfault in ngx_http_auth_ldap_ssl_handshake_handler and add "chain" option for ssl_check_cert
This pull request addresses two things relating to ngx_http_auth_ldap_ssl_handshake_handler:
- Fixes kvspb/nginx-auth-ldap#236 by not assuming
conn->sockaddris non-NULL. Instead, it tries to get it fromconn->sockaddr,c->conn.sockaddr, and finallyc->server->parsed_url.sockaddr.sockaddr, in that order:
struct sockaddr *conn_sockaddr = NULL;
if (conn->sockaddr != NULL) conn_sockaddr = conn->sockaddr;
else if (c->conn.sockaddr != NULL) conn_sockaddr = c->conn.sockaddr;
else conn_sockaddr = &c->server->parsed_url.sockaddr.sockaddr;
Additionally, it uses the correct AF_INET and AF_INET6 constants for checking sa_family for IPv4 vs. IPv6, rather than the incorrect 4 and 6 integer literals.
ssl_check_certnow acceptschainin addition toonandoff:
on- full certificate verification inngx_http_auth_ldap_ssl_handshake_handler, meaning checking the certificate chain withSSL_get_verify_resultandX509_check_hostorX509_check_ip(same as previousonbehavior;fullcan also be used to mean the same thing ason)off- no certificate verification (same as previousoffbehavior)chain- perform certificate chain verification withSSL_get_verify_result, but don't do host/IP verification (i.e., don't callX509_check_hostorX509_check_ip)
This should not break backwards compatibility. I've been testing it in conjunction with an issue in my project (idaholab/Malcolm#128) and it addresses my needs. I've left the checks in place for OPENSSL_VERSION_NUMBER to leave the warnings in place if compiled with too old a version of openssl.
Let me know if you've got any issues or questions.
ping... project still active?