[Postfixbuch-users] postfix cyrus-imapd und die lokalen benutzerkonten

Marcel Hartmann mail at marcel-hartmann.com
Mi Feb 16 19:51:29 CET 2005


Hallo,

nachdem ich von einem Mitglied dieser Liste darauf aufmerksam gemacht worden
bin, das sie in deutsch
ist, schreibe ich hier nun nocheinmal mein Problemchen in Deutscher Fassung
:-)

Meine Problemstellung war es, alle Emaildomains inkl. aller ihrer Konten
Virtuell in eine DB zu legen.
Dies habe ich mittels dem Webcyradm HowTo von Luc De Louw auch realisieren
können.

http://www.tldp.org/HOWTO/Postfix-Cyrus-Web-cyradm-HOWTO/


Der Server läuft korrekt und alles was ich zum anlegen von
Domains/Mailkonten benötige sind ein
paar mysql INSERT Abfragen. :)

Hier meine Konfigurationen:

$postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailbox_size_limit = 256000000
mailbox_transport = cyrus
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 40480000
mime_header_checks = pcre:/etc/postfix/body_checks
mydestination = localhost.$mydomain, localhost.localdomain, $myhostname,
$mydomain, mysql:/etc/postfix/mysql-mydestination.cf
mydomain = snitch.de
myhostname = mailrelay.snitch.de
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.1.5/README_FILES
sample_directory = /usr/share/doc/postfix-2.1.5/samples
sender_canonical_maps = mysql:/etc/postfix/mysql-canonical.cf
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_tls_note_starttls_offer = yes
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,
permit_mynetworks,        reject_unauth_destination,
reject_invalid_hostname,        reject_non_fqdn_hostname,
reject_non_fqdn_sender,        reject_non_fqdn_recipient,
reject_unknown_sender_domain,        reject_unknown_recipient_domain,
reject_unauth_pipelining,        reject_rbl_client dnsbl.ahbl.org,
reject_rbl_client query.bondedsender.org,        reject_rbl_client
cbl.abuseat.org,        reject_rbl_client sbl.csma.biz,
reject_rbl_client unconfirmed.dsbl.org,        reject_rbl_client
zombie.dnsbl.sorbs.net,        reject_rbl_client relays.ordb.org,
reject_rbl_client opm.blitzed.org,        reject_rbl_client list.dsbl.org,
reject_rbl_client sbl.spamhaus.org,        permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
smtpd_tls_CAfile = /etc/postfix/ssl/smtpd.pem
smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.pem
smtpd_tls_key_file = /etc/postfix/ssl/smtpd.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 450
virtual_alias_maps = hash:/etc/postfix/virtual,
mysql:/etc/postfix/mysql-virtual.cf

$less mysql-mydestination.cf
# mysql config file for local domain (like sendmail's sendmail.cw) lookups
on postfix
# comments are ok.
#
# the user name and password to log into the mysql server
hosts = localhost
user = *****
password = *******
# the database name on the servers
dbname = system_database
# the table name
table = mail_domain
#
select_field = domain_name
where_field = domain_name
#
additional_conditions = and status = '1'

$less mysql-virtual.cf
#
# mysql config file for alias lookups on postfix
# comments are ok.
#
# the user name and password to log into the mysql server
hosts = localhost
user = ****
password = ****
# the database name on the servers
dbname = system_database
# the table name
table = mail_virtual
#
select_field = dest
where_field = alias
additional_conditions = and status = '1'

$less mysql-canonical.cf
# mysql config file for canonical lookups on postfix
# comments are ok.
#
# the user name and password to log into the mysql server
hosts = localhost
user = ***
password = ***
# the database name on the servers
dbname = system_database
# the table name
table = mail_virtual
#
select_field = alias
where_field = username
# Return the first match only
additional_conditions = and status = '1' limit 1


Nun zu meinem Problem...

Ich war es gewohnt das LogWatch, welches täglich per cron ausgeführt wird zu
lesen, um sshd zugriffe etc. mit zu bekommen.
Diese mails habe ich immer als root mit mutt gelesen. Beim Nachsehen habe
ich gesehen das die Mailboxdatei welche mutt
zeigt in /var/spool/mail zu finden sind. Dort liegen der root und der
snitch.

Fakt ist, das ich dieses Logwatch nicht mehr bekomme seit dem 02.02.2005!
Bei meiner Fehlersuche habe ich per telnet versucht eine E-Mail von
snitch at localhost an snitch at localhost zu senden.
Etwa so:

$ telnet localhost 25
EHLO localhost
…
mail from: snitch at localhost
rcpt to: snitch at localhost
data
subject: testmail
testmail
.
quit
…

Im log steht dann das er die Mailbox für den User snitch nicht finden kann!

