Автор Тема: Postfix+sasl+dovecot  (Прочетена 7005 пъти)

d3v1ous

  • Напреднали
  • *****
  • Публикации: 127
    • Профил
Postfix+sasl+dovecot
« -: Mar 12, 2008, 12:42 »
Здравейте. Ползвам postfix, Dovecot IMAP+POP3 и IMAP+SSL,POP3+SSL , всичко си работи както трябва, имам само проблеми със АUTH. Опитах да го с pop-before-smtp , но без успех.. тъй като според мойте виждания това работи на принципна regexp т.е. поне така гледах в конфига. Чете логовете на POP и IMAP, и съответно добавя ip за relay. Но не успях да го накарам да работи, интересното е че и грешки няма. А в неговия лог пише само daemon started/daemon stoped. Нищо повече като информация. Бих искал ако някой е конфигурирал
Postfix+SASL+Dovecot и има някакъв howto на български да хелп-не 10х '<img'>
Активен

Hapkoc

  • Напреднали
  • *****
  • Публикации: 2117
    • Профил
Postfix+sasl+dovecot
« Отговор #1 -: Mar 12, 2008, 13:32 »
[postfix/main.cf]
smtpd_tls_CAfile = ...
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = ...
smtpd_tls_key_file = ...
smtpd_tls_security_level = may
smtpd_tls_exclude_ciphers = aNULL, MD5
smtpd_tls_mandatory_ciphers = high

smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot

[dovecot.conf] - долното го добавяш в секцията auth default {}
  socket listen {
    client {
      path = /var/spool/postfix/private/auth
      mode = 0660
      user = _postfix
      group = _postfix
    }
  }


Забележки:

 * настройките за TLS на postfix ти си преценяваш дали да ги ползваш и съответно трябва да ги прегледаш да видиш кое трябва да пипнеш, кое не;
 * настройките горе са в случай, че postfix е chroot-нат (в случая в /var/spool/postfix, както се вижда), т.е. трябва да си оправиш пътищата при теб;
 * за да работи, трябва да имаш dovecot sasl поддръжка в postfix - проверява се с postconf -a.

Това е май.



Активен

d3v1ous

  • Напреднали
  • *****
  • Публикации: 127
    • Профил
Postfix+sasl+dovecot
« Отговор #2 -: Mar 12, 2008, 14:20 »
Примерен код
/etc/postfix/main.cf

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

# TLS parameters
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = jony.atlantica.us
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
#myorigin = /etc/mailname
myorigin = jony.atlantica.us
#mydestination = jony.atlantica.us
mydestination = jony.atlantica.us
#mynetworks = 127.0.0.0/8
mynetworks = 192.168.0.0/28, 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
delay_notice_recipient = d3v1ous
queue_directory = /var/mail
bounce_notice_recipient = d3v1ous
2bounce_notice_recipient = d3v1ous
error_notice_recipient = d3v1ous
#smtpd_recipient_restrictions = permit_mynetworks reject_unauth_destination reject_unknown_reverse_client_hostname
smtpd_helo_required = yes

# User Settings

smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination,reject_non_fqdn_reci

pient,reject_unauth_destination,

smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = jony.atlantica.us
smtpd_sasl_security_options = noanonymous

smtpd_tls_CAfile = ...
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = ...
smtpd_tls_key_file = ...
smtpd_tls_security_level = may
smtpd_tls_exclude_ciphers = aNULL, MD5
smtpd_tls_mandatory_ciphers = high

smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot


Примерен код
/etc/dovecot/dovecot.conf

auth default {
mechanisms = plain login
passdb pam {
}
userdb passwd {
}
socket listen {
client {
mode = 0660
user = postfix
group = postfix
}
}
}



Примерен код


postconf -a
cyrus
dovecot



Примерен код
/var/log/mail.log

