@@ -38,52 +38,56 @@ sub custom_line {
38
38
# rule sets inspired by ethanpill's work at https://community.centminmod.com/posts/49893/
39
39
40
40
# /var/log/virtualmin/*_access_log
41
+ # /var/log/nginx/access.log
41
42
# Nginx 444 (Default: 5 errors bans for 24 hours)
42
- if (($globlogs {CUSTOM1_LOG }{$lgfile }) and ($line =~ / (\S +) -.*[GET|POST|HEAD].*(\s 444\s )/ )) {
43
+ if (($globlogs {CUSTOM1_LOG }{$lgfile }) or ( $globlogs { CUSTOM3_LOG }{ $lgfile }) and ($line =~ / (\S +) -.*[GET|POST|HEAD].*(\s 444\s )/ )) {
43
44
return (" Nginx 444" ,$1 ," nginx_444" ," 5" ," 80,443" ," 86400" ," 0" );
44
45
}
45
46
46
47
# /var/log/nginx/access.log
47
48
# Nginx 444 (Default: 5 errors bans for 24 hours)
48
- if (($globlogs {CUSTOM3_LOG }{$lgfile }) and ($line =~ / (\S +) -.*[GET|POST|HEAD].*(\s 444\s )/ )) {
49
- return (" Nginx 444" ,$1 ," nginx_444" ," 5" ," 80,443" ," 86400" ," 0" );
50
- }
49
+ # if (($globlogs{CUSTOM3_LOG}{$lgfile}) and ($line =~ /(\S+) -.*[GET|POST|HEAD].*(\s444\s)/)) {
50
+ # return ("Nginx 444",$1,"nginx_444","5","80,443","86400","0");
51
+ # }
51
52
52
53
# /var/log/virtualmin/*_error_log
54
+ # /var/log/nginx/error.log
53
55
# NginX security rules trigger (Default: 40 errors bans for 24 hours)
54
- if (($globlogs {CUSTOM2_LOG }{$lgfile }) and ($line =~ / .*access forbidden by rule, client: (\S +).*/ )) {
56
+ if (($globlogs {CUSTOM2_LOG }{$lgfile }) or ( $globlogs { CUSTOM4_LOG }{ $lgfile }) and ($line =~ / .*access forbidden by rule, client: (\S +).*/ )) {
55
57
return (" Nginx Security rule triggered from" ,$1 ," nginx_security" ," 40" ," 80,443" ," 86400" ," 0" );
56
58
}
57
59
58
60
# /var/log/nginx/error.log
59
61
# NginX security rules trigger (Default: 40 errors bans for 24 hours)
60
- if (($globlogs {CUSTOM4_LOG }{$lgfile }) and ($line =~ / .*access forbidden by rule, client: (\S +).*/ )) {
61
- return (" Nginx Security rule triggered from" ,$1 ," nginx_security" ," 40" ," 80,443" ," 86400" ," 0" );
62
- }
62
+ # if (($globlogs{CUSTOM4_LOG}{$lgfile}) and ($line =~ /.*access forbidden by rule, client: (\S+).*/)) {
63
+ # return ("Nginx Security rule triggered from",$1,"nginx_security","40","80,443","86400","0");
64
+ # }
63
65
64
66
# /var/log/virtualmin/*_error_log
67
+ # /var/log/nginx/error.log
65
68
# NginX 404 errors (Default: 50 errors bans for 24 hours)
66
- if (($globlogs {CUSTOM2_LOG }{$lgfile }) and ($line =~ / .*No such file or directory\) , client: (\S +),.*/ )) {
69
+ if (($globlogs {CUSTOM2_LOG }{$lgfile }) or ( $globlogs { CUSTOM4_LOG }{ $lgfile }) and ($line =~ / .*No such file or directory\) , client: (\S +),.*/ )) {
67
70
return (" Nginx Security rule triggered from" ,$1 ," nginx_404s" ," 50" ," 80,443" ," 86400" ," 0" );
68
71
}
69
72
70
73
# /var/log/nginx/error.log
71
74
# NginX 404 errors (Default: 50 errors bans for 24 hours)
72
- if (($globlogs {CUSTOM4_LOG }{$lgfile }) and ($line =~ / .*No such file or directory\) , client: (\S +),.*/ )) {
73
- return (" Nginx Security rule triggered from" ,$1 ," nginx_404s" ," 50" ," 80,443" ," 86400" ," 0" );
74
- }
75
+ # if (($globlogs{CUSTOM4_LOG}{$lgfile}) and ($line =~ /.*No such file or directory\), client: (\S+),.*/)) {
76
+ # return ("Nginx Security rule triggered from",$1,"nginx_404s","50","80,443","86400","0");
77
+ # }
75
78
76
79
# /var/log/virtualmin/*_access_log
80
+ # /var/log/nginx/access.log
77
81
# Trying to download htaccess or htpasswd (Default: 2 error bans for 24 hours)
78
- if (($globlogs {CUSTOM1_LOG }{$lgfile }) and ($line =~ / .*\. (htpasswd|htaccess).*client: (\S +),.*GET/ )) {
82
+ if (($globlogs {CUSTOM1_LOG }{$lgfile }) or ( $globlogs { CUSTOM3_LOG }{ $lgfile }) and ($line =~ / .*\. (htpasswd|htaccess).*client: (\S +),.*GET/ )) {
79
83
return (" Trying to download .ht files" ,$1 ," nginx_htfiles" ," 2" ," 80,443" ," 86400" ," 0" );
80
84
}
81
85
82
86
# /var/log/nginx/access.log
83
87
# Trying to download htaccess or htpasswd (Default: 2 error bans for 24 hours)
84
- if (($globlogs {CUSTOM3_LOG }{$lgfile }) and ($line =~ / .*\. (htpasswd|htaccess).*client: (\S +),.*GET/ )) {
85
- return (" Trying to download .ht files" ,$1 ," nginx_htfiles" ," 2" ," 80,443" ," 86400" ," 0" );
86
- }
88
+ # if (($globlogs{CUSTOM3_LOG}{$lgfile}) and ($line =~ /.*\.(htpasswd|htaccess).*client: (\S+),.*GET/)) {
89
+ # return ("Trying to download .ht files",$1,"nginx_htfiles","2","80,443","86400","0");
90
+ # }
87
91
88
92
# Wordpress fail2ban plugin https://wordpress.org/plugins/wp-fail2ban-redux/
89
93
# (Default: 2 errors bans for 24 hours)
@@ -116,24 +120,33 @@ sub custom_line {
116
120
}
117
121
118
122
# /var/log/virtualmin/*_error_log
123
+ # /var/log/nginx/error.log
119
124
# https://community.centminmod.com/posts/74546/
120
125
# Nginx connection limit rule trigger (Default: 5 errors bans for 60mins)
121
- if (($globlogs {CUSTOM2_LOG }{$lgfile }) and ($line =~ / .*limiting connections by zone .*, client: (\S +),(.*)/ )) {
126
+ if (($globlogs {CUSTOM2_LOG }{$lgfile }) or ( $globlogs { CUSTOM4_LOG }{ $lgfile }) and ($line =~ / .*limiting connections by zone .*, client: (\S +),(.*)/ )) {
122
127
return (" Nginx Security rule triggered from" ,$1 ," nginx_conn_limit" ," 5" ," 80,443" ," 3600" ," 0" );
123
128
}
124
129
125
130
# /var/log/nginx/error.log
126
131
# https://community.centminmod.com/posts/74546/
127
132
# Nginx connection limit rule trigger (Default: 5 errors bans for 60mins)
128
- if (($globlogs {CUSTOM4_LOG }{$lgfile }) and ($line =~ / .*limiting connections by zone .*, client: (\S +),(.*)/ )) {
129
- return (" Nginx Security rule triggered from" ,$1 ," nginx_conn_limit_localhost" ," 5" ," 80,443" ," 3600" ," 0" );
130
- }
133
+ # if (($globlogs{CUSTOM4_LOG}{$lgfile}) and ($line =~ /.*limiting connections by zone .*, client: (\S+),(.*)/)) {
134
+ # return ("Nginx Security rule triggered from",$1,"nginx_conn_limit_localhost","5","80,443","3600","0");
135
+ # }
131
136
132
137
# WordPress Catch all
133
138
# if (($globlogs{CUSTOM1_LOG}{$lgfile}) and ($line =~ /(\S+) -.*[GET|POST].*(\/wp-admin|wp-admins.php|administrator\/|login.php|backend|admin|\/xmlrpc.php|\/wp-(app|cron|login|register|mail).php|wp-.*.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|wlwmanifest.xml|wp-cl-plugin.php|[a-z0-9_-]+-sitemap([0-9]+)?.xml)/)) {
134
139
# return ("WordPress Catch all Attack",$1,"wordpress","7","80,443","1");
135
140
# }
136
141
142
+ # /var/log/virtualmin/*_access_log
143
+ # /var/log/nginx/access.log
144
+ # WordPress Non Existent plugin locations
145
+ # (Default: 2 errors bans for 24 hours)
146
+ if (($globlogs {CUSTOM1_LOG }{$lgfile }) or ($globlogs {CUSTOM3_LOG }{$lgfile }) and ($line =~ / (\S +) -.*[GET|POST|HEAD] (\/ wp-content\/ plugins\/ ).*(\s 404\s )/ )) {
147
+ return (" WordPress Plugins Honeypot Trap" ,$1 ," wordpress_404" ," 2" ," 80,443" ," 86400" ," 0" );
148
+ }
149
+
137
150
# Source: https://www.digitalflare.co.uk/blog/view/blocking-wp-login-and-xmlrpc-brute-force-attacks-with-csf-cpanel/
138
151
# WordPress XMLRPC
139
152
if (($globlogs {CUSTOM1_LOG }{$lgfile }) and ($line =~ / (\S +) -.*[GET|POST].*(xmlrpc.php)/ )) {
0 commit comments