Postfix > Procmail >> Probleme mbox/mdir

van_haakonnen

Registered User
Hallo Community,

ich verzweifel hier so langsam nach ca. 7 Stunden herumprobieren an meinem Mailsystem...

Folgende Configuration:
Installiert ist das aktuellste Confixx. Der Maileingang soll über Postfix laufen. Postfix soll nun die Mails weiter an procmail reichen, welches diese z.B. bei Spamtreffern in einen eigenen Unterordner SPAM verschieben soll.

Postfix und Confixx sind eigentlich so konfiguriert, dass sie Maildirs anlegen sollen unter /home/email/webXpX/

Meine Probleme sind nun wie folgt:
1) Im Webmail von Confixx (eingestellt auf IMAP) kann ich keine Mails abrufen. Es werden keinerlei Ordner angezeigt. Es erscheint aber auch keine Fehlermeldung. Das Abholen von Mails via POP3/IMAP z.B. via Outlook klappt aber.

2) Wenn ich procmail versuche einzubinden, damit ich SPAM aussortieren kann, dann zerhaut es mir meine Mailkonfiguration. Mail werden plötzlich unter /var/mail/webXpX als mbox angelegt.

3) Obwohl ich unter procmail.rc das Loggin aktiviert habe, kann ich unter /var/log/procmail nichts finden

4) Postfix scheint die Mails nocoh zuzustellen: "delivered to command: procmail -a "$EXTENSION"". Nur Procmail scheint nicht zu funktionieren...

Hier meine Konfig:

procmail.rc
Code:
VERBOSE=YES
LOGFILE=/var/log/procmail
LOGABSTRACT=all
DROPPRIVS=yes
DEFAULT=$HOME/Maildir/
MAILDIR=$HOME/Maildir/
SHELL=/bin/sh

:0fw: spamassassin.lock
* < 256000
|/usr/bin/spamc -f

:0:
* ^X-Spam-Status: Yes
$HOME/Maildir/.Spam/

:0
* ^^rom[ ]
{
  LOG="*** Dropped F off From_ header! Fixing up. "

  :0 fhw
  | sed -e '1s/^/F/'
}


main.cf
Code:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtp_scache
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
#smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
smtp_tls_session_cache_database = btree:/var/lib/postfix/smtp_scache


# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
home_mailbox = Maildir/
mydestination = $myorigin
relayhost =
mynetworks = 127.0.0.0/8
#mailbox_command=
mailbox_command= procmail -a "$EXTENSION"
mailbox_size_limit = 0
message_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

smtpd_recipient_restrictions=
  permit_sasl_authenticated,
  permit_mynetworks,
  reject_unauth_destination,
  reject_non_fqdn_sender,
  reject_non_fqdn_recipient,
  reject_invalid_helo_hostname,
  reject_unknown_sender_domain,
  reject_unknown_recipient_domain,
  check_policy_service inet:127.0.0.1:60000
  permit

### CONFIXX POSTFIX ENTRY ###
virtual_maps = hash:/etc/postfix/confixx_virtualUsers, hash:/etc/postfix/confixx_localDomains

### /CONFIXX POSTFIX ENTRY ###
#smtpd_helo_required = yes
#smtpd_helo_restrictions = reject_invalid_hostname
#smtpd_recipient_restrictions = permit_mynetworks, reject_unknown_recipient_domain, permit_sasl_authenticated, reject_unauth_destination
#smtpd_sender_restrictions = reject_unknown_address
#smtpd_sasl_auth_enable = yes
#smtpd_sasl_security_options = noanonymous
#smtpd_sasl_local_domain =
#smtp_sasl_auth_enable = no
#broken_sasl_auth_clients = yes
(END)

master.cf
Code:
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
#submission inet n       -       -       -       -       smtpd
#  -o smtpd_enforce_tls=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#smtps     inet  n       -       -       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#628      inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       -       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
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
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       -       -       -       smtp
        -o fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
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 -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}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}

retry     unix  -       -       -       -       -       error
(END)

Habt Ihr eine Idee wo mein Fehler liegen könnte? Ich weiß eben wirklich nicht mehr weiter... :/

Vielen Dank

Van_Haakonnen
 
Als erstes musst Du klären, ob die von Dir gepostete Datei procmail.rc überhaupt verwendet wird...

Da Du folgendes verwendest
Code:
VERBOSE=YES
LOGFILE=/var/log/procmail
, sollte es leicht fallen im Logfile zu sehen, welche Regeln greifen und was bei der Verarbeitung ausgeführt wird, sobald das Logging funktioniert.