Mar 12 14:24:21 jony dovecot: IMAP(d3v1ous): Disconnected: Logged out
Mar 12 14:24:48 jony postfix/smtpd[9200]: cannot load Certificate Authority data
Mar 12 14:24:48 jony postfix/smtpd[9200]: warning: TLS library problem: 9200:error:02001002:system library:fopen:No such file or directory:bss_file.c:122:fopen('...','r'):
Mar 12 14:24:48 jony postfix/smtpd[9200]: warning: TLS library problem: 9200:error:2006D080:BIO routines:BIO_new_file:no such file:bss_file.c:125:
Mar 12 14:24:48 jony postfix/smtpd[9200]: warning: TLS library problem: 9200:error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib:by_file.c:274:
Mar 12 14:24:48 jony postfix/smtpd[9200]: warning: SASL: Connect to private/auth failed: No such file or directory
Mar 12 14:24:48 jony postfix/smtpd[9200]: fatal: no SASL authentication mechanisms
Mar 12 14:24:49 jony postfix/master[9178]: warning: process /usr/lib/postfix/smtpd pid 9200 exit status 1
Mar 12 14:24:49 jony postfix/master[9178]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
Mar 12 14:25:21 jony dovecot: imap-login: Disconnected: rip=217.18.252.139, lip=77.70.5.130, TLS
Mar 12 14:25:44 jony dovecot: imap-login: Login: user=<d3v1ous>, method=PLAIN, rip=217.18.252.139, lip=77.70.5.130, TLS
Mar 12 14:25:44 jony dovecot: IMAP(d3v1ous): Disconnected in IDLE
Mar 12 14:25:49 jony postfix/smtpd[9207]: cannot load Certificate Authority data
Mar 12 14:25:49 jony postfix/smtpd[9207]: warning: TLS library problem: 9207:error:02001002:system library:fopen:No such file or directory:bss_file.c:122:fopen('...','r'):
Mar 12 14:25:49 jony postfix/smtpd[9207]: warning: TLS library problem: 9207:error:2006D080:BIO routines:BIO_new_file:no such file:bss_file.c:125:
Mar 12 14:25:49 jony postfix/smtpd[9207]: warning: TLS library problem: 9207:error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib:by_file.c:274:
Mar 12 14:25:49 jony postfix/smtpd[9207]: warning: SASL: Connect to private/auth failed: No such file or directory
Mar 12 14:25:49 jony postfix/smtpd[9207]: fatal: no SASL authentication mechanisms
Mar 12 14:25:50 jony postfix/master[9178]: warning: process /usr/lib/postfix/smtpd pid 9207 exit status 1
Mar 12 14:25:50 jony postfix/master[9178]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
Mar 12 14:25:50 jony dovecot: imap-login: Login: user=<d3v1ous>, method=PLAIN, rip=217.18.252.139, lip=77.70.5.130, TLS
Mar 12 14:25:50 jony dovecot: IMAP(d3v1ous): Disconnected: Logged out
Mar 12 14:25:50 jony dovecot: imap-login: Login: user=<d3v1ous>, method=PLAIN, rip=217.18.252.139, lip=77.70.5.130, TLS
Mar 12 14:25:51 jony dovecot: IMAP(d3v1ous): Disconnected: Logged out

Активен

d3v1ous

  • Напреднали
  • *****
  • Публикации: 127
    • Профил
Postfix+sasl+dovecot
« Отговор #3 -: Mar 12, 2008, 14:25 »
okey , това с TSL-a го оправих, просто го има два пъти, аз просто paste твойте неща без да гледам, на горе си го има по default..
Активен

d3v1ous

  • Напреднали
  • *****
  • Публикации: 127
    • Профил
Postfix+sasl+dovecot
« Отговор #4 -: Mar 12, 2008, 14:28 »
Примерен код
/etc/postfix/main.cf

smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = jony.atlantica.us
smtpd_sasl_security_options = noanonymous
smtpd_tls_security_level = may
smtpd_tls_exclude_ciphers = aNULL, MD5
smtpd_tls_mandatory_ciphers = high
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot



smtpd_sasl_path = private/auth

само кажи тук какво да пиша
Активен

d3v1ous

  • Напреднали
  • *****
  • Публикации: 127
    • Профил
Postfix+sasl+dovecot
« Отговор #5 -: Mar 12, 2008, 14:30 »
Примерен код
/var/log/mail.log

Mar 12 14:36:49 jony postfix/smtpd[9503]: warning: SASL: Connect to private/auth failed: No such file or directory
Mar 12 14:36:49 jony postfix/smtpd[9503]: fatal: no SASL authentication mechanisms
Mar 12 14:36:50 jony postfix/master[9499]: warning: process /usr/lib/postfix/smtpd pid 9503 exit status 1
Mar 12 14:36:50 jony postfix/master[9499]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling



