[Postfixbuch-users] Postfix und crm114

Thomas Wegner thomaswegner at gmx.net
Mo Feb 5 22:19:41 CET 2007


Am Montag, den 05.02.2007, 21:14 +0100 schrieb Sandy Drobic:
Hallo Sandy!

> Poste bitte noch mal den aktuellen Stand von:
>   master.cf
----------------------------------------------
#
==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
#
==========================================================================
#smtp      inet  n       -       -       -       -       smtpd
#submission inet n      -       -       -       -       smtpd
#       -o smtpd_etrn_restrictions=reject
#628      inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       -       300     1       qmgr
#qmgr     fifo  n       -       -       300     1       oqmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
#Eintraguer crm114
localhost:smtp inet n -         n       -       -       smtpd -o
smtpd_sender_restrictions= -o content_filter=crm114:dummy

# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# maildrop. See the Postfix MAILDROP_README file for details.
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail
($recipient)
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -d -t$nexthop -f$sender
$recipient
scalemail-backend unix  -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
${nexthop} ${user} ${extension}
cyrus   unix    -       n       n       -       -       pipe
  user=cyrus    argv=/usr/sbin/cyrdeliver -e -m ${extension}    ${user}

##incoming traffic with crm114 spamfilter
crm114  unix    -       n       n       -       -       pipe
  flags=Rq user=filter argv=/etc/postfix/crmfilter.sh -i -f ${sender}
--${recipient}


# only used by postfix-tls
#tlsmgr   fifo  -       -       n       300     1       tlsmgr
#smtps    inet  n       -       n       -       -       smtpd -o
smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#587      inet  n       -       n       -       -       smtpd -o
smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
scache    unix  -       -       -       -       1       scache
discard   unix  -       -       -       -       -       discard
---------------------------------------------------------------------------

>   postconf -n
root at chef:/home/tommi # postconf -n
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
config_directory = /etc/postfix
default_destination_concurrency_limit = 10
default_privs = nobody
default_transport = smtp
fallback_transport = cyrus
inet_interfaces = all
local_destination_concurrency_limit = 2
luser_relay = $root at chef.home
mail_owner = postfix
mailbox_transport = cyrus
mydestination = $myhostname, $mydomain, localhost, localhost.$mydomain
mydomain = home
myhostname = chef.home
mynetworks = 127.0.0.0/8 192.168.1.0/24
myorigin = $myhostname
notify_classes = bounce, delay, resource, software
relayhost = [mail.teleos-web.de]
smtp_generic_maps = hash:/etc/postfix/generic
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_sasl_security_options = noanonymous
smtpd_banner = $myhostname ESMTP

>   ls -l /etc/postfix/crmfilter.sh
root at chef:/home/tommi # ls -l /etc/postfix/crmfilter.sh 
-rwxr-xr-x 1 filter root 1044 2007-02-05 21:37 /etc/postfix/crmfilter.sh

>   ls -l /etc/ | grep postfix
root at chef:/home/tommi # ls -l /etc | grep postfix
drwxr-xr-x  3 root       root       4096 2007-02-05 21:53 postfix

>   /etc/postfix/crmfilter.sh
--------------------------------------------
#!/bin/sh
#crmfilter by Dirk Datzert
#erstellt von tommi am 01.02.2007
#noch nicht getestet fï¿œr Ubuntu 06.10
#Localize these.
INSPECT_DIR=/var/spool/filter
#genaendert gemss postfix-handbuch
#SENDMAIL=/usr/sbin/sendmail
SENDMAIL="usr/sbin/sendmail -G -i" #NEVER NEVER NEVER use "-t"
CRM=/usr/bin/crm
FILEPREFIX=/var/spool/crm/
MAILFILTER=/usr/share/crm114/mailfilter.crm

#Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69

#Clean up when done or when aborting
trap "rm -f in.$$ out.$$" 0 1 2 3 15

#Start processing
cd $INSPECT_DIR || {echo $INSPECT_DIR does not exist; exit
$EX_TEMPFAIL;}

(grep -iv ^X-CRM114 | cat >in.$$) {echo Cannot save mail to file; exit
$EX_TEMPFAIL;}

#If CRM114 has a problem set output=input
#$SENDMAIL "$@" <in.$$
#exit $?
out=in.$$

#Only mail under 1MB thru CRM114 (size in 512 byte-blocks)!!
for crm in 'find . -name in.$$ -size -2048 -type f'; do $CRM
--fileprefix=$FILEPREFIX $MAILFILTER <in.$$ >out.$$ || {echo CRM114
failed; exit $EX_TEMPFAIL;}

out=out.$$
done

$SENDMAIL "$@" <$out

exit $?
-------------------------------------------------------------------

> Ich empfehle, ein eigenes Verzeichnis für den user filter zu erstellen und
> dies als Homeverzeichnis einzurichten. Eine Loginshell braucht der user
> filter nicht. 
Das habe ich auch soweit gemacht. Das HomeVerzeichnis
ist /var/spool/filter.
root at chef:/home/tommi # ls -la /var/spool/filter
insgesamt 8
drwxr-x---  2 filter filter 4096 2007-02-01 16:49 .


> Passe auch das Script an, dass es auf dieses Verzeichnis
> zugreifen kann.
?? Wie. Über die Variable INSPECT_DIR? 

>  Das Script selbst muss dann auch auf /usr/sbin/sendmail
> zugreifen können.
Ich habe jetzt die Rechte auf sendmail so vergeben, dass der user filter
sendmail auch ausführen darf.

Wenn der Rest passt (s. o.) kann ich das ja mal testen.

-- 
Gruß

Thomas


Homepage: www.tommiwe.de
Key fingerprint = DA5C B5F7 DB88 6CF4 9FA2  92DC 99D0 65D6 4B14 5FC0





Mehr Informationen über die Mailingliste Postfixbuch-users