Courier - настройка: различия между версиями
imported>Vix Нет описания правки |
imported>Vix Нет описания правки |
||
Строка 43: | Строка 43: | ||
makeuserdb; | makeuserdb; | ||
'''authpostgresql''' или настройка на postgresql | |||
The authpostgresql module integrates with the PostgreSQL database server to support many thousands of virtual mail users. | |||
Note: A fully configured and running PostgreSQL instance is assumed. | |||
Information for valid email addresses, their associated passwords and maildir locations is stored in a database table. First, an os user should be created to seperate the mail user database from other information kept in the db. A directory should be created for the courier schemas files to live. | |||
# groupadd courierdb | |||
# useradd -g courierdb courierdb | |||
# mkdir /var/spool/courierdb | |||
# chown courierdb:courierdb /var/spool/courierdb | |||
Next, set up a database and table in Postgre: | |||
# psql -U postgres template1 ## Configure postgres | |||
= create user courierdb; | |||
= create database courierdb with owner courierdb; | |||
= \c courierdb courierdb | |||
> CREATE TABLE mail_users ( | |||
id serial NOT NULL, | |||
username character varying(64) NOT NULL, | |||
vhost character varying(64) NOT NULL, | |||
passwd character varying(64), | |||
maildir character varying(256), | |||
alias character varying(32) | |||
); | |||
> \q; | |||
Finally set up authentication rights for the courierdb user in Postgre. | |||
# editor pg_hba.conf; ## Add the following to the users list | |||
local courierdb courierdb trust | |||
Once the postgre user and password have been setup, courier just needs to be configured to use it. | |||
# editor authdaemonrc; ## Find and change the following | |||
authmodulelist="authpgsql" | |||
# /etc/init.d/courier-authdaemon restart; | |||
# editor authpgsqlrc | |||
PGSQL_HOST localhost | |||
PGSQL_PORT 5432 | |||
PGSQL_USERNAME courierdb | |||
PGSQL_PASSWORD # trusted | |||
PGSQL_DATABASE courierdb | |||
PGSQL_USER_TABLE mail_users | |||
PGSQL_CLEAR_PWFIELD passwd | |||
PGSQL_LOGIN_FIELD username || '@' || vhost | |||
** [http://www.daeglo.com/projects/couriermailserversetup использованы материалы от сюда...] | ** [http://www.daeglo.com/projects/couriermailserversetup использованы материалы от сюда...] | ||
** [http://dannorth.net/2007/09/09/virtual-mailboxes-with-courier-imap-and-postfix/ и от сюда...] | ** [http://dannorth.net/2007/09/09/virtual-mailboxes-with-courier-imap-and-postfix/ и от сюда...] |
Текущая версия от 00:20, 9 октября 2013
Статья создана ввиду отсутствия внятного описания настройки в Debian системы COURIER-POP3 вместе с POSTFIX
- перед тем как устанавливать и настраивать Courier рекомендуется прочесть настройку Postfix
- до начала данной установки уже должны быть установлены пакеты:
postfix mutt
и так начнем:
- устанавливаем необходимые пакеты:
# apt-get install courier-authdaemon courier-authlib-userdb courier-base courier-pop courier-authlib
- в /etc/courier/authdaemonrc - добавляем:
authmodulelist="authpam authuserdb"
- создаем папку для базы пользователей:
# mkdir /etc/courier/userdb && chmod 0700 /etc/courier/userdb;
- перезапускаем службу авторизации:
# /etc/init.d/courier-authdaemon restart;
- далее с помощью данного скрипта добавляем пользователей в базу почтового сервера:
#!/bin/bash # имя пользователя переданное скрипту типа: courier-adduser username usermail=$1 # переменная вашего почтового домена mailhost="mymailserver.ru" if [[ "$usermail" = '' ]]; then echo "не задано имя пользователя..." exit 0 fi mkdir -p /var/mail/$mailhost/$usermail@$mailhost; maildirmake /var/mail/$mailhost/$usermail@$mailhost/Maildir; chown -R 5000:5000 /var/mail/$mailhost/$usermail@$mailhost; userdb $mailhost/$usermail@$mailhost set home=/var/mail/$mailhost/$usermail uid=5000 gid=5000; userdbpw -md5| userdb $mailhost/$usermail@$mailhost set systempw; makeuserdb;
authpostgresql или настройка на postgresql
The authpostgresql module integrates with the PostgreSQL database server to support many thousands of virtual mail users.
Note: A fully configured and running PostgreSQL instance is assumed.
Information for valid email addresses, their associated passwords and maildir locations is stored in a database table. First, an os user should be created to seperate the mail user database from other information kept in the db. A directory should be created for the courier schemas files to live.
# groupadd courierdb # useradd -g courierdb courierdb # mkdir /var/spool/courierdb # chown courierdb:courierdb /var/spool/courierdb
Next, set up a database and table in Postgre:
# psql -U postgres template1 ## Configure postgres = create user courierdb; = create database courierdb with owner courierdb; = \c courierdb courierdb > CREATE TABLE mail_users ( id serial NOT NULL, username character varying(64) NOT NULL, vhost character varying(64) NOT NULL, passwd character varying(64), maildir character varying(256), alias character varying(32) ); > \q;
Finally set up authentication rights for the courierdb user in Postgre.
# editor pg_hba.conf; ## Add the following to the users list local courierdb courierdb trust
Once the postgre user and password have been setup, courier just needs to be configured to use it.
# editor authdaemonrc; ## Find and change the following authmodulelist="authpgsql" # /etc/init.d/courier-authdaemon restart; # editor authpgsqlrc PGSQL_HOST localhost PGSQL_PORT 5432 PGSQL_USERNAME courierdb PGSQL_PASSWORD # trusted PGSQL_DATABASE courierdb PGSQL_USER_TABLE mail_users PGSQL_CLEAR_PWFIELD passwd PGSQL_LOGIN_FIELD username || '@' || vhost