25
25
#include "apr_optional.h"
26
26
#include "mod_log_config.h"
27
27
28
+ #ifdef APLOG_USE_MODULE
29
+ APLOG_USE_MODULE (security2 );
30
+ #endif
31
+
28
32
#include "msc_logging.h"
29
33
#include "msc_util.h"
30
34
@@ -1451,6 +1455,9 @@ static int hook_connection_early(conn_rec *conn)
1451
1455
1452
1456
apr_cpystrn (ws_record -> client , client_ip , sizeof (ws_record -> client ));
1453
1457
1458
+ ap_log_cerror (APLOG_MARK , APLOG_TRACE3 , 0 , conn ,
1459
+ "ModSecurity: going to loop through %d servers with %d threads" ,
1460
+ server_limit , thread_limit );
1454
1461
for (i = 0 ; i < server_limit ; ++ i ) {
1455
1462
for (j = 0 ; j < thread_limit ; ++ j ) {
1456
1463
@@ -1485,14 +1492,18 @@ static int hook_connection_early(conn_rec *conn)
1485
1492
}
1486
1493
}
1487
1494
1495
+ ap_log_cerror (APLOG_MARK , APLOG_TRACE3 , 0 , conn ,
1496
+ "ModSecurity: threads in READ: %ld of %ld, WRITE: %ld of %ld, IP: %s" ,
1497
+ ip_count_r , conn_read_state_limit , ip_count_w , conn_write_state_limit , client_ip );
1498
+
1488
1499
if (conn_read_state_limit > 0 && ip_count_r > conn_read_state_limit )
1489
1500
{
1490
1501
if (conn_read_state_suspicious_list &&
1491
1502
(tree_contains_ip (conn -> pool ,
1492
1503
conn_read_state_suspicious_list , client_ip , NULL , & error_msg ) <= 0 ))
1493
1504
{
1494
1505
if (conn_limits_filter_state == MODSEC_DETECTION_ONLY )
1495
- ap_log_error (APLOG_MARK , APLOG_WARNING , 0 , NULL ,
1506
+ ap_log_cerror (APLOG_MARK , APLOG_WARNING , 0 , conn ,
1496
1507
"ModSecurity: Too many threads [%ld] of %ld allowed " \
1497
1508
"in READ state from %s - There is a suspission list " \
1498
1509
"but that IP is not part of it, access granted" ,
@@ -1502,15 +1513,15 @@ static int hook_connection_early(conn_rec *conn)
1502
1513
conn_read_state_whitelist , client_ip , NULL , & error_msg ) > 0 )
1503
1514
{
1504
1515
if (conn_limits_filter_state == MODSEC_DETECTION_ONLY )
1505
- ap_log_error (APLOG_MARK , APLOG_WARNING , 0 , NULL ,
1516
+ ap_log_cerror (APLOG_MARK , APLOG_WARNING , 0 , conn ,
1506
1517
"ModSecurity: Too many threads [%ld] of %ld allowed " \
1507
1518
"in READ state from %s - Ip is on whitelist, access " \
1508
1519
"granted" , ip_count_r , conn_read_state_limit ,
1509
1520
client_ip );
1510
1521
}
1511
1522
else
1512
1523
{
1513
- ap_log_error (APLOG_MARK , APLOG_WARNING , 0 , NULL ,
1524
+ ap_log_cerror (APLOG_MARK , APLOG_WARNING , 0 , conn ,
1514
1525
"ModSecurity: Access denied with code 400. Too many " \
1515
1526
"threads [%ld] of %ld allowed in READ state from %s - " \
1516
1527
"Possible DoS Consumption Attack [Rejected]" , ip_count_r ,
@@ -1528,7 +1539,7 @@ static int hook_connection_early(conn_rec *conn)
1528
1539
conn_write_state_suspicious_list , client_ip , NULL , & error_msg ) <= 0 ))
1529
1540
{
1530
1541
if (conn_limits_filter_state == MODSEC_DETECTION_ONLY )
1531
- ap_log_error (APLOG_MARK , APLOG_WARNING , 0 , NULL ,
1542
+ ap_log_cerror (APLOG_MARK , APLOG_WARNING , 0 , conn ,
1532
1543
"ModSecurity: Too many threads [%ld] of %ld allowed " \
1533
1544
"in WRITE state from %s - There is a suspission list " \
1534
1545
"but that IP is not part of it, access granted" ,
@@ -1538,15 +1549,15 @@ static int hook_connection_early(conn_rec *conn)
1538
1549
conn_write_state_whitelist , client_ip , NULL , & error_msg ) > 0 )
1539
1550
{
1540
1551
if (conn_limits_filter_state == MODSEC_DETECTION_ONLY )
1541
- ap_log_error (APLOG_MARK , APLOG_WARNING , 0 , NULL ,
1552
+ ap_log_cerror (APLOG_MARK , APLOG_WARNING , 0 , conn ,
1542
1553
"ModSecurity: Too many threads [%ld] of %ld allowed " \
1543
1554
"in WRITE state from %s - Ip is on whitelist, " \
1544
1555
"access granted" , ip_count_w , conn_read_state_limit ,
1545
1556
client_ip );
1546
1557
}
1547
1558
else
1548
1559
{
1549
- ap_log_error (APLOG_MARK , APLOG_WARNING , 0 , NULL ,
1560
+ ap_log_cerror (APLOG_MARK , APLOG_WARNING , 0 , conn ,
1550
1561
"ModSecurity: Access denied with code 400. Too many " \
1551
1562
"threads [%ld] of %ld allowed in WRITE state from %s - " \
1552
1563
"Possible DoS Consumption Attack [Rejected]" , ip_count_w ,
0 commit comments