I'm trying to block a IP list generated by CustomLog using IfDefine to avoid log ip again, but it's not working. I changed CustomLog conditional and something bizarre behavior can be observed:
RewriteMap blacklist txt:/var/www/blacklist.log
RewriteCond ${blacklist:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND [OR]
RewriteCond ${blacklist:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND
RewriteRule ^ - [F,E=BLOCKED_IP]
<IfDefine !BLOCKED_IP>
SetEnvIf Request_URI "^/xmlrpc\.php$" BAD_BEHAVIOR
CustomLog /var/log/apache2/blacklist.log "%h ## %t BAD_BEHAVIOR \"%r\" %>s %b \"%{User-agent}i\"" env=BLOCKED_IP
</IfDefine>
Even when BLOCKED_IP true the code inside IfDefine executes and CustomLog has a inverse conditional... It doesnt make any sense -.-
- RewriteRule define BLOCKED_IP
- IfDefine !BLOCKED_IP pass (why?)
- CustomLog works with a inverse conditional (why again?)
- blacklist.log has added same IP
Can someone explain this behavior??