Wydrukuj tę dokumentację Pokaż jako slajdy

Instalacja roundcube

Panel webowy roundcube zapewnia wygodny dostęp do poczty. Co najważniejsze, w przeciwieństwie do wiewiórki nie ma problemu z obsługą ISO-8859-2.

Instalację najlepiej wykonać za pomocą własnego repozytorium pakietów

pkg install -y mail/roundcube

# opcjonalnie instalacja pluginów:
#
pkg install -y mail/roundcube-sieverules

Konfiguracja roundcube

Konfiguracja to głównie poprawki dla plików konfiguracyjnych. Wszystkie poniższe poprawki zostały wykonane z głównego drzewa instalacyjnego.

Wygenerowanie klucza na potrzeby sesji

Klucz 24 znaków do wpisania do pliku konfiguracyjnego

apg -a 0 -M NCL -n 15 -x 24 -m 24

Skopiowanie plików konfiguracyjnych przed uruchomieniem łatania

# główny plik konfiguracyjny
#
cp -p /usr/local/www/roundcube/config/config.inc.php.sample /usr/local/www/roundcube/config/config.inc.php

# konfiguracja sieverules
#
cp -p /usr/local/www/roundcube/plugins/managesieve/config.inc.php.dist /usr/local/www/roundcube/plugins/managesieve/config.inc.php

# konfiguracja zmiany hasła
#
cp -p /usr/local/www/roundcube/plugins/password/config.inc.php.dist /usr/local/www/roundcube/plugins/password/config.inc.php

Ustawienia domyślne konfiguracji

Ustawienia domyślne konfiguracji są zapisane w pliku /usr/local/www/roundcube/config/defaults.inc.php. Jest on w razie czego źródłem wszelkich ustawień konfiguracyjnych.

/!\ UWAGA!!! smtp_host ma dodany tls://, co oznacza, że w konfiguracji postfix-a musi by/c stosowny certyfikat, który obsłuży nazwę podaną w certyfikacie.

config/config.inc.php

--- /usr/local/www/roundcube/config/config.inc.php      2016-05-22 13:06:45.000000000 +0200
+++ /usr/local/www/roundcube/config/config.inc.php.new  2016-09-10 23:50:24.111625000 +0200
@@ -25,7 +25,7 @@ $config = array();
 // For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
 // NOTE: for SQLite use absolute path (Linux): 'sqlite:////full/path/to/sqlite.db?mode=0646'
 //       or (Windows): 'sqlite:///C:/full/path/to/sqlite.db'
-$config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
+$config['db_dsnw'] = 'pgsql://__user__:__haslo_do_zmiany__@localhost/roundcubemail';

 // The mail host chosen to perform the log-in.
 // Leave blank to show a textbox at login, give a list of hosts
@@ -37,7 +37,7 @@ $config['db_dsnw'] = 'mysql://roundcube:
 // %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
 // %s - domain name after the '@' from e-mail address provided at login screen
 // For example %n = mail.domain.tld, %t = domain.tld
-$config['default_host'] = 'localhost';
+$config['default_host'] = 'localhost.bsdserwis.com';

 // SMTP server host (for sending mails).
 // To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
@@ -49,38 +49,65 @@ $config['default_host'] = 'localhost';
 // %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
 // %z - IMAP domain (IMAP hostname without the first part)
 // For example %n = mail.domain.tld, %t = domain.tld
-$config['smtp_server'] = '';
+$config['smtp_server'] = 'tls://localhost.bsdserwis.com';

 // SMTP port (default is 25; use 587 for STARTTLS or 465 for the
 // deprecated SSL over SMTP (aka SMTPS))
-$config['smtp_port'] = 25;
+$config['smtp_port'] = 587;

 // SMTP username (if required) if you use %u as the username Roundcube
 // will use the current username for login
-$config['smtp_user'] = '';
+$config['smtp_user'] = '%u';

 // SMTP password (if required) if you use %p as the password Roundcube
 // will use the current user's password for login
