Postfix, courier-imap, ssl

Обсуждение настройки и работы сервисов, резервирования, сетевых настроек и вопросов безопасности ОС.

Модераторы: SLEDopit, Модераторы разделов

Vampire
Сообщения: 14
ОС: Gentoo 2006.1

Postfix, courier-imap, ssl

Сообщение Vampire »

День добрый..
Установлен postfix+courier-imap+mysql+openssl. Мой ip внутренний:10.16.2.215. По незащищенному соединению получение и отправка почты (pop3d) происходит нормально.. При отправке почты с использованием TLS все вроде впорядке.. Но стоит использовать ssl thunderbird тупо висит.. в maillog: postfix/smtpd[10146]: connect from unknown[10.16.2.215] и далее этого ничего не происходит.. через пол минуты:

Код: Выделить всё

Jan 31 01:14:18 localhost postfix/smtpd[10146]: lost connection after UNKNOWN from unknown[10.16.2.215]
Jan 31 01:14:18 localhost postfix/smtpd[10146]: disconnect from unknown[10.16.2.215]

Kmail же при тех же условиях в лог пишет:

Код: Выделить всё

Jan 31 01:18:42 localhost postfix/smtpd[10243]: connect from unknown[10.16.2.215]
Jan 31 01:18:42 localhost postfix/smtpd[10243]: lost connection after CONNECT from unknown[10.16.2.215]
Jan 31 01:18:42 localhost postfix/smtpd[10243]: disconnect from unknown[10.16.2.215]

Далее pop3d-ssl.. pop3d работает нормально.. Стоит использовать ssl и thunderbird опять же тупо висит.. но в лог вообще ничего не пишет.. Kmail же выдает: could not login to 10.16.2.215. The server terminated the connection immediately.
openssl s_client -connect localhost:995 проходит с read:errno=0.
Как-то потерялся среди разнообразных гайдов по postfix+courier.. Не знаю на что здесь сетовать..

$ cat /etc/postfix/main.cf

Код:

queue_directory = /var/spool/postfix command_directory = /usr/sbin daemon_directory = /usr/lib/postfix data_directory = /var/lib/postfix mail_owner = postfix default_privs = nobody myhostname = server.dto.vs mydomain = dto.vs myorigin = $mydomain inet_interfaces = all mydestination = $myhostname, localhost.$mydomain, localhost, mysql:/etc/postfix/mysql-mydestination.cf local_recipient_maps = $virtual_mailbox_maps,$virtual_alias_maps,$alias_maps unknown_local_recipient_reject_code = 550 mynetworks = 10.16.0.0/20, 127.0.0.0/8 alias_database = hash:/etc/mail/aliases mail_spool_directory = /var/spool/mail smtpd_banner = $myhostname ESMTP debug_peer_level = 2 debug_peer_list = 127.0.0.1 debug_peer_list = dto.vs debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 sendmail_path = /usr/sbin/sendmail newaliases_path = /usr/bin/newaliases mailq_path = /usr/bin/mailq setgid_group = postdrop html_directory = /usr/share/doc/postfix-2.5.6/html manpage_directory = /usr/share/man sample_directory = /etc/postfix readme_directory = /usr/share/doc/postfix-2.5.6/readme home_mailbox = .maildir/ smtpd_sasl_auth_enable = yes smtpd_sasl_application_name = smtpd smtpd_sasl_local_domain=$mydomain broken_sasl_auth_clients = yes smtpd_sasl_security_options = noanonymous virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf virtual_maps = mysql:/etc/postfix/mysql-virtual.cf virtual_uid_maps = mysql:/etc/postfix/mysql-virtual-uid.cf virtual_gid_maps = mysql:/etc/postfix/mysql-virtual-gid.cf transport_maps = mysql:/etc/postfix/mysql-transport.cf virtual_mailbox_base = / virtual_maildir_extended=yes virtual_mailbox_limit_override=yes virtual_create_maildirsize = yes virtual_overquota_bounce = yes virtual_maildir_limit_message="Sorry, the user's maildir has overdrawn his diskspace quota, please try again later" virtual_minimum_uid = 1000 smtpd_tls_cert_file = /etc/ssl/certServer.pem smtpd_tls_key_file = /etc/ssl/server_key_secret.pem smtpd_tls_loglevel = 0 smtpd_use_tls = yes smtpd_tls_session_cache_database = btree:/etc/postfix/smtpd_scache smtpd_tls_session_cache_timeout = 3600s smtpd_starttls_timeout = 270s tls_random_source = dev:/dev/urandom smtpd_tls_auth_only = yes #################################


$cat /etc/postfix/master.cf

Код: Выделить всё

smtp      inet  n       -       n       -       -       smtpd
smtps     inet  n       -       y       -       -       smtpd -o smtpd_enforce_tls=yes
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
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       n       -       -       smtp
relay     unix  -       -       n       -       -       smtp
    -o smtp_fallback_relay=
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
retry     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