Da procmail mit normalen Benutzerrechten ausgeführt wird, wird das Schreiben mit Deiner aktuellen Konfiguration aber nicht funktionieren. Verwende besser /var/tmp/procmail.log. Bei verschiedenen Benutzern kann das aber auch wieder zu Problemen führen, die sich vermeiden lassen, wenn man die Logdatei im Home ablegt ($HOME/Maildir/.procmail.log). Da die Dateien schnell ziemlich groß werden, sollte man das Logging wieder abschalten, sobald alles funktioniert.
 
Guten Morgen,

vielen Dank für die Antwort. Also es handelt sich dabei um die globale procmail.rc unter /etc/.

Ich habe das Logging jetzt mal auf /var/tmp/procmail abgeändert. Leider schreibt er nur keine Logfiles... :/
 
Die Frage ist immer noch nicht geklärt, ob /etc/procmailrc überhaupt verwendet wird.
Evtl. musst Du mit strace nachschauen, welche Dateien gelesen werden.
 
Also jetzt muss ich mal die virtuellen Hosen runterlassen und gestehne, dass ich bei der Verwendung von strace nicht wirklich Erfahrung habe - ist wohl der MOment gekommen, sich hier einmal einzulesen...

Ich habe aber noch festgestelt, dass auch mein postgrey wohl nicht wirklich verwendet wird. Wenn ich in den Logfiles suche, dann finde ich keinen Hinweis darauf, dass postgrey verwendet wird... obwohl es in der main.cf eigentlich drin steht...

Ich werde mir mal in meinem Urlaub ein Postfix-Buch zu Gemüte führen... so steige ich da nicht durch... Muss ich den Server erstmal ohne procmail und postgrey laufen lassen...

Was ich immernoch nicht verstehe ist, dass Confixx mir sagt es könnte auf den IMAP-Server nicht zugreifen.. gehe ich per Outlook dran, dann komme ich via IMAP problemlos drauf...
 
Also jetzt muss ich mal die virtuellen Hosen runterlassen und gestehne, dass ich bei der Verwendung von strace nicht wirklich Erfahrung habe - ist wohl der MOment gekommen, sich hier einmal einzulesen...
Also hier eine Kurzfassung (da die Befehle teilweise mit root-Berechtigungen ausgeführt werden müssen, solltest Du vor dem blinden Ausführen nachvollziehen, was sie bewirken :) )
Code:
 # ps -ef | grep postfix/master | grep -v grep | awk '{print $2}'
[COLOR="Blue"]23778[/COLOR]
# strace -o /tmp/postfix.trace -p23778 -f -F
[COLOR="Blue"]Process 23778 attached - interrupt to quit
Process 22260 attached
Process 22261 attached
Process 22262 attached
Process 22264 attached
Process 22267 attached
Process 22269 attached
Process 22271 attached
Process 22272 attached
Process 22273 attached
Process 22272 suspended
Process 22272 resumed
Process 22273 detached
Process 22272 detached
Process 22274 attached
Process 22275 attached (waiting for parent)
Process 22275 resumed (parent 22274 ready)
Process 22274 suspended
Process 22274 resumed
Process 22275 detached
Process 22274 detached
Process 22276 attached (waiting for parent)
Process 22276 resumed (parent 22271 ready)
Process 22277 attached (waiting for parent)
Process 22277 resumed (parent 22271 ready)
Process 22271 detached
Process 22278 attached
Process 22279 attached
Process 22278 detached
Process 22277 detached
Process 22279 detached
Process 22276 detached
Process 22280 attached
Process 22281 attached
Process 22282 attached (waiting for parent)
Process 22282 resumed (parent 22281 ready)
Process 22281 suspended
Process 22283 attached
Process 22284 attached
Process 22282 suspended
Process 22282 resumed
Process 22283 detached
Process 22282 suspended
Process 22282 resumed
Process 22284 detached
Process 22281 resumed
Process 22282 detached
Process 22280 suspended
Process 22280 resumed
Process 22281 detached
Process 22285 attached (waiting for parent)
Process 22285 resumed (parent 22280 ready)
Process 22286 attached (waiting for parent)
Process 22286 resumed (parent 22285 ready)
Process 22285 suspended
Process 22280 suspended
Process 22285 resumed
Process 22286 detached
Process 22280 resumed
Process 22285 detached
Process 22287 attached (waiting for parent)
Process 22287 resumed (parent 22280 ready)
Process 22288 attached (waiting for parent)
Process 22288 resumed (parent 22287 ready)
Process 22287 suspended
Process 22289 attached
Process 22290 attached
Process 22291 attached
Process 22292 attached
Process 22293 attached
Process 22288 suspended
Process 22288 resumed
Process 22290 detached
Process 22288 suspended
Process 22288 resumed
Process 22291 detached
Process 22288 suspended
Process 22288 resumed
Process 22292 detached
Process 22288 suspended
Process 22288 resumed
Process 22293 detached
Process 22294 attached
Process 22288 suspended
Process 22288 resumed
Process 22294 detached
Process 22287 resumed
Process 22288 detached
Process 22287 detached
Process 22295 attached
Process 22280 suspended
Process 22280 resumed
Process 22295 detached
Process 22296 attached
Process 22280 suspended
Process 22297 attached (waiting for parent)
Process 22297 resumed (parent 22296 ready)
Process 22298 attached (waiting for parent)
Process 22298 resumed (parent 22296 ready)
Process 22296 suspended
Process 22296 resumed
Process 22297 detached
Process 22296 suspended
Process 22296 resumed
Process 22298 detached
Process 22280 resumed[/COLOR]
^C[COLOR="Blue"]Process 22296 detached
Process 22280 detached
Process 23778 detached
Process 22260 detached
Process 22261 detached
Process 22262 detached
Process 22264 detached
Process 22267 detached
Process 22269 detached
Process 22289 detached[/COLOR]
Als erstes muss die Prozess-ID des Postfix-Masterprozesses ermittelt werden. Diese wird dann als strace übergeben, das sich an diesen Prozess anhängt und die Systemaufrufe in eine Datei schreibt und dabei auch sämtliche erzeugten Unterprozesse berückischtig. Dann kann man sich eine Mail schreiben, woraufhin viele Unterprozesse erzeugt werden. Sobald die Mail zugestellt worden ist, sollte strace durch Drücken von Strg-C abgebrochen werden.