-$config['smtp_pass'] = '';
+$config['smtp_pass'] = '%p';

 // provide an URL where a user can get support for this Roundcube installation
 // PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
 $config['support_url'] = '';

 // Name your service. This is displayed on the login screen and in the window title
-$config['product_name'] = 'Roundcube Webmail';
+$config['product_name'] = '__Nazwa firmy uzywajacej webmaila__';

 // this key is used to encrypt the users imap password which is stored
 // in the session record (and the client cookie if remember password is enabled).
 // please provide a string of exactly 24 chars.
 // YOUR KEY MUST BE DIFFERENT THAN THE SAMPLE VALUE FOR SECURITY REASONS
-$config['des_key'] = 'rcmail-!24ByteDESkey*Str';
+$config['des_key'] = '__wynik_z_apg_dlug_24_zn';

 // List of active plugins (in plugins/ directory)
 $config['plugins'] = array(
-    'archive',
-    'zipdownload',
-);
+     'archive',
+     'attachment_reminder',
+     'markasjunk',
+     'new_user_dialog',
+     'new_user_identity',
+     'password',
+     'managesieve',
+     'zipdownload',);

 // skin name: folder from skins/
 $config['skin'] = 'larry';
+
+// the default locale setting (leave empty for auto-detection)
+// RFC1766 formatted language name like en_US, de_DE, de_CH, fr_FR, pt_BR
+$config['language'] = 'pl_PL';
+
+// Set the spell checking engine. Possible values:
+// - 'googie'  - the default (also used for connecting to Nox Spell Server, see 'spellcheck_uri' setting)
+// - 'pspell'  - requires the PHP Pspell module and aspell installed
+// - 'enchant' - requires the PHP Enchant module
+// - 'atd'     - install your own After the Deadline server or check with the people at http://www.afterthedeadline.com before using their API
+// Since Google shut down their public spell checking service, the default settings
+// connect to http://spell.roundcube.net which is a hosted service provided by Roundcube.
+// You can connect to any other googie-compliant service by setting 'spellcheck_uri' accordingly.
+$config['spellcheck_engine'] = 'pspell';
+$config['enable_installer'] = true;
+
+// automatically create the above listed default folders on user login
+$config['create_default_folders'] = true;
+
+// path to webserver mime.types database
+$config['mime_types'] = '/usr/local/etc/apache24/mime.types';
+
+?>

Dodatkowe ustawienia konfiguracyjne

Dodatkowe ustawienia konfiguracyjne warte dodania.

Ustawienie kodowania panelu

$config['default_charset'] = 'UTF-8';

Ustawienie strefy czasowej

// use this timezone to display date/time
// valid timezone identifers are listed here: php.net/manual/en/timezones.php
// 'auto' will use the browser's timezone settings
$config['timezone'] = 'Europe/Warsaw';

Ustawienie tworzenia wiadomości - txt/html

// compose html formatted messages by default
//  0 - never,
//  1 - always,
//  2 - on reply to HTML message,
//  3 - on forward or reply to HTML message
//  4 - always, except when replying to plain text message
$config['htmleditor'] = 1;

nginx: niepoprawne mime.types

Przy korzystaniu z nginx roundcube nie rozpoznaje poprawnie mime.types. Można temu zaradzić poprzez pobranie pliku ze źródeł Apache-a oraz ustawienie zmiennej w konfiguracji:

fetch http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types -o /usr/local/etc/nginx/mime_types

$config['mime_types'] = '/usr/local/etc/nginx/mime_types';

plugins/password/config.inc.php

--- plugins/password/config.inc.php.dist        2016-05-22 13:06:46.000000000 +0200
+++ plugins/password/config.inc.php     2016-06-28 14:22:37.293416000 +0200
@@ -12,14 +12,14 @@ $config['password_confirm_current'] = tr

 // Require the new password to be a certain length.
 // set to blank to allow passwords of any length
-$config['password_minimum_length'] = 0;
+$config['password_minimum_length'] = 8;

 // Require the new password to contain a letter and punctuation character
 // Change to false to remove this check.
 $config['password_require_nonalpha'] = false;

 // Enables logging of password changes into logs/password
