]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
13 years agoFixed Ssl::CertificateProperties::dbKey() to always reset the accumulation buf.
Alex Rousskov [Fri, 3 Feb 2012 23:48:48 +0000 (16:48 -0700)] 
Fixed Ssl::CertificateProperties::dbKey() to always reset the accumulation buf.

Also use append instead of assignment, just in case the assignment operator
frees previously reserve()d memory.

13 years agoFixed debugging line: "<<" has higher precedence than "?:".
Alex Rousskov [Fri, 3 Feb 2012 23:34:03 +0000 (16:34 -0700)] 
Fixed debugging line: "<<" has higher precedence than "?:".

13 years agoFixed GCC v4.1.2 "converting to non-pointer type bool from NULL" warning.
Alex Rousskov [Fri, 3 Feb 2012 22:47:56 +0000 (15:47 -0700)] 
Fixed GCC v4.1.2 "converting to non-pointer type bool from NULL" warning.

13 years agoPolice ssl_crtd generating/parsing request code
Christos Tsantilas [Fri, 3 Feb 2012 18:44:57 +0000 (20:44 +0200)] 
Police ssl_crtd generating/parsing request code

This patch:

Add the following methods:
- Ssl::CrtdMessage::parseRequest: Parse a ssl_crtd "new certificate" request and
  store the requested certificate properties to a CertificateProperties object

- Ssl::CrtdMessage::composeRequest: Generate a "new certificate" ssl_crtd
  request using the certificate properties given by a CertificateProperties
  object

- Ssl::CertificateProperties::dbKey:  Return a valid key for the generated
  certificate to be used with a (memory or disk) database, based on its
  properties

Others:
- The ssl_crtd.cc code simplified using the above methods
- The ConnStateData::buildSslCertGenerationParams and ConnStateData::getSslContextStart
  simplified using the above methods

13 years agoDisable persistent connections after client-side-detected errors.
Alex Rousskov [Fri, 3 Feb 2012 18:01:27 +0000 (11:01 -0700)] 
Disable persistent connections after client-side-detected errors.

HTTP does not require to close the connection after most errors, but some
client-side-detected errors (those detected by clientProcessRequest) are about
HTTP message framing and should result in connection closure. For other
client-side-detected errors (those detected in serveDelayedError), the
client-side code is just not ready to handle persistency well:

* If we leave flags.readMore as true, then a new request on the same
  connection may find bumpErrorEntry set and think there is a delayed error
  that needs to be served, but that StoreEntry object has been already used.
  And we should not simply clear bumpErrorEntry because it is not locked by
  the error writing code using it. There may be other problems as well (and it
  is likely the connection is not usable anyway because the fake certificate
  was rejected by the client).

* If we set flags.readMore to false then we will not resume reading after
  serving the error, causing "abandoning such and such connection" errors
  and stuck ConnStateData jobs.

Thus, in summary, we should set flags.readMore to false and, if we do that, we
should also set proxy_keepalive to zero so that we close the connection after
serving the error to the client.

13 years agoServer certificate testing ACLs Part2
Christos Tsantilas [Thu, 2 Feb 2012 19:14:55 +0000 (21:14 +0200)] 
Server certificate testing ACLs Part2

Replace the hard coded implementation for default signing algorithm applied
to generated certificates which does not match the configured sslproxy_cert_sign
access list, with default acl lines.

The new tag POSTSCRIPTUM added to the cf.data.pre file which can be used to
append to the user configuration some default config lines.

13 years agoServer certificate testing ACLs
Christos Tsantilas [Thu, 2 Feb 2012 10:53:08 +0000 (12:53 +0200)] 
Server certificate testing ACLs

This patch add the following ACLs to test the condition of the origin server
certificate: ssl::certHasExpired, ssl::certNotYetValid, ssl::certDomainMismatch,
ssl::certUntrusted and ssl::certSelfSigned.

The above in this patch are predifined acl lists or/and can be used as error
name shortcuts with ssl_error ACL lists

Implementation details:
1) The ssl::certHasExpired,  ssl::certNotYetValid, ssl::certDomainMismatch
ssl::certUntrusted and ssl::certSelfSign acl lists are predifined in cf.data.pre

2) The above names can also used as error names. The ssl-error parser
(Ssl::ParseErrorString function) replace them with the appropriate SSL error
list.

3) The Ssl::ParseErrorString function modified to return a list of errors, not
just an error code.

4) I implement the IFDEF /ENDIF block support for cf.data.pre file.

13 years agoBug fix: broken intermediate certificate is mimicked instead of the origin server...
Christos Tsantilas [Thu, 2 Feb 2012 09:28:02 +0000 (11:28 +0200)] 
Bug fix: broken intermediate certificate is mimicked instead of the origin server certificate

 In the case of SSL error we are trying to get the server ssl certificate from
the Ssl::ErrorDetail object using the Ssl::ErrorDetail::peerCert method.
But with the current implementation this method does not return the peer
certificate but instead the broken certificate which may be different than the
peer certificate.

This patch:
1) Stores both server and broken certificate in Ssl::ErrorDetail objects
2) Fix the Ssl::ErrorDetail::peerCert method to return always server certificate
3) Add a new method the Ssl::ErrorDetail::brokenCert which return the broken
   certificate

13 years agoSet logged status code (%<Hs) to 200 when establishing a bumped tunnel.
Alex Rousskov [Wed, 1 Feb 2012 19:12:41 +0000 (12:12 -0700)] 
Set logged status code (%<Hs) to 200 when establishing a bumped tunnel.

Bumped CONNECT requests are logged separately and we always use 200 status
code when bumping them. Eventually, tunnel and bumping code should use
real HttpReply objects instead of writing hard-coded reply strings that
logging code has no access to.

