ich habe einen Postfix SMTP Server bereitgestellt.
Er erwartet eine Authentifizierung mit Klartext-Passwort via AUTH PLAIN.
Das Klartext-Passwort wird an Cyrus SASL 2 weitergegeben und dort mit einer Klartext-Passwort-Spalte in einer MySQL Datenbank vergleichen.
Soweit klappt ja alles.
Das simple Problem:
Die Passwörter stehen im Klartext in der Datenbank.
Ich möchte die Passwörter aber als MD5-Hash ablegen.
Postfix soll das Passwort wie gewohnt als Klartext-Passwort an Cyrus SASL 2 weitergeben. Cyrus SASL 2 soll dann den MD5-Hash des Passwortes mit dem in der Datenbank gespeicherten MD5-Hash vergleichen.
Diese Anforderung an ein Programm das extra für Authentifizierung geschrieben wurde ist denke ich nicht sehr hoch.
Noch ein paar relevante configs:
/etc/postfix/main.cf
Code: Select all
# SMTP - SASL Configuration
###########################
# Enable SASL authentication in the Postfix SMTP server.
smtpd_sasl_auth_enable = yes
# Report the SASL authenticated user name in the smtpd(8)
# Received message header.
smtpd_sasl_authenticated_header = yes
# Enable inter-operability with SMTP clients that implement an
# obsolete version of the AUTH command (RFC 4954).
broken_sasl_auth_clients = yes
# The access restrictions that the Postfix SMTP server
# applies in the context of the RCPT TO command.
smtpd_recipient_restrictions = reject_sender_login_mismatch
permit_sasl_authenticated
reject
# Postfix SMTP server SASL security options
smtpd_sasl_security_options = noanonymous
# Optional lookup table with the SASL login names that own sender
# (MAIL FROM) addresses.
smtpd_sender_login_maps = mysql:/etc/postfix/mysql_smtpd_sender_login_maps.cf
Code: Select all
# Whitespace separated list of mechanisms used to verify passwords
pwcheck_method: auxprop
# Name of auxiliary plugin to use
auxprop_plugin: sql
# Specify a list of authentication mechanisms
mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5
# Specify database backend
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: postfix
sql_passwd: xxx
sql_database: xxx
# Authentication SQL Query
sql_select: SELECT password FROM view_emailaccount WHERE address REGEXP '(^%u@%r.?$)'
http://mod-authn-sasl.sourceforge.net/sasl/index.html
http://mod-authn-sasl.sourceforge.net/sasl/options.html
... und Postfix:
http://www.postfix.org/SASL_README.html
Ich habe versucht in der smtpd.conf einfach
password_format: crypt
srp_mda: md5 (Message digest algorithm for SRP calculations (possible values: 'md5', 'sha1', 'rmd160')
zu setzen, das hat aber leider auch nichts gebracht.
Wenn "srp_mda" nicht dafür ist, was macht es dann ??
Dann habe ich noch gelesen courier-authlib dazwischenzuschalten. Meiner Meinung nach muss es aber auch irgendwie mit SASL gehen, was ja genau dafür gemacht wurde.
Edit: Ach ja und ich hab noch was von nem Patch gelesen, den ich aber nicht benutzten möchte.
Für Ideen wäre ich dankbar!