-$config['password_log'] = false;
+$config['password_log'] = true;

 // Comma-separated list of login exceptions for which password change
 // will be not available (no Password tab in Settings)
@@ -41,11 +41,11 @@ $config['password_force_new_user'] = fal
 // Possible options: des-crypt, ext-des-crypt, md5-crypt, blowfish-crypt,
 // sha256-crypt, sha512-crypt, md5, sha, smd5, ssha, samba, ad, dovecot, clear.
 // For details see password::hash_password() method.
-$config['password_algorithm'] = 'clear';
+$config['password_algorithm'] = 'ssha';

 // Password prefix (e.g. {CRYPT}, {SHA}) for passwords generated
 // using password_algorithm above. Default: empty.
-$config['password_algorithm_prefix'] = '';
+$config['password_algorithm_prefix'] = '{SSHA}';

 // Path for dovecotpw/doveadm-pw (if not in the $PATH).
 // Used for password_algorithm = 'dovecot'.
@@ -150,7 +150,7 @@ $config['password_saslpasswd_args'] = ''
 // You can provide one or several hosts in an array in which case the hosts are tried from left to right.
 // Exemple: array('ldap1.exemple.com', 'ldap2.exemple.com');
 // Default: 'localhost'
-$config['password_ldap_host'] = 'localhost';
+$config['password_ldap_host'] = '127.0.0.1';

 // LDAP base name (root directory)
 // Exemple: 'dc=exemple,dc=com'
-$config['password_ldap_basedn'] = 'dc=exemple,dc=com';
+$config['password_ldap_basedn'] = 'ou=smtpd,dc=codenix,dc=pro';

 // LDAP connection method
 // There is two connection method for changing a user's LDAP password.
@@ -194,7 +194,7 @@ $config['password_ldap_adminPW'] = null;
 // '%domain' will be replaced by the current roundcube user's domain part
 // '%dc' will be replaced by domain name hierarchal string e.g. "dc=test,dc=domain,dc=com"
 // Exemple: 'uid=%login,ou=people,dc=exemple,dc=com'
-$config['password_ldap_userDN_mask'] = 'uid=%login,ou=people,dc=exemple,dc=com';
+//$config['password_ldap_userDN_mask'] = 'uid=%login,ou=smtpd,dc=codenix,dc=pro';

 // LDAP search DN
 // The DN roundcube should bind with to find out user's DN
@@ -205,7 +205,7 @@ $config['password_ldap_userDN_mask'] = '
 // users login to find his DN instead. A common reason might be that
 // your users are placed under different ou's like engineering or
 // sales which cannot be derived from their login only.
-$config['password_ldap_searchDN'] = 'cn=roundcube,ou=services,dc=example,dc=com';
+$config['password_ldap_searchDN'] = 'uid=__rc_admin__,ou=admins,ou=smtpd,dc=codenix,dc=pro';

 // LDAP search password
 // If password_ldap_searchDN is set, the password to use for
@@ -215,13 +215,13 @@ $config['password_ldap_searchDN'] = 'cn=
 // is only accesible to roundcube and don't forget to restrict roundcube's access to
 // your directory as much as possible using ACLs. Should this password be compromised
 // you want to minimize the damage.
-$config['password_ldap_searchPW'] = 'secret';
+$config['password_ldap_searchPW'] = '___zmien_haslo__';

 // LDAP search base
 // If password_ldap_searchDN is set, the base to search in using the filter below.
 // Note that you should comment out the default password_ldap_userDN_mask setting
 // for this to take effect.
-$config['password_ldap_search_base'] = 'ou=people,dc=example,dc=com';
+$config['password_ldap_search_base'] = 'ou=smtpd,dc=codenix,dc=pro';

 // LDAP search filter
 // If password_ldap_searchDN is set, the filter to use when