Примерен код
/etc/postfix/main.cf

smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = jony.atlantica.us
smtpd_sasl_security_options = noanonymous
smtpd_tls_security_level = may
smtpd_tls_exclude_ciphers = aNULL, MD5
smtpd_tls_mandatory_ciphers = high
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
Активен

Hapkoc

  • Напреднали
  • *****
  • Публикации: 2117
    • Профил
Postfix+sasl+dovecot
« Отговор #6 -: Mar 12, 2008, 15:12 »
Еми виж, в smtpd_sasl_path трябва да стои пътя до сокета, където слуша dovecot. Сиреч в dovecot.conf трябва да му зададеш пътя, на който да си направи сокета и после на postfix да му укажеш къде е. В dovecot.conf това се указва така:

path = /път/до/сокета

Както писах - зависи дали postfix е в chroot. Ако е в chroot трябва да укажеш на dovecot абсолютния път в chroot средата, а на postfix релативен спрямо корена на chroot средата.

Примерно, при мен chroot-а е в /var/spool/postfix, съответно в dovecot.conf пише:

path = /var/spool/postfix/private/auth

а в postfix/main.cf:

smtpd_sasl_path = private/auth

Ако postfix не е в chroot, пътищата в dovecot.conf и postfix/main.cf са си еднакви.

Надявам се да разбра какво имам предвид.
Активен

d3v1ous

  • Напреднали
  • *****
  • Публикации: 127
    • Профил
Postfix+sasl+dovecot
« Отговор #7 -: Mar 12, 2008, 15:25 »
не е chroot-nat ама пътя до сокета как е.. а и не разбрах какво да ползвам като SASL /etc/init.d/saslauthd това'<img'> или dovecot си има някакъв auth daemon..
Активен

d3v1ous

  • Напреднали
  • *****
  • Публикации: 127
    • Профил
Postfix+sasl+dovecot
« Отговор #8 -: Mar 12, 2008, 15:32 »
Примерен код
/etc/postfix/main.cf

smtpd_sasl_path = /etc/postfix/sasl:/usr/lib/sasl2



Примерен код
/var/log/mail.log

Mar 12 15:36:50 jony dovecot: imap-login: Login: user=<d3v1ous>, method=PLAIN, rip=217.18.252.139, lip=77.70.5.130, TLS
Mar 12 15:36:50 jony dovecot: IMAP(d3v1ous): Disconnected: Logged out
Mar 12 15:37:14 jony postfix/smtpd[10425]: warning: SASL: Connect to /etc/postfix/sasl:/usr/lib/sasl2 failed: No such file or directory
Mar 12 15:37:14 jony postfix/smtpd[10425]: fatal: no SASL authentication mechanisms
Mar 12 15:37:15 jony postfix/master[10391]: warning: process /usr/lib/postfix/smtpd pid 10425 exit status 1
Mar 12 15:37:15 jony postfix/master[10391]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
Mar 12 15:38:15 jony postfix/smtpd[10430]: warning: SASL: Connect to /etc/postfix/sasl:/usr/lib/sasl2 failed: No such file or directory
Mar 12 15:38:15 jony postfix/smtpd[10430]: fatal: no SASL authentication mechanisms
Mar 12 15:38:16 jony postfix/master[10391]: warning: process /usr/lib/postfix/smtpd pid 10430 exit status 1
Mar 12 15:38:16 jony postfix/master[10391]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling


Примерен код