$cat /etc/courier-imap/pop3d-ssl

Код: Выделить всё

SSLPORT=995
SSLADDRESS=0
SSLPIDFILE=/var/run/pop3d-ssl.pid
SSLLOGGEROPTS="-name=pop3d-ssl"
POP3DSSLSTART=YES
POP3_STARTTLS=YES
POP3_TLS_REQUIRED=0
COURIERTLS=/usr/sbin/couriertls
TLS_STARTTLS_PROTOCOL=TLS1
TLS_KX_LIST=ALL
TLS_CERTS=X509
TLS_CERTFILE=/etc/courier-imap/pop3d.pem
TLS_TRUSTCERTS=/home/vampire/temp/trusted_certs/
TLS_VERIFYPEER=NONE
TLS_CACHEFILE=/var/lib/courier-imap/couriersslcache
TLS_CACHESIZE=524288
MAILDIRPATH=./
MAILDIR=./
Спасибо сказали:
Аватара пользователя
murder
Сообщения: 219
ОС: FreeBSD 8.0, Ubuntu 9.10

Re: Postfix, courier-imap, ssl

Сообщение murder »

Vampire писал(а):
31.01.2009 02:37
Но стоит использовать ssl thunderbird тупо висит

К main.cf претензий вроде нет. А вот судя по документации ошибка в master.cf
Vampire писал(а):
31.01.2009 02:37
smtps inet n - y - - smtpd -o smtpd_enforce_tls=yes

В документации сказано вот так:

Код: Выделить всё

It is strictly discouraged to use this mode from main.cf. If you want to support this service, enable a special port in master.cf and specify "-o smtpd_tls_wrappermode=yes" (note: no space around the "=") as an smtpd(8) command line option. Port 465 (smtps) was once chosen for this feature.

Example:
/etc/postfix/master.cf:
    smtps    inet  n       -       n       -       -       smtpd
      -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes


Vampire писал(а):
31.01.2009 02:37
Далее pop3d-ssl

courier-imap уже точно не помню, но вообще стоит увеличить уровень логирвания/дебаг и посмотреть в логи.
-//- Реальная смерть приходит с косой, а виртуальная с пассатижами -//-
Спасибо сказали:
Vampire
Сообщения: 14
ОС: Gentoo 2006.1

Re: Postfix, courier-imap, ssl

Сообщение Vampire »

murder, спасибо.. действительно помоголо.. Аутентификация на сервере smpt теперь действительно по ssl происходит.. Остается вопрос с pop3d-ssl.. Логирование в его конфиге не нашел.. есть какой-то courierlogger.. но когда делаю `courierlogger start` он тупо молчит.. В kmail ошибка выглядит как: "Could not login to $my_ip", так что сделал в /etc/courier/authlib/authdaemonrc DEBUG_LOGIN=2.. Но это никаких дополнительных сообщий в логи не привнесло.. Что бы еще сделать..(
Спасибо сказали:
Аватара пользователя
murder
Сообщения: 219
ОС: FreeBSD 8.0, Ubuntu 9.10

Re: Postfix, courier-imap, ssl

Сообщение murder »

Дебаг смотрим в /var/log/debug?)

For courier-imap, you need to set one of the following values in /usr/local/etc/authdaemonrc:
DEBUG_LOGIN=1 # turn on authentication debugging
DEBUG_LOGIN=2 # turn on authentication debugging AND show passwords

This setting is located at the very end of the configuration file.

After changing this setting, restart the authentication daemon by running the "authdaemond stop" and "authdaemond start" commands.

At this point, all debugging output goes to syslog at level 'debug', which is normally not shown. You will probably need to change your /etc/syslog.conf file to be able to see these messages. If you have an existing entry which says "mail.info" (which means facility 'mail', level 'info' or higher) then you can just change this to "mail.debug". Alternatively you can add a new entry like this:
*.debug /var/log/debug

Don't forget to create this file, and to send a HUP signal to syslogd to make it re-read its configuration:
# touch /var/log/debug
# killall -1 syslogd

If you don't want to mess around with your syslog configuration, you can also start authdaemond manually, and log its output to a file:

/usr/local/libexec/courier-authlib/authdaemond >filename 2>&1
-//- Реальная смерть приходит с косой, а виртуальная с пассатижами -//-
Спасибо сказали:
Vampire
Сообщения: 14
ОС: Gentoo 2006.1

Re: Postfix, courier-imap, ssl

Сообщение Vampire »

cat /etc/syslog-ng/syslog-ng.conf

Код:

