]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
8 years agoInvalid FTP connection handling on blocked content.
Christos Tsantilas [Mon, 25 Jan 2016 17:54:50 +0000 (19:54 +0200)] 
Invalid FTP connection handling on blocked content.

FTP client gets stuck after the following chain of events:
 * Client requests a file that will be blocked by ICAP.
 * Squid starts downloading the file from the FTP server
   and sends "150 Opening..." to the FTP client.
 * Squid aborts the data connection with the FTP server
   as soon as the ICAP service blocks it.
 * Squid sends "451 Forbidden" to the FTP client.
 * The FTP server sends "500 OOPS: setsockopt: linger" to Squid.
 * Squid terminates the control connection to the FTP server.
 * Squid establishes a new control connection to the FTP server
   but does not authenticate itself.
 * Further commands from the FTP client do not work any more.

The above and many similar problems exist because Squid handles
FTP client-to-squid and squid-to-FTP server data connections
independently from each other. In many cases, one connection does
not get notified about the problems with the other connection.

This patch:
  - Add Ftp::MasterState::userDataDone to record received
    the FTP client final response status code to sent (or to be send)
    to the client.
  - The Ftp::MasterState::waitForOriginData flag to hold status of the
    squid-to-server side. If the squid-to-server side is not finishes
    yet this is true.
  - Send a control reply to the FTP client only after the data transfered
    on both server and client sides.
  - Split Client::abortTransaction to Client::abortOnData and to
    Client::abortAll()
  - Implement the Ftp::Relay::abortOnData() and Ftp::Relay::Abort()
    (i.e., StoreEntry abort handler) to avoid closing the control
    connection when the data connection is closed unexpectedly.

This is a Measurement Factory project.

8 years agoMake %<a and %<p details available to [eCAP] RESPMOD services
Eduard Bagdasaryan [Mon, 25 Jan 2016 08:26:32 +0000 (21:26 +1300)] 
Make %<a and %<p details available to [eCAP] RESPMOD services

... via adaptation_meta.

This patch fills access log entry with server connection
details as soon as possible. Previously, ALE was updated only
in prepareLogWithRequestDetails() when adaptation process has
already finished.

8 years agoBug 4409: compile error when two Heimdal libraries are installed
Amos Jeffries [Sun, 24 Jan 2016 01:18:43 +0000 (14:18 +1300)] 
Bug 4409: compile error when two Heimdal libraries are installed

8 years agoBug 4410: 4.0.4 compile error in basic_ncsa_auth
Amos Jeffries [Sun, 24 Jan 2016 00:45:30 +0000 (13:45 +1300)] 
Bug 4410: 4.0.4 compile error in basic_ncsa_auth

8 years agoSourceFormat Enforcement
Source Maintenance [Fri, 22 Jan 2016 18:12:10 +0000 (18:12 +0000)] 
SourceFormat Enforcement

8 years agoName-only note ACL stopped matching after trunk r14465 (note -m).
Christos Tsantilas [Fri, 22 Jan 2016 14:57:46 +0000 (16:57 +0200)] 
Name-only note ACL stopped matching after trunk r14465 (note -m).

Despite this fix, empty ACLStringData values (also used for myportname,
peername, tag, and other ACLs) must [continue to] match nothing because
Squid ORs acl values. In math, empty disjunction is false.

The note ACL matches name:value entries, not bare values. A valueless
name has a different semantics than an empty list of bare values. It is

  (name and value1) or (name and value2)

rather than

  name and (value1 or value2)

where an empty value disjunction would have falsified the whole
condition.

This is a Measurement Factory project.

8 years agoTests: Add --action parameter for testing script
Amos Jeffries [Mon, 18 Jan 2016 13:40:42 +0000 (02:40 +1300)] 
Tests: Add --action parameter for testing script

This command line option allows automake target to be provided as an
override to the target specified in the test build scripts. With this a
partial test can be run for all specified layers rather than a full
distcheck which can be quite slow.

8 years agoAdd missing stubs after rev.14494
Amos Jeffries [Sat, 16 Jan 2016 14:35:28 +0000 (03:35 +1300)] 
Add missing stubs after rev.14494

8 years agoAdd missing tests/stub_libmem.cc
Amos Jeffries [Sat, 16 Jan 2016 10:57:37 +0000 (23:57 +1300)] 
Add missing tests/stub_libmem.cc

8 years agoAdd missing stub_debug.cc
Amos Jeffries [Sat, 16 Jan 2016 10:42:02 +0000 (23:42 +1300)] 
Add missing stub_debug.cc

8 years agoAdd missing library link after rev.14494
Amos Jeffries [Fri, 15 Jan 2016 19:55:40 +0000 (08:55 +1300)] 
Add missing library link after rev.14494

8 years agoCert validadator fix: Currently it is always disabled
Christos Tsantilas [Fri, 15 Jan 2016 18:34:09 +0000 (20:34 +0200)] 
Cert validadator fix: Currently it is always disabled