13 years agoProtect sslErrorList from being used outside USE_SSL. BumpSslServerFirst.take04
Alex Rousskov [Wed, 1 Feb 2012 06:36:28 +0000 (23:36 -0700)] 
Protect sslErrorList from being used outside USE_SSL.

13 years agoAdd FwdState close handler to pinned connections.
Alex Rousskov [Wed, 1 Feb 2012 06:05:08 +0000 (23:05 -0700)] 
Add FwdState close handler to pinned connections.

Without a close handler, we will not notice when Server forcefully closed the
connection (e.g., when receiving a zero-size response due to a pconn race)
and, hence, will not retry the connection (or server an error), resulting in a
stuck client (e.g., again, when the server received a zero-size response).

13 years agoReplaced PROTO_SSL_PEEK with request_flags::sslPeek and disabled server SNI
Alex Rousskov [Wed, 1 Feb 2012 05:13:24 +0000 (22:13 -0700)] 
Replaced PROTO_SSL_PEEK with request_flags::sslPeek and disabled server SNI
for bump-server-first connections.

While PROTO_SSL_PEEK was a safer design option because requests with the
"wrong" protocol scheme would be less likely to leave Squid, it required
all error-generation code to replace the protocol with PROTO_HTTPS so
that error make more sense to end users. We no longer have to do that.

The server-side SNI for bump-server-first connections has to be disabled
because bump-server-first code does not yet know the true intended server name
(even for those CONNECT requests that have server name, it would be a little
risky to use CONNECT info for SNI). That name could be eventually obtained
from the client before we peek at the server certificate but that work
is outside this project scope.

13 years agoHttpRequest::SetHost() must invalidate HttpRequest::canonical "cache"
Alex Rousskov [Wed, 1 Feb 2012 05:11:10 +0000 (22:11 -0700)] 
HttpRequest::SetHost() must invalidate HttpRequest::canonical "cache"
because the call alters canonical URI.

This change makes the callers simpler and safer.

13 years agoDo not set request->flags.no_direct for bumped CONNECT requests
Alex Rousskov [Wed, 1 Feb 2012 05:06:08 +0000 (22:06 -0700)] 
Do not set request->flags.no_direct for bumped CONNECT requests
because it precludes them from reaching their [direct] destination
unless allow-direct is set on http_port.

13 years agoPolished debugging.
Alex Rousskov [Tue, 31 Jan 2012 22:10:05 +0000 (15:10 -0700)] 
Polished debugging.

13 years agoBug fix: The SQUID_X509_V_ERR_DOMAIN_MISMATCH error name when used with sslproxy_cert...
Christos Tsantilas [Tue, 31 Jan 2012 20:57:35 +0000 (22:57 +0200)] 
Bug fix: The SQUID_X509_V_ERR_DOMAIN_MISMATCH error name when used with sslproxy_cert_error never matches

13 years agoApplied temporary workaround for bug 3405 to avoid ssl_crtd crashes when
Alex Rousskov [Tue, 31 Jan 2012 20:08:08 +0000 (13:08 -0700)] 
Applied temporary workaround for bug 3405 to avoid ssl_crtd crashes when
dealing with bad certificates.

13 years agosslproxy_cert_sign squid.conf option
Christos Tsantilas [Fri, 27 Jan 2012 15:53:38 +0000 (17:53 +0200)] 
sslproxy_cert_sign squid.conf option

This option control how generated fake SSL certificates are signed.

Syntax:
  sslproxy_cert_sign <signing algorithm> acl ...

where <signing algorithm> can be one of the signTrusted, signUntrusted or
signSelf

Default signing algorithm if the sslproxy_cert_sign is not configured is
signSelf, if the server certificate is self signed, signUntrusted if the server
certificate is untrusted (ERR_INVALID_CA, ERR_SELF_SIGNED_CERT_IN_CHAIN,
ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE, ERR_UNABLE_TO_GET_ISSUER_CERT,
ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY and ERR_CERT_UNTRUSTED errors) and
signTrusted if the server certificate is trusted.

Notes:
  - The signing algorithm passed as parameter to the ssl_crtd daemon

  - A self signed certificate generated on squid startup to be used as
    signing certificate for untrusted certificates, with CN =
    "Squid CA for Untrusted Certificates"

  - The configured certificates with http(s)_port squid.conf option chained to
    the client SSL connection only when signTrusted signing algorithm selected.
    When the signing algorithm is signSelf or signUntrusted no other certificate
    send to the client browser.

  - A small bug fixed which did not allow the sslproxy_cert_adapt option
    to be enabled in squid if the icap client is not enabled

13 years agoNo need to require s->key to be set: s->cert is used instead when needed.
Alex Rousskov [Thu, 26 Jan 2012 21:32:25 +0000 (14:32 -0700)] 
No need to require s->key to be set: s->cert is used instead when needed.

13 years agoUse CbDataList to implement Ssl::Errors list
Christos Tsantilas [Tue, 24 Jan 2012 10:03:18 +0000 (12:03 +0200)] 
Use CbDataList to implement Ssl::Errors list

Convert type of Ssl::Errors from std::vector<ssl_error_t> to
CbDataList<Ssl::ssl_error_t>

13 years agosslproxy_cert_adapt squid.conf option
Christos Tsantilas [Sat, 21 Jan 2012 10:11:43 +0000 (12:11 +0200)] 
sslproxy_cert_adapt squid.conf option

This patch add the sslproxy_cert_adapt option to squid.conf which gives to
squid administrators the required functionality to "fix" a known broken
certificate using acls.
Currently only the "Not After", "Not Before" and "Common Name" fields of a
certificate can be modified/fixed.

The sslproxy_cert_adapt option has the form:
   sslproxy_cert_adapt <adaptation algorithm> acl ...
