Апр 232013
 

likeunix.ru
Настраиваем постфикс.
Полное описание параметров почтового сервера тут смотреть.Описания параметров Postfix

# cat /usr/local/etc/postfix/main.cf
biff = no
append_dot_mydomain = no
readme_directory = /usr/local/share/doc/postfix
queue_directory = /var/spool/postfix
command_directory = /usr/local/sbin
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mail_owner = postfix
unknown_local_recipient_reject_code = 550
myhostname = mail.local.loca
mydomain = local.loca
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 127.0.0.0/8
local_recipient_maps = unix:passwd.byname $alias_maps
#recipient_delimiter = +
inet_interfaces = all
debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/local/sbin/sendmail
newaliases_path = /usr/local/bin/newaliases
mailq_path = /usr/local/bin/mailq
setgid_group = maildrop
html_directory = /usr/local/share/doc/postfix
manpage_directory = /usr/local/man
sample_directory = /usr/local/etc/postfix
readme_directory = /usr/local/share/doc/postfix
inet_protocols = ipv4
virtual_mailbox_domains = local.loca
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_maps = hash:/usr/local/etc/postfix/vmailbox
virtual_alias_maps = hash:/usr/local/etc/postfix/virtual
virtual_mailbox_limit = 310000000
mail_spool_directory = /var/spool/mail
virtual_mailbox_base = /var/spool/mail
#virtual_mailbox_base = /var/spool/mail
#mail_spool_directory = /var/spool/mail
relay_domains = $mydestination, $virtual_mailbox_domain
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
broken_sasl_auth_clients = yes
smtpd_client_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_pipelining,permit
smtpd_helo_restrictions = permit
smtpd_sender_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_non_fqdn_sender,reject_unknown_sender_domain,reject_unverified_sender,permit
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_non_fqdn_recipient,reject_unauth_destination,reject_unknown_recipient_domain,reject_unverified_recipient,permit
smtpd_data_restrictions = permit
smtpd_end_of_data_restrictions = permit
smtpd_etrn_restrictions = permit
smtp_use_tls = no
smtpd_use_tls = yes
smtpd_tls_auth_only = no
smtpd_tls_key_file = /etc/ssl/dovecot/key.pem
smtpd_tls_cert_file = /etc/ssl/dovecot/cert.pem
smtpd_tls_session_cache_database = btree:/usr/local/etc/postfix/tls_smtpd_scache
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes

Добавим такую строку.

# cat /usr/local/etc/postfix/master.cf | grep -v # | grep dovecot
dovecot unix  - n n -  -  pipe flags=DRhu user=virtual:virtual argv=/usr/local/libexec/dovecot/deliver -d ${recipient}

Укажим постфиксу куда складывать почту.

# cat /usr/local/etc/postfix/vmailbox
admin@local.loca local.loca/admin/

Настраиваем Dovecot

# cat /usr/local/etc/dovecot.conf
protocols = pop3 pop3s lmtp
ssl_cert_file = /etc/ssl/dovecot/cert.pem
ssl_key_file = /etc/ssl/dovecot/key.pem
mail_location = maildir:/var/spool/mail/%d/%n
disable_plaintext_auth = no
shutdown_clients = yes
log_path = /var/log/dovecot
mail_debug = yes
auth_verbose = yes
auth_debug = yes
auth_debug_passwords = yes
dotlock_use_excl = yes
verbose_proctitle = yes
first_valid_uid = 5000
first_valid_gid = 5000
protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}
protocol managesieve {
}
auth_username_format = %Lu
auth default {
mechanisms = plain login cram-md5 digest-md5
userdb passwd-file {
args = /usr/local/etc/dovecot/users
}
passdb passwd-file {
args = /usr/local/etc/dovecot/passwd
}
user = root
socket listen {
master {
path = /var/run/dovecot/auth-master
mode = 0600
user = virtual
}
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}
dict {
}
plugin {
}

Настроим пользователя и пароль к нему.

# cat /usr/local/etc/dovecot/users
admin@local.loca::5000:5000::/var/spool/mail/local.loca:/bin/false::

Создадим пароль для пользователя.

# dovecotpw -s CRAM-MD5 -u admin@local.loca
{CRAM-MD5}f2794daaa11b26fa36889763ef9f4f0m1d727d5eb1
# cat /usr/local/etc/dovecot/passwd 
admin@local.loca:{CRAM-MD5}f2794daaa11b26fa36889763ef9f4f0m1d727d5eb1:5000:5000

Осталось создать директорию для почты и дать на нее права.

# mkdir /var/spool/mail/local.loca

Теперь создаим пользака virtual и группу такуюже.
Создаем группу.

# pw pw group add virtual -g 5000

Создадим пользователя.

# pw useradd -u 5000 -g 5000 virtual -G virtual -s /bin/tcsh

Дадим права на эту диру.
Ну вот и все.
осталось прописать mx запись на домене и запустить сервисы.

 Leave a Reply

(required)

(required)

38 Запросов к базе. 0,359 Генерации страницы, 36MB Использование памяти.
Вы зашли с IP: 54.198.210.67