8 years agoSourceFormat Enforcement
Source Maintenance [Fri, 15 Jan 2016 12:12:15 +0000 (12:12 +0000)] 
SourceFormat Enforcement

8 years agoBug 4005: Dynamic certificate cache exceeds dynamic_cert_mem_cache_size
Amos Jeffries [Fri, 15 Jan 2016 06:57:17 +0000 (19:57 +1300)] 
Bug 4005: Dynamic certificate cache exceeds dynamic_cert_mem_cache_size

* disable the use of system CA by default to verify client connection
  certificates. Since the use of client certificates is rare.

* no change to verification of upstream server or peer certificates.
  Since the use of system CA to sign server certificates is common.

* the new "default-ca" configuration option and its documentation are
  updated to make the situation more obvious amongst the other TLS options
  changes in Squid-4.

* the action of the sslflags=NO_DEFAULT_CA is already deprecated, so no
  change when it is used. On port lines it now merely sets the default.

It may be a good idea to also disable system CA use for cache_peer and
ICAPS connections. For now they are left unchanged.

8 years agoSourceLayout: C++11 upgrade for class YesNoNone
Amos Jeffries [Fri, 15 Jan 2016 06:47:59 +0000 (19:47 +1300)] 
SourceLayout: C++11 upgrade for class YesNoNone

* shuffles YesNoNone file to src/base/

* converts C++03 hacked 'bool' converter to a proper bool()
  operator.

* adds support for implicit defaults as will as explicit
  squid.conf settings.

* adds unit tests for YesNoNone

8 years agoSourceFormat Enforcement
Source Maintenance [Wed, 13 Jan 2016 12:12:11 +0000 (12:12 +0000)] 
SourceFormat Enforcement

8 years agoAdd connections_encrypted ACL part3: fix compiling problems
Christos Tsantilas [Wed, 13 Jan 2016 11:23:50 +0000 (13:23 +0200)] 
Add connections_encrypted ACL part3: fix compiling problems

The new acl/ConnectionsEncrypted.[cc,h] files should compiled even if
the ssl is not enabled.

8 years agoBug 4378: assertion failed: DestinationIp.cc:60: 'checklist->conn() && checklist...
Eduard Bagdasaryan [Wed, 13 Jan 2016 10:29:32 +0000 (23:29 +1300)] 
Bug 4378: assertion failed: DestinationIp.cc:60: 'checklist->conn() && checklist->conn()->clientConnection != NULL'

8 years agoAdd connections_encrypted ACL part2: add missing files
Christos Tsantilas [Wed, 13 Jan 2016 10:15:33 +0000 (12:15 +0200)] 
Add connections_encrypted ACL part2: add missing files

The src/acl/ConnectionsEncrypted.[cc,h] files forgotten while the patch
applieded to trunk.

8 years agoAdd connections_encrypted ACL
Christos Tsantilas [Wed, 13 Jan 2016 10:10:20 +0000 (12:10 +0200)] 
Add connections_encrypted ACL

The new connections_encrypted ACL matches transactions where all HTTP
messages were received over TLS transport connections, including messages
received from ICAP servers.

Some ICAP/eCAP services receive data from unencrypted sources. Some ICAP/eCAP
services are "secure". By default we assume that all eCAP services and all
ICAP services on TLS transport connections  are "secure" unless the user
uses the "connection_encryption" option in service configuration line.

This is a Measurement Factory project.

8 years agoFix tls/ssl flags parsing
Christos Tsantilas [Tue, 12 Jan 2016 17:35:06 +0000 (19:35 +0200)] 
Fix tls/ssl flags parsing

Tls flags listed using the [tls-|tls|ssl]flags option are not configured
correctly. In practice always the SSL_FLAG_NO_DEFAULT_CA even if no
selected and all other flags are ingored

8 years agoBug 4403: helper compile errors after rev.14454
Eliezer Croitoru [Mon, 11 Jan 2016 09:23:06 +0000 (22:23 +1300)] 
Bug 4403: helper compile errors after rev.14454

8 years agoBug 4401: compile error on Solaris
Eduard Bagdasaryan [Fri, 8 Jan 2016 05:49:15 +0000 (18:49 +1300)] 
Bug 4401: compile error on Solaris

8 years ago4.0.4 SQUID_4_0_4
Amos Jeffries [Wed, 6 Jan 2016 16:10:48 +0000 (05:10 +1300)] 
4.0.4

8 years agoPrep for 4.0.4 and 3.5.13
Amos Jeffries [Wed, 6 Jan 2016 14:18:40 +0000 (03:18 +1300)] 
Prep for 4.0.4 and 3.5.13

8 years agonegotiate_kerberos_auth: check for overflow on count of group SIDs
Amos Jeffries [Wed, 6 Jan 2016 04:02:24 +0000 (17:02 +1300)] 
negotiate_kerberos_auth: check for overflow on count of group SIDs

