Еще раз сбрасываю все конфиги от эксима до давекота
slapd.conf
Код: Выделить всё
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
include /usr/local/etc/openldap/schema/misc.schema
include /usr/local/etc/openldap/schema/nis.schema
include /usr/local/etc/openldap/schema/openldap.schema
include /usr/local/etc/openldap/schema/mail.schema
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
modulepath /usr/local/libexec/openldap
moduleload back_bdb
access to attrs=userPassword
by dn="cn=bonhead,dc=lepselan,dc=net,dc=ua"
by self write
by anonymous auth
by * none
access to *
by self write
by anonymous read
by * none
database bdb
suffix "dc=lepselan,dc=net,dc=ua"
rootdn "cn=bonhead,dc=lepselan,dc=net,dc=ua"
rootpw {SSHA}kh7Qzfwh5XzrKgBvSCvQKKETKhC1qu1Q
directory /var/db/openldap-data
loglevel 256
index objectClass eq
index cn eq
base.ldif
Код: Выделить всё
dn: dc=lepselan,dc=net,dc=ua
objectClass: dcObject
objectClass: organization
objectClass: top
dc:lepselan
o:lepselan
exim.ldif
Код: Выделить всё
dn: mail=bonhead@lepselan.net.ua,ou=lepselan.net.ua,ou=exim,dc=lepselan,dc=net,dc=ua
objectClass: top
objectClass: MailAccount
mail: bonhead@lepselan.net.ua
homeDirectory: lepselan.net.ua/bonhead
accountStatus: active
mailMessageStore: Maildir/
clearPassword: secret
mailQuotaSize: 2500
Эксим
Код: Выделить всё
primary_hostname = mx.lepselan.net.ua
ldap_default_servers = 10.135.1.250::389
LDAP_AUTH = user="cn=bonhead,dc=lepselan,dc=net,dc=ua" pass="nhjatq"
domainlist local_domains = lepselan.net.ua
domainlist relay_to_domains = lepselan.net.ua
hostlist relay_from_hosts = localhost:127.0.0.0/8
acl_smtp_rcpt = acl_check_rcpt
acl_smtp_data = acl_check_data
av_scanner = clamd:/var/run/clamav/clamd
tls_advertise_hosts = *
tls_certificate = /usr/local/etc/ssl/mail.pem
tls_privatekey = /usr/local/etc/ssl/mail.pem
qualify_domain = lepselan.net.ua
qualify_recipient = lepselan.net.ua
allow_domain_literals = false
exim_user = mailnull
exim_group = mail
never_users = root
rfc1413_query_timeout = 0s
ignore_bounce_errors_after = 45m
timeout_frozen_after = 15d
freeze_tell = root@lepselan.net.ua
helo_accept_junk_hosts = 10.135.1.0/24, 213.160.144.186
auto_thaw = 1h
smtp_banner = "$primary_hostname, ESMTP EXIM $version_number"
smtp_accept_max = 20
smtp_accept_max_per_connection = 4
smtp_connect_backlog = 30
smtp_accept_max_per_host = 4
split_spool_directory = true
remote_max_parallel = 5
return_size_limit = 70k
message_size_limit = 10M
helo_allow_chars = _
smtp_enforce_sync = true
log_selector = \
+all_parents \
+connection_reject \
+incoming_interface \
+lost_incoming_connection \
+received_sender \
+received_recipients \
+smtp_confirmation \
+smtp_syntax_error \
+smtp_protocol_error \
-queue_run
syslog_timestamp = no
begin acl
acl_check_rcpt:
accept hosts = :
deny message = "Недопустимые символы в адресе"
domains = +local_domains
local_parts = ^[.] : ^.*[@%!/|]
deny message = "Недопустимые символы в адресе"
domains = !+local_domains
local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
deny message = "HELO/EHLO обязано быть по SMTP RFC"
condition = ${if eq{$sender_helo_name}{}{yes}{no}}
deny condition = ${if eq{$sender_helo_name}\
{$interface_address}{yes}{no}}
hosts = !127.0.0.1 : !localhost : *
message = "Это мой IP-адрес! Пшёл прочь!"
deny condition = ${if match{$sender_helo_name}\
{\N^\d+$\N}{yes}{no}}
hosts = !127.0.0.1:!localhost:*
message = "В HELO не могут быть тока цифры!"
deny message = "Не нравится мне Ваш хост..."
condition = ${if match{$sender_host_name} \
{adsl|dialup|pool|peer|dhcp} \
{yes}{no}}
accept authenticated = *
warn
set acl_m0 = 25s
warn
hosts = +relay_from_hosts
set acl_m0 = 0s
warn
logwrite = Delay $acl_m0 for $sender_host_name \
[$sender_host_address] with HELO=$sender_helo_name. Mail \
from $sender_address to $local_part@$domain.
delay = $acl_m0
accept domains = +local_domains
endpass
message = "В этом домене нет такого пользователя"
verify = recipient
accept domains = +relay_to_domains
endpass
message = "Моя сервера не знать маршрут на этот хост..."
verify = recipient
accept hosts = +relay_from_hosts
deny message = "Свободен. Это тебе не ОпенРелей."
acl_check_data:
deny message = "this is spam - denied"
condition = ${if match{$message_body} \
{105[-_]*51[-_]*86|778[-_]*98[-_]*94} \
{yes}{no}}
accept
begin routers
dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more
system_aliases:
driver = redirect
allow_fail
allow_defer
data = ${lookup ldapm{LDAP_AUTH \
ldap:///ou=exim,dc=lepselan,dc=net,dc=ua?mail?sub?(&(accountStatus=active) \
(mailAlternateAddress=${quote_ldap:$local_part}${quote_ldap:@}${quote_ldap:$domain}))}}
ldapuser:
driver = accept
condition = ${if eq{}{${lookup ldapdn{LDAP_AUTH \
ldap:///ou=exim,dc=lepselan,dc=net,dc=ua??sub?(&(accountStatus=active) \
(mail=${quote_ldap:$local_part}${quote_ldap:@}${quote_ldap:$domain}))}}}{no}{yes}}
transport = ldap_delivery
begin transports
remote_smtp:
driver = smtp
ldap_delivery:
driver = appendfile
check_string = ""
create_directory
delivery_date_add
directory = ${lookup ldap{LDAP_AUTH \
ldap:///ou=exim,dc=lepselan,dc=net,dc=ua?homeDirectory?sub?\
(&(accountStatus=active) \
(mail=${quote_ldap:$local_part}${quote_ldap:@}${quote_ldap:$domain}))}{/usr/mail/$value/Maildir/} }
directory_mode = 770
envelope_to_add
maildir_use_size_file
group = mail
maildir_format
maildir_tag = ,S=$message_size
message_prefix = ""
message_suffix = ""
mode = 0600
quota = ${lookup ldap{LDAP_AUTH \
ldap:///ou=exim,dc=lepselan,dc=net,dc=ua?mailQuotaSize?\
sub?(&(accountStatus=active) \
(mail=${quote_ldap:$local_part}${quote_ldap:@}${quote_ldap:$domain}))}{$value}fail}
quota_warn_message = "\
To: $local_part@$domain\n\
From: postmaster@$domain\n\
Subject: Your maildir is going full\n\
This message is automaticaly gnerated by your mail server.\n\
This means, that your mailbox is 80% full. If you would \n\
override this limit new mail would not be delivered to you!\n\n\
Please, clean your mailbox."
quota_warn_threshold = 80%
return_path_add
address_file:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add
address_pipe:
driver = pipe
return_output
address_reply:
driver = autoreply
begin retry
* quota
* * F,2h,15m; G,16h,1h,1.5; F,4d,6h
begin rewrite
begin authenticators
auth_plain:
driver = plaintext
public_name = PLAIN
server_condition = ${lookup ldapdn{LDAP_AUTH \
ldap:///ou=exim,dc=lepselan,dc=net,dc=ua??sub?(&\
(accountStatus=active)(mail=${quote_ldap:$2}) \
(clearPassword=${quote_ldap:$3}))}{yes}{no}}
server_prompts = :
server_set_id = $2
auth_login:
driver = plaintext
public_name = LOGIN
server_condition = ${lookup ldapdn{LDAP_AUTH \
ldap:///ou=exim,dc=lepselan,dc=net,dc=ua??sub?\
(&(accountStatus=active)(mail=${quote_ldap:$1}) \
(clearPassword=${quote_ldap:$2}))}{yes}{no}}
server_prompts = Username:: : Password::
server_set_id = $1
auth_cram_md5:
driver = cram_md5
public_name = CRAM-MD5
server_secret = ${lookup ldap{LDAP_AUTH \
ldap:///ou=exim,dc=lepselan,dc=net,dc=ua?clearPassword?sub?\
(&(accountStatus=active)(mail=${quote_ldap:$1}) \
)}{$value}fail}
server_set_id = $1
Давекот
dovecot.conf
Код: Выделить всё
mx# less dovecot.conf
## Dovecot configuration file
# If you're in a hurry, see http://wiki.dovecot.org/QuickConfiguration
# "doveconf -n" command gives a clean output of the changed settings. Use it
# instead of copy&pasting files when posting to the Dovecot mailing list.
# '#' character and everything after it is treated as comments. Extra spaces
# and tabs are ignored. If you want to use either of these explicitly, put the
# value inside quotes, eg.: key = "# char and trailing whitespace "
# Default values are shown for each setting, it's not required to uncomment
# those. These are exceptions to this though: No sections (e.g. namespace {})
# or plugin settings are added by default, they're listed only as examples.
# Paths are also just examples with the real defaults being based on configure
# options. The paths listed here are for configure --prefix=/usr/local
# --sysconfdir=/usr/local/etc --localstatedir=/var
# Most of the actual configuration gets included below. The filenames are
# first sorted by their ASCII value and parsed in that order. The 00-prefixes
# in filenames are intended to make it easier to understand the ordering.
!include conf.d/*.conf
# Protocols we want to be serving.
protocols = imap pop3
# A comma separated list of IPs or hosts where to listen in for connections.
# "*" listens in all IPv4 interfaces, "::" listens in all IPv6 interfaces.
# If you want to specify non-default ports or anything more complex,
# edit conf.d/master.conf.
listen = *
# Base directory where to store runtime data.
base_dir = /var/run/dovecot/
# Greeting message for clients.
login_greeting = Dovecot ready.
# Space separated list of trusted network ranges. Connections from these
# IPs are allowed to override their IP addresses and ports (for logging and
# for authentication checks). disable_plaintext_auth is also ignored for
# these networks. Typically you'd specify your IMAP proxy servers here.
#login_trusted_networks =
# Sepace separated list of login access check sockets (e.g. tcpwrap)
#login_access_sockets =
# Show more verbose process titles (in ps). Currently shows user name and
# IP address. Useful for seeing who are actually using the IMAP processes
# (eg. shared mailboxes or if same uid is used for multiple accounts).
#verbose_proctitle = no
# Should all processes be killed when Dovecot master process shuts down.
# Setting this to "no" means that Dovecot can be upgraded without
# forcing existing client connections to close (although that could also be
# a problem if the upgrade is e.g. because of a security fix).
shutdown_clients = yes
# If non-zero, run mail commands via this many connections to doveadm server,
# instead of running them directly in the same process.
#doveadm_worker_count = 0
# UNIX socket or host:port used for connecting to doveadm server
#doveadm_socket_path = doveadm-server
##
## Dictionary server settings
##
# Dictionary can be used to store key=value lists. This is used by several
# plugins. The dictionary can be accessed either directly or though a
# dictionary server. The following dict block maps dictionary names to URIs
# when the server is used. These can then be referenced using URIs in format
# "proxy::<name>".
dict {
#quota = mysql:/usr/local/etc/dovecot/dovecot-dict-sql.conf.ext
#expire = sqlite:/usr/local/etc/dovecot/dovecot-dict-sql.conf.ext
}
# A config file can also tried to be included without giving an error if
# it's not found:
#!include_try /usr/local/etc/dovecot/local.conf
dovecot-ldap.conf
Код: Выделить всё
# This file is opened as root, so it should be owned by root and mode 0600.
#
# http://wiki.dovecot.org/AuthDatabase/LDAP
#
# NOTE: If you're not using authentication binds, you'll need to give
# dovecot-auth read access to userPassword field in the LDAP server.
# With OpenLDAP this is done by modifying /etc/ldap/slapd.conf. There should
# already be something like this:
# access to attribute=userPassword
# by dn="<dovecot's dn>" read # add this
# by anonymous auth
# by self write
# by * none
# Space separated list of LDAP hosts to use. host:port is allowed too.
hosts = localhost
# LDAP URIs to use. You can use this instead of hosts list. Note that this
# setting isn't supported by all LDAP libraries.
uris = ldap://localhost
# Distinguished Name - the username used to login to the LDAP server.
# Leave it commented out to bind anonymously (useful with auth_bind=yes).
dn = cn=bonhead,dc=lepselan,dc=net,dc=ua
# Password for LDAP server, if dn is specified.
dnpass = nhjatq
# Use SASL binding instead of the simple binding. Note that this changes
# ldap_version automatically to be 3 if it's lower. Also note that SASL binds
# and auth_bind=yes don't work together.
#sasl_bind = no
# SASL mechanism name to use.
#sasl_mech =
# SASL realm to use.
#sasl_realm =
# SASL authorization ID, ie. the dnpass is for this "master user", but the
# dn is still the logged in user. Normally you want to keep this empty.
#sasl_authz_id =
# Use TLS to connect to the LDAP server.
#tls = no
# TLS options, currently supported only with OpenLDAP:
#tls_ca_cert_file =
#tls_ca_cert_dir =
#tls_cipher_suite =
# TLS cert/key is used only if LDAP server requires a client certificate.
#tls_cert_file =
#tls_key_file =
# Valid values: never, hard, demand, allow, try
#tls_require_cert =
# Use the given ldaprc path.
#ldaprc_path =
# LDAP library debug level as specified by LDAP_DEBUG_* in ldap_log.h.
# -1 = everything. You may need to recompile OpenLDAP with debugging enabled
# to get enough output.
#debug_level =
# Use authentication binding for verifying password's validity. This works by
# logging into LDAP server using the username and password given by client.
# The pass_filter is used to find the DN for the user. Note that the pass_attrs
# is still used, only the password field is ignored in it. Before doing any
# search, the binding is switched back to the default DN.
auth_bind = no
# If authentication binding is used, you can save one LDAP request per login
# if users' DN can be specified with a common template. The template can use
# the standard %variables (see user_filter). Note that you can't
# use any pass_attrs if you use this setting.
#
# If you use this setting, it's a good idea to use a different
# dovecot-ldap.conf.ext for userdb (it can even be a symlink, just as long as
# the filename is different in userdb's args). That way one connection is used
# only for LDAP binds and another connection is used for user lookups.
# Otherwise the binding is changed to the default DN before each user lookup.
#
# For example:
# auth_bind_userdn = cn=%u,ou=people,o=org
#
#auth_bind_userdn = mail=%u,ou=lepselan.net.ua
# LDAP protocol version to use. Likely 2 or 3.
ldap_version = 3
# LDAP base. %variables can be used here.
# For example: dc=mail, dc=example, dc=org
base = ou=lepselan.net.ua,ou=exim,dc=lepselan,dc=net,dc=ua
# Dereference: never, searching, finding, always
deref = never
# Search scope: base, onelevel, subtree
#scope = subtree
# User attributes are given in LDAP-name=dovecot-internal-name list. The
# internal names are:
# uid - System UID
# gid - System GID
# home - Home directory
# mail - Mail location
#
# There are also other special fields which can be returned, see
# http://wiki.dovecot.org/UserDatabase/ExtraFields
user_attrs = homeDirectory=home,mail=uid,mail=mail
# Filter for user lookup. Some variables can be used (see
# http://wiki.dovecot.org/Variables for full list):
# %u - username
# %n - user part in user@domain, same as %u if there's no domain
# %d - domain part in user@domain, empty if user there's no domain
user_filter = (&(accountStatus=active)(mail=%u))
# Password checking attributes:
# user: Virtual user name (user@domain), if you wish to change the
# user-given username to something else
# password: Password, may optionally start with {type}, eg. {crypt}
# There are also other special fields which can be returned, see
# http://wiki.dovecot.org/PasswordDatabase/ExtraFields
pass_attrs = mail=user,clearPassword=password
# If you wish to avoid two LDAP lookups (passdb + userdb), you can use
# userdb prefetch instead of userdb ldap in dovecot.conf. In that case you'll
# also have to include user_attrs in pass_attrs field prefixed with "userdb_"
# string. For example:
#pass_attrs = uid=user,userPassword=password,\
# homeDirectory=userdb_home,uidNumber=userdb_uid,gidNumber=userdb_gid
# Filter for password lookups
pass_filter = (&(accountStatus=active)(mail=%u))
# Attributes and filter to get a list of all users
#iterate_attrs = mail=user
#iterate_filter = (accountStatus=active)
# Default password scheme. "{scheme}" before password overrides this.
# List of supported schemes is in: http://wiki.dovecot.org/Authentication
default_pass_scheme = CRYPT
Теперь логи
debud.log
Код: Выделить всё
Dec 19 14:29:00 mx slapd[40895]: conn=1067 fd=14 ACCEPT from IP=10.135.1.250:15597 (IP=0.0.0.0:389)
Dec 19 14:29:00 mx slapd[40895]: conn=1067 op=0 BIND dn="cn=bonhead,dc=lepselan,dc=net,dc=ua" method=128
Dec 19 14:29:00 mx slapd[40895]: conn=1067 op=0 BIND dn="cn=bonhead,dc=lepselan,dc=net,dc=ua" mech=SIMPLE ssf=0
Dec 19 14:29:00 mx slapd[40895]: conn=1067 op=0 RESULT tag=97 err=0 text=
Dec 19 14:29:00 mx slapd[40895]: connection_input: conn=1067 deferring operation: binding
Dec 19 14:29:00 mx slapd[40895]: conn=1067 op=1 SRCH base="ou=exim,dc=lepselan,dc=net,dc=ua" scope=2 deref=0 filter="(&(accountStatus=active)(mailAlternateAddress=root@lepselan.net.ua))"
Dec 19 14:29:00 mx slapd[40895]: conn=1067 op=1 SRCH attr=mail
Dec 19 14:29:00 mx slapd[40895]: <= bdb_equality_candidates: (accountStatus) not indexed
Dec 19 14:29:00 mx slapd[40895]: <= bdb_equality_candidates: (mailAlternateAddress) not indexed
Dec 19 14:29:00 mx slapd[40895]: conn=1067 op=1 SEARCH RESULT tag=101 err=0 nentries=0 text=
Dec 19 14:29:00 mx slapd[40895]: conn=1067 op=2 SRCH base="ou=exim,dc=lepselan,dc=net,dc=ua" scope=2 deref=0 filter="(&(accountStatus=active)(mail=root@lepselan.net.ua))"
maillog
Код: Выделить всё
Dec 19 14:20:51 mx dovecot: master: Dovecot v2.0.7 starting up
Dec 19 14:26:00 mx dovecot: auth: Fatal: ldap: LDAP attribute 'mail' used multiple times. This is currently unsupported.
Dec 19 14:26:00 mx dovecot: master: Error: service(auth): command startup failed, throttling
Dec 19 14:26:35 mx dovecot: imap-login: Error: Timeout waiting for handshake from auth server. my pid=43037, input bytes=0
Dec 19 14:27:00 mx dovecot: auth: Fatal: ldap: LDAP attribute 'mail' used multiple times. This is currently unsupported.
Dec 19 14:27:00 mx dovecot: master: Error: service(auth): command startup failed, throttling
Вроде пока все