brother4
Basic Pleskian
- Server operating system version
- Ubuntu 22.04
- Plesk version and microupdate number
- Plesk Obsidian 18.0.64 Web Host Edition
Hey!
I would like to block an IP if any of the following URLs are accessed three times. Essentially, if a bot tries to access these files multiple times, it should be automatically blocked:
I would like to block an IP if any of the following URLs are accessed three times. Essentially, if a bot tries to access these files multiple times, it should be automatically blocked:
- /wp-content/plugins/index.php
- /admin/function.php
- /wp-admin/user/network.php
- /wp-content/plugins/core-plugin/include.php
Code:
# Custom rule to monitor and block IP addresses for specific file requests
SecRule REQUEST_URI "@streq /wp-content/plugins/index.php" \
"id:20001,phase:2,log,drop,msg:'Suspicious access detected to /wp-content/plugins/index.php',t:none,tag:'security',setvar:'ip.block_counter=+1',expirevar:'ip.block_counter=3600'"
SecRule REQUEST_URI "@streq /admin/function.php" \
"id:20002,phase:2,log,drop,msg:'Suspicious access detected to /admin/function.php',t:none,tag:'security',setvar:'ip.block_counter=+1',expirevar:'ip.block_counter=3600'"
SecRule REQUEST_URI "@streq /wp-admin/user/network.php" \
"id:20003,phase:2,log,drop,msg:'Suspicious access detected to /wp-admin/user/network.php',t:none,tag:'security',setvar:'ip.block_counter=+1',expirevar:'ip.block_counter=3600'"
SecRule REQUEST_URI "@streq /wp-content/plugins/core-plugin/include.php" \
"id:20004,phase:2,log,drop,msg:'Suspicious access detected to /wp-content/plugins/core-plugin/include.php',t:none,tag:'security',setvar:'ip.block_counter=+1',expirevar:'ip.block_counter=3600'"
# Rule to automatically block an IP after multiple suspicious access attempts
SecRule IP:block_counter "@ge 3" \
"id:20005,phase:1,log,drop,msg:'IP blocked due to multiple suspicious requests',t:none,setvar:'ip.block=1',expirevar:'ip.block=86400'"
- Will this setup work correctly with Plesk NGINX v3.0 and ModSecurity (Comodo Ruleset)?
- Does the use of drop (instead of deny) ensure that attackers do not receive any hints about why their connection was blocked?
- Is there anything I need to adjust or be aware of for this configuration to work smoothly in Plesk with NGINX as the web server?