• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

Postfix, mysql und sasl/tls

Status
Für weitere Antworten geschlossen.
Hallo Zusammen,

ich hoffe ihr könnt mir helfen, ich bin jetzt seit 3 Tagen dabei einen Postfix Server mit SuSE 10.2 aufzusetzen und es klappt einfach nicht. Ich hab schon duzende Tutorial und foren durchgelesen, aber irgendwie will das Ding bei mir einfach nicht laufen. So wie fange ich den jetzt eigentlich am besten an.

Also als erstes es funktioniert schonmal der Mailversand local, der versand local nach extern, und der Empfang extern (also mit einem Mailclient). POP3 und IMAP funktioniert auch (beides ssl). Aber wenn ich nun versuche eine Mail mit dem Mailclient zuverschicken, gehts nicht. Es kommt immer die Fehlermeldung
z.B. KMail "Ihr SMTP-Server unterstützt PLAIN nicht"
Meldung des Servers: "5.7.0 Error: authentication failed: generic failure"

Im Log /var/log/mail erscheint folgender Fehler:

  • May 9 11:11:49 postfix/smtpd[16074]: < unknown[85.177.152.167]: AUTH PLAIN LmRlAHRlc3QxMjM=
    May 9 11:11:49 postfix/smtpd[16074]: xsasl_cyrus_server_first: sasl_method PLAIN, init_response mRlAHRlc3QxMjM=
    May 9 11:11:49 postfix/smtpd[16074]: xsasl_cyrus_server_first: decoded initial response webmaster@domain.de
    May 9 11:11:49 postfix/smtpd[16074]: warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory
    May 9 11:11:49 postfix/smtpd[16074]: warning: SASL authentication failure: Password verification failed
    May 9 11:11:49 postfix/smtpd[16074]: warning: unknown[85.177.152.167]: SASL PLAIN authentication failed: generic failure
    May 9 11:11:49 postfix/smtpd[16074]: > unknown[85.177.152.167]: 535 5.7.0 Error: authentication failed: generic failure
    May 9 11:11:49 postfix/smtpd[16074]: smtp_get: EOF

Also hab ich als nächtes mal ein "testsaslauthd -u webmaster@domain.de -p passwort -s smtp" ausprobiert. Das liefert mit dann im log
/var/log/messages folgendes:

  • May 9 11:42:10 saslauthd[15681]: server_exit : master exited: 15681
    May 9 11:42:11 saslauthd[15795]: detach_tty : master pid is: 15795
    May 9 11:42:11 saslauthd[15795]: ipc_init : listening on socket: /var/run/sasl2//mux
    May 9 11:42:14 saslauthd[15796]: DEBUG: auth_pam: pam_authenticate failed: User not known to the underlying authentication module
    May 9 11:42:14 saslauthd[15796]: do_auth : auth failure: [service=smtp] [realm=] [mech=pam] [reason=PAM auth error]
    [/list]

    hier dann mal der auszug von saslfinger -sch
    [list]
    saslfinger - postfix Cyrus sasl configuration Mi 9. Mai 13:18:06 CEST 2007
    version: 1.0.1
    mode: server-side SMTP AUTH

    -- basics --
    Postfix: 2.3.2
    System:
    Welcome to openSUSE 10.2 (X86-64) - Kernel \r (\l).

    -- smtpd is linked to --
    libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x00002ae7e7605000)

    -- active SMTP AUTH and TLS parameters for smtpd --
    broken_sasl_auth_clients = yes
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_local_domain = $myhostname
    smtpd_sasl_security_options = noanonymous
    smtpd_tls_cert_file = /etc/postfix/ssl/postfix.pem
    smtpd_tls_key_file = /etc/postfix/ssl/postfix.pem
    smtpd_tls_loglevel = 3
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    smtpd_use_tls = yes


    -- listing of /etc/sasl2 --
    insgesamt 16
    drwxr-xr-x 2 root root 4096 9. Mai 11:48 .
    drwxr-xr-x 76 root root 8192 9. Mai 10:50 ..
    -rw------- 1 root root 264 9. Mai 11:48 smtpd.conf




    -- content of /etc/sasl2/smtpd.conf --
    pwcheck_method: saslauthd
    mech_list: plain login
    saslauthd_path: /var/run/sasl2
    allow_plaintext: true
    auxprop_plugin: mysql
    sql_hostnames: localhost
    sql_user: --- replaced ---
    sql_passwd: --- replaced ---
    sql_database: postfix
    sql_select: select clean from users where email = '%u@%r'


    -- active services in /etc/postfix/master.cf --
    # service type private unpriv chroot wakeup maxproc command + args
    # (yes) (yes) (yes) (never) (100)
    smtp inet n - - - - smtpd -v
    pickup fifo n - n 60 1 pickup
    cleanup unix n - n - 0 cleanup
    qmgr fifo n - n 300 1 qmgr
    tlsmgr unix - - n 1000? 1 tlsmgr
    rewrite unix - - n - - trivial-rewrite
    bounce unix - - n - 0 bounce
    defer unix - - n - 0 bounce
    trace unix - - n - 0 bounce
    verify unix - - n - 1 verify
    flush unix n - n 1000? 0 flush
    proxymap unix - - n - - proxymap
    smtp unix - - n - - smtp
    relay unix - - n - - smtp
    -o fallback_relay=
    showq unix n - n - - showq
    error unix - - n - - error
    discard unix - - n - - discard
    local unix - n n - - local
    virtual unix - n n - - virtual
    lmtp unix - - n - - lmtp
    anvil unix - - n - 1 anvil
    scache unix - - n - 1 scache
    maildrop unix - n n - - pipe
    flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
    cyrus unix - n n - - pipe
    user=cyrus argv=/usr/lib/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
    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=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
    procmail unix - n n - - pipe
    flags=R user=nobody argv=/usr/bin/procmail -t -m /etc/procmailrc ${sender} ${recipient}

    -- mechanisms on localhost --
    250-AUTH PLAIN LOGIN
    250-AUTH=PLAIN LOGIN


    -- end of saslfinger output --
    [/list]

    Dann geb ich euch auch mal die Postfix konfiguration mit postconf -n
    [list]
    alias_maps = mysql:/etc/postfix/mysql-aliases.cf
    append_dot_mydomain = no
    biff = no
    broken_sasl_auth_clients = yes
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    daemon_directory = /usr/lib/postfix
    maps_rbl_domains = relays.ordb.org
    mydestination = $myhostname $mydomain localhost localhost.$mydomain
    mydomain = localhost
    myhostname = localhost
    mynetworks = 127.0.0.0/8
    queue_directory = /var/spool/postfix
    setgid_group = maildrop
    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_local_domain = $myhostname
    smtpd_sasl_security_options = noanonymous
    smtpd_tls_cert_file = /etc/postfix/ssl/postfix.pem
    smtpd_tls_key_file = /etc/postfix/ssl/postfix.pem
    smtpd_tls_loglevel = 3
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    smtpd_use_tls = yes
    tls_random_source = dev:/dev/urandom
    virtual_alias_domains =
    virtual_alias_maps = mysql:/etc/postfix/mysql-virtual.cf
    virtual_gid_maps = static:100
    virtual_mailbox_base = /
    virtual_mailbox_domains = mysql:/etc/postfix/mysql-domains.cf
    virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf
    virtual_transport = virtual
    virtual_uid_maps = static:1001
    [/list]

    So braucht ihr sonst nochwas? Könnt Ihr mir helfen? Ich bedanke mich jetzt schon für eure hilfe!!!

    Gruß

    Burner
 
