]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
11 years agoFix "Secure ICAP" patch, revno.14055, to allow compile with openSSL disabled
Christos Tsantilas [Wed, 6 May 2015 14:58:01 +0000 (17:58 +0300)] 
Fix "Secure ICAP" patch, revno.14055, to allow compile with openSSL disabled

11 years agoSourceFormat Enforcement
Source Maintenance [Tue, 5 May 2015 18:12:06 +0000 (18:12 +0000)] 
SourceFormat Enforcement

11 years agoSquid Assertion Read.cc:205: "params.data == data"
Christos Tsantilas [Tue, 5 May 2015 17:40:36 +0000 (20:40 +0300)] 
Squid Assertion Read.cc:205: "params.data == data"

Inside IdleConnList::findUseable the IdleConnList::removeAt call can delete
"this" IdleConnList object. The IdleConnList::clearHandlers called imediatelly
after the removeAt method, will try to use the invalid "this" object in
a comm_read_cancel function call, causing this assertion or other similar.

This patch fixes the IdleConnList::findUseable, IdleConnList::pop and
IdleConnList::findAndClose methods to call IdleConnList::clearHandlers before
the IdleConnList::removeAt is called.

This is a Measurement Factory project

11 years agoSquid Assertion errorpage.cc:600: "entry->isEmpty()"
Christos Tsantilas [Tue, 5 May 2015 15:59:56 +0000 (18:59 +0300)] 
Squid Assertion errorpage.cc:600: "entry->isEmpty()"

While squid shuting down, aborted transactions, for which body data already
downloaded, can cause this bug.

This is a Measurement Factory project

11 years agoSquid Assertion MemBuf.cc:380: "new_cap > (size_t) capacity"
Christos Tsantilas [Tue, 5 May 2015 15:38:39 +0000 (18:38 +0300)] 
Squid Assertion MemBuf.cc:380: "new_cap > (size_t) capacity"

The maximum buffer size for holding Server and Client SSL hello messages is only
16k which is not enough hold a Hello message which includes some extensions and
1-2 or more Certificates.
This patch increases the maximum size to 65535 and also adds some checks to
avoid squid crashes in the case the hello messages buffer overflows.

This is a Measurement Factory project

11 years agoSourceFormat Enforcement
Source Maintenance [Tue, 5 May 2015 12:12:14 +0000 (12:12 +0000)] 
SourceFormat Enforcement

11 years agoSecure ICAP
Christos Tsantilas [Tue, 5 May 2015 09:09:27 +0000 (12:09 +0300)] 
Secure ICAP

This patch adds support for ICAP services that require SSL/TLS transport
connections. The same options used for the cache_peer directive are used for
the icap_service directive, with similar certificate validation logic.

To mark an ICAP service as "secure", use an "icaps://" service URI scheme when
listing your service via an icap_service directive. The industry is using a
"Secure ICAP" term, and Squid follows that convention, but "icaps" seems more
appropriate for a _scheme_ name.

Squid uses port 11344 for Secure ICAP by default, following another popular
proxy convention. The old 1344 default for plain ICAP ports has not changed.

Technical Details
==================

This patch:
  - Splits Ssl::PeerConnector class into Ssl::PeerConnector parent and two kids:
    Ssl::BlindPeerConnector, a basic SSL connector for cache_peers, and
    Ssl::PeekingPeerConnector, a peek-and-splice SSL connector for HTTP servers.

  - Adds a third Ssl::IcapPeerConnector kid to connect to Secure ICAP servers.

  - Fixes ErrorState class to avoid crashes on nil ErrorState::request member.
    (Ssl::IcapPeerConnector may generate an ErrorState with a nil request).

  - Modifies the ACL peername to use the Secure ICAP server name as value while
    connecting to an ICAP server. This is useful to make SSL certificate
    policies based on ICAP server name. However, this change is undocumented
    until we decide whether a dedicated ACL would be better.

This is a Measurement Factory project.

11 years agoMake pod2man an optional dependency
Amos Jeffries [Sun, 3 May 2015 07:46:48 +0000 (00:46 -0700)] 
Make pod2man an optional dependency

Documentation files can be built on a best-effort basis. This allows
Squid more helpers to be built without pod2man and sub-dependencies.

configure.ac already checks for pod2man existence and sets appropriate
automake conditionals.

11 years agoPrep for 3.5.4, 3.4.13, 3.3.14, 3.2.14
Amos Jeffries [Fri, 1 May 2015 07:35:40 +0000 (00:35 -0700)] 
Prep for 3.5.4, 3.4.13, 3.3.14, 3.2.14

11 years agoFix X509 server certificate domain matching
Amos Jeffries [Fri, 1 May 2015 06:31:01 +0000 (23:31 -0700)] 
Fix X509 server certificate domain matching

The X509 certificate domain fields may contain non-ASCII encodings.
Ensure the domain match algorithm is only passed UTF-8 ASCII-compatible
strings.

