Hi
i want to block the ips of spam sources immediately as soon as dspam detects
them as spam
dspam does a logs these ips correctly into my /var/log/maillog file so i know
that things are working correctly
on the linux console i use the following command to block an ip address
/sbin/iptables -I INPUT -s 111.111.111.111 -j DROP
this code snippet below is from the dspam source ie dspam.c file in the src
directory
the variable called "ip" contains the ip address which is logged to the maillog
file
i understand that just a single line is required after the last line to execute
the command but i am not sure of the C syntax
can someone help me ?
###########
int tracksource(DSPAM_CTX *CTX) {
char ip[32];
if (!dspam_getsource (CTX, ip, sizeof (ip)))
{
if (CTX->totals.innocent_learned + CTX->totals.innocent_classified > 2500) {
if (CTX->result == DSR_ISSPAM &&
_ds_match_attribute(agent_config, "TrackSources", "spam")) {
FILE *file;
char dropfile[MAX_FILENAME_LENGTH];
LOG (LOG_INFO, "spam detected from %s", ip);
###########
thanks
raj