Commit Graph

209 Commits

Author SHA1 Message Date
8e416f19be ssl_io_filter_handshake(): When a post-handshake check fails,
return an error code understood by ssl_io_filter_error().

That function needs to perform error handling, and a valid
apr_status_t needs to be returned up.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1645529 13f79535-47bb-0310-9956-ffa450edef68
2014-12-14 21:48:25 +00:00
00e4c4fbc9 tab vs space
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1633530 13f79535-47bb-0310-9956-ffa450edef68
2014-10-22 05:25:02 +00:00
d8fd328cfb mod_ssl: Fix SSL_CLIENT_VERIFY value when "SSLVerifyClient optional_no_ca" and
SSLSessionCache are used and SSL session is resumed. SSL_CLIENT_VERIFY value
has been set to SUCCESS on resumption even when originally it was set to
GENEROUS. PR 53193.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1633085 13f79535-47bb-0310-9956-ffa450edef68
2014-10-20 09:18:22 +00:00
c14ecfa1dd mod_ssl: dump SSL IO/state for the write side of the connection(s), like reads.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1601919 13f79535-47bb-0310-9956-ffa450edef68
2014-06-11 14:42:32 +00:00
4af211f0ef Initialize post_handshake_rc for case where a failure has
already occurred (doesn't change execution but avoids warning
with some levels of gcc).

Pointed out by: kbrand


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1588868 13f79535-47bb-0310-9956-ffa450edef68
2014-04-21 11:03:26 +00:00
f82af68aa4 mod_ssl: Add hooks to allow other modules to perform processing at
several stages of initialization and connection handling.  See
mod_ssl_openssl.h.

This is enough to allow implementation of Certificate Transparency
outside of mod_ssl.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1587607 13f79535-47bb-0310-9956-ffa450edef68
2014-04-15 15:25:03 +00:00
6aafe58a02 mod_ssl: Don't flush when an EOS is received. Prepares mod_ssl
to support write completion.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1542546 13f79535-47bb-0310-9956-ffa450edef68
2013-11-16 18:50:45 +00:00
725978c554 Increase minimum required OpenSSL version to 0.9.8a (in preparation
for the next mod_ssl commit, which will rely on the get_rfcX_prime_Y
functions added in that release):

- remove obsolete #defines / macros

- in ssl_private.h, regroup definitions based on whether
  they depend on TLS extension support or not

- for ECC and SRP support, set HAVE_X and change the rather awkward
  #ifndef OPENSSL_NO_X lines accordingly

For the discussion prior to taking this step, see
https://mail-archives.apache.org/mod_mbox/httpd-dev/201309.mbox/%3C524275C7.9060408%40velox.ch%3E


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1527294 13f79535-47bb-0310-9956-ffa450edef68
2013-09-29 10:12:47 +00:00
728ec107c2 add some log messages and AP_DEBUG_ASSERTs for functions that should never be
called


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1519264 13f79535-47bb-0310-9956-ffa450edef68
2013-09-01 12:26:25 +00:00
64a22f8933 adjust log level
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1514624 13f79535-47bb-0310-9956-ffa450edef68
2013-08-16 08:53:45 +00:00
b747d7f3c3 add high trace level log messages for debugging buffering and write completion
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1510295 13f79535-47bb-0310-9956-ffa450edef68
2013-08-04 18:21:24 +00:00
b3ce136d05 mod_ssl: Redesign NPN (Next Protocol Negotiation) API to avoid use of
hooks API and inter-module hard linkage:

* modules/ssl/mod_ssl.h: Remove NPN hooks, add "modssl_register_npn"
  optional function and callback function type declarations for
  ssl_npn_advertise_protos, ssl_npn_proto_negotiated.

* modules/ssl/mod_ssl.c: Drop hooks.
  (modssl_register_npn): New optional function implementation.
  (ssl_register_hooks): Register it.

* modules/ssl/ssl_private.h (SSLConnRec): Add npn_advertfns,
  npn_negofns array fields.

* modules/ssl/ssl_engine_kernel.c (ssl_callback_AdvertiseNextProtos): 
  Replace use of hook API with array iteration.

* modules/ssl/ssl_engine_io.c (ssl_io_filter_input): Likewise.