@@ -241,7 +241,7 @@ $config['password_ldap_search_filter'] =
 // Set to 'default' if you want to use method specified in password_algorithm option above.
 // Multiple password Values can be generated by concatenating encodings with a +. E.g. 'cram-md5+crypt'
 // Default: 'crypt'.
-$config['password_ldap_encodage'] = 'crypt';
+$config['password_ldap_encodage'] = 'ssha';

 // LDAP password attribute
 // Name of the ldap's attribute used for storing user password

plugins/managesieve/config.inc.php

To jest plugin wbudowany w samego roundcube. Bardzo dobrze zastępuje plugins/sieverules, który jest już nie rozwijany.

--- /usr/local/www/roundcube/plugins/managesieve/config.inc.php.dist    2018-04-11 13:13:47.000000000 +0200
+++ /usr/local/www/roundcube/plugins/managesieve/config.inc.php 2018-05-12 19:17:35.516988000 +0200
@@ -2,7 +2,7 @@

 // managesieve server port. When empty the port will be determined automatically
 // using getservbyname() function, with 4190 as a fallback.
-$config['managesieve_port'] = null;
+$config['managesieve_port'] = 4190;

 // managesieve server address, default is localhost.
 // Replacement variables supported in host name:
@@ -10,11 +10,11 @@ $config['managesieve_port'] = null;
 // %n - http hostname ($_SERVER['SERVER_NAME'])
 // %d - domain (http hostname without the first part)
 // For example %n = mail.domain.tld, %d = domain.tld
-$config['managesieve_host'] = 'localhost';
+$config['managesieve_host'] = '127.0.0.1';

 // authentication method. Can be CRAM-MD5, DIGEST-MD5, PLAIN, LOGIN, EXTERNAL
 // or none. Optional, defaults to best method supported by server.
-$config['managesieve_auth_type'] = null;
+$config['managesieve_auth_type'] = LOGIN;

 // Optional managesieve authentication identifier to be used as authorization proxy.
 // Authenticate as a different user but act on behalf of the logged in user.
@@ -42,10 +42,10 @@ $config['managesieve_usetls'] = false;
 $config['managesieve_conn_options'] = null;

 // default contents of filters script (eg. default spam filter)
-$config['managesieve_default'] = '/etc/dovecot/sieve/global';
+//$config['managesieve_default'] = '/etc/dovecot/sieve/global';

 // The name of the script which will be used when there's no user script
-$config['managesieve_script_name'] = 'managesieve';
+$config['managesieve_script_name'] = 'roundcube';

 // Sieve RFC says that we should use UTF-8 endcoding for mailbox names,
 // but some implementations does not covert UTF-8 to modified UTF-7.
@@ -85,7 +85,7 @@ $config['managesieve_domains'] = array()
 // 0 - no separate section (default),
 // 1 - add Vacation section,
 // 2 - add Vacation section, but hide Filters section
-$config['managesieve_vacation'] = 0;
+$config['managesieve_vacation'] = 1;

 // Default vacation interval (in days).
 // Note: If server supports vacation-seconds extension it is possible
