Hello !
J'ai un problème sur l'authentification SASL de postfix... une bonne âme pour m'aider ? ;-)
Pour tester l'authentification SASL, je lance la commande:
Résultat des logs:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 #testsaslauthd -u user@mondomaine.com -p mon_password_non_crypté 0: NO "authentication failed"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 ==> /var/log/auth.log <== Feb 3 01:46:31 localhost saslauthd[32249]: (pam_unix) check pass; user unknown Feb 3 01:46:31 localhost saslauthd[32249]: (pam_unix) authentication failure; logname= uid=0 euid=0 tty= ruser= rhost= Feb 3 01:46:33 localhost saslauthd[32249]: DEBUG: auth_pam: pam_authenticate failed: User not known to the underlying authentication module Feb 3 01:46:33 localhost saslauthd[32249]: do_auth : auth failure: [user=user@mondomaine.fr] [service=imap] [realm=] [mech=pam] [reason=PAM auth error]
En testant la récupération du courrier depuis Thunderbird ( configuré avec TLS activé ), celui ci répond "Temporary problem, please try again". Sur les logs du serveur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21==> /var/log/mail.log <== Feb 3 02:04:55 localhost courierpop3login: Connection, ip=[::ffff:82.244.225.202] Feb 3 02:04:55 localhost authdaemond: received auth request, service=pop3, authtype=login Feb 3 02:04:55 localhost authdaemond: authmysql: trying this module Feb 3 02:04:55 localhost authdaemond: authmysqllib: connected. Versions: header 50032, client 50032, server 50032 Feb 3 02:04:55 localhost authdaemond: SQL query: SELECT username, password, "", 103, 105, "/var/spool/vmail", CONCAT(SUBSTRING_INDEX(username,'@',-1),'/',SUBSTRING_INDEX(username,'@',1),'/') , "", name, "" FROM mailbox WHERE username = 'user@mondomaine.fr' Feb 3 02:04:55 localhost authdaemond: password matches successfully Feb 3 02:04:55 localhost authdaemond: authmysql: sysusername=<null>, sysuserid=103, sysgroupid=105, homedir=/var/spool/vmail, address=user@mondomaine.fr, fullname=Prenom Nom, maildir=mondomaine.fr/prenom.nom/, quota=<null>, options=<null> Feb 3 02:04:55 localhost authdaemond: authmysql: clearpasswd=<null>, passwd=zlxc3e8je1Yo2 Feb 3 02:04:55 localhost authdaemond: Authenticated: sysusername=<null>, sysuserid=103, sysgroupid=105, homedir=/var/spool/vmail, address=user@mondomaine.fr, fullname=Prenom Nom, maildir=mondomaine.fr/prenom.nom/, quota=<null>, options=<null> Feb 3 02:04:55 localhost authdaemond: Authenticated: clearpasswd=Mon_Password_en_clair, passwd=zlxc3e8je1Yo2 Feb 3 02:04:55 localhost courierpop3login: user@mondomaine.fr: chdir(/var/spool/vmail) failed!! Feb 3 02:04:55 localhost courierpop3login: error: Permission denied Feb 3 02:04:55 localhost courierpop3login: LOGIN FAILED, user=user@mondomaine.fr, ip=[::ffff:82.244.225.202] Feb 3 02:04:55 localhost courierpop3login: authentication error: Permission denied ==> /var/log/mysql.log <== 100203 2:04:55 12672 Connect postfix@localhost on 12672 Init DB postfix 12672 Query SELECT username, password, "", 103, 105, "/var/spool/vmail", CONCAT(SUBSTRING_INDEX(username,'@',-1),'/',SUBSTRING_INDEX(username,'@',1),'/') , "", name, "" FROM mailbox WHERE username = 'user@mondomaine.fr'
Un test pour contrôler la bonne initialisation de postfix:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 # telnet 127.0.0.1 25 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. 220 localhost ESMTP Postfix (Debian/GNU) EHLO domaine.com 250-localhost 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN quit 221 2.0.0 Bye Connection closed by foreign host. dagobah:~#
Voici ma conf:
Distrib: Debian 4.0
Postfix (résultat de "postconf -n"):
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_dot_mydomain = no biff = no broken_sasl_auth_clients = yes config_directory = /etc/postfix inet_interfaces = all mailbox_command = procmail -a "$EXTENSION" mailbox_size_limit = 0 mydestination = mail.mondomaine.fr, localhost, localhost.localdomain, localhost myhostname = localhost mynetworks = 127.0.0.0/8 myorigin = /etc/mailname recipient_delimiter = + relayhost = smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unauth_destination, reject_unauth_pipelining, reject_invalid_hostname, reject_rbl_client list.dsbl.org, reject_rbl_client bl.spamcop.net, reject_rbl_client sbl-xbl.spamhaus.org smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_security_options = noanonymous smtpd_tls_cert_file = /etc/postfix/smtpd.cert smtpd_tls_key_file = /etc/postfix/smtpd.key smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache smtpd_use_tls = yes virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf virtual_gid_maps = static:20001 virtual_mailbox_base = /var/spool/vmail/ virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf virtual_mailbox_limit = 51200000 virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf virtual_minimum_uid = 20001 virtual_transport = virtual virtual_uid_maps = static:20001
/etc/postfix/sasl/smtpd.conf
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3pwcheck_method: saslauthd mech_list: login plain
/etc/pam.d/smtp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 auth required pam_mysql.so user=postfix passwd=XXXXXXX host=127.0.0.1 db=postfix table=mailbox usercolumn=username passwdcolumn=password crypt=1 account sufficient pam_mysql.so user=postfix passwd=XXXXXXX host=127.0.0.1 db=postfix table=mailbox usercolumn=username passwdcolumn=password crypt=1
/etc/courier/authdeamonrc
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 authmodulelist="authmysql" authmodulelistorig="authuserdb authpam authpgsql authldap authmysql authcustom authpipe" daemons=5 authdaemonvar=/var/run/courier/authdaemon DEBUG_LOGIN=2 DEFAULTOPTIONS="" LOGGEROPTS=""
/etc/courier/authmysqlrc
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 MYSQL_SERVER 127.0.0.1 MYSQL_USERNAME postfix MYSQL_PASSWORD XXXXXX #MYSQL_SOCKET /var/lib/mysql/mysql.sock MYSQL_PORT 0 MYSQL_OPT 0 MYSQL_DATABASE postfix MYSQL_USER_TABLE mailbox MYSQL_CRYPT_PWFIELD password MYSQL_UID_FIELD 103 MYSQL_GID_FIELD 105 MYSQL_LOGIN_FIELD username MYSQL_HOME_FIELD "/var/spool/vmail/" MYSQL_NAME_FIELD name MYSQL_MAILDIR_FIELD CONCAT(SUBSTRING_INDEX(username,'@',-1),'/',SUBSTRING_INDEX(username,'@',1),'/')
/etc/default/saslauthd
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 START=yes MECHANISMS="pam" THREADS=5 OPTIONS="-c -r -m /var/spool/postfix/var/run/saslauthd"
/etc/postfix/sasl/smtpd.conf
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3pwcheck_method: saslauthd mech_list: login plain
Les requêtes mysql s'exécutent correctement, mais voici néanmoins la structure de la table "mailbox":
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 CREATE TABLE `mailbox` ( `username` varchar(255) NOT NULL default '', `password` varchar(255) NOT NULL default '', `name` varchar(255) NOT NULL default '', `quota` int(10) NOT NULL default '0', `domain` varchar(255) NOT NULL default '', `created` datetime NOT NULL default '0000-00-00 00:00:00', `modified` datetime NOT NULL default '0000-00-00 00:00:00', `active` tinyint(1) NOT NULL default '1', PRIMARY KEY (`username`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Postfix Admin - Virtual Mailboxes';
D'avance merci !





Répondre avec citation


Partager