Reviewed by: Matthew Steele <mdsteele google.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1487772 13f79535-47bb-0310-9956-ffa450edef68
2013-05-30 07:19:07 +00:00
a47569f7c1 core, mod_ssl: Lift the restriction that prevents mod_ssl taking
full advantage of the event MPM. Enable the ability for a module
to reverse the sense of a poll event from a read to a write or vice
versa.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1470679 13f79535-47bb-0310-9956-ffa450edef68
2013-04-22 19:48:25 +00:00
50eb694c34 mod_ssl: add support for subjectAltName-based host name checking in proxy mode
(PR 54030)

factor out code from ssl_engine_init.c:ssl_check_public_cert()
to ssl_util_ssl.c:SSL_X509_match_name()

introduce new SSLProxyCheckPeerName directive, which should eventually
obsolete SSLProxyCheckPeerCN

ssl_engine_io.c:ssl_io_filter_handshake(): avoid code duplication
when aborting with HTTP_BAD_GATEWAY


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1425874 13f79535-47bb-0310-9956-ffa450edef68
2012-12-26 10:54:54 +00:00
8b22033a29 make ssl_io_data_dump respect per-conn loglevel
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1418765 13f79535-47bb-0310-9956-ffa450edef68
2012-12-08 22:06:49 +00:00
14f1654b1f rename variables: s should be the server_rec
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1418763 13f79535-47bb-0310-9956-ffa450edef68
2012-12-08 22:06:09 +00:00
7b8a5d3d58 Don't claim "BIO dump follows" if it is not logged due to log level config.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1418761 13f79535-47bb-0310-9956-ffa450edef68
2012-12-08 21:47:27 +00:00
bcb6dc0178 * modules/ssl/ssl_engine_io.c (ssl_io_filter_error): Use the correct
response status in the 502 error bucket; fortuitously this error
  bucket is currently ignored so this bug was not user-visible.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1416589 13f79535-47bb-0310-9956-ffa450edef68
2012-12-03 16:58:21 +00:00
d41fac0208 * modules/ssl/ssl_engine_io.c (ssl_io_filter_handshake): Add a
wildcard common name match.

PR: 53006


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1375584 13f79535-47bb-0310-9956-ffa450edef68
2012-08-21 14:46:55 +00:00
41cd334ad6 Avoid buffer overflow if one protocol string is too long, but at least
one is not.

Also add log messages numbers and avoid useless string dup.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1345599 13f79535-47bb-0310-9956-ffa450edef68
2012-06-02 22:28:26 +00:00
dd5f55ce6b Add support for TLS Next Protocol Negotiation:
* modules/ssl/mod_ssl.c, modules/ssl/mod_ssl.h: Add and implement new
  hooks for next protocol advertisement/discovery.

* modules/ssl/ssl_engine_init.c (ssl_init_ctx_callbacks): Enable
  NPN advertisement callback in handshake.

* modules/ssl/ssl_engine_io.c (ssl_io_filter_input): Invoke
  next-protocol discovery hook.

* modules/ssl/ssl_engine_kernel.c (ssl_callback_AdvertiseNextProtos): 
  New callback.

* modules/ssl/ssl_private.h: Add prototype.

Submitted by: Matthew Steele <mdsteele google.com>
  with slight tweaks by jorton


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1332643 13f79535-47bb-0310-9956-ffa450edef68
2012-05-01 13:27:14 +00:00
43d54ae919 When receiving http on https, send the error response with http 1.0
It is important that we send a proper error status, or search engines
may index the error message.
    
PR: 50823


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1328325 13f79535-47bb-0310-9956-ffa450edef68
2012-04-20 11:21:12 +00:00
92e366007c Add lots of unique tags to error log messages
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209766 13f79535-47bb-0310-9956-ffa450edef68
2011-12-02 23:02:04 +00:00
304e9c4c08 drop SSLv2 support (set SSL_OP_NO_SSLv2 for any new SSL_CTX)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1203491 13f79535-47bb-0310-9956-ffa450edef68
2011-11-18 05:27:00 +00:00
9567e5f16c enable the SNI extension for proxy connections
to TLS backends (but avoid for pure SSLv2/SSLv3)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1175416 13f79535-47bb-0310-9956-ffa450edef68
2011-09-25 15:55:13 +00:00
427c85bd23 Cleanup effort in prep for GA push:
Trim trailing whitespace... no func change



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174751 13f79535-47bb-0310-9956-ffa450edef68
2011-09-23 13:39:32 +00:00
7bd59fd67a Remove the ssl_toolkit_compat layer, which is no longer needed
after support for non-OpenSSL toolkits has been dropped.