11 years agoBug 3775: Disable HTTP/1.1 pipeline feature for pinned connections
Christos Tsantilas [Fri, 1 May 2015 06:25:14 +0000 (23:25 -0700)] 
Bug 3775: Disable HTTP/1.1 pipeline feature for pinned connections

11 years agoCleanup: Display correct error code in debugging output for IoCallback::finish
Alex Dowad [Wed, 29 Apr 2015 11:26:53 +0000 (04:26 -0700)] 
Cleanup: Display correct error code in debugging output for IoCallback::finish

It seems clear that the debugging log message in IoCallback::finish
was intended to display the arguments passed to the method.

11 years agoCleanup: Fix spelling error in debug message in parseHttpRequest()
Alex Dowad [Wed, 29 Apr 2015 11:24:02 +0000 (04:24 -0700)] 
Cleanup: Fix spelling error in debug message in parseHttpRequest()

11 years agoCleanup: Add whitespace to make debug message in writeComplete() more readable
Alex Dowad [Wed, 29 Apr 2015 11:22:58 +0000 (04:22 -0700)] 
Cleanup: Add whitespace to make debug message in writeComplete() more readable

11 years agoDocs: READ_HANDLER and WRITE_HANDLER error handling requirements
Alex Dowad [Wed, 29 Apr 2015 11:06:52 +0000 (04:06 -0700)] 
Docs: READ_HANDLER and WRITE_HANDLER error handling requirements

All existing READ_HANDLER functions return < 0 on error, so we can test that.
None of them overwrite errno before returning.

11 years agopconn_lifetime robustness fixes
Christos Tsantilas [Tue, 28 Apr 2015 09:55:08 +0000 (12:55 +0300)] 
pconn_lifetime robustness fixes

This patch changes pconn_lifetime (r13780) to abort only really idle
persistent connections (when they timeout). It removes some "extra" features
(added to pconn_lifetime during the feature review) because they break things
when aggressive timeouts is combined with picky clients. Specifically,

1. Squid closed connections with partially received requests when they
   reached pconn_lifetime limit. We should only close _idle_ connections.

2. When connecting to Squid without sending anything for longer than
   pconn_lifetime, the connection hangs if the request is sent after the
   waiting period.

3. The connection also hangs if the initial request is starting to be
   transmitted but then there is a longer pause before the request is
   completed.

Most of the above problems are easy to trigger only when using very aggressive
pconn_lifetime settings that the feature was not designed for, but they still
can be considered bugs from admins point of view. Fixes:

* Do not stop reading a partially received request when we are timing out,
  to avoid aborting that request.

* Do not set keepalive flag based on the pconn_lifetime timeout. We cannot
  predict whether some new request data is going to be read (and reset the
  idle timeout clock) before our Connection:close response is sent back.

HTTP clients are supposed to recover from such races, but some apparently
do not, especially if it is their first request on the connection.

This is a Measurement Factory project.

11 years agoAdd vsnprintf() protection for vargs
Amos Jeffries [Mon, 27 Apr 2015 14:39:04 +0000 (07:39 -0700)] 
Add vsnprintf() protection for vargs

11 years agoMake StoreEntry provide Packable interface
Amos Jeffries [Mon, 27 Apr 2015 14:20:17 +0000 (07:20 -0700)] 
Make StoreEntry provide Packable interface

Preparation for removal of C-style storeAppendPrintf()
functions and Packer wrapper class.

11 years agoUpdate libsquidssl.la MemBuf use
Amos Jeffries [Mon, 27 Apr 2015 11:16:32 +0000 (04:16 -0700)] 
Update libsquidssl.la MemBuf use

11 years agoFix printf format for size_t and mb_size_t
Amos Jeffries [Mon, 27 Apr 2015 11:15:44 +0000 (04:15 -0700)] 
Fix printf format for size_t and mb_size_t

11 years agoRename Packable::Printf as Packable::appendf
Amos Jeffries [Mon, 27 Apr 2015 09:52:02 +0000 (02:52 -0700)] 
Rename Packable::Printf as Packable::appendf

It performs append semantics not replace semantics, and this also paves
the way for SBuf integration.

11 years agoMemBuf implements Packable interface
Amos Jeffries [Mon, 27 Apr 2015 05:31:56 +0000 (22:31 -0700)] 
MemBuf implements Packable interface

... detatch it from Packer wrapper class

11 years agoRename MemBuf::vPrintf to MemBuf::vappendf
Amos Jeffries [Mon, 27 Apr 2015 04:06:26 +0000 (21:06 -0700)] 
Rename MemBuf::vPrintf to MemBuf::vappendf

... inline with the Packable API method name

11 years agoUpdate Packable API to implement vappendf() method
Amos Jeffries [Mon, 27 Apr 2015 01:50:41 +0000 (18:50 -0700)] 
Update Packable API to implement vappendf() method

