Given some incentive after deep consideration of the slowloris claims.
While I still do not believe Squid is vulnerable per-se and some people
have tested and found no such failures as claimed for the DoS attack.
We found we could provide better administrative controls. This is one such
that has been asked about many times and still did not exist. It operates
essentially teh same as the maxconn ACL, but does not require HTTP headers
and other request data to fully exist like ACLs do.
It is tested immediately after accept() and is request type agnostic, right
down to DNS TCP requests. So care is warranted in hierarchy situations or where
clients may be behind NAT.
Utilizes the client DB to monitor accepted TCP links. Operates prior to
everything so as to eliminate resource usage on the blocking case and
close the windows of opportunity for dribble-attacks etc.
Default (-1) is to keep the status-quo of no limits.
accept_filter data
DOC_END
+NAME: client_ip_max_connections
+TYPE: int
+LOC: Config.client_ip_max_connections
+DEFAULT: -1
+DOC_START
+ Set an absolute limit on the number of connections a single
+ client IP can use. Any more than this and Squid will begin to drop
+ new connections from the client until it closes some links.
+
+ Note that this is a global limit. It affects all HTTP, HTCP, Gopher and FTP
+ connections from the client. For finer control use the ACL access controls.
+
+ Requires client_db to be enabled (the default).
+
+ WARNING: This may noticably slow down traffic received via external proxies
+ or NAT devices and cause them to rebound error messages back to their clients.
+DOC_END
+
NAME: tcp_recv_bufsize
COMMENT: (bytes)
TYPE: b_size_t
#include "icmp/net_db.h"
#include "ip/IpAddress.h"
#include "ip/IpIntercept.h"
+#include "protos.h"
#if defined(_SQUID_CYGWIN_)
#include <sys/ioctl.h>
details.peer = *gai;
+ if ( Config.client_ip_max_connections >= 0) {
+ if (clientdbEstablished(details.peer, 0) > Config.client_ip_max_connections) {
+ debugs(50, DBG_IMPORTANT, "WARNING: " << details.peer << " attempting more than " << Config.client_ip_max_connections << " connections.");
+ details.me.FreeAddrInfo(gai);
+ return COMM_ERROR;
+ }
+ }
+
details.me.InitAddrInfo(gai);
details.me.SetEmpty();
#if USE_LOADABLE_MODULES
wordlist *loadable_module_names;
#endif
+
+ int client_ip_max_connections;
};
SQUIDCEXTERN SquidConfig Config;