Code:
# grep procmailrc /tmp/postfix.trace
[COLOR="Blue"]22271 open("/etc/procmailrc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
22271 stat64("/home/user1/.procmailrc", {st_mode=S_IFREG|0644, st_size=291, ...}) = 0
22271 open("/home/user1/.procmailrc", O_RDONLY|O_LARGEFILE) = 4
[/COLOR]
Zeigt Dir dann an, aus welchen Dateien mit procmailrc im Namen zu lesen versucht wird. Im Beispiel wird /home/user1/.procmailrc verwendet, da es die Datei /etc/procmailrc nicht gibt.

Ich habe aber noch festgestelt, dass auch mein postgrey wohl nicht wirklich verwendet wird. Wenn ich in den Logfiles suche, dann finde ich keinen Hinweis darauf, dass postgrey verwendet wird... obwohl es in der main.cf eigentlich drin steht...
Hast Du Postfix nach Eingabe der Änderungen schon neu gestartet?
Code:
# /usr/sbin/postfix reload
 
Also erstmal ein ganz, ganz großes Lob und Dankeschön für die Mühe, die du dir hier mit mir machst. Besser hätte eine Anleitung gar nicht sein können.

Bei mir kommt folgendes dabei heraus:

Code:
/tmp/postfix.trace.22584:open("/etc/procmailrc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
/tmp/postfix.trace.22584:stat64("/home/email/web1p1/.procmailrc", 0xbfb3ff1c) = -1 ENOENT (No such file or directory)
/tmp/postfix.trace.22584:open("/home/email/web1p1/.procmailrc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
/tmp/postfix.trace.22797:open("/etc/procmailrc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
/tmp/postfix.trace.22797:stat64("/home/email/web1p1/.procmailrc", 0xbfd3310c) = -1 ENOENT (No such file or directory)
/tmp/postfix.trace.22797:open("/home/email/web1p1/.procmailrc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or director

Bei mir gibt es nur eine /etc/procmail.rc - ich habe jetzt einfach mal einen symbolischen Link angelegt in etc: ln -s procmail.rc procmailrc

Werde heute Abend mal ausprobieren, ob es das war :)


=== EDIT:

Also Procmail scheint jetzt zu funktionieren.

Was mich noch ganz stark stört ist folgendes:
Wenn ich z.B. in Outlook einen neuen Ordner (via IMAP) auf derselben Ebene wie der Posteingang anlegen möchte, dann erhalte ich die Meldung: "Die Elemente können nicht verschoben werden. Invalid mailbox name.". Versuche ich einen Ordner unterhalb von Posteingang anzulegen, so klappt es.

Zum Webinterface von Confixx im Bereich Mail:
Hier erhalte ich zwar zunächst keine Fehlermeldung aber sehe einfach weder Ordner noch Mails... Konfiguriert ist der Zugriff in Confixx via IMAP. Gehe ich auf den Punkt "Ordner" im Webinterface erhalte ich die Meldung: "Bekomme keinen Connect zum Server. Vielleicht ist der POP3-Server gerade nicht zu erreichen."
 
Last edited by a moderator:
Back
Top