ls -l /usr/lib/sasl2/
total 412
-rw-r--r-- 1 root root 13304 2006-12-13 23:26 libanonymous.a
-rw-r--r-- 1 root root   855 2006-12-13 23:26 libanonymous.la
lrwxrwxrwx 1 root root    22 2008-03-10 15:08 libanonymous.so -> libanonymous.so.2.0.22
lrwxrwxrwx 1 root root    22 2008-03-10 15:08 libanonymous.so.2 -> libanonymous.so.2.0.22
-rw-r--r-- 1 root root 12844 2006-12-13 23:26 libanonymous.so.2.0.22
-rw-r--r-- 1 root root 15502 2006-12-13 23:26 libcrammd5.a
-rw-r--r-- 1 root root   841 2006-12-13 23:26 libcrammd5.la
lrwxrwxrwx 1 root root    20 2008-03-10 15:08 libcrammd5.so -> libcrammd5.so.2.0.22
lrwxrwxrwx 1 root root    20 2008-03-10 15:08 libcrammd5.so.2 -> libcrammd5.so.2.0.22
-rw-r--r-- 1 root root 15052 2006-12-13 23:26 libcrammd5.so.2.0.22
-rw-r--r-- 1 root root 46320 2006-12-13 23:26 libdigestmd5.a
-rw-r--r-- 1 root root   864 2006-12-13 23:26 libdigestmd5.la
lrwxrwxrwx 1 root root    22 2008-03-10 15:08 libdigestmd5.so -> libdigestmd5.so.2.0.22
lrwxrwxrwx 1 root root    22 2008-03-10 15:08 libdigestmd5.so.2 -> libdigestmd5.so.2.0.22
-rw-r--r-- 1 root root 43040 2006-12-13 23:26 libdigestmd5.so.2.0.22
-rw-r--r-- 1 root root 13482 2006-12-13 23:26 liblogin.a
-rw-r--r-- 1 root root   835 2006-12-13 23:26 liblogin.la
lrwxrwxrwx 1 root root    18 2008-03-10 15:08 liblogin.so -> liblogin.so.2.0.22
lrwxrwxrwx 1 root root    18 2008-03-10 15:08 liblogin.so.2 -> liblogin.so.2.0.22
-rw-r--r-- 1 root root 13384 2006-12-13 23:26 liblogin.so.2.0.22
-rw-r--r-- 1 root root 29300 2006-12-13 23:26 libntlm.a
-rw-r--r-- 1 root root   829 2006-12-13 23:26 libntlm.la
lrwxrwxrwx 1 root root    17 2008-03-10 15:08 libntlm.so -> libntlm.so.2.0.22
lrwxrwxrwx 1 root root    17 2008-03-10 15:08 libntlm.so.2 -> libntlm.so.2.0.22
-rw-r--r-- 1 root root 28776 2006-12-13 23:26 libntlm.so.2.0.22
-rw-r--r-- 1 root root 13818 2006-12-13 23:26 libplain.a
-rw-r--r-- 1 root root   835 2006-12-13 23:26 libplain.la
lrwxrwxrwx 1 root root    18 2008-03-10 15:08 libplain.so -> libplain.so.2.0.22
lrwxrwxrwx 1 root root    18 2008-03-10 15:08 libplain.so.2 -> libplain.so.2.0.22
-rw-r--r-- 1 root root 13992 2006-12-13 23:26 libplain.so.2.0.22
-rw-r--r-- 1 root root 21726 2006-12-13 23:26 libsasldb.a
-rw-r--r-- 1 root root   856 2006-12-13 23:25 libsasldb.la
lrwxrwxrwx 1 root root    19 2008-02-21 20:31 libsasldb.so -> libsasldb.so.2.0.22
lrwxrwxrwx 1 root root    19 2008-02-21 20:31 libsasldb.so.2 -> libsasldb.so.2.0.22
-rw-r--r-- 1 root root 17980 2006-12-13 23:26 libsasldb.so.2.0.22
-rw-r--r-- 1 root root 23576 2006-12-13 23:26 libsql.a
-rw-r--r-- 1 root root   964 2006-12-13 23:26 libsql.la
lrwxrwxrwx 1 root root    16 2008-03-10 20:34 libsql.so -> libsql.so.2.0.22
lrwxrwxrwx 1 root root    16 2008-03-10 20:34 libsql.so.2 -> libsql.so.2.0.22
-rw-r--r-- 1 root root 23072 2006-12-13 23:26 libsql.so.2.0.22
-rw-r--r-- 1 root root    69 2008-03-11 12:08 Sendmail.conf
Активен

Hapkoc

  • Напреднали
  • *****
  • Публикации: 2117
    • Профил
Postfix+sasl+dovecot
« Отговор #9 -: Mar 12, 2008, 15:49 »
Момент сега, saslauthd ако се не лъжа е част от cyrus-sasl, в случая не ти трябва изобщо.

Колкото до пътя, който трябва да се опише - еми слагаш в dovecot.conf някакъв път файл, като трябва директорията от въпросния път да съществува, а самия файл трябва да не съществува. Това е така, т.к. dovecot ще създаде на този път unix domain socket, на който ще слуша за заявки от postfix.

