summaryrefslogtreecommitdiffhomepage
path: root/src/event (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-07-13QUIC: caching c->quic in the ngx_quic_handle_ack_frame() function.Vladimir Homutov1-10/+13
To minimize difference with the following changes.
2020-07-10QUIC: delay field of an ACK frame is now calculated.Vladimir Homutov3-2/+28
2020-07-16QUIC: added rtt estimation.Vladimir Homutov2-9/+96
According to the quic-recovery 29, Section 5: Estimating the Round-Trip Time. Currently, integer arithmetics is used, which loses sub-millisecond accuracy.
2020-07-13Merged with the default branch.Sergey Kandaurov3-21/+51
2020-07-06Upstream: drop extra data sent by upstream.Maxim Dounin1-0/+28
Previous behaviour was to pass everything to the client, but this seems to be suboptimal and causes issues (ticket #1695). Fix is to drop extra data instead, as it naturally happens in most clients. This change covers generic buffered and unbuffered filters as used in the scgi and uwsgi modules. Appropriate input filter init handlers are provided by the scgi and uwsgi modules to set corresponding lengths. Note that for responses to HEAD requests there is an exception: we do allow any response length. This is because responses to HEAD requests might be actual full responses, and it is up to nginx to remove the response body. If caching is enabled, only full responses matching the Content-Length header will be cached (see b779728b180c).
2020-07-02QUIC: Introduced ngx_quic_finalize_connection().Roman Arutyunyan4-48/+91
The function finalizes QUIC connection with an application protocol error code and sends a CONNECTION_CLOSE frame with type=0x1d. Also, renamed NGX_QUIC_FT_CONNECTION_CLOSE2 to NGX_QUIC_FT_CONNECTION_CLOSE_APP.
2020-06-29SSL: fixed unexpected certificate requests (ticket #2008).Maxim Dounin1-1/+2
Using SSL_CTX_set_verify(SSL_VERIFY_PEER) implies that OpenSSL will send a certificate request during an SSL handshake, leading to unexpected certificate requests from browsers as long as there are any client certificates installed. Given that ngx_ssl_trusted_certificate() is called unconditionally by the ngx_http_ssl_module, this affected all HTTPS servers. Broken by 699f6e55bbb4 (not released yet). Fix is to set verify callback in the ngx_ssl_trusted_certificate() function without changing the verify mode.
2020-06-19Style.Vladimir Homutov1-0/+1
2020-06-23Update Initial salt and Retry secret from quic-tls-29.Sergey Kandaurov1-4/+15
See sections 5.2 and 5.8 for the current values.
2020-06-23Get rid of hardcoded numbers used for quic handshake errors.Sergey Kandaurov3-7/+13
2020-06-23Discard short packets which could not be decrypted.Sergey Kandaurov2-4/+6
So that connections are protected from failing from on-path attacks. Decryption failure of long packets used during handshake still leads to connection close since it barely makes sense to handle them there.
2020-06-23Close connection with PROTOCOL_VIOLATION on decryption failure.Sergey Kandaurov1-2/+2
A previously used undefined error code is now replaced with the generic one. Note that quic-transport prescribes keeping connection intact, discarding such QUIC packets individually, in the sense that coalesced packets could be there. This is selectively handled in the next change.
2020-06-23Define KEY_UPDATE_ERROR from quic-tls-24.Sergey Kandaurov2-2/+2
2020-06-23Reject new QUIC connection with CONNECTION_REFUSED on shutdown.Sergey Kandaurov1-0/+5
2020-06-23Close QUIC connection with NO_ERROR on c->close.Sergey Kandaurov1-1/+2
That way it makes more sense. Previously it was closed with INTERNAL_ERROR.
2020-06-23QUIC error SERVER_BUSY renamed to CONNECTION_REFUSED in draft-29.Sergey Kandaurov2-2/+2
2020-06-18QUIC: cleaned up quic encryption state tracking.Vladimir Homutov1-14/+6
The patch removes remnants of the old state tracking mechanism, which did not take into account assimetry of read/write states and was not very useful. The encryption state now is entirely tracked using SSL_quic_read/write_level().
2020-06-18QUIC: added ALPN checks.Vladimir Homutov2-3/+32
quic-transport draft 29: section 7: * authenticated negotiation of an application protocol (TLS uses ALPN [RFC7301] for this purpose) ... Endpoints MUST explicitly negotiate an application protocol. This avoids situations where there is a disagreement about the protocol that is in use. section 8.1: When using ALPN, endpoints MUST immediately close a connection (see Section 10.3 of [QUIC-TRANSPORT]) with a no_application_protocol TLS alert (QUIC error code 0x178; see Section 4.10) if an application protocol is not negotiated. Changes in ngx_quic_close_quic() function are required to avoid attempts to generated and send packets without proper keys, what happens in case of failed ALPN check.
2020-06-18QUIC: fixed off-by-one in frame range handler.Vladimir Homutov1-1/+1
The ctx->pnum is incremented after the packet is sent, thus pointing to the next packet number, which should not be used in comparison.
2020-06-16QUIC: further limiting maximum QUIC packet size.Vladimir Homutov2-4/+21
quic-transport draft 29, section 14: QUIC depends upon a minimum IP packet size of at least 1280 bytes. This is the IPv6 minimum size [RFC8200] and is also supported by most modern IPv4 networks. Assuming the minimum IP header size, this results in a QUIC maximum packet size of 1232 bytes for IPv6 and 1252 bytes for IPv4. Since the packet size can change during connection lifetime, the ngx_quic_max_udp_payload() function is introduced that currently returns minimal allowed size, depending on address family.
2020-06-15QUIC: raise error on missing transport parameters.Vladimir Homutov1-40/+48
quic-tls, 8.2: The quic_transport_parameters extension is carried in the ClientHello and the EncryptedExtensions messages during the handshake. Endpoints MUST send the quic_transport_parameters extension; endpoints that receive ClientHello or EncryptedExtensions messages without the quic_transport_parameters extension MUST close the connection with an error of type 0x16d (equivalent to a fatal TLS missing_extension alert, see Section 4.10).
2020-06-15QUIC: Fixed connection cleanup.Vladimir Homutov1-0/+4
A posted event need to be deleted during the connection close.
2020-06-15OCSP: fixed use-after-free on error.Roman Arutyunyan1-21/+20
When validating second and further certificates, ssl callback could be called twice to report the error. After the first call client connection is terminated and its memory is released. Prior to the second call and in it released connection memory is accessed. Errors triggering this behavior: - failure to create the request - failure to start resolving OCSP responder name - failure to start connecting to the OCSP responder The fix is to rearrange the code to eliminate the second call.
2020-06-10Style.Vladimir Homutov1-1/+2
2020-06-10Limited max udp payload size for outgoing packets.Vladimir Homutov2-1/+9
This allows to avoid problems with packet fragmentation in real networks. This is a temporary workaround.
2020-06-10Increased default initial retransmit timeout.Vladimir Homutov1-3/+5
This is a temporary workaround, proper retransmission mechanism based on quic-recovery rfc draft is yet to be implemented. Currently hardcoded value is too small for real networks. The patch sets static PTO, considering rtt of ~333ms, what gives about 1s.
2020-06-10Fixed usage of own/client transport parameters.Vladimir Homutov1-2/+2
2020-06-05Stream ID handling in MAX_STREAM_DATA and STREAM_DATA_BLOCKED.Sergey Kandaurov1-0/+21
2020-06-05Stream ID handling in RESET_STREAM and STOP_SENDING frames.Sergey Kandaurov1-2/+79
2020-06-05Reject invalid STREAM ID with STREAM_STATE_ERROR connection error.Sergey Kandaurov1-0/+12
2020-06-05Introduced connection error APPLICATION_ERROR from draft-28.Sergey Kandaurov2-2/+2
2020-06-05Receipt of CONNECTION_CLOSE in 0-RTT is permitted in draft-28.Sergey Kandaurov1-0/+5
2020-06-05Treat receipt of NEW_TOKEN as connection error PROTOCOL_VIOLATION.Sergey Kandaurov2-2/+1
2020-06-03SSL: added verify callback to ngx_ssl_trusted_certificate().Maxim Dounin1-0/+2
This ensures that certificate verification is properly logged to debug log during upstream server certificate verification. This should help with debugging various certificate issues.
2020-06-01Compatibility with BoringSSL master branch.Sergey Kandaurov3-11/+25
Recently BoringSSL introduced SSL_set_quic_early_data_context() that serves as an additional constrain to enable 0-RTT in QUIC. Relevant changes: * https://boringssl.googlesource.com/boringssl/+/7c52299%5E!/ * https://boringssl.googlesource.com/boringssl/+/8519432%5E!/
2020-06-01Fixed transport parameters on a new connection with a valid token.Sergey Kandaurov2-8/+13
Previously, the retry transport parameter was sent regardless.
2020-05-29Made NGX_QUIC_DRAFT_VERSION tunable from configure parameters.Sergey Kandaurov1-0/+2
Now it can be switched using --with-cc-opt='-DNGX_QUIC_DRAFT_VERSION=28'.
2020-05-29QUIC draft-28 transport parameters support.Sergey Kandaurov4-8/+64
Draft-27 and draft-28 support can now be enabled interchangeably, it's based on the compile-time macro NGX_QUIC_DRAFT_VERSION.
2020-05-29Introduced macros for building length-value transport parameters.Sergey Kandaurov1-7/+16
2020-05-29Renamed max_packet_size to max_udp_payload_size, from draft-28.Sergey Kandaurov5-29/+31
No functional changes.
2020-05-29Rejected forbidden transport parameters with TRANSPORT_PARAMETER_ERROR.Sergey Kandaurov1-8/+10
2020-05-29Fixed return codes in ngx_quic_add_handshake_data() callback.Sergey Kandaurov1-2/+2
2020-05-26Merged with the default branch.Sergey Kandaurov3-179/+1122
2020-05-23Fixed format specifiers.Sergey Kandaurov1-2/+2
2020-05-22OCSP: certificate status cache.Roman Arutyunyan2-4/+307
When enabled, certificate status is stored in cache and is used to validate the certificate in future requests. New directive ssl_ocsp_cache is added to configure the cache.
2020-05-22SSL: client certificate validation with OCSP (ticket #1534).Roman Arutyunyan3-15/+607
OCSP validation for client certificates is enabled by the "ssl_ocsp" directive. OCSP responder can be optionally specified by "ssl_ocsp_responder". When session is reused, peer chain is not available for validation. If the verified chain contains certificates from the peer chain not available at the server, validation will fail.
2020-05-22OCSP stapling: iterate over all responder addresses.Roman Arutyunyan1-13/+54
Previously only the first responder address was used per each stapling update. Now, in case of a network or parsing error, next address is used. This also fixes the issue with unsupported responder address families (ticket #1330).
2020-05-17OCSP stapling: keep extra chain in the staple object.Roman Arutyunyan1-29/+18
2020-05-21Style.Vladimir Homutov1-4/+4
Rephrased error message and removed trailing space. Long comments were shortened/rephrased.
2020-05-22Added sending of extra CONNECTION_CLOSE frames.Vladimir Homutov1-27/+36
According to quic-transport draft 28 section 10.3.1: When sending CONNECTION_CLOSE, the goal is to ensure that the peer will process the frame. Generally, this means sending the frame in a packet with the highest level of packet protection to avoid the packet being discarded. After the handshake is confirmed (see Section 4.1.2 of [QUIC-TLS]), an endpoint MUST send any CONNECTION_CLOSE frames in a 1-RTT packet. However, prior to confirming the handshake, it is possible that more advanced packet protection keys are not available to the peer, so another CONNECTION_CLOSE frame MAY be sent in a packet that uses a lower packet protection level.