[Postfixbuch-users] cyrus lmtp:

Stefan G. Weichinger lists at xunil.at
Do Jan 3 08:01:35 CET 2013


Am 02.01.2013 23:47, schrieb Peer Heinlein:
> Am 02.01.2013 21:53, schrieb Stefan G. Weichinger:
>> Der Cyrus-imapd hängt an einer mysql-DB, auf IMAPs/POPs funktioniert das
>> Authentifizieren tadellos, also tut auch saslauthd ...
> 
> Das würde ich gerne sehen. Es fällt erstmal schwer vorzustellen, daß
> lmtp von Cyrus nicht geht, imapd aber schon.

Das ging mir genauso ...

> Also:
> 
> a) Wo sind die Logzeilen, daß es mit Cyrus geht? Wird dort auch die
> Mailadresse als Identifier genutzt oder ist das eine separate Login-Kennung?

Ich sah einfach dauernd Zugriffe per imaps und pop3s im
/var/log/messages ... und konnte auch selbst per Thunderbird meine
Postfächer durchforsten. Auch nach Restart des TB, als neuerlicher
Anmeldung an cyrus.

Das Login lautet zB oop3sefn, und so steht der username auch in der
MySQL-DB.

> b) Was loggt Cyrus zu dem LMTP-Versuch?

Tja, gute Frage. Soweit ich verstehe, müßte der Socket namens "lmtpunix"
in /var/log/messages aufscheinen (siehe unten).

Und dieser Socket taucht auch dort wieder auf, seitdem ich per deliver
übergebe (ca. 23h). Davor hatte ich von ca. 16h an keine einzige Zeile
mit "lmtpunix" im Log, auch keine Fehler.

Davor tadellos ala:

Jan  2 15:53:24 postler lmtpunix[3469]: Delivered:
<50E449F7.7090001 at pxxacher.at> to mailbox: user.oop4ofc

An welcher Stelle kann ich den cyrus-lmtp auf "more verbose" stellen?


>> Also vermutete ich lmtp-Socket-Probleme:
> 
> Nö. Wenn es ein Socket-Problem wäre, dann würde er nicht mit Cyrus
> erfolgreich reden. Und das tut er ja.

> Was Du hier siehst ist die alleinige und bewußte Entscheidung von Cyrus,
> daß er die Mail nicht haben will, weil er oop3sefn at lichtfels.com nicht
> kennt.
> 
> Die Frage, die du Dir stellen mußt ist alleine: Warum kommt Cyrus auf
> die Idee, daß er oop3sefn at lichtfels.com nicht kennt.

Ja, verstehe.

Also, Hosen runter:


# cat cyrus.conf
# standard standalone server implementation

START {
  # do not delete this entry!
  recover	cmd="ctl_cyrusdb -r"

  # this is only necessary if using idled for IMAP IDLE
  idled		cmd="idled"
}

# UNIX sockets start with a slash and are put into /var/lib/imap/socket
SERVICES {
  # add or remove based on preferences
  #imap		cmd="imapd" listen="imap" prefork=0

## webcyradm lokal
  imaplocal     cmd="imapd -C /etc/cyrus-imapd-local.conf"
listen="127.0.0.1:imap" prefork=0
  #imapslocal    cmd="imapd -C /etc/cyrus-imapd-local.conf -s"
listen="127.0.0.1:imaps" prefork=0
## auch am openvpn losen, fuer den saslauthd am postler, sgw
  imap          cmd="imapd -C /etc/cyrus-imapd.conf"
listen="10.1.0.4:imap" prefork=0
## webcyradm remote
  #imap         cmd="imapd -C /etc/cyrus-imapd.conf" listen="imap" prefork=0

  imaps		cmd="imapd -C /etc/cyrus-imapd.conf -s" listen="imaps" prefork=2
  pop3		cmd="pop3d" listen="pop3" prefork=0
  pop3s		cmd="pop3d -C /etc/cyrus-popd.conf -s" listen="pop3s" prefork=2
  sieve		cmd="timsieved -C /etc/cyrus-timsieved.conf" listen="sieve"
prefork=1
#  sievelocal    cmd="timsieved -C /etc/imapd-local.conf
listen="127.0.0.1:sieve" prefork=0

  # at least one LMTP is required for delivery
  lmtp		cmd="lmtpd -C /etc/cyrus-lmtpd.conf" listen="lmtp" prefork=1
  #lmtp		cmd="lmtpd -a" listen="lmtp" prefork=1
  #lmtpunix	cmd="lmtpd" listen="/var/spool/postfix/public/lmtp" prefork=1
  lmtpunix	cmd="lmtpd" listen="/var/imap/socket/lmtp" prefork=0

  # this is only necessary if using notifications
  notify	cmd="notifyd" listen="/var/imap/socket/notify" proto="udp"
prefork=1
}