The backend classes actually implement the vappendf()
base function receiving va_list args object.

The Printf() implementations are all duplicate code. So
provide that function in terms of a virtual vappendf().

vappendf() is incidentally the name used by SBuf API for
this operation and avoids the global vprintf() libc
definition.

11 years agoConvert packing methods from Packer* to Packable* objects
Amos Jeffries [Sun, 26 Apr 2015 16:41:06 +0000 (09:41 -0700)] 
Convert packing methods from Packer* to Packable* objects

Packaging code can now receive any object that implements the Packable
interface instead of requiring the Packer trampoline object. For now it
is still the only object implementing Packable.

11 years agoCreate Packable interface class
Amos Jeffries [Sun, 26 Apr 2015 15:20:11 +0000 (08:20 -0700)] 
Create Packable interface class

Packer class model used C-style function pointers and a standalone
object to perform C-style trampoline for function/method calls.

C++ virtual methods offer to inline all that directly in the data store
objects and enforces type safety on the child object methods instead of
forcing manual type casting on developers.

Re-implement Packer as a wrapper class providing the Packable interface
for backward compatibility with Packer* code. Future code should inherit
objects directly from Packable and implement the interface.

11 years agoShuffle packerPrintf() to be Packer::Printf method
Amos Jeffries [Sun, 26 Apr 2015 14:05:28 +0000 (07:05 -0700)] 
Shuffle packerPrintf() to be Packer::Printf method

11 years agoShuffle packerAppend() to Packer::append() method
Amos Jeffries [Sun, 26 Apr 2015 12:48:26 +0000 (05:48 -0700)] 
Shuffle packerAppend() to Packer::append() method

11 years agoMake packerClean() the destructor actions for Packer class
Amos Jeffries [Sun, 26 Apr 2015 11:25:26 +0000 (04:25 -0700)] 
Make packerClean() the destructor actions for Packer class

11 years agoSourceFormat Enforcement
Source Maintenance [Sat, 25 Apr 2015 18:12:10 +0000 (18:12 +0000)] 
SourceFormat Enforcement

11 years agoBug 4234: comm_connect_addr uses errno incorrectly
Alex Dowad [Sat, 25 Apr 2015 17:21:26 +0000 (10:21 -0700)] 
Bug 4234: comm_connect_addr uses errno incorrectly

comm_connect_addr() uses errno to determine whether library calls like connect()
are successful. Its callers also use errno for extra information on the cause
of any problem. However, after calling library functions like connect(),
comm_connect_addr() calls other library functions which can overwrite errno.

As the errno manpage explains, "a function that succeeds is allowed to change
errno". So even when nothing is wrong, comm_connect_addr() may return an error
flag if libc sets errno. And when something *is* wrong, incorrect error information
may be returned to the caller because errno was overwritten with a different code.

Correct this by using our own error code variable which is set only when a library
call fails. To avoid breaking callers, set errno before returning.

11 years agoFix 'access_log none' to prevent following logs being used
Amos Jeffries [Fri, 24 Apr 2015 04:15:29 +0000 (21:15 -0700)] 
Fix 'access_log none' to prevent following logs being used

The documented behaviour of "access_log none" for preventing logging
using log lines following the directive has not been working in
Squid-3 for some time.

Since the 'none' type does not have a log module associated the entire
switch logic where its abort is checked for was being skipped.

11 years agoFix for patch rev.14034: The ssl_free_SBuf is a free function for ssl_ex_index_server...
Christos Tsantilas [Thu, 23 Apr 2015 16:05:48 +0000 (19:05 +0300)] 
Fix for patch rev.14034: The ssl_free_SBuf is a free function for ssl_ex_index_server, not for ssl_ctx_ex_index_dont_verify_domain

11 years agoDocs: Update CONTRIBUTORS
Source Maintenance [Thu, 23 Apr 2015 14:40:32 +0000 (14:40 +0000)] 
Docs: Update CONTRIBUTORS

11 years agoDocs: clarify Squid masking of TOS ECN bits
Source Maintenance [Thu, 23 Apr 2015 03:31:40 +0000 (03:31 +0000)] 
Docs: clarify Squid masking of TOS ECN bits

11 years agoSourceFormat Enforcement
Source Maintenance [Thu, 23 Apr 2015 00:12:11 +0000 (00:12 +0000)] 
SourceFormat Enforcement

11 years agoFix SSL_get_peer_certificate memory leak
Christos Tsantilas [Wed, 22 Apr 2015 19:45:30 +0000 (22:45 +0300)] 
Fix SSL_get_peer_certificate memory leak

The SSL_get_peer_certificate openSSL function increases the lock for X509
object it returns so X509 object retrieved using this function must be
released with X509_free after use.
This patch uses the Ssl::X509_Pointer TidyPointer to release X509 object
retrieved with the SSL_get_peer_certificate function inside the
Ssl::PeerConnector::handleNegotiateError method