where <adaptation algorithm> is one of the setValidAfter, setValidBefore and
setCommonName.

    setValidAfter: sets the "Not After" property to the signing cert's
                   "Not After" property.
    setValidBefore: sets the "Not Before" property to the signing cert's
                   "Not After" property.
    setCommonName: sets certificate Subject.CN property to the host name
                   from specified as a CN parameter (setCommonName{CN}) or,
                   if no explicit CN parameter was specified, extracted from
                   the CONNECT request

When the acl(s) match, the corresponding adaptation algorithm is applied to
the fake/generated certificate. Otherwise, the default mimicking action takes
place.

13 years agoCheck SSL server certificate on reconnect
Christos Tsantilas [Tue, 10 Jan 2012 10:41:18 +0000 (12:41 +0200)] 
Check SSL server certificate on reconnect

In the case where the squid-to-server connection closed and we re-connect to
server we need to check if the server certificate changed.

Moreover we need to check stored certificates with the web server certificate
to handle the case the web server certificate is updated. In this case a new
certificate must generated to mimic the updated server certificate fields

13 years agoBump-server-first fails with SQUID_X509_V_ERR_DOMAIN_MISMATCH error BumpSslServerFirst.take03
Christos Tsantilas [Fri, 6 Jan 2012 12:01:42 +0000 (14:01 +0200)] 
Bump-server-first fails with SQUID_X509_V_ERR_DOMAIN_MISMATCH error

When the bump-server-first used we do not always know the hostname of the server
we are connecting to. Thus the the hostname validity check for the
SSL server certificate will fail with SQUID_X509_V_ERR_DOMAIN_MISMATCH error.

This patch does not check if server certificate is valid for the hostname on
bump-server-first case and move this check after the http request received
from the web client

13 years agoThe error pages of failed "ssl bump first" requests contains urls in the form: BumpSslServerFirst.take02
Christos Tsantilas [Thu, 22 Dec 2011 16:36:55 +0000 (18:36 +0200)] 
The error pages of failed "ssl bump first" requests contains urls in the form:
    ssl_peek://hosrtname:443
This patch fixes this problem adding code which creates a new fake HttpRequest
which is a clone of the "ssl_peek" request but sets the hostname to the CN
retrieved from server certificate and protocol to Https.
The fake HttpRequest object passed to the ErrorState object.

13 years agoImplement the Ssl::CommonHostName name to recurn the CN from a certificate,
Christos Tsantilas [Thu, 22 Dec 2011 15:23:33 +0000 (17:23 +0200)] 
Implement the Ssl::CommonHostName name to recurn the CN from a certificate,
suitable for use as a host name.
Use this function to set the ConnStateData::sslHostName in ConnStateData::httpsPeeked method

13 years agoCherry-picked trunk r11900: Bug 3433: Segfault closing SNMP BumpSslServerFirst.take01
Alex Rousskov [Wed, 21 Dec 2011 01:44:04 +0000 (18:44 -0700)] 
Cherry-picked trunk r11900: Bug 3433: Segfault closing SNMP

13 years agoForward a StoreEntry holding the bumped secure connection establishment
Christos Tsantilas [Tue, 20 Dec 2011 15:35:27 +0000 (17:35 +0200)] 
Forward a StoreEntry holding the bumped secure connection establishment
error page from the server-side code (which generates the error) to the
client-side code (which delays the error until the first encrypted
request comes). This allows Squid to display the error page to the user
(using secure connection) when bumping intercepted SSL connections. The
code still needs more polishing, including generating errors with host
names and not IP addresses (when possible).

The peeked server certificate is now stored in
ConnStateData::bumpErrorEntry. This allows us to mimic the certificate
of dropped server connections.

Load signing certificate and key when initializing a tproxy-enabled
https_port.

Fixed debugging when opening a peeking connection.

13 years agoCertificate mimicking
Christos Tsantilas [Fri, 16 Dec 2011 17:17:57 +0000 (19:17 +0200)] 
Certificate mimicking

This patch try to mimic true server certificate properties when generating
a fake SSL certificate for SslBump. If ssl_crtd is enabled, it receives the
true server certificate and mimic its properties. Otherwise, the certificate
mimicking code will run in the worker.

Currently the following properties mimicked: subject name, not before/after,
and subject alternate name.

13 years agoUse CN from the peeked certificate to generate a fake certificate.
Alex Rousskov [Thu, 15 Dec 2011 19:19:53 +0000 (12:19 -0700)] 
Use CN from the peeked certificate to generate a fake certificate.

13 years agoPeek at the origin server SSL certificate when bumping intercepted HTTPS.
Alex Rousskov [Wed, 14 Dec 2011 18:24:29 +0000 (11:24 -0700)] 
Peek at the origin server SSL certificate when bumping intercepted HTTPS.

* Configuration changes:

Allow intercepted SSL connections to be bumped, in addition to the
tproxied SSL connections.

Honor and check ssl-bump flag in https_port. Earlier code apparently
assumed that the flag must be present in http_port and left
Ssl::TheGlobalContextStorage uninitialized if only https_port had the
flag.

* Client-side changes:

Added a new Ssl::ServerPeeker class to do client-side error handling
while peeking at the origin server certificate. Peeking is done at the
server-side. Server-side uses Store and store_client API to report
errors to the client-side. That works OK when the errors can be sent to
the client, but when we bump intercepted connections, the client does
not yet have a secure connection established with Squid so errors cannot
be sent (popular browsers do not display CONNECT-stage errors). Instead,
the errors must be accumulated and sent after the secure connection with
the client is established (in response to the first HTTP request on that
connection). Ssl::ServerPeeker needs work to support such accumulation.

Start Ssl::ServerPeeker job in ConnStateData::switchToHttps() and wait
for somebody to call the new ConnStateData::httpsPeeked() method back.
Needs more work to actually use the peeked certificate and handle
errors.