EVENTS {
  # this is required
  checkpoint	cmd="ctl_cyrusdb -c" period=10

  # this is only necessary if using duplicate delivery suppression
  delprune      cmd="cyr_expire -E 3" at=0400

  # this is only necessary if caching TLS sessions
  tlsprune      cmd="tls_prune" at=0400

  # Uncomment the next entry, if you want to automatically remove
  # old messages of EVERY user.
  # This example calls ipurge every 60 minutes and ipurge will delete
  # ALL messages older then 30 days.
  # enter 'man 8 ipurge' for more details

  # cleanup      cmd="ipurge -d 30 -f" period=60

  squatter      cmd="squatter -s -r *" period=180
# indexing of mailboxs for server side fulltext searches
  # reindex changed mailboxes (fulltext) approximately every other hour
##  squatter_1 cmd="nice -n 19 squatter -s" period=120
##  # reindex all mailboxes (fulltext) daily
  squatter_a cmd="squatter" at=2340

}



# cat cyrus-lmtpd.conf
sasl_pwcheck_method: auxprop
sasl_auxprop_plugin: sasldb
sasl_mech_list: cram-md5 digest-md5
sasl_log_level: 1


configdirectory: /var/imap
partition-default: /var/mail/imap
sievedir: /var/imap/sieve
allowanonymouslogin: no
allowplaintext: no
reject8bit: no
lmtp_overquota_perm_failure: no
lmtp_allowplaintext: no
lmtp_admins: lmtpuser



# cat /etc/conf.d/saslauthd
# Config file for /etc/init.d/saslauthd
SASLAUTHD_OPTS="-n0 -s4096 -t3600 -c -a pam"

> a) Wie ist der imapd konfiguriert, wenn der doch geht?

# cyrus-imapd.conf (ohne tls-Zeilen)
postmaster: postmaster
admins: cyrus
allowplaintext: yes
servername: imap.lichtfels.com
autocreatequota: 10000
quotawarn: 90
timeout: 30
poptimeout: 10
dracinterval: 0
drachost: localhost
sasl_pwcheck_method: saslauthd
sasl_mech_list: plain login
sasl_log_level: 1
sieve_maxscriptsize: 32
sieve_maxscripts: 5

mailnotifier: mailto
sievenotifier: mailto

duplicate_db: skiplist
tlscache_db: skiplist

configdirectory: /var/imap
partition-default: /var/mail/imap
sievedir: /var/imap/sieve
allowanonymouslogin: no
reject8bit: no
lmtp_overquota_perm_failure: no

# cat /etc/sasl2/smtpd.conf
mech_list: PLAIN LOGIN
pwcheck_method: auxprop saslauthd
auxprop_plugin: sasldb
log_level: 3