When processing a Kerberos token the count of group SID records is
received from the remote end. Validate that the count given does not
exceed the possible length values on 32-bit systems.
 Detected by Coveriity Scan. Issues 12587011258702,1258703

8 years agobasic_ncsa_auth: reduce use of std::string::c_str()
Amos Jeffries [Wed, 6 Jan 2016 03:15:12 +0000 (16:15 +1300)] 
basic_ncsa_auth: reduce use of std::string::c_str()

This should also reduce issues with c_str() escaping and variable scope
"use after free" identified by Coverity Scan issue #1347000

8 years agoRevert wrong changes incorrectly added to r14477
Amos Jeffries [Tue, 5 Jan 2016 13:00:50 +0000 (02:00 +1300)] 
Revert wrong changes incorrectly added to r14477

8 years agoSourceFormat Enforcement
Source Maintenance [Tue, 5 Jan 2016 12:12:09 +0000 (12:12 +0000)] 
SourceFormat Enforcement

8 years agoSsl::CertValidationHelper::sslSubmit: Assure that the callback->getDialer()
Christos Tsantilas [Tue, 5 Jan 2016 11:02:19 +0000 (13:02 +0200)] 
Ssl::CertValidationHelper::sslSubmit: Assure that the callback->getDialer()
return non NULL before use the result

Detected by Coverity Scan. Issue 1346998

8 years agoSsl::CertValidationResponse::RecvdError::error_depth may used uninitialized
Christos Tsantilas [Tue, 5 Jan 2016 10:55:14 +0000 (12:55 +0200)] 
Ssl::CertValidationResponse::RecvdError::error_depth may used uninitialized

The Ssl::CertValidationResponse::RecvdError::error_depth is not initialized
inside copy constructor and inside "=" operator.

This class member added with the patch 14443:
    "%ssl::<cert_errors logformat code part2: provide depth information"

Detected by Coverity Scan. Issue 1346999

8 years agoBug 4393: compile fails on OS X
Francesco Chemolli [Tue, 5 Jan 2016 10:35:51 +0000 (23:35 +1300)] 
Bug 4393: compile fails on OS X

Also fixes related issues with -latomic detection and linking
to binaries that do not use C++11 atomics.

8 years agoFix GnuTLS detection via pkg-config
Francesco Chemolli [Mon, 4 Jan 2016 14:39:06 +0000 (15:39 +0100)] 
Fix GnuTLS detection via pkg-config

8 years agoRevert non-CharacterSet changes from rev.14472
Amos Jeffries [Mon, 4 Jan 2016 05:52:47 +0000 (18:52 +1300)] 
Revert non-CharacterSet changes from rev.14472

8 years agoFix libatomic detection in configure.ac
Francesco Chemolli [Sun, 3 Jan 2016 10:45:27 +0000 (11:45 +0100)] 
Fix libatomic detection in configure.ac

8 years agoSourceFormat Enforcement
Source Maintenance [Sat, 2 Jan 2016 18:12:11 +0000 (18:12 +0000)] 
SourceFormat Enforcement

8 years agoCharacterSet improvements: implement operators -=, +, -, ==, !=; implement c++11...
Francesco Chemolli [Sat, 2 Jan 2016 13:52:42 +0000 (14:52 +0100)] 
CharacterSet improvements: implement operators -=, +, -, ==, !=; implement c++11 ranges-constructor, add ostream output operator, and related unit tests.
Change build order in top-level Makefile.am so that src/ is built before helpers/

8 years agoSourceFormat Enforcement
Source Maintenance [Fri, 1 Jan 2016 06:11:55 +0000 (06:11 +0000)] 
SourceFormat Enforcement

8 years agoSourceFormat Enforcement
Source Maintenance [Fri, 1 Jan 2016 00:12:18 +0000 (00:12 +0000)] 
SourceFormat Enforcement

8 years agoReflect the [ugly] reality in external_acl_type cache=n documentation.
Alex Rousskov [Thu, 31 Dec 2015 03:32:59 +0000 (20:32 -0700)] 
Reflect the [ugly] reality in external_acl_type cache=n documentation.

The patch does not change how the cache works, but may help admins
configure the cache correctly if they stumble upon the updated docs.

A typical external ACL cache with the default cache settings consumes
about 70 MB of RAM (more in many cases, e.g., if annotations are used
with external ACLs). Besides memory usage, the default cache is using
only 977 hash buckets for 262144 entries so there may be quite a bit
of linear search going on by default.

8 years agoMigrate basic_ncsa_auth from squid has to std:: containers
Francesco Chemolli [Mon, 28 Dec 2015 11:14:42 +0000 (12:14 +0100)] 
Migrate basic_ncsa_auth from squid has to std:: containers

8 years agoWorkaround for build regression introduced in r14458
Francesco Chemolli [Sun, 27 Dec 2015 14:20:16 +0000 (15:20 +0100)] 
Workaround for build regression introduced in r14458