This is a Measurement Factory project

11 years agorevert rev.14035
Christos Tsantilas [Wed, 22 Apr 2015 19:41:13 +0000 (22:41 +0300)] 
revert rev.14035

11 years agoThe %err_detail formating code print wrong error information
Christos Tsantilas [Wed, 22 Apr 2015 19:36:24 +0000 (22:36 +0300)] 
The %err_detail formating code print wrong error information

The bug added with the r13732 patch.

11 years agoFix SSL_get_peer_certificate memory leak
Christos Tsantilas [Wed, 22 Apr 2015 19:25:36 +0000 (22:25 +0300)] 
Fix SSL_get_peer_certificate memory leak

The SSL_get_peer_certificate openSSL function increases the lock for X509
object it returns so X509 object retrieved using this function must be
released with X509_free after use.
This patch uses the Ssl::X509_Pointer TidyPointer to release X509 object
retrieved with the SSL_get_peer_certificate function inside the
Ssl::PeerConnector::handleNegotiateError method

This is a Measurement Factory project

11 years agoUnexpected SQUID_X509_V_ERR_DOMAIN_MISMATCH errors while accessing sites with valid...
Christos Tsantilas [Wed, 22 Apr 2015 19:23:08 +0000 (22:23 +0300)] 
Unexpected SQUID_X509_V_ERR_DOMAIN_MISMATCH errors while accessing sites with valid certificates

A "const char *" pointer retrieved using the SBuf::c_str() method may attached
to an SSL object using the SSL_set_ex_data method as server name used to
validate server certificates. This pointer may become invalid, causing
the SQUID_X509_V_ERR_DOMAIN_MISMATCH errors.

This patch changes the type of the ssl_ex_index_server index used with the
SSL_set_ex_data function to be an SBuf object.

This is a Measurement Factory project

11 years agoPortability: Add hacks to define C++11 explicit N-bit type limits
Amos Jeffries [Wed, 22 Apr 2015 13:32:56 +0000 (06:32 -0700)] 
Portability: Add hacks to define C++11 explicit N-bit type limits

Add cstdint and stdint.h to libcompat headers and ensure that type limits
used by Squid are always available. Mostly this involves shuffling
existing hacks into the compat headers but the UINT32_* limits are new.

11 years agoRevert rev.14029
Amos Jeffries [Wed, 22 Apr 2015 11:06:20 +0000 (04:06 -0700)] 
Revert rev.14029

11 years agoC++11: retain support for older compilers after rev.14028
Amos Jeffries [Wed, 22 Apr 2015 04:42:04 +0000 (21:42 -0700)] 
C++11: retain support for older compilers after rev.14028

11 years agoEpoll: initialize kdpfd and epoll_event in all cases
Amos Jeffries [Tue, 21 Apr 2015 14:20:23 +0000 (07:20 -0700)] 
Epoll: initialize kdpfd and epoll_event in all cases

11 years agoCBDATA: use class Lock for reference counting
Amos Jeffries [Tue, 21 Apr 2015 14:16:56 +0000 (07:16 -0700)] 
CBDATA: use class Lock for reference counting

11 years agoEnsure class Lock counter remains within bounds
Amos Jeffries [Tue, 21 Apr 2015 14:14:49 +0000 (07:14 -0700)] 
Ensure class Lock counter remains within bounds

11 years agoBug 4231 pt2: comm_open_uds does not provide description for newly opened FD
Amos Jeffries [Tue, 21 Apr 2015 13:41:25 +0000 (06:41 -0700)] 
Bug 4231 pt2: comm_open_uds does not provide description for newly opened FD

Thanks to Alex Dowad for identifying the problem.

11 years agoBug 4231 pt1: fd_open() not correctly handling empty descriptions
Alex Dowad [Tue, 21 Apr 2015 13:40:29 +0000 (06:40 -0700)] 
Bug 4231 pt1: fd_open() not correctly handling empty descriptions

11 years agoSourceFormat Enforcement
Source Maintenance [Tue, 21 Apr 2015 06:12:14 +0000 (06:12 +0000)] 
SourceFormat Enforcement

11 years agoAdd Kerberos support for MAC OS X 10.x
Markus Moeller [Tue, 21 Apr 2015 04:50:22 +0000 (21:50 -0700)] 
Add Kerberos support for MAC OS X 10.x

11 years agoReverted r14022 due to some regressions
Francesco Chemolli [Fri, 17 Apr 2015 15:12:09 +0000 (17:12 +0200)] 
Reverted r14022 due to some regressions

11 years agoDetect and use libc++, needed for clang c++11 support
Francesco Chemolli [Fri, 17 Apr 2015 07:15:52 +0000 (09:15 +0200)] 
Detect and use libc++, needed for clang c++11 support

11 years agoNegotiate Kerberos authentication request size exceeds output buffer size.
Christos Tsantilas [Thu, 16 Apr 2015 13:18:44 +0000 (16:18 +0300)] 
Negotiate Kerberos authentication request size exceeds output buffer size.