След това на postfix трябва да му укажеш къде е този файл, т.е. да му сложиш същия път като на dovecot.
Активен

d3v1ous

  • Напреднали
  • *****
  • Публикации: 127
    • Профил
Postfix+sasl+dovecot
« Отговор #10 -: Mar 12, 2008, 16:12 »
Starting mail server: dovecotError: Error in configuration file /etc/dovecot/dovecot.conf line 1023: Unknown setting: path

Примерен код
/etc/postfix/main.cf

smtpd_sasl_path = /etc/postfix/socket



ls -la /etc/postfix/socket/
total 8
drwxr-xr-x 2 root root 4096 2008-03-12 16:02 .
drwxr-xr-x 4 root root 4096 2008-03-12 16:02 ..
Активен

Hapkoc

  • Напреднали
  • *****
  • Публикации: 2117
    • Профил
Postfix+sasl+dovecot
« Отговор #11 -: Mar 12, 2008, 16:26 »
Добре де, айде вложи малко мисъл и творчество.

Пътя в dovecot.conf се дефинира както съм писал в първия си пост по темата... т.е. в секцията auth default, в подсекцията за сокета...
Активен

d3v1ous

  • Напреднали
  • *****
  • Публикации: 127
    • Профил
Postfix+sasl+dovecot
« Отговор #12 -: Mar 12, 2008, 16:48 »
ако искаш кажи точно какво да напиша аз не мисля да се занимавам повече с това.. тука една седмица чета форуми като олигофрен и тфа се се дъни боли ме кура..

Mar 12 16:53:45 jony dovecot: Dovecot v1.0.rc15 starting up
Mar 12 16:53:46 jony dovecot: Auth process died too early - shutting down
Mar 12 16:53:46 jony dovecot: auth(default): bind(socket/auth) failed: No such file or directory
Mar 12 16:53:46 jony dovecot: auth(default): net_listen_unix(socket/auth) failed: No such file or directory
Mar 12 16:53:46 jony dovecot: child 12441 (auth) returned error 89
Mar 12 16:53:46 jony dovecot: Temporary failure in creating login processes, slowing down for now
Mar 12 16:55:02 jony postfix/smtpd[12449]: warning: SASL: Connect to /etc/postfix/socket failed: No such file or directory
Mar 12 16:55:02 jony postfix/smtpd[12449]: fatal: no SASL authentication mechanisms
Mar 12 16:55:03 jony postfix/master[12428]: warning: process /usr/lib/postfix/smtpd pid 12449 exit status 1
Mar 12 16:55:03 jony postfix/master[12428]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling


smtpd_sasl_type = dovecot
smtpd_sasl_path = /etc/postfix/socket


# User Settings


auth default {
mechanisms = plain login
passdb pam {
}
userdb passwd {
}
socket listen {
client {
mode = 0660
user = postfix
group = postfix
path = socket/auth
}
}
}
Активен

Hapkoc

  • Напреднали
  • *****
  • Публикации: 2117
    • Профил
Postfix+sasl+dovecot
« Отговор #13 -: Mar 12, 2008, 17:07 »
Виж сега, тебе ако те болу к*ра, мене пък съвсем ме боли...

Ще опитам за последно:

dovecot трябва да създаде някъде файл от тип socket, през който да получава заявки за автентикация. postfix трябва да разбере къде е този файл. dovecot се пуска, създава сокета и слуша на него. postfix се пуска и като има заявка от клиент се закача за сокета. Толкоз ли е трудно да укажеш някакъв път до файл?

Сложи и на двете места /tmp/fuckme...
Активен

d3v1ous

  • Напреднали
  • *****
  • Публикации: 127
    • Профил
Postfix+sasl+dovecot
« Отговор #14 -: Mar 12, 2008, 17:26 »
Mar 12 17:32:51 jony postfix/master[13362]: daemon started -- version 2.3.8, configuration /etc/postfix
Mar 12 17:33:00 jony postfix/smtpd[13370]: warning: SASL: Connect to /tmp/fuckme failed: No such file or directory
Mar 12 17:33:00 jony postfix/smtpd[13370]: fatal: no SASL authentication mechanisms
Mar 12 17:33:01 jony postfix/master[13362]: warning: process /usr/lib/postfix/smtpd pid 13370 exit status 1
Mar 12 17:33:01 jony postfix/master[13362]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling
Активен