с заменой courier-imap на Dovecot, плюс добавление Roundcube.
Начнем
Код: Выделить всё
#uname -a
FreeBSD mail.domen.net 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri Feb 5 11:19:20 EET 2010 root@mail.domen.net:/usr/obj/usr/src/sys/n_kernel1 i386
Код: Выделить всё
#courier_authdaemond_enable="YES"
#courier_imap_pop3d_enable="YES"
#postfix_enable="YES"
собираем dovecot
Код: Выделить всё
make config
[X] KQUEUE kqueue(2) support
[X] SSL SSL support
[X] POP3 POP3 support
[X] LDA LDA support
[X] MYSQL MySQL support
Код: Выделить всё
#cd /usr/ports/mail/dovecot
#make install clean
Код: Выделить всё
base_dir = /var/run/dovecot/
listen = *
disable_plaintext_auth = no
log_path = /var/log/dovecot.log
info_log_path = /var/log/dovecot_inf.log
log_timestamp = "%b %d %H:%M:%S "
ssl_disable = yes
mail_location = maildir:/var/spool/mail/%d/%n
mail_privileged_group = mail
mail_debug = yes
mail_log_prefix = "%Us(%u): "
mail_log_max_lines_per_sec = 10
dotlock_use_excl = yes
verbose_proctitle = yes
first_valid_gid = 65534
last_valid_gid = 65534
maildir_copy_with_hardlinks = yes
ssl_disable = yes
protocol imap {
login_greeting_capability = yes
imap_client_workarounds = delay-newmail netscape-eoh tb-extra-mailbox-sep
}
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}
protocol lda {
postmaster_address = postmaster@domain.loc
sendmail_path = /usr/sbin/sendmail
}
auth_username_format = %Lu
auth_verbose = yes
auth_debug = yes
auth_debug_passwords = yes
auth default {
mechanisms = plain login cram-md5 digest-md5
passdb sql {
args = /usr/local/etc/dovecot-sql.conf
}
userdb sql {
args = /usr/local/etc/dovecot-sql.conf
}
user = nobody
socket listen {
master {
path = /var/run/dovecot/auth-master
mode = 0666
}
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}
dict {
}
plugin {
quota = maildir:User quota
quota_rule = *:storage=20MB
quota_rule2 = Trash:storage=20MB
quota_rule3 = Spam:storage=10MB
trash = /usr/local/etc/dovecot-trash.conf
expire = Trash 7 Spam 30
}
first_valid_uid = 65534
last_valid_uid = 65534
# cat dovecot-sql.conf | grep -v # | grep -v ^$
Код: Выделить всё
driver = mysql
connect = host=localhost dbname=postfix user=postfix password=postfix_passw
default_pass_scheme = CRAM-MD5
password_query = SELECT username AS user, password FROM mailbox WHERE username = '%u' AND
domain = '%d'
user_query = SELECT maildir, 65534 AS uid, 65534 AS gid FROM mailbox WHERE username = '%u'
AND domain = '%d'
#
Код: Выделить всё
#dovecot -n
добавляем в rc.conf
Код: Выделить всё
echo "dovecot_enable=YES" >> /etc/rc.conf
Код: Выделить всё
#touch /var/log/dovecot.log
#touch /var/log/dovecot_inf.log
# chown -R nobody:nobody /var/log/dovecot.log
# chmod 440 /var/log/dovecot.log
Код: Выделить всё
#cd /usr/ports/mail/postfix/
#make deinstall clean
Код: Выделить всё
[X] PCRE Perl Compatible Regular Expressions
[X] SASL2 Cyrus SASLv2 (Simple Auth. and Sec. Layer)
[X] DOVECOT Dovecot SASL authentication method
[X] TLS Enable SSL and TLS support
[X] MYSQL MySQL maps (choose version with WITH_MYSQL_VER)
[X] VDA VDA (Virtual Delivery Agent)
Код: Выделить всё
#make install clean
# cat main.cf | grep -v # | grep -v ^$
Код: Выделить всё
mailbox_size_limit = 102400000
message_size_limit = 10240000
queue_directory = /var/spool/postfix
command_directory = /usr/local/sbin
base = /usr/local/etc/postfix
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix
mail_owner = postfix
default_privs = nobody
myhostname = mail.domain.net
mydomain = domain.net
myorigin = $myhostname
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
local_recipient_maps = unix:passwd.byname $alias_maps
unknown_local_recipient_reject_code = 550
mynetworks_style = host
mynetworks = 192.168.0.0/24, 127.0.0.0/8
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
smtpd_banner = $myhostname ESMTP $mail_name
local_destination_concurrency_limit = 2
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
unverified_sender_reject_code = 550
smtpd_helo_required = yes
smtp_always_send_ehlo = yes
smtpd_hard_error_limit = 8
dovecot_destination_recipient_limit = 1
virtual_transport = dovecot
virtual_alias_maps = mysql:$base/mysqlLookupMaps/alias.conf
virtual_mailbox_domains = mysql:$base/mysqlLookupMaps/domain.conf
virtual_mailbox_maps = mysql:$base/mysqlLookupMaps/mailbox.conf
virtual_mailbox_base = /var/spool/mail
virtual_minimum_uid = 65534
virtual_uid_maps = static:65534
virtual_gid_maps = static:65534
smtpd_sasl_auth_enable = yes
smtpd_sasl_exceptions_networks = $mynetworks
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_recipient_restrictions =
permit_mynetworks
permit_sasl_authenticated
reject_unauth_destination
manpage_directory = /usr/local/man
sample_directory = /usr/local/etc/postfix
readme_directory = no
html_directory = no
setgid_group = maildrop
newaliases_path = /usr/local/bin/newaliases
mailq_path = /usr/local/bin/mailq
#
Код: Выделить всё
# cat master.cf | grep -v # | grep -v ^$
smtp inet n - n - - smtpd
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
-o smtp_fallback_relay=
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
dovecot unix - n n - - pipe flags=DRhu user=nobody:nobody argv=/usr/local/libexec/dovecot/deliver -f ${sender} -d ${recipient}
#
Код: Выделить всё
# mkdir /var/spool/mail
# chown nobody:nobody /var/spool/mail/
# chmod 740 /var/spool/mail/
Код: Выделить всё
# cat /etc/rc.conf | grep sendmail
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
Код: Выделить всё
# touch /etc/periodic.conf
# cat /etc/periodic.conf
daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"
Код: Выделить всё
#/usr/local/etc/postfix start
#echo "postfix_enable=YES" >>/etc/rc.conf
устанавливаем и настраиваем postfixadmin
#make config
Код: Выделить всё
[X] MYSQL MySQL back-end (use mysql PHP extension)
[X] MYSQLI MySQL 4.1+ back-end (use mysqli PHP extension)
Код: Выделить всё
<VirtualHost *:80>
ServerAdmin postmaster@domen.net
DocumentRoot /usr/local/www/postfixadmin
ServerName postadmin.domen.net
<Directory /usr/local/www/postfixadmin>
AllowOverride All
</Directory>
</VirtualHost>
# chown -R www:www /usr/local/www/postfixadmin/
# chmod 440 /usr/local/www/postfixadmin/*.php
редактируем config.inc.php
Код: Выделить всё
<?php
if (ereg ("config.inc.php", $_SERVER['PHP_SELF']))
{
header ("Location: login.php");
exit;
}
$CONF['configured'] = true;
$CONF['postfix_admin_url'] = 'http://postfadmin.domen.net';
$CONF['postfix_admin_path'] = '/usr/local/www/postfixadmin/';
$CONF['default_language'] = 'ru';
$CONF['database_type'] = 'mysqli';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = 'passw_v_otkr_vide';
$CONF['database_name'] = 'postfix';
$CONF['database_prefix'] = '';
$CONF['database_prefix'] = '';
$CONF['database_tables'] = array (
'admin' => 'admin',
'alias' => 'alias',
'alias_domain' => 'alias_domain',
'config' => 'config',
'domain' => 'domain',
'domain_admins' => 'domain_admins',
'fetchmail' => 'fetchmail',
'log' => 'log',
'mailbox' => 'mailbox',
'vacation' => 'vacation',
'vacation_notification' => 'vacation_notification',
'quota' => 'quota',
'quota2' => 'quota2',
);
$CONF['admin_email'] = 'postmaster@domain.net';
$CONF['smtp_server'] = 'localhost';
$CONF['smtp_port'] = '25';
$CONF['encrypt'] = 'md5crypt';
$CONF['authlib_default_flavor'] = 'md5raw';
$CONF['dovecotpw'] = "/usr/sbin/dovecotpw";
$CONF['min_password_length'] = 5;
$CONF['generate_password'] = 'NO';
$CONF['show_password'] = 'NO';
$CONF['page_size'] = '20';
$CONF['default_aliases'] = array (
'abuse' => 'abuse@domain.net',
'hostmaster' => 'hostmaster@domain.net',
'postmaster' => 'postmaster@domain.net',
'webmaster' => 'webmaster@domain.net'
);
$CONF['domain_path'] = 'YES';
$CONF['domain_in_mailbox'] = 'YES';
$CONF['aliases'] = '10';
$CONF['mailboxes'] = '50';
$CONF['maxquota'] = '10';
$CONF['quota'] = 'YES';
$CONF['quota_multiplier'] = '1024000';
$CONF['transport'] = 'NO';
$CONF['transport_options'] = array (
'virtual', // for virtual accounts
'local', // for system accounts
'relay' // for backup mx
);
$CONF['transport_default'] = 'virtual';
$CONF['vacation'] = 'NO';
$CONF['vacation_domain'] = 'autoreply.domain.net';
$CONF['vacation_control'] ='YES';
$CONF['vacation_control_admin'] = 'YES';
$CONF['alias_control'] = 'YES';
$CONF['alias_control_admin'] = 'YES';
$CONF['special_alias_control'] = 'YES';
$CONF['alias_goto_limit'] = '0';
$CONF['alias_domain'] = 'YES';
$CONF['backup'] = 'YES';
$CONF['sendmail'] = 'NO';
$CONF['logging'] = 'YES';
$CONF['fetchmail'] = 'YES';
$CONF['fetchmail_extra_options'] = 'YES';
$CONF['show_header_text'] = 'NO';
$CONF['header_text'] = ':: Postfix Admin ::';
$CONF['user_footer_link'] = "http://postfadmin.domen.net";
$CONF['show_footer_text'] = 'YES';
$CONF['footer_text'] = 'Вернуться на главную страницу';
$CONF['footer_link'] = 'http://postfadmin.domen.net';
$CONF['welcome_text'] = <<<EOM
Добро пожаловать в новый аккаунт!
Системный администратор.
EOM;
$CONF['emailcheck_resolve_domain']='NO';
$CONF['show_status']='YES';
$CONF['show_status_key']='NO';
$CONF['show_status_text']=' ';
$CONF['show_undeliverable']='YES';
$CONF['show_undeliverable_color']='tomato';
//$CONF['show_undeliverable_exceptions']=array("unixmail.domain.ext","exchangeserver.domain.ex
t","gmail.com");
$CONF['show_popimap']='NO';
$CONF['show_popimap_color']='darkgrey';
$CONF['show_custom_count']=2;
//$CONF['show_custom_domains']=array("subdomain.domain.ext","domain2.ext");
$CONF['show_custom_colors']=array("lightgreen","lightblue");
$CONF['recipient_delimiter'] = "";
$CONF['create_mailbox_subdirs_prefix']='INBOX.';
$CONF['used_quotas'] = 'YES';
$CONF['new_quota_table'] = 'NO';
$CONF['theme_logo'] = 'images/logo-default.png';
$CONF['theme_css'] = 'css/default.css';
$CONF['xmlrpc_enabled'] = false;
if (file_exists(dirname(__FILE__) . '/config.local.php')) { # for /
include(dirname(__FILE__) . '/config.local.php');
}
#
Код: Выделить всё
#rm /usr/local/www/postfixadmin/setup.php
Код: Выделить всё
# cd /usr/ports/mail/roundcube/
#make config
[X] MYSQL Use MySQL backend
[X] SSL Enable SSL support (imaps or google spellcheck) -это на потом
# make install clean
Код: Выделить всё
<VirtualHost *:80>
ServerAdmin admin@domen.net
DocumentRoot /usr/local/www/roundcube/
ServerName mail.domen.net
</VirtualHost>
Код: Выделить всё
#cd /usr/local/www/roundcube/config
# cat main.inc.php | grep -v ^// | grep -v ^$
<?php
$rcmail_config = array();
$rcmail_config['debug_level'] = 1;
$rcmail_config['log_driver'] = 'file';
$rcmail_config['syslog_id'] = 'roundcube';
$rcmail_config['syslog_facility'] = LOG_USER;
$rcmail_config['log_dir'] = 'logs/';
$rcmail_config['temp_dir'] = 'temp/';
$rcmail_config['enable_caching'] = TRUE;
$rcmail_config['message_cache_lifetime'] = '10d';
$rcmail_config['auto_create_user'] = TRUE;
$rcmail_config['default_host'] = '';
$rcmail_config['default_port'] = 143;
$rcmail_config['imap_auth_type'] = null;
$rcmail_config['imap_root'] = null;
$rcmail_config['imap_delimiter'] = null;
$rcmail_config['username_domain'] = '';
$rcmail_config['mail_domain'] = '';
$rcmail_config['virtuser_file'] = '';
$rcmail_config['virtuser_query'] = '';
$rcmail_config['smtp_server'] = '';
$rcmail_config['smtp_port'] = 25;
$rcmail_config['smtp_user'] = '';
$rcmail_config['smtp_pass'] = '';
$rcmail_config['smtp_auth_type'] = '';
$rcmail_config['smtp_helo_host'] = '';
$rcmail_config['smtp_log'] = TRUE;
$rcmail_config['sendmail_delay'] = 0;
$rcmail_config['list_cols'] = array('subject', 'from', 'date', 'size', 'flag',
'attachment');
$rcmail_config['skin_include_php'] = FALSE;
$rcmail_config['session_lifetime'] = 10;
$rcmail_config['ip_check'] = false;
$rcmail_config['double_auth'] = false;
$rcmail_config['des_key'] = 'rcmail-!24ByteDESkey*Str';
$rcmail_config['language'] = null;
$rcmail_config['date_short'] = 'D H:i';
$rcmail_config['date_long'] = 'd.m.Y H:i';
$rcmail_config['date_today'] = 'H:i';
$rcmail_config['useragent'] = 'RoundCube Webmail/0.2.1';
$rcmail_config['product_name'] = 'RoundCube Webmail';
$rcmail_config['drafts_mbox'] = 'Drafts';
$rcmail_config['junk_mbox'] = 'Junk';
$rcmail_config['sent_mbox'] = 'Sent';
$rcmail_config['trash_mbox'] = 'Trash';
$rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash');
$rcmail_config['create_default_folders'] = FALSE;
$rcmail_config['protect_default_folders'] = TRUE;
$rcmail_config['quota_zero_as_unlimited'] = FALSE;
$rcmail_config['mdn_requests'] = 0;
$rcmail_config['default_charset'] = 'ISO-8859-1';
$rcmail_config['enable_spellcheck'] = TRUE;
$rcmail_config['spellcheck_engine'] = 'googie';
$rcmail_config['spellcheck_uri'] = '';
$rcmail_config['spellcheck_languages'] = NULL;
$rcmail_config['generic_message_footer'] = '';
$rcmail_config['http_received_header'] = false;
$rcmail_config['mail_header_delimiter'] = NULL;
$rcmail_config['session_domain'] = '';
$rcmail_config['address_book_type'] = 'sql';
$rcmail_config['ldap_public'] = array();
$rcmail_config['autocomplete_addressbooks'] = array('sql');
$rcmail_config['dont_override'] = array();
$rcmail_config['identities_level'] = 0;
$rcmail_config['include_host_config'] = false;
$rcmail_config['max_pagesize'] = 200;
$rcmail_config['mime_magic'] = '/usr/share/misc/magic';
$rcmail_config['message_sort_col'] = 'date';
$rcmail_config['message_sort_order'] = 'DESC';
$rcmail_config['enable_installer'] = false;
$rcmail_config['log_logins'] = false;
$rcmail_config['delete_always'] = false;
$rcmail_config['min_keep_alive'] = 60;
$rcmail_config['skin'] = 'default';
$rcmail_config['pagesize'] = 40;
$rcmail_config['timezone'] = 'auto';
$rcmail_config['dst_active'] = (bool)date('I');
$rcmail_config['prefer_html'] = TRUE;
$rcmail_config['show_images'] = 0;
$rcmail_config['htmleditor'] = FALSE;
$rcmail_config['prettydate'] = TRUE;
$rcmail_config['draft_autosave'] = 300;
$rcmail_config['preview_pane'] = FALSE;
$rcmail_config['focus_on_new_message'] = true;
$rcmail_config['logout_purge'] = FALSE;
$rcmail_config['logout_expunge'] = FALSE;
$rcmail_config['inline_images'] = TRUE;
$rcmail_config['mime_param_folding'] = 0;
$rcmail_config['skip_deleted'] = FALSE;
$rcmail_config['read_when_deleted'] = TRUE;
$rcmail_config['flag_for_deletion'] = FALSE;
$rcmail_config['keep_alive'] = 60;
$rcmail_config['check_all_folders'] = FALSE;
?>