Despite the "must match" comment, MAX_AUTHTOKEN_LEN in
auth/UserRequest.h got out of sync with similar constants in Negotiate helpers.
A 32KB buffer cannot fit some helper requests (e.g., those carrying Privilege
Account Certificate information in the client's Kerberos ticket). Each truncated
request blocks the negotiate helper channel, eventually causing helper queue
overflow and possibly killing Squid.

This patch increases MAX_AUTHTOKEN_LEN in UserRequest.h to 65535 which
is also the maximum used by the negotiate helpers. The patch also adds checks
to avoid sending truncated requests, treating them as helper errors instead.

This is a Measurement Factory project.

11 years agoDo not increment an iterator invalidated by std::map::erase().
Alex Rousskov [Thu, 16 Apr 2015 04:10:51 +0000 (22:10 -0600)] 
Do not increment an iterator invalidated by std::map::erase().

11 years agoFix initializer missed in rev.14018
Amos Jeffries [Wed, 15 Apr 2015 14:07:51 +0000 (07:07 -0700)] 
Fix initializer missed in rev.14018

11 years agoUse std::map instead of hash.h for tracking CBDATA memory
Amos Jeffries [Wed, 15 Apr 2015 13:36:55 +0000 (06:36 -0700)] 
Use std::map instead of hash.h for tracking CBDATA memory

One more step towards removing the custom hash implementation.

This also resolves some crashes introduced by the custom hash bucket
system to the cbdata cachemgr reports and valgrind tracking.

Also removes the HASHED_CBDATA macro in favour of WITH_VALGRIND.

11 years agoFix require-proxy-header preventing HTTPS proxying and ssl-bump
Yuhua Wu [Wed, 15 Apr 2015 10:26:30 +0000 (03:26 -0700)] 
Fix require-proxy-header preventing HTTPS proxying and ssl-bump

When requir-proxy-header was used, the request->flags.interceptTproxy is
wrongly set to 1.

Since request->flags.interceptTproxy is 1, the 200 status code for CONNECT
call is not sent which breaks both HTTPS proxying and SSL-bump.

11 years agoFix typo in rev.14015
Amos Jeffries [Mon, 13 Apr 2015 14:11:16 +0000 (07:11 -0700)] 
Fix typo in rev.14015

11 years agoBug 4212: ssl_crtd crashes with corrupt database
Amos Jeffries [Mon, 13 Apr 2015 06:06:15 +0000 (23:06 -0700)] 
Bug 4212: ssl_crtd crashes with corrupt database

The fix for Bug 3664 "ssl_crtd fails to build on OpenSolaris/OpenIndiana/Solaris 11"
introduced a regression on BSD and Linux where lockf() implementations appear not to
lock the entire file correctly or as reliably as flock().

Reverting the flock/lockf change for non-Solaris OS.

11 years agoRelease Notes: document ssl::server_name
Amos Jeffries [Mon, 13 Apr 2015 06:03:20 +0000 (23:03 -0700)] 
Release Notes: document ssl::server_name

11 years agoSourceFormat Enforcement
Source Maintenance [Sat, 11 Apr 2015 12:12:06 +0000 (12:12 +0000)] 
SourceFormat Enforcement

11 years agoSupport for resuming sessions
Christos Tsantilas [Sat, 11 Apr 2015 09:36:48 +0000 (12:36 +0300)] 
Support for resuming sessions

This patch adds code in squid to control SslBump behavior when dealing with
"resuming SSL/TLS sessions". Without these changes, SslBump usually terminates
all resuming sessions with an error because such sessions do not include
server certificates, preventing Squid from successfully validating the server
identity.

After these changes, Squid splices resuming sessions. Splicing is the right
because Squid most likely has spliced the original connections that the client
and server are trying to resume now.
Without SslBump, session resumption would just work, and SslBump behaviour
should approach that ideal.

Future projects may add ACL checks for allowing resuming sessions and may
add more complex algorithms, including maintaining an SMP-shared
cache of sessions that may be resumed in the future and evaluating
client/server attempts to resume a session using that cache.

This patch also makes SSL client Hello message parsing more robust and
adds an SSL server Hello message parser.

Also add support for NPN (next protocol negotiation) and ALPN (Application-Layer Protocol Negotiation) tls extensions, required to correctly bump web clients
support these extensions

Technical details
-----------------

In Peek mode, the old Squid code would forward the client Hello message to the
server. If the server tries to resume the previous (spliced) SSL session with
the client, then Squid SSL code gets an ssl/PeerConnector.cc "ccs received
early" error (or similar) because the Squid SSL object expects a server
certificate and does not know anything about the session being resumed.

With this patch, Squid detects session resumption attempts and splices

Session resumption detection
----------------------------

There are two mechanism in SSL/TLS for resuming sessions. The traditional
shared session IDs and the TLS ticket extensions:

* If Squid detects a shared ID in both client and server Hello messages, then
Squid decides whether the session is being resumed by comparing those client
and server shared IDs. If (and only if) the IDs are the same, then Squid
assumes that it is dealing with a resuming session (using session IDs).

* If Squid detects a TLS ticket in the client Hello message and TLS ticket
support in the server Hello message as well as a Change Cipher Spec or a New
TLS Ticket message (following the server Hello message), then (and only then)
Squid assumes that it is dealing with a resuming session (using TLS tickets).

The TLS tickets check is not performed if Squid detects a shared session ID
in both client and server Hello messages.

NPN and ALPN tls extensions
---------------------------

Even if squid has some SSL hello messages parsing code, we are relying to
openSSL for full parsing. The openSSL used in peek and splice mode to  parse
server hello message, check for errors and verify server certificates.
If the openSSL, while parses the server hello message, find an extension enabled
in the server hello message, which is not enabled in its side, fails with an
error ("...parse tlsext...").

OpenSSL supports NPN tls extension and from 1.0.2 release supports also the
ALPN tls extensions. In peek mode we are forwading the client SSL hello message
as is, and if this message include support for NPN or ALPN tls extension is
possible that the SSL server support them and include related extensions
in its response. The openSSL will fail if support for these extensions is
not enabled in its side.

This patch handles the NPN (TLSEXT_TYPE_next_proto_neg) as follows:
Try to select the http/1.1 protocol from the server protocols list. If the
http/1.1 is not supported then the SSL bumping will fail. This is valid
because only http protocol we are supporting in squid.
Splicing is not affected.

Also add support for the ALPN TLS extension. This extension is a replacement
for the NPN extension. The client sends a list of supported protocols. In the
case of stare mode squid now sends only http as supported protocol. In the
case of server-first or client-first bumbing modes, squid does enable this
extension.

The NPN supported by chromium browser the ALPN supported by firefox.
Support for ALPN is added to openSSL 1.0.2 release.
These extensions are used to support SPDY and similar protocols.

This is a Measurement Factory project.

11 years agoBug 4226: digest_edirectory_auth: found but cannot be built
Amos Jeffries [Sat, 11 Apr 2015 01:50:37 +0000 (18:50 -0700)] 
Bug 4226: digest_edirectory_auth: found but cannot be built

11 years agoSourceFormat Enforcement
Source Maintenance [Fri, 10 Apr 2015 12:12:08 +0000 (12:12 +0000)] 
SourceFormat Enforcement

11 years agoAdd Http1::Tokenzer class
Amos Jeffries [Fri, 10 Apr 2015 11:02:44 +0000 (04:02 -0700)] 
Add Http1::Tokenzer class

... for tokenizing HTTP/1.x lexical symbols. Inherits from the protocol
agnostic ::Parser::Tokenizer base class.

Provdes quoted-string and (token / quoted-string) parsing methods with
HTTP/1.0 and HTTP/1.1 compliant character sets and \-escaping support.

11 years agoFix server_name ACL patch (r14008): fixes to allow squid compile when openssl is...
Christos Tsantilas [Fri, 10 Apr 2015 10:30:20 +0000 (13:30 +0300)] 
Fix server_name ACL  patch (r14008): fixes to allow squid compile when openssl is not enabled

11 years agoAdd server_name ACL matching server name(s) obtained from various sources such as...
Christos Tsantilas [Fri, 10 Apr 2015 08:54:13 +0000 (11:54 +0300)] 
Add server_name ACL matching server name(s) obtained from various sources such as CONNECT request URI, client SNI, and SSL server certificate CN.

During each SslBump step, Squid improves its understanding of a "true server
name", with a bias towards server-provided (and Squid-validated) information.

The server-provided server names are retrieved from the server certificate CN
and Subject Alternate Names. The new server_name ACL matches any of alternate
names and CN. If the CN or an alternate name is a wildcard, then the new ACL
matches any domain that matches the domain with the wildcard.

Other than supporting many sources of server name information (including
sources that may supply Squid with multiple server name variants and
wildcards), the new ACL is similar to dstdomain.

Also added a server_name_regex ACL.

This is a Measurement Factory project.

11 years agoFix HttpStateData::readReply to retry read from server in the case of EINPROGRESS...
Christos Tsantilas [Thu, 9 Apr 2015 07:08:47 +0000 (10:08 +0300)] 
Fix HttpStateData::readReply to retry read from server in the case of EINPROGRESS, EAGAIN or similar errors

This bug mostly affects SSL bumped connections.
The HttpStateData::readReply will not retry read from server in the case of an
EINPROGRESS or similar comm errors and the connection will hang, until the
timeout handler called.

The Comm::ReadNow method calls ignoreErrno function to test if the comm error
should be ignored and in this case return Comm::INPROGRESS value.
In this case we need to set flags.do_next_read to true to force
HttpStateData::maybeReadVirginBody() method retry read.

This is a Measurement Factory project

11 years agoFix: An invalid request->clientConnectionManager object can be used inside Ssl::PeerC...
Christos Tsantilas [Wed, 8 Apr 2015 15:46:14 +0000 (18:46 +0300)] 
Fix: An invalid request->clientConnectionManager object can be used inside Ssl::PeerConnector::handleNegotiateError method

This patch adds the Ssl::ServerBio::bumpMode() method to retrieve the configured
mode from a ServerBio object, and uses this method for checking the bumping
mode inside Ssl::PeerConnector::handleNegotiateError method

This is a Measurement Factory project

11 years agohttpsEstablish: remove unused code
Christos Tsantilas [Wed, 8 Apr 2015 15:32:14 +0000 (18:32 +0300)] 
httpsEstablish: remove unused code

11 years agoassertion failed: client_side.h:364: "sslServerBump == srvBump"
Christos Tsantilas [Wed, 8 Apr 2015 15:04:41 +0000 (18:04 +0300)] 
assertion failed: client_side.h:364: "sslServerBump == srvBump"

After a failed http_access acl check of an HTTP request, tunneled through a
SSL bumped connection, ssl bumping code try to re-setup the connection for a
client-first bumping mode to serve the error crashing squid.

This is a Measurement Factory project

11 years agoFix cross-compile issues with SSL_get_certificate()
Amos Jeffries [Wed, 8 Apr 2015 05:27:24 +0000 (22:27 -0700)] 
Fix cross-compile issues with SSL_get_certificate()

Explicitly assume 'no' to these hacks when cross-compiling and create
the autoconf.h #define.

Thanks to Cambier GaĆ«tan for identifying the problem.

11 years agoDocs: RFC 7238 obsoleted by RFC 7538
Amos Jeffries [Wed, 8 Apr 2015 03:00:14 +0000 (20:00 -0700)] 
Docs: RFC 7238 obsoleted by RFC 7538

11 years agoFix to make ECAP build and run after patch r13995
Christos Tsantilas [Mon, 6 Apr 2015 16:50:20 +0000 (19:50 +0300)] 
Fix to make ECAP build and run after patch r13995

11 years agoUpdate SPONSORS entries
Amos Jeffries [Wed, 1 Apr 2015 05:34:46 +0000 (22:34 -0700)] 
Update SPONSORS entries

11 years agoAbort parse cleanly if there is nothing to do
Amos Jeffries [Tue, 31 Mar 2015 13:58:50 +0000 (06:58 -0700)] 
Abort parse cleanly if there is nothing to do

ICAP behaviour on noteMoreBodySpaceAvailable() can result in a parse
being attempted even if the read I/O buffer has not yet received any
new content to fill the available space. Handle this cleanly instead of
throwing parse errors and causing ICAP service disconnect.

11 years agodigest_edirectory_auth: Fix -lnettle dependency error
Eray Aslan [Tue, 31 Mar 2015 10:33:07 +0000 (03:33 -0700)] 
digest_edirectory_auth: Fix -lnettle dependency error

11 years agoBoilerplate: reference Translator copyrights in CREDITS
Amos Jeffries [Mon, 30 Mar 2015 13:28:02 +0000 (06:28 -0700)] 
Boilerplate: reference Translator copyrights in CREDITS

11 years agoRefactor Http1::ChunkedCodingParser to Http1::Parser API with SBuf
Amos Jeffries [Mon, 30 Mar 2015 11:43:06 +0000 (04:43 -0700)] 
Refactor Http1::ChunkedCodingParser to Http1::Parser API with SBuf

* refactor the parse to accept SBuf input buffer using the Parser API
 and shift the MemBuf output buffer accesses to a separate API method.

* refactor the parsing steps to use Parser methods where available and
 Tokenizer for lexical tokenising.

This removes one temporary data copy and two performance regressions
from each chunked message payload processing action. It also removes
c-string operations and strign termination dependency from chunk parsing.

11 years agoInherit ChunkedCodingParser from Http1::Parser
Amos Jeffries [Sun, 29 Mar 2015 14:11:36 +0000 (07:11 -0700)] 
Inherit ChunkedCodingParser from Http1::Parser

* add temporary dummy parse(SBuf) method

* re-write parse sequence using ParseState stages instead of Step method
  pointers

* replace needsMoreData() with Http1::Parser method

11 years agoShuffle ChunkedCodingParser into Http1:: namespace
Amos Jeffries [Sun, 29 Mar 2015 04:38:29 +0000 (21:38 -0700)] 
Shuffle ChunkedCodingParser into Http1:: namespace

11 years agoCleanup: Place explicit size on ref-count lock counter
Amos Jeffries [Sun, 29 Mar 2015 04:22:08 +0000 (21:22 -0700)] 
Cleanup: Place explicit size on ref-count lock counter

This allows us to make explicit calculation of child object sizes in a
portable way despite differences in system 'unsigned' size.

11 years agoSourceFormat Enforcement
Source Maintenance [Sat, 28 Mar 2015 18:12:06 +0000 (18:12 +0000)] 
SourceFormat Enforcement

11 years agoShuffle ChunkedCodingParser to libhttp1
Amos Jeffries [Sat, 28 Mar 2015 17:29:35 +0000 (10:29 -0700)] 
Shuffle ChunkedCodingParser to libhttp1

11 years agoMerged ICAP changes from trunk rev.13995
Amos Jeffries [Sat, 28 Mar 2015 14:57:12 +0000 (07:57 -0700)] 
Merged ICAP changes from trunk rev.13995

11 years agoParser-NG: Convert the ICAP read buffer to an SBuf.
Amos Jeffries [Sat, 28 Mar 2015 14:53:59 +0000 (07:53 -0700)] 
Parser-NG: Convert the ICAP read buffer to an SBuf.

* Remove the double-buffering hack used to comm_read() ICAP responses as
  c-string then convert to MemBuf for parsing.

* Revert the HttpMsg parser API from MemBuf to c-string parameters.
  The internals did not make much use of the MemBuf abilities and it is
  simpler to retrieve c-string values directly from an SBuf than to go
  via a MemBuf conversion.

11 years agoMerge from trunk rev.13994
Amos Jeffries [Sat, 28 Mar 2015 13:20:21 +0000 (06:20 -0700)] 
Merge from trunk rev.13994

11 years agoRelease Notes: update for 4.x
Amos Jeffries [Sat, 28 Mar 2015 11:12:46 +0000 (04:12 -0700)] 
Release Notes: update for 4.x

11 years agoPrep for 3.5.3
Amos Jeffries [Sat, 28 Mar 2015 10:51:16 +0000 (03:51 -0700)] 
Prep for 3.5.3

11 years agoUse Security::PeerOptions in AnyP::PortCfg for basic TLS config
Amos Jeffries [Fri, 27 Mar 2015 14:12:17 +0000 (07:12 -0700)] 
Use Security::PeerOptions in AnyP::PortCfg for basic TLS config

11 years agoMove Ssl::parse_flags to Security::ParseFlags
Amos Jeffries [Thu, 26 Mar 2015 09:57:25 +0000 (02:57 -0700)] 
Move Ssl::parse_flags to Security::ParseFlags

... in preparation for making PeerOptions used by both server and client
configuation.

11 years agoDocs: update QUICKSTART and INSTALL
Source Maintenance [Thu, 26 Mar 2015 09:52:12 +0000 (09:52 +0000)] 
Docs: update QUICKSTART and INSTALL

11 years agoFix Squid crash while an error page generated
Christos Tsantilas [Thu, 26 Mar 2015 09:21:15 +0000 (11:21 +0200)] 
Fix Squid crash while an error page generated

When squid generated an error page which contains the "%m" formating code
but the authentication information is not available squid dies with
segfault.

This is a Measurement Factory project

11 years agoFix GNU atomics detection support, enable caching for them
Francesco Chemolli [Mon, 23 Mar 2015 14:13:16 +0000 (15:13 +0100)] 
Fix GNU atomics detection support, enable caching for them

11 years agoRename PeerOptions::createContext to createClientContext
Amos Jeffries [Mon, 23 Mar 2015 10:20:17 +0000 (03:20 -0700)] 
Rename PeerOptions::createContext to createClientContext

Paves the way for PeerOptions to represent either server or client
options, and context state.

11 years agoShuffle Ssl::parse_options to Security::ParseOptions
Amos Jeffries [Sat, 21 Mar 2015 13:35:24 +0000 (06:35 -0700)] 
Shuffle Ssl::parse_options to Security::ParseOptions

The function itself is generic, the options array entries are all
conditional so library agnostic.

Adjust the context creation functions to receive pre-parsed options
instead of the string to avoid circular dependency between libsquidssl
and libsecurity.

11 years agoDefine Security::ContextPointer for GnuTLS
Amos Jeffries [Sat, 21 Mar 2015 11:58:32 +0000 (04:58 -0700)] 
Define Security::ContextPointer for GnuTLS

11 years agoCrypto-NG: Move Ssl::PeerConnectorAnswer to Security::EncryptorAnswer
Amos Jeffries [Sat, 21 Mar 2015 08:25:19 +0000 (01:25 -0700)] 
Crypto-NG: Move Ssl::PeerConnectorAnswer to Security::EncryptorAnswer

This class was not actually depending on OpenSSL API symbols and by
abstracting it out we can unify the callback handlers for encrypted and
non-encrypted logic paths for several classes that setup connections.

11 years agoRevert changes to external_acl.cc in rev.13985
Amos Jeffries [Sat, 21 Mar 2015 08:00:21 +0000 (01:00 -0700)] 
Revert changes to external_acl.cc in rev.13985