cyrus-sasl-saslauthd installieren und aktivieren (rcsaslauthd start und insserv saslauthd), sowie cyrus-sasl-plain installieren.
Und sonst, als Referenz für TLS/AUTH: http://pastebin.ca/479635
Docs: http://postfix.state-of-mind.de/patrick.koetter/smtpauth/postfix_configuration.html (Kapitel 1 bis 10 treffern nicht zu.)
 
Hallo jengelh,

die Pakete hatte ich schon installiert, den ersten link war irgendwie nicht wirklich für mich brauchbar, aber trotzdem danke. Der zweite link hat mich dann darauf gebracht wieso es evtl. nicht funktionieren könnte. Und siehe da mein postfix läuft im chroot, bzw. nur der smtp, also hab ich das mal schnell geändert und siehe da postfix findet nun auch den saslauthd.

nun sagt der saslauthd aber immer, das mein passwort falsch sei, aber das stimmt nicht, woran kann das den noch liegen? Also ich möchte ja nun gerne, das saslauthd mit der mysql DB die user und passwörter abgleicht. Ich hab jetzt folgendes in folgende Dateien geschrieben:

/etc/pam.d/smtp:

  • #%PAM-1.0
    auth suffficient pam_mysql.so user=username passwd=passwort host=localhost db=dbname table=users usercolumn=email passwdcolumn=clear crypt=0
    account required pam_mysql.so user=username passwd=passwort host=localhost db=dbname table=users usercolumn=email passwdcolumn=clear crypt=0

/etc/sasl2/smtpd.conf:

  • pwcheck_method: saslauthd
    mech_list: plain login

Achso die fehlermeldung sollte ich euch vielleicht auch noch geben ;)

  • May 11 13:52:05 postfix/smtpd[4141]: < e177156043: AUTH PLAIN mRlAHRlc3QxMjM=
    May 11 13:52:05 postfix/smtpd[4141]: xsasl_cyrus_server_first: sasl_method PLAIN, init_response YXJlLmRlAHRlc3QxMjM=
    May 11 13:52:05 postfix/smtpd[4141]: xsasl_cyrus_server_first: decoded initial response webmaster@domain.de
    May 11 13:52:05 postfix/smtpd[4141]: warning: SASL authentication failure: Password verification failed
    May 11 13:52:05 postfix/smtpd[4141]: warning: e177156043: SASL PLAIN authentication failed: authentication failure
    May 11 13:52:05 postfix/smtpd[4141]: > e177156043: 535 5.7.0 Error: authentication failed: authentication failure

Und sonst, als Referenz für TLS/AUTH: http://pastebin.ca/479635
Docs: http://postfix.state-of-mind.de/patrick.koetter/smtpauth/postfix_configuration.html (Kapitel 1 bis 10 treffern nicht zu.)
 
Versuch's erstmal mit 'nem normalen User (/etc/passwd & shadow -- die generell über pam_unix2 authentifiziert werden).
 
Status
Für weitere Antworten geschlossen.
Oben