@@ -38,56 +38,52 @@ 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
42
41
# Nginx 444 (Default: 5 errors bans for 24 hours)
43
- if (($globlogs {CUSTOM1_LOG }{$lgfile }) or ( $globlogs { CUSTOM3_LOG }{ $lgfile }) and ($line =~ / (\S +) -.*[GET|POST|HEAD].*(\s 444\s )/ )) {
42
+ if (($globlogs {CUSTOM1_LOG }{$lgfile }) and ($line =~ / (\S +) -.*[GET|POST|HEAD].*(\s 444\s )/ )) {
44
43
return (" Nginx 444" ,$1 ," nginx_444" ," 5" ," 80,443" ," 86400" ," 0" );
45
44
}
46
45
47
46
# /var/log/nginx/access.log
48
47
# Nginx 444 (Default: 5 errors bans for 24 hours)
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
- # }
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
+ }
52
51
53
52
# /var/log/virtualmin/*_error_log
54
- # /var/log/nginx/error.log
55
53
# NginX security rules trigger (Default: 40 errors bans for 24 hours)
56
- if (($globlogs {CUSTOM2_LOG }{$lgfile }) or ( $globlogs { CUSTOM4_LOG }{ $lgfile }) and ($line =~ / .*access forbidden by rule, client: (\S +).*/ )) {
54
+ if (($globlogs {CUSTOM2_LOG }{$lgfile }) and ($line =~ / .*access forbidden by rule, client: (\S +).*/ )) {
57
55
return (" Nginx Security rule triggered from" ,$1 ," nginx_security" ," 40" ," 80,443" ," 86400" ," 0" );
58
56
}
59
57
60
58
# /var/log/nginx/error.log
61
59
# NginX security rules trigger (Default: 40 errors bans for 24 hours)
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
- # }
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
+ }
65
63
66
64
# /var/log/virtualmin/*_error_log
67
- # /var/log/nginx/error.log
68
65
# NginX 404 errors (Default: 50 errors bans for 24 hours)
69
- if (($globlogs {CUSTOM2_LOG }{$lgfile }) or ( $globlogs { CUSTOM4_LOG }{ $lgfile }) and ($line =~ / .*No such file or directory\) , client: (\S +),.*/ )) {
66
+ if (($globlogs {CUSTOM2_LOG }{$lgfile }) and ($line =~ / .*No such file or directory\) , client: (\S +),.*/ )) {
70
67
return (" Nginx Security rule triggered from" ,$1 ," nginx_404s" ," 50" ," 80,443" ," 86400" ," 0" );
71
68
}
72
69
73
70
# /var/log/nginx/error.log
74
71
# NginX 404 errors (Default: 50 errors bans for 24 hours)
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
- # }
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
+ }
78
75
79
76
# /var/log/virtualmin/*_access_log
80
- # /var/log/nginx/access.log
81
77
# Trying to download htaccess or htpasswd (Default: 2 error bans for 24 hours)
82
- if (($globlogs {CUSTOM1_LOG }{$lgfile }) or ( $globlogs { CUSTOM3_LOG }{ $lgfile }) and ($line =~ / .*\. (htpasswd|htaccess).*client: (\S +),.*GET/ )) {
78
+ if (($globlogs {CUSTOM1_LOG }{$lgfile }) and ($line =~ / .*\. (htpasswd|htaccess).*client: (\S +),.*GET/ )) {
83
79
return (" Trying to download .ht files" ,$1 ," nginx_htfiles" ," 2" ," 80,443" ," 86400" ," 0" );
84
80
}
85
81
86
82
# /var/log/nginx/access.log
87
83
# Trying to download htaccess or htpasswd (Default: 2 error bans for 24 hours)
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
- # }
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
+ }
91
87
92
88
# Wordpress fail2ban plugin https://wordpress.org/plugins/wp-fail2ban-redux/
93
89
# (Default: 2 errors bans for 24 hours)
@@ -120,30 +116,33 @@ sub custom_line {
120
116
}
121
117
122
118
# /var/log/virtualmin/*_error_log
123
- # /var/log/nginx/error.log
124
119
# https://community.centminmod.com/posts/74546/
125
120
# Nginx connection limit rule trigger (Default: 5 errors bans for 60mins)
126
- if (($globlogs {CUSTOM2_LOG }{$lgfile }) or ( $globlogs { CUSTOM4_LOG }{ $lgfile }) and ($line =~ / .*limiting connections by zone .*, client: (\S +),(.*)/ )) {
121
+ if (($globlogs {CUSTOM2_LOG }{$lgfile }) and ($line =~ / .*limiting connections by zone .*, client: (\S +),(.*)/ )) {
127
122
return (" Nginx Security rule triggered from" ,$1 ," nginx_conn_limit" ," 5" ," 80,443" ," 3600" ," 0" );
128
123
}
129
124
130
125
# /var/log/nginx/error.log
131
126
# https://community.centminmod.com/posts/74546/
132
127
# Nginx connection limit rule trigger (Default: 5 errors bans for 60mins)
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
- # }
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
+ }
136
131
137
132
# WordPress Catch all
138
133
# 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)/)) {
139
134
# return ("WordPress Catch all Attack",$1,"wordpress","7","80,443","1");
140
135
# }
141
-
142
136
# /var/log/virtualmin/*_access_log
137
+ # WordPress Non Existent plugin locations
138
+ # (Default: 2 errors bans for 24 hours)
139
+ if (($globlogs {CUSTOM1_LOG }{$lgfile }) and ($line =~ / (\S +) -.*[GET|POST|HEAD] (\/ wp-content\/ plugins\/ ).*(\s 404\s )/ )) {
140
+ return (" WordPress Plugins Honeypot Trap" ,$1 ," wordpress_404" ," 2" ," 80,443" ," 86400" ," 0" );
141
+ }
143
142
# /var/log/nginx/access.log
144
143
# WordPress Non Existent plugin locations
145
144
# (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 )/ )) {
145
+ if (($globlogs {CUSTOM3_LOG }{$lgfile }) and ($line =~ / (\S +) -.*[GET|POST|HEAD] (\/ wp-content\/ plugins\/ ).*(\s 404\s )/ )) {
147
146
return (" WordPress Plugins Honeypot Trap" ,$1 ," wordpress_404" ," 2" ," 80,443" ," 86400" ," 0" );
148
147
}
149
148
0 commit comments