Replace macros by their value proper where feasible, and keep
those definitions in ssl_private.h which depend on specific
OpenSSL versions.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1154687 13f79535-47bb-0310-9956-ffa450edef68
2011-08-07 10:34:31 +00:00
1eb818742f Drop support for the RSA BSAFE SSL-C toolkit from configure,
and remove #ifdef'ed code from mod_ssl and ab where applicable.

Consensus for dropping support for SSL/TLS toolkits other
than OpenSSL was reached on dev@httpd in June 2010 (message
with ID <20100602162310.GA11156@redhat.com> and follow-ups).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1154683 13f79535-47bb-0310-9956-ffa450edef68
2011-08-07 10:29:09 +00:00
f66af00c19 Avoid some memory allocations by using apr_table_setn where the string
arguments are const.

Submitted by: Christophe JAILLET <christophe jaillet wanadoo fr>
PR: 51357


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1135083 13f79535-47bb-0310-9956-ffa450edef68
2011-06-13 10:58:10 +00:00
36a8e607bb * modules/ssl/ssl_engine_io.c: Revamp output buffering: add a
"coalesce" filter which buffers the plaintext, and remove buffering
  of the SSL records -- i.e. buffer before the SSL output filter,
  rather than after it.  This aims to reduce the network overhead
  imposed by the output of many small brigades (such as produced by
  chunked HTTP response), which can now be transformed into a few
  large TLS records rather than many small ones.

  (ssl_filter_ctx_t): Remove "nobuffer" field.
  (bio_filter_out_ctx_t): Remove length, buffer, blen fields.
  (bio_filter_out_pass): Split from bio_filter_out_flush.
  (bio_filter_out_write): Remove handling of buffer.
  (bio_filter_out_ctrl): Adjust to reflect lack of buffer.
  (ssl_io_filter_coalesce): Add new filter...
  (ssl_io_filter_init): ...add it to the filter chain...
  (ssl_io_filter_register): ...and register it.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1059910 13f79535-47bb-0310-9956-ffa450edef68
2011-01-17 13:14:21 +00:00
5208ff93f4 * We can only get there if the line is too long and in this case
we should return the partial line as defined in util_filter.h.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1059037 13f79535-47bb-0310-9956-ffa450edef68
2011-01-14 15:14:16 +00:00
cd749c90da * Fix comment typo as noticed by jorton
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1058133 13f79535-47bb-0310-9956-ffa450edef68
2011-01-12 13:32:53 +00:00
98a2ee3314 * Do not drop contents of incomplete lines, but safe them for the next
round of reading.

PR: 50481


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1051468 13f79535-47bb-0310-9956-ffa450edef68
2010-12-21 11:43:42 +00:00
5daa6b7a7d * Put a note in the connection notes that the SSL handshake to the backend
failed such that mod_proxy can put the worker in error state.

PR: 50332
Submitted by: Daniel Ruggeri <DRuggeri primary.net>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1039304 13f79535-47bb-0310-9956-ffa450edef68
2010-11-26 10:33:19 +00:00
6b803976f2 Fix a number of typos and misspellings. Reported by Ville Skytta.
PR48496.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1029134 13f79535-47bb-0310-9956-ffa450edef68
2010-10-30 17:56:13 +00:00
a527986832 remove more unused variables
revove some obsolete comments

netware file is untested


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@982050 13f79535-47bb-0310-9956-ffa450edef68
2010-08-03 22:12:19 +00:00
0d11ddb595 - Introduce ap_log_cserror to allow mod_ssl to associate log messages to
different servers than c->base_server.
- Adjust the scope of some mod_ssl trace logging from server to conn.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@954611 13f79535-47bb-0310-9956-ffa450edef68
2010-06-14 19:59:05 +00:00
ba0d30294e Replace LogLevelDebugDump with TRACE log levels
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951904 13f79535-47bb-0310-9956-ffa450edef68
2010-06-06 17:10:23 +00:00
01b9f2e551 - Be less verbose at levels INFO and DEBUG in mod_proxy* and mod_ssl
- Add some trace logging to core and http


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951900 13f79535-47bb-0310-9956-ffa450edef68
2010-06-06 17:07:12 +00:00
af4c0f4923 Use new loglevel accessor macros to simplify code
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951896 13f79535-47bb-0310-9956-ffa450edef68
2010-06-06 17:01:29 +00:00
7d6bd86673 Introduce SSLLOG_MARK for use with ssl_log_ssl_error(). This will allow to
redefine APLOG_MARK later.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951194 13f79535-47bb-0310-9956-ffa450edef68
2010-06-03 22:57:00 +00:00
c9897ccf0c Further mitigation for the TLS renegotation attack, CVE-2009-3555:
* modules/ssl/ssl_engine_kernel.c (has_buffered_data): New function.
  (ssl_hook_Access): Forcibly disable keepalive for the connection if
  there is any buffered data readable from the input filter stack.

