MD5 0cd0983e7d8ffe717947d00500245ece files/27_mod_limitipconn.conf 635
RMD160 2ced447e4048e2bc762936b611b022fd6337f9f8 files/27_mod_limitipconn.conf 635
SHA256 fa6dd0d740877f2fb1956d65e683366a4a923eeb842fe943016c50d3e1ebe686 files/27_mod_limitipconn.conf 635
+AUX mod_limitipconn-0.04-local_ip.patch 2235 RMD160 a2cadf33f3fa2cdfb2acb61fbc162519d9529b89 SHA1 93e875dfa062882ac5ef4d6475773364d30ba518 SHA256 2c7e2ec647968c2b356c83f82e131f830bac3279f800657a567ef2d07a87458a
+MD5 c893598a5903f5b8b9456f0ac5d4de82 files/mod_limitipconn-0.04-local_ip.patch 2235
+RMD160 a2cadf33f3fa2cdfb2acb61fbc162519d9529b89 files/mod_limitipconn-0.04-local_ip.patch 2235
+SHA256 2c7e2ec647968c2b356c83f82e131f830bac3279f800657a567ef2d07a87458a files/mod_limitipconn-0.04-local_ip.patch 2235
+AUX mod_limitipconn-0.04-vhost.patch 7997 RMD160 6cee2606f8f5fb1428c2b59b0b9d0aa9013d85c6 SHA1 d9f462b70744bd3d9fdf4ff47aa9fe2038c20d97 SHA256 9c8e8e5eda27313866a7e65334fc5247af034e462ee787df15b9279ef62ae23f
+MD5 19738f900e2a69c3a3165a23f7c8b122 files/mod_limitipconn-0.04-vhost.patch 7997
+RMD160 6cee2606f8f5fb1428c2b59b0b9d0aa9013d85c6 files/mod_limitipconn-0.04-vhost.patch 7997
+SHA256 9c8e8e5eda27313866a7e65334fc5247af034e462ee787df15b9279ef62ae23f files/mod_limitipconn-0.04-vhost.patch 7997
+DIST mod_limitipconn-0.04.tar.gz 6267 RMD160 90bb7bc1a98258fbbf262a88b6fea1db0b45303b SHA1 da39f65eb1e6bdeddc9d904bc1989f1b30e3f2ac SHA256 ad131bbd5af50bb37450d3bafddffeb81b4a2e8456c2bddb3ba300beca530a94
DIST mod_limitipconn-0.22.tar.gz 6333 RMD160 7e62fd51bf837a02a1d42d2b807e03191682ce48 SHA1 b8477f92f1dd63af3153617b924f94ac8e604a7f SHA256 c11e308316f8fe2fb46e365f6b2d4aa389aa220094f7ed8e555853c2734f70b1
-EBUILD mod_limitipconn-0.22-r1.ebuild 869 RMD160 3648e40ae857ceebe13b6ae8495df1c343974b26 SHA1 de98c8a6c75ae15d1cae0711451b35329a6ef0ff SHA256 81d913c9fb65bd290a4c5b028090f16df69568783030dc3b5ecd0e0750cb4f24
-MD5 e430b685ba0aeac6e161240157b5523d mod_limitipconn-0.22-r1.ebuild 869
-RMD160 3648e40ae857ceebe13b6ae8495df1c343974b26 mod_limitipconn-0.22-r1.ebuild 869
-SHA256 81d913c9fb65bd290a4c5b028090f16df69568783030dc3b5ecd0e0750cb4f24 mod_limitipconn-0.22-r1.ebuild 869
-MISC ChangeLog 2157 RMD160 325024f1c05e4f3e658d8c692bc71a5f82eb4c6e SHA1 5903ec91daad7abef0ac468f1ecab9ade7da0a5f SHA256 16b959925d08b28e2108c3c845f662247af7121869928f0ebe4edc8497d8ccfe
-MD5 e220b6a9c74cffc8c878ac26f02be17c ChangeLog 2157
-RMD160 325024f1c05e4f3e658d8c692bc71a5f82eb4c6e ChangeLog 2157
-SHA256 16b959925d08b28e2108c3c845f662247af7121869928f0ebe4edc8497d8ccfe ChangeLog 2157
-MISC metadata.xml 160 RMD160 a0f6e133e170b7477018d8584c20e8723f6914fa SHA1 a3b9b520ec43ee1f9b1c7b5c5b8745bf84454c03 SHA256 3c312146c4cb5b912d6f56292242ce3a85c629ca98ee7ef0a84ca575708b44fe
-MD5 5eede8f5b73ba3c19b1bee203033a5cf metadata.xml 160
-RMD160 a0f6e133e170b7477018d8584c20e8723f6914fa metadata.xml 160
-SHA256 3c312146c4cb5b912d6f56292242ce3a85c629ca98ee7ef0a84ca575708b44fe metadata.xml 160
+EBUILD mod_limitipconn-0.04.ebuild 854 RMD160 421c20372c8670b18aade2c0357ce27e031b7a35 SHA1 0fd31cab39cc533a813835f1bee0179d3174f5b2 SHA256 8862f38f6874398157c2ab1a41d57fff16907a8bec754ff20e5314ce3355dc5b
+MD5 2f48a88c916bd0ba6a57c30eb841cbe1 mod_limitipconn-0.04.ebuild 854
+RMD160 421c20372c8670b18aade2c0357ce27e031b7a35 mod_limitipconn-0.04.ebuild 854
+SHA256 8862f38f6874398157c2ab1a41d57fff16907a8bec754ff20e5314ce3355dc5b mod_limitipconn-0.04.ebuild 854
+EBUILD mod_limitipconn-0.22-r1.ebuild 656 RMD160 45df06cd44ebadd08eddd5a658ba259014fe8c5f SHA1 b5c0a19cdb29ccf1cd681de8934cea026938ec21 SHA256 a6b72283d4785f44acc3821a6fd4853ee880a4ea529cc8601bb4e4a494362fa8
+MD5 141364301cc6559534d9c4aebc696172 mod_limitipconn-0.22-r1.ebuild 656
+RMD160 45df06cd44ebadd08eddd5a658ba259014fe8c5f mod_limitipconn-0.22-r1.ebuild 656
+SHA256 a6b72283d4785f44acc3821a6fd4853ee880a4ea529cc8601bb4e4a494362fa8 mod_limitipconn-0.22-r1.ebuild 656
+MISC ChangeLog 2461 RMD160 a2163514a1a4f781ce3623b13cbbf4a34604b537 SHA1 db7234a04e28f6016a4b9e069df96a978b5393ff SHA256 f52e3f7566814b80465cc5b01c7c93fc13417867cedc5c18c84e9f550fae0c58
+MD5 a4d63c03c2ca7aa1474aaab8a7bcf9f8 ChangeLog 2461
+RMD160 a2163514a1a4f781ce3623b13cbbf4a34604b537 ChangeLog 2461
+SHA256 f52e3f7566814b80465cc5b01c7c93fc13417867cedc5c18c84e9f550fae0c58 ChangeLog 2461
+MISC metadata.xml 442 RMD160 500a512e83e389abed161e96f6319ab2597cadcc SHA1 8a8ac224d5def9cf41a753ebb1a7d44694935297 SHA256 48e1087d432356290f329bc1b4ed471643e840b23ef83dd2e97af7db40c6a343
+MD5 e0e0cf8c6b257c2088e6861f4f297396 metadata.xml 442
+RMD160 500a512e83e389abed161e96f6319ab2597cadcc metadata.xml 442
+SHA256 48e1087d432356290f329bc1b4ed471643e840b23ef83dd2e97af7db40c6a343 metadata.xml 442
+MD5 e8051c108c0cc421d722325ffc7e1bcc files/digest-mod_limitipconn-0.04 256
+RMD160 2845ad3cc9d3eb1517567c697cbbf33773a5fe0a files/digest-mod_limitipconn-0.04 256
+SHA256 cc5dc906764ef543315551e0a96c8a191ed49b6e568d8fc6841c3669609ab7c2 files/digest-mod_limitipconn-0.04 256
MD5 77709f6bd89513a3a53e26946c8c37a8 files/digest-mod_limitipconn-0.22-r1 256
RMD160 8baca16bff0d8932a64979284d70ef989addf7f2 files/digest-mod_limitipconn-0.22-r1 256
SHA256 bbc66c211a4d2a512550cadbdaf7706c94e8dbe3d213e995f6d18f54e2b89320 files/digest-mod_limitipconn-0.22-r1 256
--- /dev/null
+--- mod_limitipconn.c.org Wed Apr 30 14:57:33 2003
++++ mod_limitipconn.c Wed Apr 30 15:10:31 2003
+@@ -44,6 +44,8 @@
+ checking */
+ array_header *excl_limit; /* array of MIME types to limit check; all
+ other types are exempt */
++ array_header *local_ip; /* array of local ip exempt from limit
++ checking */
+ } limitipconn_dir_config;
+
+ static void *limitipconn_create_dir_config(pool *p, char *path)
+@@ -55,6 +57,7 @@
+ cfg->limit = 0;
+ cfg->no_limit = ap_make_array(p, 0, sizeof(char *));
+ cfg->excl_limit = ap_make_array(p, 0, sizeof(char *));
++ cfg->local_ip = ap_make_array(p, 0, sizeof(char *));
+
+ return (void *) cfg;
+ }
+@@ -68,6 +71,7 @@
+ /* convert Apache arrays to normal C arrays */
+ char **nolim = (char **) cfg->no_limit->elts;
+ char **exlim = (char **) cfg->excl_limit->elts;
++ char **localip = (char **) cfg->local_ip->elts;
+
+ const char *address;
+
+@@ -109,6 +113,15 @@
+ return OK;
+ }
+
++ /* Cycle through the local ip list; if the ip is local,
++ * return OK */
++ for (i = 0; i < cfg->local_ip->nelts; i++) {
++ if ((ap_strcasecmp_match(address, localip[i]) == 0)
++ || (strncmp(localip[i], address, strlen(localip[i])) == 0)) {
++ return OK;
++ }
++ }
++
+ /* Cycle through the exempt list; if our content_type is exempt,
+ * return OK */
+ for (i = 0; i < cfg->no_limit->nelts; i++) {
+@@ -219,6 +232,16 @@
+ return NULL;
+ }
+
++/* Parse the LocalIP directive */
++static const char *local_ip_config_cmd(cmd_parms *parms, void *mconfig,
++ const char *arg)
++{
++ limitipconn_dir_config *cfg = (limitipconn_dir_config *) mconfig;
++
++ *(char **) ap_push_array(cfg->local_ip) = ap_pstrdup(parms->pool, arg);
++ return NULL;
++}
++
+ /* Array describing structure of configuration directives */
+ static command_rec limitipconn_cmds[] = {
+ {"MaxConnPerIP", limit_config_cmd, NULL, OR_LIMIT, TAKE1,
+@@ -227,6 +250,8 @@
+ "MIME types for which limit checking is disabled"},
+ {"OnlyIPLimit", excl_limit_config_cmd, NULL, OR_LIMIT, ITERATE,
+ "restrict limit checking to these MIME types only"},
++ {"LocalIP", local_ip_config_cmd, NULL, OR_LIMIT, ITERATE,
++ "no checking on local IP"},
+ {NULL},
+ };
+
--- /dev/null
+--- mod_limitipconn.c-localip 2005-02-09 16:29:55.525726056 +0100
++++ mod_limitipconn.c 2005-02-09 16:31:44.319186936 +0100
+@@ -1,5 +1,6 @@
+ /*
+ * Copyright (C) 2000-2002 David Jao <djao@dominia.org>
++ * "MaxConnPerUid", "MaxConnPerVhost" and "MaxLA*" portions by Maxim Chirkov <mc@tyumen.ru>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+@@ -40,6 +41,13 @@
+
+ typedef struct {
+ unsigned int limit; /* max number of connections per IP */
++
++ unsigned int limit_uid; /* max number of connections per user */
++ unsigned int limit_vhost; /* max number of connections per virtual host */
++ double limit_la1; /* maximum value of Load Average for 1 min. */
++ double limit_la5; /* maximum value of Load Average for 5 min. */
++ double limit_la15; /* maximum value of Load Average for 15 min. */
++
+ array_header *no_limit; /* array of MIME types exempt from limit
+ checking */
+ array_header *excl_limit; /* array of MIME types to limit check; all
+@@ -55,6 +63,11 @@
+
+ /* default configuration: no limit, and both arrays are empty */
+ cfg->limit = 0;
++ cfg->limit_uid = 0;
++ cfg->limit_vhost = 0;
++ cfg->limit_la1 = 0.0;
++ cfg->limit_la5 = 0.0;
++ cfg->limit_la15 = 0.0;
+ cfg->no_limit = ap_make_array(p, 0, sizeof(char *));
+ cfg->excl_limit = ap_make_array(p, 0, sizeof(char *));
+ cfg->local_ip = ap_make_array(p, 0, sizeof(char *));
+@@ -75,12 +88,25 @@
+
+ const char *address;
+
++ /* load average */
++ double current_la[3];
++
+ /* loop index variable */
+ int i;
+
+ /* running count of number of connections from this address */
+ int ip_count = 0;
+
++ /* count of runnung requests for current uid and virtual host*/
++ int uid_req_count = 0;
++ int vhost_req_count = 0;
++
++ /* uid of current virtual host */
++ uid_t current_uid = 0;
++
++ /* current virtual host id */
++ char *current_vhost = NULL;
++
+ /* Content-type of the current request */
+ const char *content_type;
+
+@@ -108,8 +134,44 @@
+ #endif
+ address = r->connection->remote_ip;
+
++#ifdef DEBUG
++ ap_log_error(APLOG_MARK, APLOG_ERR, r->server, "DEBUG: %s handler for requiest uri(%s) args(%s) host(%s) uid(%d)",r->handler, r->uri, r->args, r->server->server_hostname, r->server->server_uid);
++#endif
++
++ /* Check Load Average overflow */
++ if (cfg->limit_la1 != 0 || cfg->limit_la5 != 0 || cfg->limit_la15 != 0){
++
++ /* Blocking only cgi or php scripts if LA limit exceeded */
++ /* Handlers: cgi-script perl-script application/x-httpd-php application/x-httpd-cgi */
++ /* Check for cgi and php in r->uri too simple then r->handler */
++ if ((r->args != NULL)
++ || (ap_strcasestr(r->uri, "cgi") != NULL)
++ || (ap_strcasestr(r->uri, "php") != NULL)){
++
++ if( getloadavg(current_la, 3) != -1 ){
++
++ if ((current_la[0] >= cfg->limit_la1)
++ && (current_la[1] >= cfg->limit_la5)
++ && (current_la[2] >= cfg->limit_la15)){
++
++ ap_log_error(APLOG_MARK, APLOG_ERR, r->server, "Load Average limit exceeded (%.2f, %.2f, %.2f)",
++ current_la[0], current_la[1], current_la[2]);
++ ap_log_reason("System exceeded LA limit.", r->uri, r);
++
++ return HTTP_SERVICE_UNAVAILABLE;
++ }
++ }
++ }
++ }
++
++ /* Get uid of current virual host for future use */
++ if (r->server->is_virtual){
++ current_uid = r->server->server_uid;
++ current_vhost = r->server->server_hostname;
++ }
++
+ /* A limit value of 0 by convention means no limit. */
+- if (cfg->limit == 0) {
++ if (cfg->limit == 0 && cfg->limit_uid == 0 && cfg->limit_vhost == 0) {
+ return OK;
+ }
+
+@@ -168,6 +230,19 @@
+ ) {
+ ip_count++;
+ }
++ if ((score_record.vhostrec != NULL) &&
++ (score_record.vhostrec->is_virtual)){
++
++ if (score_record.vhostrec->server_uid == current_uid){
++ /* Same user */
++ uid_req_count++;
++ }
++ if ((cfg->limit_vhost != 0)
++ && (strcmp(score_record.vhostrec->server_hostname, current_vhost) == 0)){
++ /* Same host name */
++ vhost_req_count++;
++ }
++ }
+ break;
+ case
+ SERVER_DEAD:
+@@ -191,6 +266,14 @@
+ ap_table_setn(r->subprocess_env, "LIMITIP", "1");
+ /* return 503 */
+ return HTTP_SERVICE_UNAVAILABLE;
++ } else if ((uid_req_count > cfg->limit_uid) && (cfg->limit_uid)){
++ ap_log_error(APLOG_MARK, APLOG_ERR, r->server, "Rejecting vhost=%s, uid=%u", r->server->server_hostname, r->server->server_uid);
++ ap_log_reason("Client exceeded request per user limit.", r->uri, r);
++ return HTTP_SERVICE_UNAVAILABLE;
++ } else if ((vhost_req_count > cfg->limit_vhost) && (cfg->limit_vhost)){
++ ap_log_error(APLOG_MARK, APLOG_ERR, r->server, "Rejecting vhost=%s, uid=%u", r->server->server_hostname, r->server->server_uid);
++ ap_log_reason("Client exceeded request per vhost limit.", r->uri, r);
++ return HTTP_SERVICE_UNAVAILABLE;
+ } else {
+ return OK;
+ }
+@@ -242,6 +325,88 @@
+ return NULL;
+ }
+
++/* Parse the MaxConnPerVhost directive */
++static const char *limit_vhost_config_cmd(cmd_parms *parms, void *mconfig,
++ const char *arg)
++{
++ limitipconn_dir_config *cfg = (limitipconn_dir_config *) mconfig;
++
++ unsigned long int limit = strtol(arg, (char **) NULL, 10);
++
++ if (limit == LONG_MAX) {
++ return "Integer overflow or invalid number";
++ }
++
++ cfg->limit_vhost = limit;
++ return NULL;
++}
++
++/* Parse the MaxConnPerUid directive */
++static const char *limit_uid_config_cmd(cmd_parms *parms, void *mconfig,
++ const char *arg)
++{
++ limitipconn_dir_config *cfg = (limitipconn_dir_config *) mconfig;
++
++ unsigned long int limit = strtol(arg, (char **) NULL, 10);
++
++ if (limit == LONG_MAX) {
++ return "Integer overflow or invalid number";
++ }
++
++ cfg->limit_uid = limit;
++ return NULL;
++}
++
++/* Parse the MaxLA1 directive */
++static const char *limit_la1_config_cmd(cmd_parms *parms, void *mconfig,
++ const char *arg)
++{
++ limitipconn_dir_config *cfg = (limitipconn_dir_config *) mconfig;
++
++ double limit = strtod(arg, (char **) NULL);
++
++ if (limit < 0.0) {
++ return "Invalid LA1 value";
++ }
++
++ cfg->limit_la1 = limit;
++ return NULL;
++}
++
++/* Parse the MaxLA5 directive */
++static const char *limit_la5_config_cmd(cmd_parms *parms, void *mconfig,
++ const char *arg)
++{
++ limitipconn_dir_config *cfg = (limitipconn_dir_config *) mconfig;
++
++ double limit = strtod(arg, (char **) NULL);
++
++ if (limit < 0.0) {
++ return "Invalid LA5 value";
++ }
++
++ cfg->limit_la5 = limit;
++ return NULL;
++}
++
++
++/* Parse the MaxLA15 directive */
++static const char *limit_la15_config_cmd(cmd_parms *parms, void *mconfig,
++ const char *arg)
++{
++ limitipconn_dir_config *cfg = (limitipconn_dir_config *) mconfig;
++
++ double limit = strtod(arg, (char **) NULL);
++
++ if (limit < 0.0) {
++ return "Invalid LA15 value";
++ }
++
++ cfg->limit_la15 = limit;
++ return NULL;
++}
++
++
+ /* Array describing structure of configuration directives */
+ static command_rec limitipconn_cmds[] = {
+ {"MaxConnPerIP", limit_config_cmd, NULL, OR_LIMIT, TAKE1,
+@@ -252,6 +417,16 @@
+ "restrict limit checking to these MIME types only"},
+ {"LocalIP", local_ip_config_cmd, NULL, OR_LIMIT, ITERATE,
+ "no checking on local IP"},
++ {"MaxConnPerUid", limit_uid_config_cmd, NULL, OR_LIMIT, TAKE1,
++ "maximum simultaneous connections per user"},
++ {"MaxConnPerVhost", limit_vhost_config_cmd, NULL, OR_LIMIT, TAKE1,
++ "maximum simultaneous connections per virtual host"},
++ {"MaxLA1", limit_la1_config_cmd, NULL, OR_LIMIT, TAKE1,
++ "maximum Load Overage value for the past 1 minute"},
++ {"MaxLA5", limit_la5_config_cmd, NULL, OR_LIMIT, TAKE1,
++ "maximum Load Overage value for the past 5 minutes"},
++ {"MaxLA15", limit_la15_config_cmd, NULL, OR_LIMIT, TAKE1,
++ "maximum Load Overage value for the past 15 minutes"},
+ {NULL},
+ };
+