- Server operating system version
- AlmaLinux 8.10
- Plesk version and microupdate number
- Plesk Obsidian 18.0.66 #1
I have been noticing for a while that when I disable and re-enable modsecurity, it starts to block malicious attacks, but after a day there is no more ip blocking, and the logs are completely blank. This made me suspicious, and although in the plesk interface modsecurity is shown as active, I have the feeling that it is not working.
I have created a rule for modsecurity, so that when visiting a url on my server if modsecurity is running it shows error 403, and if it is not it shows error 404. I have put that when this rule is activated it does not register in the log, so that it does not block the ip.
This is the modsecurity rule:
<IfModule mod_security2.c>
SecRule REQUEST_URI "@streq /checkmodsecurity" "id:1000001,phase:1,t:none,deny,status:403,nolog,msg:'Regla para chequeo de modsecurity'"
</IfModule>
I then created a script that checks this url every 5 minutes, and if visiting the url results in 403, it does nothing, but if it results in 404, it sends me an email telling me that modsecurity is not working, and reactivates modsecurity with the command “/usr/sbin/plesk sbin modsecurity_ctl --enable”.
Since then I have found that modsecurity stops working every night between 3:15am and 3:20am, and that running the command “/usr/sbin/plesk sbin modsecurity_ctl --enable” makes it work again.
Since then there is no more blank modsecurity log and modsecurity blocks as expected.
Is this a modsecurity bug in plesk. Also to say that even though modsecurity stops working, in the plesk interface it shows as active, which leads to confusion, implying that the server is protected, but it is not.
I have created a rule for modsecurity, so that when visiting a url on my server if modsecurity is running it shows error 403, and if it is not it shows error 404. I have put that when this rule is activated it does not register in the log, so that it does not block the ip.
This is the modsecurity rule:
<IfModule mod_security2.c>
SecRule REQUEST_URI "@streq /checkmodsecurity" "id:1000001,phase:1,t:none,deny,status:403,nolog,msg:'Regla para chequeo de modsecurity'"
</IfModule>
I then created a script that checks this url every 5 minutes, and if visiting the url results in 403, it does nothing, but if it results in 404, it sends me an email telling me that modsecurity is not working, and reactivates modsecurity with the command “/usr/sbin/plesk sbin modsecurity_ctl --enable”.
Since then I have found that modsecurity stops working every night between 3:15am and 3:20am, and that running the command “/usr/sbin/plesk sbin modsecurity_ctl --enable” makes it work again.
Since then there is no more blank modsecurity log and modsecurity blocks as expected.
Is this a modsecurity bug in plesk. Also to say that even though modsecurity stops working, in the plesk interface it shows as active, which leads to confusion, implying that the server is protected, but it is not.