8 years agoSourceFormat Enforcement
Source Maintenance [Thu, 24 Dec 2015 12:12:12 +0000 (12:12 +0000)] 
SourceFormat Enforcement

8 years agoNote ACL substrings matching
Christos Tsantilas [Thu, 24 Dec 2015 06:57:04 +0000 (08:57 +0200)] 
Note ACL substrings matching

There are several use cases where an annotation may contain a list of values
for a single key. Today it is only possible to match the full annotation value.

This patch investigates the -m flag which can be used to enable delimiter
separated substrings matching on annotations:
   acl aclname note [-m[=delimiters]] name value ...
The '-m' flag by default matches comma separated substrings. The optional
"delimiters" parameter is a list of non-alphanumeric characters, which can
be used as alternate delimiters.

E.g. if an external ACL sets an annotation like:
   "applications=http,facebook,facebook-chat"
the following ACLs can be used to block access to certain applications:

acl fb_chat      note -m applications facebook-chat
acl db_upload    note -m  applications dropbox-upload
http_access      deny fb_chat
http_access      deny db_upload

This is a Measurement Factory project

8 years agoLog TLS Cryptography Parameters: more more fixes to allow "make check" work
Christos Tsantilas [Wed, 23 Dec 2015 13:17:35 +0000 (15:17 +0200)] 
Log TLS Cryptography Parameters: more more fixes to allow "make check" work

8 years agoSourceFormat Enforcement
Source Maintenance [Wed, 23 Dec 2015 12:12:10 +0000 (12:12 +0000)] 
SourceFormat Enforcement

8 years agoLog TLS Cryptography Parameters: more fixes to allow "make distcheck" work
Christos Tsantilas [Wed, 23 Dec 2015 12:08:55 +0000 (14:08 +0200)] 
Log TLS Cryptography Parameters: more fixes to allow "make distcheck" work

8 years agoLog TLS Cryptography Parameters: fixes to allow "make check/distcheck" work
Christos Tsantilas [Wed, 23 Dec 2015 10:13:39 +0000 (12:13 +0200)] 
Log TLS Cryptography Parameters: fixes to allow "make check/distcheck" work

8 years agoLog TLS Cryptography Parameters
Christos Tsantilas [Wed, 23 Dec 2015 10:11:26 +0000 (12:11 +0200)] 
Log TLS Cryptography Parameters

This patch adds the following formatting codes:
  %ssl::>negotiated_version  The TLS version of the client-to-Squid connection.
  %ssl::<negotiated_version  The TLS version of the Squid-to-server connection.
  %ssl::>received_hello_version The TLS version of the Hello message received
                                from TLS client
  %ssl::<received_hello_version The TLS version of the Hello message received
                                from TLS server.
  %ssl::>received_supported_version The maximum TLS version supported by the
                                    the TLS client.
  %ssl::<received_supported_version The maximum TLS version supported by the
                                    the TLS server.
  %ssl::>cipher   The negotiated cipher of the client-to-Squid connection.
  %ssl::<cipher   The negotiated cipher of the Squid-to-server connection.

These are useful for statistics collection, security reviews, and reviews
prior to adjusting the list of the allowed TLS protocols and ciphers.

This is a Measurement Factory project

8 years agoSourceFormat Enforcement
Source Maintenance [Tue, 22 Dec 2015 12:12:11 +0000 (12:12 +0000)] 
SourceFormat Enforcement

8 years agoAdd cache_peer auth-no-keytab option to use a credentials cache instead of keytab
Amos Jeffries [Tue, 22 Dec 2015 10:57:16 +0000 (23:57 +1300)] 
Add cache_peer auth-no-keytab option to use a credentials cache instead of keytab

... when using login=NEGOTIATE to authenticate via kerberos to a peer.

When specified, this option prevents Squid from crafting a kerberos
credentials cache from a keytab, but instead lets GSSAPI use an existing
credentials cache.

8 years agoSourceFormat Enforcement
Source Maintenance [Tue, 22 Dec 2015 00:12:11 +0000 (00:12 +0000)] 
SourceFormat Enforcement

8 years agoFix typo in rev.14350
Amos Jeffries [Mon, 21 Dec 2015 21:55:05 +0000 (10:55 +1300)] 
Fix typo in rev.14350

8 years agoSourceFormat Enforcement
Source Maintenance [Mon, 21 Dec 2015 12:12:10 +0000 (12:12 +0000)] 
SourceFormat Enforcement

8 years agoC++-ify basic_fake_auth
Francesco Chemolli [Mon, 21 Dec 2015 10:22:45 +0000 (11:22 +0100)] 
C++-ify basic_fake_auth

8 years agoConvert ClientSocketContext to MEMPROXY class
Amos Jeffries [Fri, 18 Dec 2015 13:10:26 +0000 (02:10 +1300)] 
Convert ClientSocketContext to MEMPROXY class