@@ -105,4 +105,6 @@ $config['managesieve_vacation_from_init'
 $config['managesieve_notify_methods'] = array('mailto');

 // Enables scripts RAW editor feature
-$config['managesieve_raw_editor'] = true;
+$config['managesieve_raw_editor'] = false;
+
+?>

plugins/sieverules/config.inc.php

/!\ /!\ /!\ Obecnie nie rozwijany, zatem nie do używania. Zamiast tego trzeba używać plugins/managesieve

--- plugins/sieverules/config.inc.php.dist      2014-03-30 09:53:41.000000000 +0200
+++ plugins/sieverules/config.inc.php   2016-06-28 14:36:44.757954000 +0200
@@ -11,7 +11,7 @@
 // %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
 // %s - domain name after the '@' from e-mail address provided at login screen
 // For example %n = mail.domain.tld, %t = domain.tld
-$config['sieverules_host'] = 'localhost';
+$config['sieverules_host'] = '127.0.0.1';

 // managesieve server port
 $config['sieverules_port'] = 4190;
@@ -21,7 +21,7 @@ $config['sieverules_debug'] = false;

 // authentication method. Can be CRAM-MD5, DIGEST-MD5, PLAIN, LOGIN, EXTERNAL
 // or none. Optional, defaults to best method supported by server.
-$config['sieverules_auth_type'] = null;
+$config['sieverules_auth_type'] = LOGIN;

 // optional managesieve authentication identifier to be used as authorization proxy,
 // authenticate as a different user but act on behalf of the logged in user,
@@ -97,16 +97,16 @@ $config['sieverules_predefined_rules'] =
 $config['sieverules_adveditor'] = 0;

 // Allow users to use multiple rulesets
-$config['sieverules_multiplerules'] = FALSE;
+$config['sieverules_multiplerules'] = TRUE;

 // Default (or global) sieve rule file
-$config['sieverules_default_file'] = '/etc/dovecot/sieve/default';
+//$config['sieverules_default_file'] = '/etc/dovecot/sieve/default';

 // Auto load default sieve rule file if no rules exist and no import filters match
 $config['sieverules_auto_load_default'] = FALSE;

 // Example sieve rule file
-$config['sieverules_example_file'] = '/etc/dovecot/sieve/example';
+//$config['sieverules_example_file'] = '/etc/dovecot/sieve/example';

 // By default the "header" command is used for email address based tests: from/to/cc/bcc
 // to use "address" command instead set this option to false
@@ -115,7 +115,7 @@ $config['sieverules_address_rules'] = FA
 // Force the :addresses line to always be added to new vacation rules
 // Some sieve setups require that the :address part of a vacation rule is always present for the message to be sent
 // Cyrus setups need this to option set to true
-$config['sieverules_force_vacto'] = FALSE;
+$config['sieverules_force_vacto'] = TRUE;

 // Limit the selection of :addresses available to only those setup in as an identity
 // Setting this to false will give the user a textbox to enter in any address(es) they like, rather than a list of checkboxes
@@ -147,4 +147,4 @@ $config['sieverules_from_format'] = 0;

 // For information on customising the rule file see "The structure of the rule file" in the README

-?>
\ No newline at end of file
+?>

Konfiguracja pozostałych komponentów

Utworzenie bazy danych

Istniejące repozytorium pakietów posiada roundcube zależny od bazy danych PostgreSQL. Zatem konieczne jest utworzenie bazy danych wg poniższego przepisu:

# należy przygotować wcześniej hasło do wklejenia po zapytaniu
createuser -U postgres -DPSR rcmbro

# utworzenie bazy danych z w/w właścicielem
createdb -U postgres -O rcmbro -E UTF-8 rcwebmail

Konfiguracja serwera apache

Za pomocą własnego repozytorium skryptów powinna być konfiguracja (definicja) katalogu z roundcube. Należy dla wybranego wirtualnego hosta dodać alias:

Alias /poczta/ "/usr/local/www/roundcube/"

Pozostała konfiguracja jest do wykonania poprzez przeglądarkę:

hxxps://server/poczta/installer/

Poprawka w config.inc.php

Po wykonaniu i przetestowaniu konfiguracji należy zablokować katalog installer w konfiguracji roundcube

perl -pi -e 'next unless /enable_installer/; s/true/false/' /usr/local/www/roundcube/config/config.inc.php

Ew. konwersja PL-ogonków do UTF-8

Jeżeli zajdzie tak potrzeba, to konieczna jest konwersja pliku config.inc.php:

cp -p /usr/local/www/roundcube/config/config.inc.php /usr/local/www/roundcube/config/config.l2.inc.php

# wykonanie właściwej konwersji:
#
iconv -f l2 -t utf-8 /usr/local/www/roundcube/config/config.l2.inc.php > /usr/local/www/roundcube/config/config.inc.php


{i}  (c) 2004 - 2026 BSD Serwis Krzysztof Stryjek. W przypadku błędów, poprawek proszę kontaktować się z administratorem wiki.