# postconf -n
address_verify_map = btree:/var/lib/postfix/address_verify_map
anvil_rate_time_unit = 30s
bounce_queue_lifetime = 1d
broken_sasl_auth_clients = yes
canonical_maps = hash:/etc/postfix/canonical
command_directory = /usr/sbin
config_directory = .
content_filter = smtp-amavis:[127.0.0.1]:10024
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 7
debug_peer_list =
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd
$daemon_directory/$process_name $process_id & sleep 5
defer_transports =
disable_dns_lookups = no
disable_vrfy_command = yes
home_mailbox = .maildir/
html_directory = /usr/share/doc/packages/postfix/html
lmtp_sasl_auth_enable = yes
lmtp_sasl_password_maps = hash:/etc/postfix/lmtp_sasl_pass
lmtp_sasl_security_options = noanonymous, noplaintext
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
$virtual_alias_maps
mail_owner = postfix
mail_spool_directory = /var/mail
mailbox_command =
mailbox_size_limit = 0
mailbox_transport = cyrus
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
masquerade_classes = envelope_sender, header_sender, header_recipient
masquerade_exceptions = root
max_idle = 60s
max_use = 50
maximal_queue_lifetime = 2d
message_size_limit = 16384000
mydestination = $myhostname,localhost.$mydomain,$mydomain,lists.$mydomain
myhostname = postler.lichtfels.com
mynetworks_style = host
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
non_smtpd_milters = inet:localhost:8891
postscreen_dnsbl_action = enforce
postscreen_dnsbl_sites = zen.spamhaus.org*2 bl.spamcop.net*1
b.barracudacentral.org*1
postscreen_dnsbl_threshold = 2
postscreen_greet_action = enforce
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/packages/postfix/README_FILES
recipient_bcc_maps = hash:/etc/postfix/recipient_bcc
relay_domains = proxy:mysql:/etc/postfix/mysql-relay_domains-ov.cf,
hash:/etc/postfix/relay_domains
relay_recipient_maps = $virtual_alias_maps,
hash:/etc/postfix/relay_recipients,
hash:/etc/postfix/relay_recipients_lietz,
hash:/etc/postfix/relay_recipients_bmc-gmbh,
hash:/etc/postfix/relay_recipients_eutema,
hash:/etc/postfix/relay_recipients_lists
relayhost =
relocated_maps = hash:/etc/postfix/relocated
sample_directory = /usr/share/doc/packages/postfix/samples
sender_canonical_maps = proxy:mysql:/etc/postfix/mysql-canonical_2.cf
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtp_sasl_auth_enable = no
smtp_sasl_security_options = noanonymous, noplaintext
smtp_use_tls = no
smtpd_banner = $myhostname
smtpd_client_connection_rate_limit = 15
smtpd_client_restrictions = check_client_access
hash:/etc/postfix/client_access
smtpd_data_restrictions = reject_unauth_pipelining, permit
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated,
check_helo_access hash:/etc/postfix/helo_access,
reject_invalid_hostname, reject_non_fqdn_hostname
smtpd_milters = inet:localhost:8891
smtpd_recipient_restrictions = reject_unknown_sender_domain,
reject_unlisted_recipient, reject_invalid_hostname,
reject_non_fqdn_sender, reject_unknown_recipient_domain,
check_recipient_access hash:/etc/postfix/hold_domains,
permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination,
reject_rbl_client zen.spamhaus.org, reject_rhsbl_client
dbl.spamhaus.org, check_recipient_access
hash:/etc/postfix/roleaccount_exceptions, check_client_access
hash:/etc/postfix/access_mazedonia, check_policy_service
inet:127.0.0.1:12525, check_policy_service inet:127.0.0.1:10030,
check_recipient_access hash:/etc/postfix/verify_domains, permit
smtpd_reject_footer = Contact postmaster at lichtfels.com for technical
assistance. Please provide the following information in your problem
report: error message, time ($localtime), client ($client_address) and
server ($server_name). We speak both English and German.
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = postler.lichtfels.com
smtpd_sasl_security_options = noanonymous
smtpd_sender_restrictions = check_sender_access
hash:/etc/postfix/sender_access, check_sender_mx_access
cidr:/etc/postfix/sender_mx_private_ip
smtpd_tls_CAfile = /etc/ssl/postfix/smtp.lichtfels.com.pem
smtpd_tls_cert_file = /etc/ssl/postfix/smtp.lichtfels.com.pem
smtpd_tls_key_file = /etc/ssl/postfix/smtp.lichtfels.com.pem
smtpd_tls_loglevel = 2
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
strict_rfc821_envelopes = no
tls_random_source = dev:/dev/urandom
transport_maps = hash:/etc/postfix/transport
unknown_address_reject_code = 554
unknown_client_reject_code = 554
unknown_hostname_reject_code = 554
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/RFCxxx,
hash:/etc/postfix/virtual_alias_maps,
proxy:mysql:/etc/postfix/mysql-virtual-ov.cf
virtual_gid_maps = static:12
virtual_mailbox_base = /var/mail
virtual_mailbox_domains =
proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps =
proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 251
virtual_transport = dovecot
virtual_uid_maps = static:251

