jvdmr / mod_evasive

Apache mod_evasive module
GNU General Public License v2.0
15 stars 8 forks source link

%s in subject of mail #5

Closed jeensg closed 1 month ago

jeensg commented 5 years ago

I put the following system-command: "echo 'mod-evasive HTTP Blacklisted %s more info here: www.projecthoneypot.org/ip_%s' | mail -s 'Blocked IP %s by mod-evasive' root@localhost"

--> it's always shown "(null)" or "" (nothing) in the subject. Is there a way to display IP in subject!? What am I doing wrong?

jvdmr commented 1 month ago

The system-command does get the IP filled in, but only at the first occurence of %s. Your url likely also just contains %s instead of the IP.

In your case, I would write a short shell script that takes 1 argument, and configure mod_evasive to use this shell script instead, e.g.:

#!/bin/bash

ip=$1
echo 'mod-evasive HTTP Blacklisted ${ip} more info here: www.projecthoneypot.org/ip_${ip}' | mail -s 'Blocked IP ${ip} by mod-evasive' root@localhost

and then use DOSSystemCommand "/path/to/myscript.sh %s".

Hope that helps!