* modules/ssl/ssl_engine_io.c (ssl_io_filter_input): Ensure that the
  BIO uses blocking operations when invoked outside direct control of
  the httpd filter stack.

Thanks to Hartmut Keil <Hartmut.Keil adnovum.ch> for proposing this
technique.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@891282 13f79535-47bb-0310-9956-ffa450edef68
2009-12-16 15:59:49 +00:00
39d5d9507b SECURITY: Partial fix for CVE-2009-3555:
Reject client-initiated renegotiations; this is sufficient to prevent
the attack for any configuration which does not require renegotiation
due to per-directory/per-location access control configuration.

Configuration with per-directory/per-location access control
requirements (such as "SSLVerifyClient require") are still vulnerable
to CVE-2009-3555 with this patch applied (if using OpenSSL <= 0.9.8k).

* modules/ssl/ssl_private.h (SSLConnRec): Add reneg_state field.
  (ssl_callback_Info): Renamed from ssl_callback_LogTracingState.

* modules/ssl/ssl_engine_init.c (ssl_init_ctx_callbacks): Install
  the (renamed) info callback unconditionally.

* modules/ssl/ssl_engine_io.c (ssl_filter_ctx_t): Add config pointer
  to SSLConnRec.
  (bio_filter_out_write, bio_filter_in_read): Fail with
  APR_ECONNABORTED if the reneg state is set to RENEG_ABORT.

* modules/ssl/ssl_engine_kernel.c (log_tracing_state): Factored out
  of ssl_callback_LogTracingState.
  (ssl_callback_Info): New function.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@833582 13f79535-47bb-0310-9956-ffa450edef68
2009-11-06 22:33:19 +00:00
158ed01bff fixed wrong 3rd parameter passed to apr_brigade_split_line().
Problem showed up with Sun Studio; mentioned by Jie Gao on the list.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@819373 13f79535-47bb-0310-9956-ffa450edef68
2009-09-27 18:53:33 +00:00
efcb56a2f4 Fix hung SSL handshake if a particularly long CA list is configured:
* modules/ssl/ssl_engine_io.c (bio_filter_in_read): Flush pending
  output unconditionally since OpenSSL is known to not flush correctly
  at all times, and it should be cheap even in cases where it is
  unnecessary.

PR: 46952


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@788715 13f79535-47bb-0310-9956-ffa450edef68
2009-06-26 14:22:20 +00:00
781f39a68a * modules/ssl/ssl_engine_io.c (bio_filter_out_ctrl): Switch
implementation of BIO_CTRL_PENDING and BIO_CTRL_WPENDING, to return
  zero and pending-bytes-to-write respectively.

PR: 46952
Submitted by: David Smith <David.Smith cern.ch>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@787722 13f79535-47bb-0310-9956-ffa450edef68
2009-06-23 15:42:02 +00:00
b87a8928d4 * module/ssl/ssl_engine_io.c: Comment bio_filter_out_ctx_t.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@787644 13f79535-47bb-0310-9956-ffa450edef68
2009-06-23 11:53:33 +00:00
c719980d2d * Optimize access to server_rec.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@771455 13f79535-47bb-0310-9956-ffa450edef68
2009-05-04 21:37:09 +00:00
da160114d6 * Set SSLProxyCheckPeerExpire and SSLProxyCheckPeerCN to on by default.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@769815 13f79535-47bb-0310-9956-ffa450edef68
2009-04-29 16:18:21 +00:00
506ed9e89e * Improve and simplify the implementation of SSLProxyCheckPeerExpire by
directly using X509_get_notBefore(), X509_get_notAfter() and
  X509_cmp_current_time().
  Thanks to jorton for the pointer.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@769809 13f79535-47bb-0310-9956-ffa450edef68
2009-04-29 16:12:20 +00:00