CBDATA and RefCountable are not very compatible. With the recent I/O
callback shuffling there appears to no longer be any reason for this
class to be CBDATA.

8 years agoBug 4397: DragonFly BSD, POSIX shared memory is implemented as filepath
Amos Jeffries [Fri, 18 Dec 2015 07:07:46 +0000 (20:07 +1300)] 
Bug 4397: DragonFly BSD, POSIX shared memory is implemented as filepath

8 years agoSquid with a misconfigured (too-small) shared memory cache might crash
Alex Rousskov [Fri, 18 Dec 2015 04:30:52 +0000 (21:30 -0700)] 
Squid with a misconfigured (too-small) shared memory cache might crash
upon startup.

Controller condition for allocating MemStore is slightly different from
MemStore condition for allocating MemStore::map, resulting in MemStore
without a map. Until that discrepancy is fixed, be careful when
dereferencing MemStore::map.

8 years agoFix segfault after rev.14439
Amos Jeffries [Fri, 18 Dec 2015 02:18:39 +0000 (15:18 +1300)] 
Fix segfault after rev.14439

8 years agoTypo in rev.14448
Amos Jeffries [Thu, 17 Dec 2015 11:54:50 +0000 (00:54 +1300)] 
Typo in rev.14448

8 years agoPolish: update tls-no-default-ca logic to match tls-no-npn
Amos Jeffries [Wed, 16 Dec 2015 23:17:16 +0000 (12:17 +1300)] 
Polish: update tls-no-default-ca logic to match tls-no-npn

8 years agoShuffle TLS NPN logic to libsecurity
Amos Jeffries [Wed, 16 Dec 2015 23:10:40 +0000 (12:10 +1300)] 
Shuffle TLS NPN logic to libsecurity

Also, adds new config option tls-no-npn to fully disable NPN on selected
cache_peer or http(s)_port directives.

ICAPS services set TLS NPN to off by default to prevent NPN wrongly
advertising them as HTTPS connections. The semantic meaning of NPN is to
name the protocol which is being wrapped by TLS, in the case of ICAPS that
is ICAP/1.0 but Squid NPN callback is currently hard-coded to send 'http/1.1'

8 years agoAdd missing parts to rev.14346 for squid.conf parse and display
Amos Jeffries [Wed, 16 Dec 2015 14:06:32 +0000 (03:06 +1300)] 
Add missing parts to rev.14346 for squid.conf parse and display

8 years agoFwdState should retry connect to the next ip after a Ssl::PeerConnector failure
Christos Tsantilas [Wed, 16 Dec 2015 13:47:22 +0000 (15:47 +0200)] 
FwdState should retry connect to the next ip after a Ssl::PeerConnector failure

When the Ssl::PeerConnector fails to establish an SSL connection FwdState does
not retry to connect to the next destination server ip address, but instead
returns an error.

This is a Measurement Factory project

8 years ago%ssl::<cert_errors logformat code part2: replace std::stoi call with atoi to
Christos Tsantilas [Mon, 14 Dec 2015 10:00:07 +0000 (12:00 +0200)] 
%ssl::<cert_errors logformat code part2: replace std::stoi call with atoi to
make g++-4.9 on FreeBsd-9.3 happy

8 years ago%ssl::<cert_errors logformat code part2: provide depth information
Christos Tsantilas [Sun, 13 Dec 2015 17:53:57 +0000 (19:53 +0200)] 
%ssl::<cert_errors logformat code part2: provide depth information

The first implementation of %ssl::<cert_errors formating code does not provide
information about the certificate the errors belongs.
This patch prints the chain depth information for error, if exist, using the
following format for the printed certificate error:
   ERROR@depth=X

The patch also adds the "error_depth_" parameter to cert validator, used to
pass depth information from cert validator to squid.

This is a Measurement Factory project

8 years agoAvoid memory leaks when a certificate validator is used with SslBump
Christos Tsantilas [Sun, 13 Dec 2015 17:13:44 +0000 (19:13 +0200)] 
Avoid memory leaks when a certificate validator is used with SslBump

When a certificate validator was used, sslCrtvdHandleReplyWrapper delivered
validator response directly to the Ssl::PeerConnector job using job's
Ssl::CertValidationHelper::CVHCB callback. If that synchronous call happened
to be the last job call, then Ssl::PeerConnector::done() would become true
for the job, as it should, but nobody would notice that the PeerConnector
job object should be deleted, and the object would leak.

This fix converts CVHCB into an async job call to avoid direct, unprotected
job calls in this context.

This is a Measurement Factory project.

8 years agoThe user baseDN is ignored for ext_ldap_group_acl helper
Christos Tsantilas [Wed, 9 Dec 2015 16:32:28 +0000 (18:32 +0200)] 
The user baseDN is ignored for ext_ldap_group_acl helper

The user baseDN provided with -B argument is always ignored, which leads to
problems if user baseDN and group baseDN are not the same.