Changed ConnStateData::switchToHttps() profile to require destination
port number.  Without it, we cannot switch intercepted SSL connections
because they do not have a proper request structure that can supply port
details.

Polished pinned connection cleaning code: If our Comm close handler for
the pinned connection was called, do no try to remove the handler. If
the pinned connection was closed (e.g., by a server-side error), do not
try to close it again. If we already called unpinConnection(), do not
try to close the pinned connection again.

Do not assume we have a request when pinning a connection to the server.
Intercepted connections do not have requests at the connection pinning
stage.

* Server-side changes:

Bug 3243 (CVE 2009-0801: Bypass of browser same-origin access control in
intercepted communication) fix always created a new connection to the
origin server. I think it is safe (and possibly even safer!) to reuse a
pinned connection instead (if one is available). We now do that in the
new FwdState::selectPeerForIntercepted() method. If bump-server-first
does not reuse a pinned connection (left from certificate peeking),
Squid would be opening and closing to-server connections just to learn
the certificate, which is not kosher.

Added a new internal protocol type (PROTO_SSL_PEEK) to allow FwdState to
detect peeking requests and end processing after the certificate is
received (instead of proceeding with to httpStart()).

13 years agoAllow intercepted SSL connections to be bumped,
Alex Rousskov [Wed, 14 Dec 2011 17:59:23 +0000 (10:59 -0700)] 
Allow intercepted SSL connections to be bumped,
in addition to the tproxied SSL connections.

13 years agoNotice ssl-bump flag in https_port when determining whether to start ssl_crtd.
Alex Rousskov [Wed, 14 Dec 2011 17:44:20 +0000 (10:44 -0700)] 
Notice ssl-bump flag in https_port when determining whether to start ssl_crtd.

13 years agoHonor ssl-bump option for https_port: Handle Alex comments
Christos Tsantilas [Mon, 5 Dec 2011 10:39:16 +0000 (12:39 +0200)] 
Honor ssl-bump option for https_port: Handle Alex comments

- CONNECT response string should contain the "HTTP/1.1" part and Host
- Comment fixes

13 years agoHonor ssl-bump option for https_port.
Alex Rousskov [Sat, 3 Dec 2011 22:45:38 +0000 (15:45 -0700)] 
Honor ssl-bump option for https_port.

Initial ssl-bump handling logic mimics that of http_port: If the option is
set, check the slow ssl_bump ACL, and if there is a match, plug into
switchToHttps() code path, generating a dynamic certificate and establishing a
secure connection with the client. If there is no match, Squid becomes a TCP
tunnel for the intercepted connection.

For now, we use the destination IP address of the intercepted connection as
the host name for the certificate (which will trigger browser warnings, of
course).

13 years agoMade ConnStateData::switchToHttps() and friends return void
Alex Rousskov [Thu, 1 Dec 2011 20:50:18 +0000 (13:50 -0700)] 
Made ConnStateData::switchToHttps() and friends return void
in preparation of making this code path asynchronous.

No runtime changes expected as their return value was not used anyway.

13 years agoPolish: convert one SECURITY WARNING to ALERT
Amos Jeffries [Tue, 22 Nov 2011 23:53:50 +0000 (12:53 +1300)] 
Polish: convert one SECURITY WARNING to ALERT

13 years agoCleanup: comm Close handlers
Amos Jeffries [Tue, 22 Nov 2011 12:00:59 +0000 (01:00 +1300)] 
Cleanup: comm Close handlers

Make handlers take the CommCloseCbParams instead of series of expanded
variables.

Opening access to the other CommCommonCbParams fields with Connection/FD
data. Hiding the deprecated FD parameter from most handlers. Which seem
not to have actually needed it in most cases outside Comm.

13 years agoAuthor: Alex Rousskov <rousskov@measurement-factory.com>
Christos Tsantilas [Tue, 22 Nov 2011 11:12:32 +0000 (13:12 +0200)] 
Author: Alex Rousskov <rousskov@measurement-factory.com>
Bug 3377: assertion failed: store.cc:885: "store_status == STORE_PENDING"

The StoreEntry::write in the case of an empty write, calls the StoreEntry
handlers. It is possible one of these handlers will change the state of the
store entry or abort it. The next call of the StoreEntry::write will cause
this assertion.

The block of code which calls the StoreSntry handlers in the case of an empty
write, added to allow forward http headers to the client even if no body data
arrived yet (bug 1750). There is not need for this part of code in the latest
squid releases, so it is safe to be removed.

13 years agoAvoid crashes when processing bad X509 common names (CN).
Alex Rousskov [Mon, 21 Nov 2011 16:49:34 +0000 (09:49 -0700)] 
Avoid crashes when processing bad X509 common names (CN).

X509_REQ_get_pubkey() returns a refcounted object that we must clean after use.
X509_REQ_get_subject_name() does not; cleaning the result may cause segfaults.
How we are supposed to tell the difference is beyond me.

13 years agoLanguage: fr updates
Bernard [Sun, 20 Nov 2011 11:20:37 +0000 (00:20 +1300)] 
Language: fr updates

13 years agoCleanup: comm IOACB handlers
Amos Jeffries [Sun, 20 Nov 2011 10:11:13 +0000 (03:11 -0700)] 
Cleanup: comm IOACB handlers

Make handlers take the CommAcceptCbParams instead of series of expanded
variables. Removing listening fd parameter which was not used anyway.

13 years agoSourceFormat Enforcement
Automatic source maintenance [Sun, 20 Nov 2011 02:30:20 +0000 (19:30 -0700)] 
SourceFormat Enforcement

13 years agoTranslations: POT updates
Amos Jeffries [Sat, 19 Nov 2011 23:27:13 +0000 (12:27 +1300)] 
Translations: POT updates

