QMAIL x-perts question

Panayotis Tsiamis ptsiamis at internet.gr
Fri Dec 9 10:44:22 EET 2005


Loipon i erotisi afora tous x-perts sto qmail.

Exei dokimasei kaneis na ftiaxei wrappers gia to qmail-local
kai qmail-remote, oste na ginete ekei to antispam anti
na ginete sto qmail-queue?

Ego exo ilopoihsei wrapper gia to qmail-local
to opio statistikos den "skaei" kata 98%
kai einai ena aplo BASH script.

To idio exo petixei kai kai gia to qmail-remote
alla mou prokalei problimata giati logo
diaforetikis nootropias pou thelo na exei me to qmail-local.

Pio analitika:

qmail-local
-----------

Ta dedomena tou Mail erxonte apo to STDIN
Paraliptes,domain,KTL erxonte apo to *ARGV[]
Opote i diadikasia einai i exeis:
spamc -arguments --user argv[USERNAME] | seekablepipe | qmail-local *ARGV[]
to seekablepipe einai aparetito giati to qmail-local xriazete na xananixei
ton file descriptor allios troei CORE DUMP.


Auto pou petixenei einai na kanei personalized antispam
GIA KATHE PARALIPTI O OPIOS EINAI LOCAL.


Qmail-remote
------------
Ta dedomena tou mail erxonte apo to STDIN
Akoulouthoun sto *argv[]
domain: from: to:..to:


--start--

#!/bin/bash
# ptsiamis 14/01/05
# anti-personilised antispam for remote users only
#################

#set -x

domain="$1" ; shift
sender="$1" ; shift
output=`/command/seekablepipe /opt/spamassassin/bin/spamc -U 
/tmp/spamd.sock`
FLAG=`printf "%s\n" "$output" | /command/seekablepipe 
/usr/local/bin/822field X-Spam-Flag | sed 's/^ //'`

if [ "$FLAG" == "YES" ]; then
  exec printf "%s\n" "$output" | /command/seekablepipe 
/opt/qmail/bin/bounce.pl $domain $sender $*
else
  exec printf "%s\n" "$output" | /command/seekablepipe 
/opt/qmail/bin/qmail-remote-orig $domain $sender $*
fi

--end--

To problima edo einai oti poles fores krasarei to qmail-remote
an kapios exei psaxei to kodika tou as rixei ligo fos sto tunnel.

To bounce.pl einai to exeis episis:


---start---
#!/usr/bin/perl
# pit..
# code from qmail-scanner..

$FROM="postmaster\@internet.gr";
$domain= shift;
$spammer= shift;
@rcpt=@ARGV;

$hostname="XXX.XXX.XX";
$still_headers=1;

while (<STDIN>) {

  if ($still_headers) {
    $HEADERS  .= $_;

    if (/^(\r|\r\n|\n)$/) {
      $still_headers=0;
    }    

  } else { $body .= $_; }
}
$qmailinject="/opt/qmail/bin/qmail-inject";

open(SM,"|$qmailinject -h -f ''")||&error_condition("cannot open 
$qmailinject for sending quarantine report - $!");
#open (SM, ">&STDOUT");
print SM "From: \"$FROM\" <$FROM>\n";
print SM "To: $spammer\n";
print SM "Subject: [***** SPAM *****] Your mail is consider as spam.\n";
print SM "Message-ID: <".&uniq_id."\@$hostname>\n";
print SM "Auto-Submitted: auto-replied\n";
print SM "MIME-Version: 1.0\n";
print SM "Content-type: text/plain\n";
print SM "\n";
print SM "Attention: $rcpt\n";
print SM "\n

Your mail was blah blah blah SPAM!

... and with the following headers:\n\n";

print SM "---\n";
print SM "MAILFROM: $spammer\n";
print SM "$HEADERS\n";
print SM "---\n";
#print SM "BODY:\n";
#print SM "$body\n";
#print SM "---\n";

close(SM);

sub uniq_id {
  return "$hostname" . time .  __LINE__ . $$;
}

---end---

-- 
<meta content="text/html;" http-equiv="Content-Type">
=========================================================
Τμήμα Διαχείρισης Υπηρεσιών Data Center Internet Hellas
(Data Center Services by FORTHnet)
Γενική Δ/νση Υπηρεσιών Internet
FORTHnet A.E.
23ο χιλ. Ε/Ο Αθηνών - Λαμίας, Αγ. Στέφανος, 145 65
Τηλ.: 801 100 4100, 211 100 4100 Fax: 210-6248045
Web: www.internet.gr - Email: IDC-operations at internet.gr
=========================================================




More information about the Linux-greek-users mailing list