The bug introduced with the r14382 patch.

8 years agoRefactor ClientSocketContext write(2) using Server:: write methods
Amos Jeffries [Tue, 8 Dec 2015 18:47:25 +0000 (10:47 -0800)] 
Refactor ClientSocketContext write(2) using Server:: write methods

Writing to the client connection is scoped as an action for class Server
and its child classes. There is no need for ClientSocketContext to be
providing the callback handlers and performing I/O error handling.

With Server providing the current write handler we can move from
CBDATA callbacks to AsyncCall. Initial testing indicates this has some
minor performance benefit.

8 years agoTLS: refactor cert=/key= storage in libsecurity
Amos Jeffries [Tue, 8 Dec 2015 01:48:40 +0000 (17:48 -0800)] 
TLS: refactor cert=/key= storage in libsecurity

This updates the cert=/key= filename storage from single entries
in PeerOptions to a list of key pairs in preparation for supporting
multiple certificates on client or server TLS contexts.

key= following a cert= parameter is now enforced, rather than just
warned about.

squid.conf can now be configured with multiple [cert= [key=...]]
pairs of filenames, however only the first is used. This differs
from older behaviour where the last value(s) were used. But since
configurations with multiple values was not supported previously
this seems acceptible breakage.

Since the multi-cert support is not fully existing yet this config
ability is left undocumented for now.

8 years agoFix connections over plain squid port to SSL origins
Christos Tsantilas [Mon, 7 Dec 2015 09:53:57 +0000 (11:53 +0200)] 
Fix connections over plain squid port to SSL origins

After the "Restrict SslBump inspections of cache_peer connections"/r14425 patch
https requests over plain proxy port (eg. "GET https://www.example.com/" on
http_port) does not work any more.
This is because the BlindPeerConnector class, which used now for any connection
to the https peers or servers designed initialy to work with cache_peer
connections.

This small patch fix Ssl::BlindPeerConnector to initiate SSL connections
destined to origin SSL servers.

This is a Measurement Factory project.

8 years agoCleanup: pass PeerOptions to sslCreateClientContext()
Amos Jeffries [Mon, 7 Dec 2015 01:45:46 +0000 (17:45 -0800)] 
Cleanup: pass PeerOptions to sslCreateClientContext()

... to reduce context creation code and simplify upcoming libsecurity
migration steps.

8 years agoMake TidyPointer act like other pointers in bool comparison
Amos Jeffries [Sun, 6 Dec 2015 15:42:52 +0000 (07:42 -0800)] 
Make TidyPointer act like other pointers in bool comparison

8 years agoCleanup: Expose SSL initialization function to libsecurity
Amos Jeffries [Sun, 6 Dec 2015 13:59:59 +0000 (05:59 -0800)] 
Cleanup: Expose SSL initialization function to libsecurity

SSL initialize needs to be performed before any security context
objects are generated. Expose the function so that the new blank
context methods can use it.

8 years agoAdd missing stub defines for rev.14433
Amos Jeffries [Sat, 5 Dec 2015 07:15:06 +0000 (23:15 -0800)] 
Add missing stub defines for rev.14433

8 years agoCleanup TLS: shuffle context creation to libsecurity
Amos Jeffries [Sat, 5 Dec 2015 04:45:43 +0000 (20:45 -0800)] 
Cleanup TLS: shuffle context creation to libsecurity

8 years agoBug 4392: assertion CbcPointer.h:159: 'c' via tunnelServerClosed or tunnelClientClosed
Amos Jeffries [Fri, 4 Dec 2015 18:00:46 +0000 (10:00 -0800)] 
Bug 4392: assertion CbcPointer.h:159: 'c' via tunnelServerClosed or tunnelClientClosed

8 years agoCleanup TLS: shuffle AnyP::PortCfg::staticSslContext into libsecurity
Amos Jeffries [Fri, 4 Dec 2015 13:35:13 +0000 (05:35 -0800)] 
Cleanup TLS: shuffle AnyP::PortCfg::staticSslContext into libsecurity

There are no logic changes in this patch. Only symbol moves and debugs
documentation polish.

8 years agoCleanup: add Security::ContextPointer as smart pointer to SSL_CTX*
Amos Jeffries [Fri, 4 Dec 2015 02:28:25 +0000 (18:28 -0800)] 
Cleanup: add Security::ContextPointer as smart pointer to SSL_CTX*

Due to circular dependency issues between ssl/libsquidssl.la and
security/libsecurity.la the code within src/ssl/ is restricted to
only using Security::ContextPtr, it MUST NOT use ContextPointer

Code outside of src/ssl/ should always use Security::ContextPointer
when storing a reference to a context.

Unfortunately some uses of SSL_CTX_Pointer and AnyP::PortCfg remain
in src/ssl/support.cc for now.