13 years agoLanguage: fr updates
Bernard [Sat, 19 Nov 2011 17:06:31 +0000 (06:06 +1300)] 
Language: fr updates

13 years agoFix for Bug 2619 patch: variable 'consumedPartially' set but not used
Christos Tsantilas [Sat, 19 Nov 2011 09:13:07 +0000 (11:13 +0200)] 
Fix for Bug 2619 patch: variable 'consumedPartially' set but not used

13 years agoCleanup: IsConnOpen checks for NULL
Amos Jeffries [Sat, 19 Nov 2011 00:39:25 +0000 (17:39 -0700)] 
Cleanup: IsConnOpen checks for NULL

13 years agoBug 2619: fix of the test-suite/mem_hdr_test.cc test
Christos Tsantilas [Fri, 18 Nov 2011 19:44:05 +0000 (21:44 +0200)] 
Bug 2619: fix of the test-suite/mem_hdr_test.cc test

Fix for the compile error:
   "call of overloaded â€˜StoreIOBuffer(int, int, NULL)’ is ambiguous"

13 years agoauthor: Martin Huter <mhuter@barracuda.com>, Alex Rousskov <rousskov@measurement...
Christos Tsantilas [Fri, 18 Nov 2011 16:53:45 +0000 (18:53 +0200)] 
author: Martin Huter <mhuter@barracuda.com>, Alex Rousskov <rousskov@measurement-factory.com>, Christos Tsantilas <chtsanti@users.sourceforge.net>
Bug 2619: Excessive RAM growth due to unlimited adapted body data consumption

If the client does not read from the open connection (i.e. the user does not
confirm the browsers download-message-box in microsofts IE), squid keeps on
reading data from the ICAP server into the store entry, while no more data
can be delivered to the client.
Thus the store entry in memory is growing and squid may - in worst case -
consume memory up to the size of the users download.

This patch add API to StoreEntry to call the producer back when released
memory/space from the StoreEntry and add code to the ICAP client code to not
consume body data comes from the ICAP server when there is not available space
in the store entry.

13 years agoFill access log's %error_detail when responding with
Christos Tsantilas [Fri, 18 Nov 2011 16:40:10 +0000 (18:40 +0200)] 
Fill access log's %error_detail when responding with
ERR_SECURE_CONNECT_FAIL.

This is a Measurement Factory project

13 years agoBug 3423: access violation in URL parser
Jan Klemkow [Fri, 18 Nov 2011 11:31:04 +0000 (00:31 +1300)] 
Bug 3423: access violation in URL parser

13 years agoLog Format token namespace upgrade
Amos Jeffries [Fri, 18 Nov 2011 07:48:25 +0000 (00:48 -0700)] 
Log Format token namespace upgrade

This updates the format parser and storage objects in the Format::
namespace and separates some into separate files.

Add a registration API so components can register themselves an array
of tokens in a namespace. Registering the arbitrary namespace "example"
with some tokens ("a","b") will cause the parser to accept those tokens
in a logging format like so: "%example::a %example::b".

