Знающие люди, помогите разобраться с почтой. Надо настроить внутрикорпоротивную почту с ldap авторизацией. ldap реализован осталось настроить postfix (именно это будем использовать как smpt сервис). Вот main.cf :
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
myhostname = mail.ldaptest.com
#mydomain = ldaptest.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = ldaptest.com
mydestination = $myhostname, localhost$myorigin, localhost, hash:/etc/postfix/transport
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.250.1/16
relayhost = [smtp.rambler.ru]:465
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtpd_tls_auth_only = no
virtual_mailbox_base = /usr/local/vmail/%u
virtual_uid_maps = static:114
virtual_gid_maps = static:114
virtual_minimum_uid = 1
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
fallback_transport = dovecot
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
compatibility_level = 2
relayhost = [smtp.rambler.ru]:465 - если тут ничего не указывать postfix не ставит письма в очередь.
Вот master.cf
# ==========================================================================
smtp inet n - y - - smtpd
#smtp inet n - y - 1 postscreen
#smtpd pass - - y - - smtpd
#dnsblog unix - - y - 0 dnsblog
#tlsproxy unix - - y - 0 tlsproxy
submission inet n - y - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_sasl_tls_security_options=noanonymous
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
#smtps inet n - n - - smtpd
# -o syslog_name=postfix/smtps
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - n - - qmqpd
pickup unix n - y 60 1 pickup
cleanup unix n - y - 0 cleanup
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - y 1000? 1 tlsmgr
rewrite unix - - y - - trivial-rewrite
bounce unix - - y - 0 bounce
defer unix - - y - 0 bounce
trace unix - - y - 0 bounce
verify unix - - y - 1 verify
flush unix n - y 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - y - - smtp
relay unix - - y - - smtp
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - y - - showq
error unix - - y - - error
retry unix - - y - - error
discard unix - - y - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - y - - lmtp
anvil unix - - y - 1 anvil
scache unix - - y - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
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=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}
localhost:10026 inet n - n - 10 smtpd
-o content_filter=
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks,no_milters
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
# Postfix 2.10 and later: specify empty smtpd_relay_restrictions.
-o smtpd_relay_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
На данном этапе данные авторизации берутся из файла и даже так не работает.
Вот что удалось сделать через telnet :
telnet ldaptest.com 25
Trying 127.0.0.1...
Connected to ldaptest.com.
Escape character is '^]'.
220 mail.ldaptest.com ESMTP Postfix (Debian/GNU)
ehlo ldaptest.com
250-mail.ldaptest.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250 SMTPUTF8
mail from: qqq@ldaptest.com
250 2.1.0 Ok
rcpt to: qqq@ldaptest.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Привет
.
250 2.0.0 Ok: queued as CBF42B9F5
quit
221 2.0.0 Bye
Connection closed by foreign host.
mailq - проверка очереди
nmap ldaptest.com (порты)
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
80/tcp open http
143/tcp open imap
389/tcp open ldap
587/tcp open submission
636/tcp open ldapssl
993/tcp open imaps
3306/tcp open mysql
Статусы:
service postfix status
● postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/lib/systemd/system/postfix.service; enabled; vendor preset: enabled)
Active: active (exited) since Fri 2018-06-01 15:55:36 MSK; 41s ago
Process: 7997 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
Process: 8937 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 8937 (code=exited, status=0/SUCCESS)
июн 01 15:55:36 ldaptest.com systemd[1]: Starting Postfix Mail Transport Agent...
июн 01 15:55:36 ldaptest.com systemd[1]: Started Postfix Mail Transport Agent.
echo «Привет» | mail -s «Начало» qqq@ldaptest.com mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
6A3C7B9F5* 347 Fri Jun 1 13:00:15 root@ldaptest.com
qqq@ldaptest.com
-- 0 Kbytes in 1 Request.
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
6A3C7B9F5* 347 Fri Jun 1 13:00:15 root@ldaptest.com
qqq@ldaptest.com
6868EBD9C* 347 Fri Jun 1 13:00:26 root@ldaptest.com
qqq@ldaptest.com
-- 0 Kbytes in 2 Requests.
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
BEC1FBDA5* 367 Fri Jun 1 13:00:44 root@ldaptest.com
qqq@ldaptest.com
root@ldaptest.com
6A3C7B9F5* 347 Fri Jun 1 13:00:15 root@ldaptest.com
qqq@ldaptest.com
6868EBD9C* 347 Fri Jun 1 13:00:26 root@ldaptest.com
qqq@ldaptest.com
-- 1 Kbytes in 3 Requests.
Что делать. Хотя бы на начальном этапе, с авторизацией через файл, далее возможно разберусь с ldap авторизацией