8 years agoSourceFormat Enforcement
Source Maintenance [Thu, 3 Dec 2015 00:12:11 +0000 (00:12 +0000)] 
SourceFormat Enforcement

8 years agoComplete certificate chains using external intermediate certificates
Christos Tsantilas [Wed, 2 Dec 2015 19:45:15 +0000 (21:45 +0200)] 
Complete certificate chains using external intermediate certificates
stored in sslproxy_foreign_intermediate_certs file.

Many origin servers do not send complete certificate chains. Many
browsers use certificate extensions in the server certificate to
download the missing intermediate certificates automatically from
the Internet. Squid does not do that (yet?).

This patch adds the sslproxy_foreign_intermediate_certs configuration directive
to allow an admin to supply a file with intermediate certificates that
Squid may use to complete certificate chains. These intermediate
certificates are _not_ treated as trusted root certificates.

This is a Measurement Factory project.

8 years agoSourceFormat Enforcement
Source Maintenance [Mon, 30 Nov 2015 18:12:19 +0000 (18:12 +0000)] 
SourceFormat Enforcement

8 years agoCleanup: Simplify HTTP 1xx control message writing
Amos Jeffries [Mon, 30 Nov 2015 14:23:16 +0000 (06:23 -0800)] 
Cleanup: Simplify HTTP 1xx control message writing

The ::Server class heirarchy has the responsibility of writing to
client connection sockets. The logic that was in ClientSocketContext
can be moved (unchanged) to HttpControlMsgSink and ConnStateData.
There was actually never any need to have it spread outside the
ConnStateData class hierarchy in the first place.

No logic is changed in this patch, just symbol shuffling and one
method inlined into its caller.

8 years agoRestrict SslBump inspections of cache_peer connections.
Christos Tsantilas [Mon, 30 Nov 2015 10:53:23 +0000 (12:53 +0200)] 
Restrict SslBump inspections of cache_peer connections.

This change is specific to FwdState code path. It does not affect tunneled
traffic. Thus, it does not affect CONNECT tunnels unless they are being
inspected with SslBump code.

The old code always used PeekingPeerConnector when connecting to a TLS-related
cache_peer. That approach worked because PeekingPeerConnector does not always
inspect the SSL/TLS connection it establishes. We were kind of lucky that
PeekingPeerConnector exceptions matched FwdState needs.

The primary PeekingPeerConnector goal is to inspect. As its code evolves, it may
enable inspection when FwdState does not want it. Non-peeking cases inside
PeekingPeerConnector should all deal with exceptional situations that
are difficult to predict a priori, before the connector object is created.

This change restricts inspection to cases where an inspected SSL client
connection is being forwarded, reducing the probability that a peer
connection is wrongly inspected. This change does not fix any known bugs.

This is a Measurement Factory project.

8 years agoBug 4387: Kerberos build errors on Solaris
Amos Jeffries [Sun, 29 Nov 2015 14:20:34 +0000 (06:20 -0800)] 
Bug 4387: Kerberos build errors on Solaris

8 years ago4.0.3 SQUID_4_0_3
Amos Jeffries [Sat, 28 Nov 2015 15:29:39 +0000 (07:29 -0800)] 
4.0.3

8 years agoPrep for 4.0.3 and 3.5.12
Amos Jeffries [Sat, 28 Nov 2015 14:18:32 +0000 (06:18 -0800)] 
Prep for 4.0.3 and 3.5.12

8 years agoCleanup: rename Security::ContextPointer to ContextPtr
Amos Jeffries [Sat, 28 Nov 2015 03:00:35 +0000 (19:00 -0800)] 
Cleanup: rename Security::ContextPointer to ContextPtr

... Pointer is used in Squid for smart pointers, which this is not (yet).

Also convert remaining SSL_CTX* instances with ContextPtr.

8 years agoAdd missing include after rev.14418
Amos Jeffries [Thu, 26 Nov 2015 21:14:30 +0000 (13:14 -0800)] 
Add missing include after rev.14418

8 years agoSourceFormat Enforcement
Source Maintenance [Wed, 25 Nov 2015 06:12:10 +0000 (06:12 +0000)] 
SourceFormat Enforcement

8 years agoCleanup: Refactor ConnStateData pipeline handling
Amos Jeffries [Wed, 25 Nov 2015 04:21:40 +0000 (20:21 -0800)] 
Cleanup: Refactor ConnStateData pipeline handling

This refactors the request pipeline management API to use std::list
instead of a custom linked-list with accessors spread over both
ConnStateData and ClientSocketContext.

To do this a new class Pipeline is created with methods wrapping
std::list API and extending it slightly to meet the HTTP/1.1 pipeline
behaviours and perform basic stats gathering. The pipeline management
methods and state variables are moved inside this class.

ClientSocketContext was performing several layering violations in
relation to ConnStateData when one transaction ended and the next needed
starting. Treating the pipeline properly as a std::list forced removal
of that violation.