Future work:
 - use runners registry instead of Init() function
 - convert the error pages to use format for the page body macros
 - convert the %ssl_* tokens in src/ssl/* to use format and "ssl::"
 - convert external_acl_type to use formats for its helper input string.

13 years agoUse the right certificate when detailing SSL certificate validation errors.
Mathias Fischer [Thu, 17 Nov 2011 15:31:57 +0000 (08:31 -0700)] 
Use the right certificate when detailing SSL certificate validation errors.

When an _intermediate_ SSL server certificate fails validation, we should
report errors using information in that certificate and not in the top-level
"peer" certificate. Otherwise, our details may make no sense. For example, we
may say that the validation failed due to the expired certificate and then show
an expiration date in the future (because the top-level certificate did not
expire but the intermediate certificate did).

OpenSSL X509_STORE_CTX_get_current_cert() returns the certificate that was
being tested when our certificate validation callback was called.

13 years agoFix Comm::Write closing() assertion when retrying a failed UDP DNS query.
Alex Rousskov [Tue, 15 Nov 2011 18:21:07 +0000 (11:21 -0700)] 
Fix Comm::Write closing() assertion when retrying a failed UDP DNS query.

When we receive a UDP DNS response with a truncation (TC) bit set, we retry
using TCP. Since the retry trigger has nothing to do with the TCP connection,
it is possible that the TCP connection is being closed when we are about to
write to it: A call to our connection close callback has been scheduled but
has not fired yet. We must check for and avoid such race conditions.

13 years agoBug 2910: MemBuf may grow beyond max_capacity
Alex Rousskov [Mon, 14 Nov 2011 06:34:12 +0000 (19:34 +1300)] 
Bug 2910: MemBuf may grow beyond max_capacity

13 years agoBug 3412: External ACL Uses Invalid Cache Entry
Amos Jeffries [Fri, 11 Nov 2011 10:22:02 +0000 (03:22 -0700)] 
Bug 3412: External ACL Uses Invalid Cache Entry

13 years agoLanguage: fr updates
Bernard [Thu, 10 Nov 2011 23:07:22 +0000 (12:07 +1300)] 
Language: fr updates

13 years agoBug 3398: persistent server connection closed after PUT/DELETE
Christos Tsantilas [Thu, 10 Nov 2011 21:49:07 +0000 (10:49 +1300)] 
Bug 3398: persistent server connection closed after PUT/DELETE

13 years agoFix assertion when dstdomain abused in access controls
Amos Jeffries [Thu, 10 Nov 2011 01:35:23 +0000 (14:35 +1300)] 
Fix assertion when dstdomain abused in access controls

This converts an assertion into a logged warning and a failed-match if
dstdomain ACLs are used in places where the HTTP reuqest is not available.

13 years agoLanguage: en updates
Amos [Wed, 9 Nov 2011 23:08:00 +0000 (12:08 +1300)] 
Language: en updates

13 years agoLanguage: en updates
Amos [Wed, 9 Nov 2011 23:06:13 +0000 (12:06 +1300)] 
Language: en updates

13 years agoMaintenance: keep 30 snapshots and detect the new file pattern for removals
Amos Jeffries [Wed, 9 Nov 2011 02:23:14 +0000 (19:23 -0700)] 
Maintenance: keep 30 snapshots and detect the new file pattern for removals

13 years agoSourceFormat Enforcement
Automatic source maintenance [Wed, 9 Nov 2011 01:35:19 +0000 (18:35 -0700)] 
SourceFormat Enforcement

13 years agoBug 3408: Wrong header length leads to EFAULTs when cretating UFS swap.log.new.
Matthias Pitzl [Tue, 8 Nov 2011 15:00:17 +0000 (08:00 -0700)] 
Bug 3408: Wrong header length leads to EFAULTs when cretating UFS swap.log.new.

Also localized the header variable as it may be destroyed at any time.

13 years agoDetail SSL handshake failures
Christos Tsantilas [Tue, 8 Nov 2011 13:40:26 +0000 (15:40 +0200)] 
Detail SSL handshake failures

This patch allows Squid to provide details for the %D macro on the secure
connect failed error page when an SSL handshake with the origin server fails.
The default %D text is "Handshake with SSL server failed: XYZ" where XYZ is the
corresponding error string/description returned by OpenSSL if there is any.

This is a Measurement Factory project.

13 years agoDocument and alter the pconn idle timeout directives.
Amos Jeffries [Tue, 8 Nov 2011 10:54:37 +0000 (03:54 -0700)] 
Document and alter the pconn idle timeout directives.

Alters the directive names to clarify what they do and adds some more
description to the config file documentation.

Alters the internal config variables to match the new directive names.

Also alters the well known messages in mgr:filedescriptors report a little
to indicate client/server type and adds a standard "Idle " prefix for
easy automated scanning.

13 years agoDocument and alter the pconn idle timeout directives.
Amos Jeffries [Tue, 8 Nov 2011 09:24:08 +0000 (22:24 +1300)] 
Document and alter the pconn idle timeout directives.

Alters the directive names to clarify what they do and adds some more
description to the config file documentation.

Alters the internal config variables to match the new directive names.

Also alters the well known messages in mgr:filedescriptors report a little
to indicate client/server type and adds a standard "Idle " prefix for
easy automated scanning.

13 years agoTypo in snapshot change
Amos Jeffries [Mon, 7 Nov 2011 10:08:21 +0000 (03:08 -0700)] 
Typo in snapshot change

13 years agoDocs: typo
Amos Jeffries [Mon, 7 Nov 2011 09:57:05 +0000 (02:57 -0700)] 
Docs: typo

13 years agoMaintenance: Reduce snapshot build test cycle to the basic tests
Amos Jeffries [Mon, 7 Nov 2011 09:20:51 +0000 (02:20 -0700)] 
Maintenance: Reduce snapshot build test cycle to the basic tests

13 years agoSupport %% in external ACL format
Amos Jeffries [Sun, 6 Nov 2011 22:52:18 +0000 (11:52 +1300)] 
Support %% in external ACL format

13 years agoAdd a mask on the qos_flows miss configuration value.
Andrew Beverley [Sat, 5 Nov 2011 05:21:11 +0000 (18:21 +1300)] 
Add a mask on the qos_flows miss configuration value.

The reason for this is to allow the preserved mark/TOS value from the
server to be altered slightly rather than overwritten completely.

Example usage. The following will preserve the netfilter mark, but will
ensure that the (9th) bit specified in the miss value will be set to 1
in the preserved mark:

  qos_flows mark miss=0x100/0xF00

13 years agoBug 3367: fix inverted check on host_strict_verify
Amos Jeffries [Fri, 4 Nov 2011 23:28:49 +0000 (12:28 +1300)] 
Bug 3367: fix inverted check on host_strict_verify

13 years agoBug 3299: dnsserver: various undefined references
Amos Jeffries [Fri, 4 Nov 2011 12:30:43 +0000 (01:30 +1300)] 
Bug 3299: dnsserver: various undefined references

13 years agoPortability: add cstdarg as source of var_arg when available
Amos Jeffries [Fri, 4 Nov 2011 07:03:11 +0000 (20:03 +1300)] 
Portability: add cstdarg as source of var_arg when available

13 years agoPolished calculation of the number of needed memory pages for one Store write.
Alex Rousskov [Thu, 3 Nov 2011 21:09:04 +0000 (15:09 -0600)] 
Polished calculation of the number of needed memory pages for one Store write.

The old code was overestimating the number of memory pages required when we
needed to write exactly n*SM_PAGE_SIZE bytes.

13 years agoDocs: correct syntax for UDP/TCP log module parameters
Amos Jeffries [Thu, 3 Nov 2011 11:55:29 +0000 (00:55 +1300)] 
Docs: correct syntax for UDP/TCP log module parameters

13 years agoBug 3364: SNMP Orphans
Amos Jeffries [Thu, 3 Nov 2011 10:02:02 +0000 (23:02 +1300)] 
Bug 3364: SNMP Orphans

13 years agoBug 3406: SSL Log Error in debug
Amos Jeffries [Thu, 3 Nov 2011 09:27:40 +0000 (22:27 +1300)] 
Bug 3406: SSL Log Error in debug

13 years agoLanguage: fr updates
Bernard [Wed, 2 Nov 2011 23:09:23 +0000 (12:09 +1300)] 
Language: fr updates

13 years agoLanguage: fr updates
Bernard [Wed, 2 Nov 2011 23:07:55 +0000 (12:07 +1300)] 
Language: fr updates

13 years agoFixed two more cases of outdated shared memory cache detection
Alex Rousskov [Wed, 2 Nov 2011 21:18:50 +0000 (15:18 -0600)] 
Fixed two more cases of outdated shared memory cache detection
which led to "STORE_DISK_CLIENT == getType()" assertions
when running SMP Squid with non-shared memory caching.

UsingSmp() is not the right condition to detect whether we are using a shared
memory cache because shared memory caching may be disabled and because
Coordinator does not use a shared memory cache even if shared caching is
enabled.

See also: r11821.

13 years agoSource Maintenance: Optimizations and macro fixes
Amos Jeffries [Sun, 30 Oct 2011 02:42:27 +0000 (15:42 +1300)] 
Source Maintenance: Optimizations and macro fixes

* optimize the maintenance script to ony scan for macro problems once

* fix some file macro wrappers not to clash with the OS-macro naming scheme

* fix macro ifdef/ifndef on feature presence macros to use defined() instead

13 years agoSourceFormat Enforcement
Automatic source maintenance [Sat, 29 Oct 2011 02:01:54 +0000 (20:01 -0600)] 
SourceFormat Enforcement

13 years agoadaptation_meta option
Christos Tsantilas [Fri, 28 Oct 2011 20:08:24 +0000 (23:08 +0300)] 
adaptation_meta option

add missing src/tests/testConfigParser[.h,.cc] files

13 years agoadaptation_meta option
Christos Tsantilas [Fri, 28 Oct 2011 19:43:45 +0000 (22:43 +0300)] 
adaptation_meta option

This option allows Squid administrator to add custom ICAP request
headers or eCAP options to Squid ICAP requests or eCAP transactions.
Use it to pass custom authentication tokens and other
transaction-state related meta information to an ICAP/eCAP service.

The addition of a meta header is ACL-driven:
        adaptation_meta name value [!]aclname ...

Processing for a given header name stops after the first ACL list match.
Thus, it is impossible to add two headers with the same name. If no ACL
lists match for a given header name, no such header is added. For example:

        # do not debug transactions except for those that need debugging
        adaptation_meta X-Debug 1 needs_debugging

        # log all transactions except for those that must remain secret
        adaptation_meta X-Log 1 !keep_secret

        # mark transactions from users in the "G 1" group
        adaptation_meta X-Authenticated-Groups "G 1" authed_as_G1

The "value" parameter may be a regular squid.conf token or a "double
quoted string". Within the quoted string, use backslash (\) to escape
any character, which is currently only useful for escaping backslashes
and double quotes. For example,
    "this string has one backslash (\\) and two \"quotes\""

This is a Measurement Factory project

13 years agoDocs: typos in cache_peer text
Amos Jeffries [Fri, 28 Oct 2011 02:41:16 +0000 (15:41 +1300)] 
Docs: typos in cache_peer text

13 years agoPortability fixes for Atomic::WordT API.
Dmitry Kurochkin [Fri, 28 Oct 2011 01:11:23 +0000 (19:11 -0600)] 
Portability fixes for Atomic::WordT API.

Change parameter types for swap_if() and operator==() from int to
Value.  This fixes some GCC warnings in "fake" implementation when
the AtomicWordT template parameter is unsigned.

Polished (waitingToBeFreed == true) test. waitingToBeFreed is
Atomic::WordT<uint8_t> and GCC does not know whether to cast AtomicWord or
boolean when comparing the two.

13 years agoFix "int to double" compiler warnings in IpcIoClaimMemoryNeedsRr::run().
Dmitry Kurochkin [Fri, 28 Oct 2011 01:07:48 +0000 (19:07 -0600)] 
Fix "int to double" compiler warnings in IpcIoClaimMemoryNeedsRr::run().

13 years agoProvide "fake" AtomicWordT implementation for non-SMP configurations.
Dmitry Kurochkin [Fri, 28 Oct 2011 01:01:41 +0000 (19:01 -0600)] 
Provide "fake" AtomicWordT implementation for non-SMP configurations.

While we can not provide real AtomicWordT implementation on the systems where
atomic operations are not available, we can use a "fake" one if Squid is
running in non-SMP mode.  Before the change, the "fake" implementation was
always asserting, which is too restrictive and leads to test failures on
systems without atomic operations.

The new implementation works under conditions similar to "fake" shared memory
segments and allows SMP-using code (e.g. Rock store) to work in non-SMP mode.
In particular, it allows tests to pass on such systems.

AtomicWordT was renamed to WordT and moved to Ipc::Atomic namespace to allow
Ipc::Atomic::Enabled() to be declared outside of the AtomicWordT template
class.  This lets us define the Enabled() method in AtomicWord.cc which avoids
dragging protos.h #include into the AtomicWord.h header.

13 years agoSourceFormat Enforcement
Automatic source maintenance [Fri, 28 Oct 2011 00:19:03 +0000 (18:19 -0600)] 
SourceFormat Enforcement

13 years agoBug 3150: do not start useless unlinkd.
Dmitry Kurochkin [Thu, 27 Oct 2011 23:14:28 +0000 (17:14 -0600)] 
Bug 3150: do not start useless unlinkd.

Unlinkd may be used only by UFS storage but, before the change, Squid
always started unlinkd if it was built, even if it was not needed.

Whether a SwapDir may use unlinkd depends on the SwapDir
implementation and DiskIO strategy it uses.  The patch adds
unlinkdUseful() method to SwapDir and DiskIOStrategy to decide if
unlinkd should be started.

After the change, unlinkd may be started during reconfiguration and
unlinkdInit() may be called multiple times.

After the change, unlinkdClose() may be called when unlinkd was never
started.  The patch removes a warning which was printed in this case
on Windows.

13 years agoOptimization: Make read requests in [Rock] IpcIo bypass max-swap-rate limit.
Dmitry Kurochkin [Thu, 27 Oct 2011 22:51:19 +0000 (16:51 -0600)] 
Optimization: Make read requests in [Rock] IpcIo bypass max-swap-rate limit.

Before the change, IpcIoFile::WaitBeforePop() delayed both swap ins
(hits) and swap outs (misses).  This is suboptimal because reads do
not usually accumulate unfinished I/O requests in OS buffers and,
hence, do not eventually require the OS to block all I/O.

Ideally, a disker should probably dequeue all pending disker requests,
satisfy reads ASAP, and then handle writes, but that is difficult for
several reasons.  The patch implements a simpler approach: peek the
next request to be popped, and if it is a swap in (i.e., read or hit),
then pop it without any delay.

When a read is popped, we still adjust the balance member and LastIo,
because we do want to maintain the configured average I/O rate. When a
write request comes in, it will be delayed [longer] if needed.

In the extreme case of a very long stream of read requests (no writes
at all), there will be essentially no I/O rate limit and that is what
we want.

13 years agoDo not allow max-swap-rate and swap-timeout reconfiguration for Rock Store.
Dmitry Kurochkin [Thu, 27 Oct 2011 22:44:20 +0000 (16:44 -0600)] 
Do not allow max-swap-rate and swap-timeout reconfiguration for Rock Store.

These options are used to configure DiskIO module during Rock SwapDir
initialization.  During reconfiguration, the values are updated in Rock
SwapDir, but they do not reach the DiskIO module.  Thus, while Squid says that
option has a new value, the new value is never really used.  This patch fixes
this inconsistency.

In the future, we may support reconfiguration for max-swap-rate and
swap-timeout, but that would require adding reconfiguration support
to DiskIO modules.

13 years agoRename Ipc::FewToFewBiQueue method peek() to findOldest()
Alex Rousskov [Thu, 27 Oct 2011 22:08:28 +0000 (16:08 -0600)] 
Rename Ipc::FewToFewBiQueue method peek() to findOldest()
to better match the method functionality.

13 years agoIndependent shared I/O page limit.
Dmitry Kurochkin [Thu, 27 Oct 2011 21:57:26 +0000 (15:57 -0600)] 
Independent shared I/O page limit.

Shared memory pages are used for shared memory cache and IPC I/O module.
Before this change, the number of shared memory pages needed for IPC I/O
was calculated from the size of shared memory cache.  Moreover, shared
memory cache was required for IPC I/O.

The patch makes the limit for shared I/O pages independent from the
shared memory cache size and presence.  IPC I/O pages limit is calculated
from the number of workers and diskers; it does not depend on cache_dir
configuration.  This may change in the future if we learn how to compute
it (e.g., by multiplying max-swap-rate and swap-timeout if both are
available).

13 years agoBug 3383: store.cc:1631: "new_status != IN_MEMORY" assertion
Alex Rousskov [Thu, 27 Oct 2011 20:39:23 +0000 (14:39 -0600)] 
Bug 3383: store.cc:1631: "new_status != IN_MEMORY" assertion

UsingSmp() is not the right condition to detect whether we are using a shared
cache because shared memory caching may be disabled and because Coordinator
does not use a shared memory cache even if shared caching is enabled.

The assertion was triggered by icons being added to Coordinator local memory
cache. TODO: Coordinator does not need to cache [icons] at all.

13 years agosslBump: Send intermediate CA
Christos Tsantilas [Thu, 27 Oct 2011 15:27:25 +0000 (18:27 +0300)] 
sslBump: Send intermediate CA

SslBump code assumed that it is signing generated certificates with a root CA
certificate. Root certificates are usually not sent along with the server
certificates because clients must have them independently installed or
built-in. Squid was not sending the signing certificate.

In many environments, Squid signing certificate is intermediate (i.e., it
belongs to a non-root CA). If Squid does not send that intermediate signing
certificate with the generated one, the client will not be able to establish a
complete chain of trust from the generated fake to the root CA certificate,
leading to errors.

With this change, Squid may send the signing certificate (along with the
generated one) using the following rules:

   * If the configured signing certificate is self-signed,
     then just send the generated certificate alone.
     Note that root CA certificates are self-signed (by root CA).

   * Otherwise (i.e., if the configured signing certificate is an intermediate
     CA certificate), send both the intermediate CA and the generated fake
     certificate.

   * If Squid sends the intermediate CA certificate, Squid also sends
     all other certificates from the "cert=" file, Sending a chain with
     multiple intermediate CA certificates may be required when the Squid
     signing certificate was signed by another intermediate CA.

This is a Measurement Factory Project

13 years agoBug fix: The multi-language support is broken for Ssl error details
Christos Tsantilas [Thu, 27 Oct 2011 15:22:21 +0000 (18:22 +0300)] 
Bug fix: The multi-language support is broken for Ssl error details

Current Ssl::ErrorDetail::useRequest never sets the ErrorDetail::request
member.The ErrorDetail::request member used to select the correct language
for the web client from Accept-Language header.

13 years agoSimplified code. No functionality changes expected.
Dmitry Kurochkin [Thu, 27 Oct 2011 05:24:19 +0000 (23:24 -0600)] 
Simplified code. No functionality changes expected.

!InDaemonMode() already implies both !UsingSmp() and IamWorkerProcess()
so !InDaemonMode() can be removed from the condition.

13 years agoBug 3383: unhandled exception: theGroupBSize > 0
Alex Rousskov [Thu, 27 Oct 2011 01:00:39 +0000 (19:00 -0600)] 
Bug 3383: unhandled exception: theGroupBSize > 0

Do not create shared queue for IpcIoFile if there are no diskers. The queue
code requires at least one queue reader and writer, and SMP does not imply the
existence of diskers.