瀏覽代碼

Merge pull request #101 from PajamaSoft/roundcube_managesieve

Roundcube managesieve plugin and automatic folder creation
Luke Cyca 11 年之前
父節點
當前提交
f123896767

+ 1
- 1
roles/mailserver/files/etc_dovecot_conf.d_20-imap.conf 查看文件

@@ -13,7 +13,7 @@ protocol imap {
13 13
   #mail_max_userip_connections = 10
14 14
 
15 15
   # Space separated list of plugins to load (default is global mail_plugins).
16
-  mail_plugins = $mail_plugins antispam fts fts_solr
16
+  mail_plugins = $mail_plugins antispam fts fts_solr autocreate
17 17
 
18 18
   # IMAP logout format string:
19 19
   #  %i - total number of bytes read from client

+ 12
- 0
roles/mailserver/files/etc_dovecot_conf.d_90-plugin.conf 查看文件

@@ -23,4 +23,16 @@ plugin {
23 23
   # FTS (full text search with Solr)
24 24
   fts = solr
25 25
   fts_solr = break-imap-search url=http://localhost:8080/solr/
26
+  
27
+  # Autocreate (specify mailboxes that must always exist for all users)
28
+  autocreate = Drafts
29
+  autocreate2 = Sent
30
+  autocreate3 = Junk
31
+  autocreate4 = Trash
32
+  autocreate5 = Archive
33
+  autosubscribe = Drafts
34
+  autosubscribe2 = Sent
35
+  autosubscribe3 = Junk
36
+  autosubscribe4 = Trash
37
+  autosubscribe5 = Archive
26 38
 }

+ 1
- 1
roles/mailserver/files/etc_dovecot_dovecot.conf 查看文件

@@ -96,4 +96,4 @@ dict {
96 96
 # A config file can also tried to be included without giving an error if
97 97
 # it's not found:
98 98
 !include_try /usr/share/dovecot/protocols.d/*.protocol
99
-protocols = imap lmtp
99
+protocols = imap lmtp sieve

+ 1
- 1
roles/mailserver/files/etc_postfix_master.cf 查看文件

@@ -128,4 +128,4 @@ mailman   unix  -       n       n       -       -       pipe
128 128
 dspam     unix  -       n       n       -       10      pipe
129 129
   flags=Ru user=dspam argv=/usr/bin/dspam --deliver=innocent,spam --user $recipient -i -f $sender -- $recipient
130 130
 dovecot   unix  -       n       n       -       -       pipe
131
-  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}
131
+  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/dovecot-lda -f ${sender} -d ${recipient}

+ 1
- 0
roles/mailserver/tasks/dovecot.yml 查看文件

@@ -6,6 +6,7 @@
6 6
     - mysql-server
7 7
     - dovecot-mysql
8 8
     - dovecot-lmtpd
9
+    - dovecot-managesieved
9 10
 
10 11
 - name: Create vmail group
11 12
   group: name=vmail state=present gid=5000

+ 1
- 1
roles/mailserver/templates/etc_dovecot_conf.d_15-lda.conf.j2 查看文件

@@ -44,5 +44,5 @@ hostname = {{ mail_server_hostname }}
44 44
 
45 45
 protocol lda {
46 46
   # Space separated list of plugins to load (default is global mail_plugins).
47
-  #mail_plugins = $mail_plugins
47
+  mail_plugins = $mail_plugins sieve
48 48
 }

+ 2
- 1
roles/mailserver/templates/etc_postfix_main.cf.j2 查看文件

@@ -82,7 +82,8 @@ recipient_delimiter = +
82 82
 inet_interfaces = all
83 83
 
84 84
 # dovecot mysql
85
-virtual_transport = lmtp:unix:private/dovecot-lmtp
85
+virtual_transport = dovecot
86
+dovecot_destination_recipient_limit = 1
86 87
 virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
87 88
 virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
88 89
 virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf

+ 2
- 2
roles/webmail/files/etc_roundcube_main.inc.php 查看文件

@@ -190,7 +190,7 @@ $rcmail_config['message_cache_lifetime'] = '10d';
190 190
 // enforce connections over https
191 191
 // with this option enabled, all non-secure connections will be redirected.
192 192
 // set the port for the ssl connection as value of this option if it differs from the default 443
193
-$rcmail_config['force_https'] = false;
193
+$rcmail_config['force_https'] = true;
194 194
 
195 195
 // tell PHP that it should work as under secure connection
196 196
 // even if it doesn't recognize it as secure ($_SERVER['HTTPS'] is not set)
@@ -362,7 +362,7 @@ $rcmail_config['email_dns_check'] = false;
362 362
 // ----------------------------------
363 363
 
364 364
 // List of active plugins (in plugins/ directory)
365
-$rcmail_config['plugins'] = array();
365
+$rcmail_config['plugins'] = array('managesieve');
366 366
 
367 367
 // ----------------------------------
368 368
 // USER INTERFACE

+ 67
- 0
roles/webmail/files/usr_share_roundcube_plugins_managesieve_config.inc.php 查看文件

@@ -0,0 +1,67 @@
1
+<?php
2
+
3
+// managesieve server port
4
+$rcmail_config['managesieve_port'] = 4190;
5
+
6
+// managesieve server address, default is localhost.
7
+// Replacement variables supported in host name:
8
+// %h - user's IMAP hostname
9
+// %n - http hostname ($_SERVER['SERVER_NAME'])
10
+// %d - domain (http hostname without the first part)
11
+// For example %n = mail.domain.tld, %d = domain.tld
12
+$rcmail_config['managesieve_host'] = 'localhost';
13
+
14
+// authentication method. Can be CRAM-MD5, DIGEST-MD5, PLAIN, LOGIN, EXTERNAL
15
+// or none. Optional, defaults to best method supported by server.
16
+$rcmail_config['managesieve_auth_type'] = null;
17
+
18
+// Optional managesieve authentication identifier to be used as authorization proxy.
19
+// Authenticate as a different user but act on behalf of the logged in user.
20
+// Works with PLAIN and DIGEST-MD5 auth.
21
+$rcmail_config['managesieve_auth_cid'] = null;
22
+
23
+// Optional managesieve authentication password to be used for imap_auth_cid
24
+$rcmail_config['managesieve_auth_pw'] = null;
25
+
26
+// use or not TLS for managesieve server connection
27
+// it's because I've problems with TLS and dovecot's managesieve plugin
28
+// and it's not needed on localhost
29
+$rcmail_config['managesieve_usetls'] = false;
30
+
31
+// default contents of filters script (eg. default spam filter)
32
+$rcmail_config['managesieve_default'] = '/etc/dovecot/sieve/global';
33
+
34
+// The name of the script which will be used when there's no user script
35
+$rcmail_config['managesieve_script_name'] = 'managesieve';
36
+
37
+// Sieve RFC says that we should use UTF-8 endcoding for mailbox names,
38
+// but some implementations does not covert UTF-8 to modified UTF-7.
39
+// Defaults to UTF7-IMAP
40
+$rcmail_config['managesieve_mbox_encoding'] = 'UTF-8';
41
+
42
+// I need this because my dovecot (with listescape plugin) uses
43
+// ':' delimiter, but creates folders with dot delimiter
44
+$rcmail_config['managesieve_replace_delimiter'] = '';
45
+
46
+// disabled sieve extensions (body, copy, date, editheader, encoded-character,
47
+// envelope, environment, ereject, fileinto, ihave, imap4flags, index,
48
+// mailbox, mboxmetadata, regex, reject, relational, servermetadata,
49
+// spamtest, spamtestplus, subaddress, vacation, variables, virustest, etc.
50
+// Note: not all extensions are implemented
51
+$rcmail_config['managesieve_disabled_extensions'] = array();
52
+
53
+// Enables debugging of conversation with sieve server. Logs it into <log_dir>/sieve
54
+$rcmail_config['managesieve_debug'] = false;
55
+
56
+// Enables features described in http://wiki.kolab.org/KEP:14
57
+$rcmail_config['managesieve_kolab_master'] = false;
58
+
59
+// Script name extension used for scripts including. Dovecot uses '.sieve',
60
+// Cyrus uses '.siv'. Doesn't matter if you have managesieve_kolab_master disabled.
61
+$rcmail_config['managesieve_filename_extension'] = '.sieve';
62
+
63
+// List of reserved script names (without extension).
64
+// Scripts listed here will be not presented to the user.
65
+$rcmail_config['managesieve_filename_exceptions'] = array();
66
+
67
+?>

+ 7
- 1
roles/webmail/tasks/roundcube.yml 查看文件

@@ -1,5 +1,8 @@
1 1
 - name: Install Roundcube
2
-  apt: pkg=roundcube state=latest
2
+  apt: pkg=$item state=latest
3
+  with_items:
4
+    - roundcube
5
+    - roundcube-plugins
3 6
 
4 7
 - name: Configure the Apache HTTP server for roundcube
5 8
   template: src=etc_apache2_sites-available_roundcube.j2 dest=/etc/apache2/sites-available/roundcube group=www-data owner=www-data force=yes
@@ -7,6 +10,9 @@
7 10
 - name: Configure roundcube
8 11
   copy: src=etc_roundcube_main.inc.php dest=/etc/roundcube/main.inc.php group=www-data owner=root mode=640 force=yes
9 12
 
13
+- name: Configure roundcube's managesieve plugin
14
+  copy: src=usr_share_roundcube_plugins_managesieve_config.inc.php dest=/usr/share/roundcube/plugins/managesieve/config.inc.php group=www-data owner=root mode=640 force=yes
15
+
10 16
 - name: Enable roundcube site
11 17
   command: a2ensite roundcube creates=/etc/apache2/sites-enabled/roundcube
12 18
   notify: restart apache

Loading…
取消
儲存