* actions for starting or resuming a transaction on the connection are
now moved to ConnStateData::kick(). Which gets called after each
transaction completes.
 - with some further cleanup it can be called at any point the
ConnStateData needs to resume processing. However, that is left out of
scope for this patch.

* the ClientSocketContext scope now ends when the finished() method is
used to mark completion of these contexts transactions. Which will mark
itself done and de-register from the Pipeline queue. The ConnStateData
kick() method still needs to be called to resume other transactions
processing.

* the queue is now holding RefCounted Pointers. So that the
ClientSocketContext destructor no longer needs to be careful of
registrations, and the queue entries are guaranteed to still exist while
queued.

* The old freeAllContexts() and notifyAllContexts(int) members of
ConnStateData have been combined into Pipeline::terminateAll(int).

The ClientSocketContext and ConnStateData documentation is updated to
describe what they do in regards to connection and transaction processing.

Initial testing revealed CONNECT tunnels always being logged as ABORTED.
This turns out to be techincally correct, since the only way a tunnel
can finish is for client or server to just close the connection.
However, it is not right to log these as abnormal aborts. Instead, I
have now made the context be finished() just prior to the
TunnelStateData being destroyed. That way normal closure should show up
only as TUNNEL, but timeouts and I/O errors should still be recorded as
abnormal.

Two potential bugs have been highlighted:

* The on_unsupported_protocol handling function appears to be a bit
broken. It pop()'s contexts off the pipeline directly without going
through the proper finished() process to release their state data. I
have highlighted that with an XXX and comment.

* The ssl-bump handling logic switching to TLS begins with a terminateAll(0)
run on all active contexts. It does not check whether there is any existing
pipeline of requests waiting to be processed. And the action prematurely
purges the bumped CONNECT message context, which should be closed properly
and logged as successful.

8 years agoAdd missing stub definition for CPU_ISSET
Amos Jeffries [Tue, 24 Nov 2015 08:01:16 +0000 (00:01 -0800)] 
Add missing stub definition for CPU_ISSET

8 years agoBug 4383: Kerberos library detection failing
Amos Jeffries [Tue, 24 Nov 2015 01:43:30 +0000 (17:43 -0800)] 
Bug 4383: Kerberos library detection failing

8 years agoFix typo in tunnel.cc
Amos Jeffries [Mon, 23 Nov 2015 08:18:35 +0000 (00:18 -0800)] 
Fix typo in tunnel.cc

8 years agoFix build errors in cpuafinity.cc
Amos Jeffries [Mon, 23 Nov 2015 01:46:29 +0000 (17:46 -0800)] 
Fix build errors in cpuafinity.cc

So OS provide stub sched.h which contain various amounts of the CPU_*
macro gadgets but not working sched_setaffinity / sched_getaffinity.

We need to check for each macro separately and limit the
HAVE_CPU_AFFINITY protection to the syscalls which configure actually
checked for.

8 years agoIncluded <vector> that was missing on some platforms after r14411.
Alex Rousskov [Sat, 21 Nov 2015 14:59:09 +0000 (07:59 -0700)] 
Included <vector> that was missing on some platforms after r14411.

8 years agoError on missing MIT libraries only if MIT was required
Amos Jeffries [Thu, 19 Nov 2015 14:07:53 +0000 (06:07 -0800)] 
Error on missing MIT libraries only if MIT was required

8 years agoSourceFormat Enforcement
Source Maintenance [Thu, 19 Nov 2015 06:12:03 +0000 (06:12 +0000)] 
SourceFormat Enforcement

8 years agoStore API and layout polishing. No functionality changes intended.
Alex Rousskov [Thu, 19 Nov 2015 05:51:49 +0000 (22:51 -0700)] 
Store API and layout polishing. No functionality changes intended.

Fixes "any Store is a Root" API that forced us to bloat the base
Store class with methods needed only in Store::Root() Controller.
Unblocks bug #7 (cached headers update) fixes.

Class renaming and source file movement map:

  src/SwapDir.h => src/store/Disk.h (and Controller.h)
  src/SwapDir.cc => src/store/Disk.cc
  src/StoreHashIndex.h => src/store/Disks.h (and LocalSearch.h)
  src/store_dir.cc => src/store/Controller.cc (and Disks.cc, LocalSearch.cc)
  src/disk.* => src/fs_io.*

The Store namespace hierarchy now looks like this:

* Storage: Any storage. Similar to the old Store class, but leaner.
* Controller: Combined memory/disks caches and transients. Root API.
* Controlled: Memory cache, disk(s) cache, or transient Storage.
* Disks: All disk caches combined.
* Disk: A single cache_dir Storage.
* Memory: A memory cache.
* Transients: Entries capable of being collapsed for CF.

Please see merged branch commits for details.

8 years agoAdd missing bit of rev.14405
Amos Jeffries [Thu, 19 Nov 2015 02:30:20 +0000 (18:30 -0800)] 
Add missing bit of rev.14405