Feb 16 19:20:40 localhost lmtpunix[30331]: accepted connection
Feb 16 19:20:40 localhost lmtpunix[30331]: lmtp connection preauth'd as
postman
Feb 16 19:20:40 localhost lmtpunix[30331]: verify_user(user.snitch) failed:
Mailbox does not exist
Feb 16 19:20:40 localhost postfix/pipe[30329]: C9FF8508326:
to=<snitch at snitch.de>, orig_to=<snitch at localhost.snitch.de>, relay=cyrus,
delay=0, status=bounced (data format error. Command output: snitch: Mailbox
does not exist )
Feb 16 19:20:40 localhost postfix/qmgr[30316]: C9FF8508326: removed
Feb 16 19:20:42 localhost postfix/smtpd[30320]: disconnect from
localhost[127.0.0.1]

Die Domain snitch.de existiert in der Mysql Datenbank und es ist auch ein
Konto vorhanden mit der adresse snitch at snitch.de.
Da die Konten Virtuell sind und der postfix die adresse snitch at snitch.de
eigentlich so verwaltet snitch at mailrelay.snitch.de, habe ich
dann versucht eine email an diesen user zu senden:

$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 mailrelay.snitch.de ESMTP Postfix (2.1.5)
ehlo localhost
250-mailrelay.snitch.de
250-PIPELINING
250-SIZE 40480000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250 8BITMIME
mail from: snitch0001 at mailrelay.snitch.de
250 Ok
rcpt to: snitch0001 at mailrelay.snitch.de
450 <snitch0001 at mailrelay.snitch.de>: Recipient address rejected: User
unknown in local recipient table
rcpt to: snitch at snitch.de
250 Ok
data
354 End data with <CR><LF>.<CR><LF>
test
.
250 Ok: queued as CD0DE508320

hier das log dazu:

Feb 16 19:37:40 localhost postfix/smtpd[30383]: connect from
localhost[127.0.0.1]
Feb 16 19:38:06 localhost postfix/smtpd[30383]: NOQUEUE: reject: RCPT from
localhost[127.0.0.1]: 450 <snitch0001 at mailrelay.snitch.de>: Recipient
address rejected: User unknown in local recipient table;
from=<snitch0001 at mailrelay.snitch.de> to=<snitch0001 at mailrelay.snitch.de>
proto=ESMTP helo=<localhost>

Feb 16 19:38:20 localhost postfix/smtpd[30383]: CD0DE508320:
client=localhost[127.0.0.1]
Feb 16 19:38:24 localhost postfix/cleanup[30387]: CD0DE508320:
message-id=<20050216183757.CD0DE508320 at mailrelay.snitch.de>
Feb 16 19:38:24 localhost postfix/qmgr[30316]: CD0DE508320:
from=<snitch at snitch.de>, size=344, nrcpt=1 (queue active)
Feb 16 19:38:24 localhost lmtpunix[30380]: accepted connection
Feb 16 19:38:24 localhost lmtpunix[30380]: lmtp connection preauth'd as
postman
Feb 16 19:38:24 localhost master[30393]: about to exec
/usr/lib/cyrus-imapd/lmtpd
Feb 16 19:38:24 localhost lmtpunix[30393]: executed
Feb 16 19:38:24 localhost lmtpunix[30380]: duplicate_check:
<20050216183757.CD0DE508320 at mailrelay.snitch.de> user.snitch0001      0
Feb 16 19:38:24 localhost lmtpunix[30380]: mystore: starting txn 2147483806
Feb 16 19:38:24 localhost lmtpunix[30380]: mystore: committing txn
2147483806
Feb 16 19:38:24 localhost lmtpunix[30380]: duplicate_mark:
<20050216183757.CD0DE508320 at mailrelay.snitch.de> user.snitch0001
1108579104 12
Feb 16 19:38:24 localhost postfix/pipe[30391]: CD0DE508320:
to=<snitch0001 at mailrelay.snitch.de>, orig_to=<snitch at snitch.de>,
relay=cyrus, delay=27, status=sent (mailrelay.snitch.de)

Letzendlich wäre es am besten, wenn ich die Virtuellen Mailkonten auch den
Lokalen Usern zuordnen könnte, wie in diesem Falle für snitch, welcher
ein lokales Konto hat auf dem System und eine Domain in der mysql DB für den
Mailserver.

Und die root Mails müssen weiterhin irgendwo ankommen, von mir aus auch bei
einem der virtuellen Konten wie z.B. snitch at snitch.de.

Ich hoffe ich habe nichts zu sehr verkompliziert. Bin für jeden Tipp
dankbar. Gruß und schönen Abend.

Marcel Hartmann
-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: <https://listi.jpberlin.de/pipermail/postfixbuch-users/attachments/20050216/f084e3ab/attachment.html>


Mehr Informationen über die Mailingliste Postfixbuch-users