--- generell:

Gentoo Linux ...

postfix 2.9.5
cyrus-imapd 2.4.16
cyrus-sasl 2.1.23 (mit neueren Versionen gab es Probleme mit einem
Partner-Server, der noch altes Suse fährt ...)

Diese Kombi ist seit ein paar Wochen so im Einsatz gewesen.

> b) Wie ist die Authentifizierung geklärt? Werden dort Manipulationen an
> der Login-Kennung gemacht? Wird hier Groß-/Kleinschreibung vergurkt oder
> ggf. nicht repariert?

Authentifizierung ...

# /etc/pam.d/imap

auth sufficient pam_mysql.so user=postfix passwd=*** host=127.0.0.1:3306
db=mail table=accountuser usercolumn=username passwdcolumn=password
crypt=1 logtable=log logmsgcolumn=msg logusercolumn=user
loghostcolumn=host logpidcolumn=pid logtimecolumn=time sqllog=yes verbose=0
auth sufficient pam_unix.so

account sufficient pam_mysql.so user=postfix passwd=***
host=127.0.0.1:3306 db=mail table=accountuser usercolumn=username
passwdcolumn=password crypt=1 logtable=log logmsgcolumn=msg
logusercolumn=user loghostcolumn=host logpidcolumn=pid
logtimecolumn=time sqllog=yes verbose=0
account  sufficient       pam_unix.so

All das entspricht in etwa dem Setup von hier:

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

Ja, ist alt, und es gibt neueres ... aber es tat bislang ziemlich OK.


> c) Steht der User so WIRKLICH in der SQL-Datenbank?
> 
> d) Wird hier vielleicht durch irgendeine Config-Änderung ein Teil der
> Mailadresse im Authentifizierungsprozeß abgeschnitten? Wird das ganze
> vielleicht ohne Domain (%n) durchgereicht?

Wie gesagt, gestern ist nix am Server passiert.

> e) Im Zweifel wäre ein SQL-Protokoll schön. WAS fragt er denn genau an
> MySQL so daß das seitens MySQL dann keinen Treffer mehr liefert? Schalte
> ein binlog bei SQL ein und protokolliere, was Cyrus und SQL da besprechen.

Da muß ich noch dran, schaue ich gleich noch.

>> Kann hier das root:root das Problem sein?
> 
> Nein, weil:
> 
> a) dann hätten sie ja kaum miteinander reden können und
> b) chmod 777 ist hier ja gesetzt.

Ja, klar ... sorry, ich war in Panik gestern ...

>> Hatte ich vorher schon mal der Gruppe mail gegeben, ist wieder retour,
>> ich suche mal nach der Ursache (init-Skript, Gentoo).
> 
> Du suchst an der völlig falschen Stelle. Dein Problem beginnt in Cyrus
> und Endet in SQL. Du suchst aber 10 Kilometer vor Cyrus.

OK, ich verstehe.

Danke vorerst für die ausführliche Antwort,
guten Morgen noch mal,
Stefan



Mehr Informationen über die Mailingliste Postfixbuch-users