# /etc/syslog-ng/syslog-ng.conf # From the Gentoo Linux Security Guide # http://www.gentoo.org/doc/en/gentoo-security.xml # Creative Commons - Attribution / Share Alike License # http://creativecommons.org/licenses/by-sa/2.0 options { chain_hostnames(no); sync(0); }; #source where to read log source src { unix-stream("/dev/log"); internal(); }; source kernsrc { file("/proc/kmsg"); }; #define destinations destination authlog { file("/var/log/auth.log"); }; destination syslog { file("/var/log/syslog"); }; destination cron { file("/var/log/cron.log"); }; destination daemon { file("/var/log/daemon.log"); }; destination kern { file("/var/log/kern.log"); }; destination lpr { file("/var/log/lpr.log"); }; destination user { file("/var/log/user.log"); }; # Should be maillog (Without dot) as it was the default on logwatch destination mail { file("/var/log/maillog"); }; destination mailinfo { file("/var/log/mail.info"); }; destination mailwarn { file("/var/log/mail.warn"); }; destination mailerr { file("/var/log/mail.err"); }; destination newscrit { file("/var/log/news/news.crit"); }; destination newserr { file("/var/log/news/news.err"); }; destination newsnotice { file("/var/log/news/news.notice"); }; destination debug { file("/var/log/debug"); }; destination messages { file("/var/log/messages"); }; destination console { usertty("root"); }; destination console_all { file("/dev/tty12"); }; destination xconsole { pipe("/dev/xconsole"); }; #create filters filter f_auth { facility(auth); }; filter f_authpriv { facility(auth, authpriv); }; filter f_syslog { not facility(authpriv, mail); }; filter f_cron { facility(cron); }; filter f_daemon { facility(daemon); }; filter f_kern { facility(kern); }; filter f_lpr { facility(lpr); }; filter f_mail { facility(mail); }; filter f_user { facility(user); }; filter f_debug { facility(auth, authpriv, news, mail); }; filter f_messages { level(info..warn) and not facility(auth, authpriv, mail, news); }; filter f_emergency { level(emerg); }; filter f_info { level(info); }; filter f_notice { level(notice); }; filter f_warn { level(warn); }; filter f_crit { level(crit); }; filter f_err { level(err); }; filter f_failed { match("failed"); }; filter f_denied { match("denied"); }; #connect filter and destination log { source(src); filter(f_authpriv); destination(authlog); }; log { source(src); filter(f_syslog); destination(syslog); }; log { source(src); filter(f_cron); destination(cron); }; log { source(src); filter(f_daemon); destination(daemon); }; log { source(kernsrc); filter(f_kern); destination(kern); }; log { source(src); filter(f_lpr); destination(lpr); }; log { source(src); filter(f_mail); destination(mail); }; log { source(src); filter(f_user); destination(user); }; log { source(src); filter(f_mail); filter(f_info); destination(mailinfo); }; log { source(src); filter(f_mail); filter(f_warn); destination(mailwarn); }; log { source(src); filter(f_mail); filter(f_err); destination(mailerr); }; log { source(src); filter(f_debug); destination(debug); }; log { source(src); filter(f_messages); destination(messages); }; log { source(src); filter(f_emergency); destination(console); }; #default log log { source(src); destination(console_all); };

cat authdaemonrc

Код: Выделить всё

authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=5
authdaemonvar=/var/lib/courier/authdaemon
DEBUG_LOGIN=1
DEFAULTOPTIONS=""
LOGGEROPTS=""

Ни в какой из файлов в /var/log ничего не пишет в момент ошибки.. честно (
Спасибо сказали:
Аватара пользователя
murder
Сообщения: 219
ОС: FreeBSD 8.0, Ubuntu 9.10

Re: Postfix, courier-imap, ssl

Сообщение murder »

В syslog-ng, честно не силен. А что если опробовать варинт с

Код: Выделить всё

/usr/local/libexec/courier-authlib/authdaemond >filename 2>&1
-//- Реальная смерть приходит с косой, а виртуальная с пассатижами -//-
Спасибо сказали:
Vampire
Сообщения: 14
ОС: Gentoo 2006.1

Re: Postfix, courier-imap, ssl

Сообщение Vampire »

Ничего такого, чего бы он не писал в maillog нету..(
Спасибо сказали:
Аватара пользователя
murder
Сообщения: 219
ОС: FreeBSD 8.0, Ubuntu 9.10

Re: Postfix, courier-imap, ssl

Сообщение murder »

И при DEBUG_LOGIN=2?

P.S. Можно попробовать еще dovecot вместо курьера
-//- Реальная смерть приходит с косой, а виртуальная с пассатижами -//-
Спасибо сказали:
Vampire
Сообщения: 14
ОС: Gentoo 2006.1

Re: Postfix, courier-imap, ssl

Сообщение Vampire »

murder: Спасибо еще раз.. dovecot вроде бы адекватно сейчас работает.. Жаль, что с курьером не сложилось..
Спасибо сказали:
Аватара пользователя
murder
Сообщения: 219
ОС: FreeBSD 8.0, Ubuntu 9.10

Re: Postfix, courier-imap, ssl

Сообщение murder »

Не знаю, нов от лично я когда переполз с курьера на него - доволен. Работает как часы, не глючит, и много фишек разных есть. В общем советую
-//- Реальная смерть приходит с косой, а виртуальная с пассатижами -//-
Спасибо сказали: