Различия
Здесь показаны различия между двумя версиями данной страницы.
Следующая версия | Предыдущая версия | ||
wiki:postfix_dovecot_ldap_ubuntu_10_04 [2010/11/12 13:35] создано |
wiki:postfix_dovecot_ldap_ubuntu_10_04 [2011/01/26 19:42] (текущий) |
||
---|---|---|---|
Строка 1: | Строка 1: | ||
- | ====== Настройка Postfix + Dovecot + Dovecot SASL + виртуальные пользователи в LDAP + roundcubemail c адресной книгой в LDAP ====== | + | ======HOW-TO: Настройка Postfix + Dovecot + Dovecot SASL + виртуальные пользователи в LDAP ====== |
- | + | ||
- | <style right> | + | |
- | //Автор — Владимир (Vovan1982)// | + | |
- | //[[http://forum.ubuntu.ru/index.php?action=profile;u=10780|Профиль на форуме]]// | + | |
- | </style> | + | |
И так, у нас уже есть настроенный LDAP сервер по [[http://help.ubuntu.ru/wiki/samba_pdc_ldap_ubuntu_10_04|этой]] статье и внём уже есть пользователи, хотелось бы использовать данных пользователей для почтового сервера. Сформируем условия для нашего почтового сервера: | И так, у нас уже есть настроенный LDAP сервер по [[http://help.ubuntu.ru/wiki/samba_pdc_ldap_ubuntu_10_04|этой]] статье и внём уже есть пользователи, хотелось бы использовать данных пользователей для почтового сервера. Сформируем условия для нашего почтового сервера: | ||
Строка 27: | Строка 22: | ||
обязательно включенной опцией starttls, imap соединения будут осуществляться на 993 порту либо на 143 порту с обязательно включенной опцией starttls, smtp соединение для отправки почты пользователями будет осуществляться на 465 порту либо на 25 порту с обязательно включенной опцией starttls. | обязательно включенной опцией starttls, imap соединения будут осуществляться на 993 порту либо на 143 порту с обязательно включенной опцией starttls, smtp соединение для отправки почты пользователями будет осуществляться на 465 порту либо на 25 порту с обязательно включенной опцией starttls. | ||
- | В распоряжении имеется машина со свежеустановленной Ubuntu 10.04 в процессе установки был выбран LAMP сервер, в связи с этим я здесь не буду описывать настройку apache2 + php5 + mysql. | + | В распоряжении имеется машина со свежеустановленной Ubuntu 10.04. |
Все действия в этой статье выполняются от пользователя root. | Все действия в этой статье выполняются от пользователя root. | ||
Строка 825: | Строка 820: | ||
Всё почтовый сервер готов к использованию. | Всё почтовый сервер готов к использованию. | ||
- | ===== 8. Настройка Roundcubemail ===== | ||
- | Скачиваем Roundcubemail | ||
- | |||
- | <code> | ||
- | cd /usr/src/ && wget http://ignum.dl.sourceforge.net/project/roundcubemail/roundcubemail/0.4.2/roundcubemail-0.4.2.tar.gz | ||
- | </code> | ||
- | |||
- | Распаковываем полученный архив | ||
- | |||
- | <code> | ||
- | tar xzf roundcubemail-0.4.2.tar.gz | ||
- | </code> | ||
- | |||
- | Перемещаем распакованные файлы | ||
- | |||
- | <code> | ||
- | mv roundcubemail-0.4.2 /var/www/roundcubemail | ||
- | </code> | ||
- | |||
- | Назначаем права | ||
- | |||
- | <code> | ||
- | chown -R root:root /var/www/roundcubemail | ||
- | chown -R :www-data /var/www/roundcubemail/logs | ||
- | chown -R :www-data /var/www/roundcubemail/temp | ||
- | chmod 775 /var/www/roundcubemail/logs | ||
- | chmod 775 /var/www/roundcubemail/temp | ||
- | </code> | ||
- | |||
- | Устанавливаем необходимые пакеты | ||
- | |||
- | <code> | ||
- | apt-get install php5-mcrypt | ||
- | </code> | ||
- | |||
- | Перезагружаем apache | ||
- | |||
- | <code> | ||
- | /etc/init.d/apache2 restart | ||
- | </code> | ||
- | |||
- | Создаём базу данных для roundcubemail | ||
- | |||
- | <code> | ||
- | mysql -u root -p | ||
- | |||
- | CREATE DATABASE roundcubemail; | ||
- | GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcube@localhost IDENTIFIED BY 'password'; | ||
- | |||
- | \q | ||
- | </code> | ||
- | |||
- | Открываем Roundcubemail в браузере | ||
- | <code> | ||
- | http://IP вашего сервера/roundcubemail/installer | ||
- | </code> | ||
- | и начинаем конфигурировать. | ||
- | |||
- | Жмём //START INSTALLATION// | ||
- | |||
- | Везде должно быть ОК кроме | ||
- | |||
- | <code> | ||
- | PostgreSQL: NOT AVAILABLE(Not installed) | ||
- | SQLite (v2): NOT AVAILABLE(Not installed) | ||
- | date.timezone: NOT OK(Could be set) | ||
- | </code> | ||
- | |||
- | Жмём //NEXT// и в появившейся странице выставляем следующие значения | ||
- | |||
- | **General configuration** | ||
- | <code> | ||
- | product_name = ваше значение | ||
- | </code> | ||
- | |||
- | **Database setup** | ||
- | <code> | ||
- | Database type = MySql | ||
- | Database server (omit for sqlite) = localhost | ||
- | Database name (use absolute path and filename for sqlite) = roundcubemail | ||
- | Database user name (needs write permissions)(omit for sqlite) = roundcube | ||
- | Database password (omit for sqlite) = password | ||
- | </code> | ||
- | |||
- | **IMAP Settings** | ||
- | <code> | ||
- | default_host = ssl://localhost | ||
- | default_port = 993 | ||
- | username_domain = example.com | ||
- | </code> | ||
- | |||
- | **SMTP Settings** | ||
- | <code> | ||
- | smtp_server = ssl://localhost | ||
- | smtp_port = 465 | ||
- | Use the current IMAP username and password for SMTP authentication = ставим галочку | ||
- | </code> | ||
- | |||
- | **Display settings & user prefs** | ||
- | <code> | ||
- | language * = ru_RU | ||
- | preview_pane * = ставим галочку | ||
- | htmleditor * = ставим галочку | ||
- | draft_autosave * = never | ||
- | </code> | ||
- | |||
- | Жмём //CREATE CONFIG// и скачиваем main.inc.php и db.inc.php после чего их необходимо поместить в /var/www/roundcubemail/config на сервере | ||
- | |||
- | Жмём //CONTINUE// | ||
- | |||
- | Видим следующее | ||
- | <code> | ||
- | DB Schema: NOT OK(Database not initialized) | ||
- | </code> | ||
- | Жмём //Initialize database// | ||
- | |||
- | Тестируем IMAP | ||
- | |||
- | **Test IMAP config** | ||
- | |||
- | Указываем Username и Password | ||
- | |||
- | Жмём //Check login// | ||
- | |||
- | Ответом должно быть | ||
- | <code> | ||
- | IMAP connect: OK(SORT capability: yes) | ||
- | </code> | ||
- | |||
- | SMTP протестировать не удалось так как не смотря указанный логи и пароль тест идёт от анонимного пользователя. Но при работе всё нормально. | ||
- | |||
- | Всё конфигурирование Roundcubemail завершено. | ||
- | |||
- | Можно зайти и посмотреть как всё работает, открываем в браузере | ||
- | <code> | ||
- | http://IP вашего сервера/roundcubemail | ||
- | </code> | ||
- | |||
- | Подключим два плагина, один для создания фильтров, второй для перемещения писем в папку спам. | ||
- | |||
- | Редактируем /var/www/roundcubemail/config/main.inc.php следующим образом | ||
- | |||
- | <code> | ||
- | $rcmail_config['plugins'] = array('managesieve', 'markasjunk'); | ||
- | </code> | ||
- | |||
- | Подключаем конфиг файл плагина managesieve | ||
- | |||
- | <code> | ||
- | cp /var/www/roundcubemail/plugins/managesieve/config.inc.php.dist /var/www/roundcubemail/plugins/managesieve/config.inc.php | ||
- | </code> | ||
- | |||
- | Всё плагины подключены. | ||
- | |||
- | Теперь подключим адресную книгу из LDAP. | ||
- | |||
- | Для этого устанавливаем необходимые пакеты | ||
- | <code> | ||
- | apt-get install php5-ldap | ||
- | </code> | ||
- | и редактируем /var/www/roundcubemail/config/main.inc.php | ||
- | |||
- | Находим в нём раздел | ||
- | <code> | ||
- | // ---------------------------------- | ||
- | // ADDRESSBOOK SETTINGS | ||
- | // ---------------------------------- | ||
- | </code> | ||
- | и приводим его к следующему виду | ||
- | |||
- | <code php> | ||
- | // This indicates which type of address book to use. Possible choises: | ||
- | // 'sql' (default) and 'ldap'. | ||
- | // If set to 'ldap' then it will look at using the first writable LDAP | ||
- | // address book as the primary address book and it will not display the | ||
- | // SQL address book in the 'Address Book' view. | ||
- | $rcmail_config['address_book_type'] = 'sql'; | ||
- | |||
- | // In order to enable public ldap search, configure an array like the Verisign | ||
- | // example further below. if you would like to test, simply uncomment the example. | ||
- | //$rcmail_config['ldap_public'] = array(); | ||
- | |||
- | // | ||
- | // If you are going to use LDAP for individual address books, you will need to | ||
- | // set 'user_specific' to true and use the variables to generate the appropriate DNs to access it. | ||
- | // | ||
- | // The recommended directory structure for LDAP is to store all the address book entries | ||
- | // under the users main entry, e.g.: | ||
- | // | ||
- | // o=root | ||
- | // ou=people | ||
- | // uid=user@domain | ||
- | // mail=contact@contactdomain | ||
- | // | ||
- | // So the base_dn would be uid=%fu,ou=people,o=root | ||
- | // The bind_dn would be the same as based_dn or some super user login. | ||
- | /* | ||
- | * example config for Verisign directory | ||
- | * | ||
- | */ | ||
- | $rcmail_config['ldap_public']['Example'] = array( | ||
- | 'name' => 'Example', | ||
- | // Replacement variables supported in host names: | ||
- | // %h - user's IMAP hostname | ||
- | // %n - http hostname ($_SERVER['SERVER_NAME']) | ||
- | // %d - domain (http hostname without the first part) | ||
- | // For example %n = mail.domain.tld, %d = domain.tld | ||
- | 'hosts' => array('ldap.example.com'), | ||
- | 'port' => 389, | ||
- | 'use_tls' => true, | ||
- | 'user_specific' => false, // If true the base_dn, bind_dn and bind_pass default to the user's IMAP login. | ||
- | // %fu - The full username provided, assumes the username is an email | ||
- | // address, uses the username_domain value if not an email address. | ||
- | // %u - The username prior to the '@'. | ||
- | // %d - The domain name after the '@'. | ||
- | // %dc - The domain name hierarchal string e.g. "dc=test,dc=domain,dc=com" | ||
- | 'base_dn' => 'ou=Users,dc=example,dc=com', | ||
- | 'bind_dn' => 'cn=admin,dc=example,dc=com', | ||
- | 'bind_pass' => 'secret', | ||
- | 'writable' => false, // Indicates if we can write to the LDAP directory or not. | ||
- | // If writable is true then these fields need to be populated: | ||
- | // LDAP_Object_Classes, required_fields, LDAP_rdn | ||
- | 'LDAP_Object_Classes' => array("top", "inetOrgPerson"), // To create a new contact these are the object classes to specify (or any other classes you wish to use). | ||
- | 'required_fields' => array("cn", "sn", "mail"), // The required fields needed to build a new contact as required by the object classes (can include additional fields not required by the object classes). | ||
- | 'LDAP_rdn' => 'mail', // The RDN field that is used for new entries, this field needs to be one of the search_fields, the base of base_dn is appended to the RDN to insert into the LDAP directory. | ||
- | 'ldap_version' => 3, // using LDAPv3 | ||
- | 'search_fields' => array('mail', 'cn'), // fields to search in | ||
- | 'name_field' => 'cn', // this field represents the contact's name | ||
- | 'email_field' => 'mail', // this field represents the contact's e-mail | ||
- | 'surname_field' => 'sn', // this field represents the contact's last name | ||
- | 'firstname_field' => 'gn', // this field represents the contact's first name | ||
- | 'sort' => 'cn', // The field to sort the listing by. | ||
- | 'scope' => 'sub', // search mode: sub|base|list | ||
- | 'filter' => '(&(mail=*))', // used for basic listing (if not empty) and will be &'d with search queries. example: status=act | ||
- | 'fuzzy_search' => true, // server allows wildcard search | ||
- | 'sizelimit' => '0', // Enables you to limit the count of entries fetched. Setting this to 0 means no limit. | ||
- | 'timelimit' => '0', // Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit. | ||
- | ); | ||
- | // An ordered array of the ids of the addressbooks that should be searched | ||
- | // when populating address autocomplete fields server-side. ex: array('sql','Verisign'); | ||
- | $rcmail_config['autocomplete_addressbooks'] = array('sql','Example'); | ||
- | </code> | ||
- | |||
- | Теперь в roundcube, в разделе Контакты должна быть доступна адресная книга Example с пользователями из LDAP | ||
- | |||
- | Как добавить другие параметры из LDAP читайте [[http://diff.org.ua/archives/553|здесь]]. | ||
**P.S.** Лично мне не удобно использовать в качестве логина email пользователя. Мой почтовый сервер обслуживает один домен, поэтому я немного модифицировал запрос получения пароля из ldap в dovecot-ldap.conf, изменив в нём одну строку с | **P.S.** Лично мне не удобно использовать в качестве логина email пользователя. Мой почтовый сервер обслуживает один домен, поэтому я немного модифицировал запрос получения пароля из ldap в dovecot-ldap.conf, изменив в нём одну строку с | ||
Строка 1084: | Строка 833: | ||
<note warning>ВНИМАНИЕ!!! Данный вариант работает только если ваш сервер обслуживает один домен, на серверах где больше одного домена не тестировалось, скорей всего работать не будет так как на разных доменах могут быть одинаковые пользователи.</note> | <note warning>ВНИМАНИЕ!!! Данный вариант работает только если ваш сервер обслуживает один домен, на серверах где больше одного домена не тестировалось, скорей всего работать не будет так как на разных доменах могут быть одинаковые пользователи.</note> | ||
- | Итак почтовый сервер настроен и работает, хотелось бы чтоб почта приходящая на него проверялась на наличие вирусов и на спам. Для решения этой задачи существует множество способов, лично мне в качестве спам фильтра больше нравится Dspam, но возможности amavisd-new меня тоже устраивают, поэтому в следующей статье я попробую скрестить Dspam, Amavisd-new и ClamAV 8-) | + | Итак почтовый сервер настроен и работает, хотелось бы чтоб почта приходящая на него проверялась на наличие вирусов и на спам. Для решения этой задачи существует множество способов, лично мне в качестве спам фильтра больше нравится Dspam, но возможности amavisd-new меня тоже устраивают, поэтому в [[http://help.ubuntu.ru/wiki/amavis_clamav_dspam_ubuntu_10_04|следующей]] статье я попробую скрестить Dspam, Amavisd-new и ClamAV 8-) |
+ | |||
+ | Обсудить данную статью можно на [[http://forum.ubuntu.ru/index.php?topic=123588.0|форуме]]. | ||
- | ===== 9. Материалы используемые при написании данной статьи ===== | + | ===== 8. Материалы используемые при написании данной статьи ===== |
https://oss.gonicus.de/labs/gosa/wiki/PluginInstallationMailPostfix | https://oss.gonicus.de/labs/gosa/wiki/PluginInstallationMailPostfix | ||
Строка 1134: | Строка 885: | ||
http://daevy.uzps.mh.ru/?p=342 | http://daevy.uzps.mh.ru/?p=342 | ||
- | http://blogs.ungrund.org/xio/2008/08/13/roundcube-on-debian-testing/ | + | ===== 9. Статьи по теме ===== |
- | http://muff.kiev.ua/content/roundcube-webmail-eshche-odin-pochtovyi-veb-interfeis | + | [[http://help.ubuntu.ru/wiki/samba_pdc_ldap_ubuntu_10_04|Настройка Samba 3 (PDC) + OpenLDAP 2.4 + Gosa 2.6 на базе Ubuntu 10.04 server]] |
- | http://trac.roundcube.net/wiki/Howto_Install | + | [[http://help.ubuntu.ru/wiki/amavis_clamav_dspam_ubuntu_10_04|Настройка Amavisd-new + ClamAV + Dspam]] |
- | http://trac.roundcube.net/wiki | + | [[http://help.ubuntu.ru/wiki/roundcubemail_ubuntu_10_04|Настройка Roundcubemail c адресной книгой в LDAP]] |
- | http://roundcube.net/ | + | [[http://help.ubuntu.ru/wiki/samba_bdc_ldap_ubuntu_10_04|Настройка сервера Ubuntu 10.04 Samba 3 (BDC) + OpenLDAP 2.4 (Slave) + PhpLdapAdmin 1.2.0.5]] |
- | {{tag>postfix dovecot roundcubemail server 10.04 ldap NEW Можно_улучшить HOWTO}} | + | {{tag>postfix dovecot server 10.04 ldap NEW Можно_улучшить HOWTO}} |