Commits

Zhang Huangbin committed 98f0394

Fixed: Add missing config and SQL table required for sharing IMAP folder to anyone. Thanks BigMichi1 <bigmichi1 _at_ bigmichi1.de>.

Comments (0)

Files changed (8)

iRedMail/ChangeLog

     * Enforce connections over https in Roundcube.
     * Fix incorrect MySQL user password and databases in MySQL backup script.
     * Fixed:
+        + Add missing config and SQL table required for sharing IMAP folder to
+          anyone. Thanks BigMichi1 <bigmichi1 _at_ bigmichi1.de>.
         + Add missing auth service in Dovecot-2: auth-userdb.
         + Add new LDAP attribute and SQL column required by Dovecot-2 share folder:
           enabledService=lib-storage (ldap), enablelib-storage=1 (SQL).

iRedMail/conf/dovecot

 export DOVECOT_QUOTA_WARNING_SCRIPT='/usr/local/bin/dovecot-quota-warning.sh'
 export DOVECOT_REALTIME_QUOTA_TABLE='used_quota'
 export DOVECOT_SHARE_FOLDER_DB_TABLE='share_folder'
+export DOVECOT_SHARE_FOLDER_ANYONE_DB_TABLE='anyone_shares'
 
 if [ X"${BACKEND}" == X"OPENLDAP" -o X"${BACKEND}" == X"MYSQL" ]; then
     export DOVECOT_SHARE_FOLDER_SQLTYPE='mysql'

iRedMail/functions/dovecot1.sh

 plugin {
     acl = vfile
     acl_shared_dict = proxy::acl
+
+    # By default Dovecot doesn't allow using the IMAP "anyone" or
+    # "authenticated" identifier, because it would be an easy way to spam
+    # other users in the system. If you wish to allow it,
+    #acl_anyone = allow
 }
 dict {
     acl = ${DOVECOT_SHARE_FOLDER_SQLTYPE}:${DOVECOT_SHARE_FOLDER_CONF}
         to_user = \$to
     }
 }
+
+# To share mailbox to anyone, please uncomment 'acl_anyone = allow' in
+# dovecot.conf
+map {
+    pattern = shared/shared-boxes/anyone/\$from
+    table = ${DOVECOT_SHARE_FOLDER_ANYONE_DB_TABLE}
+    value_field = dummy
+    fields {
+        from_user = \$from
+    }
+}
 EOF
 
         chown ${DOVECOT_USER}:${DOVECOT_GROUP} ${DOVECOT_SHARE_FOLDER_CONF}

iRedMail/functions/dovecot2.sh

     # SQL lookup for share folder.
     cat > ${DOVECOT_SHARE_FOLDER_CONF} <<EOF
 ${CONF_MSG}
-connect = host=${MYSQL_SERVER} dbname=${share_folder_db_name} user=${share_folder_db_user} password=${share_folder_db_passwd}
+connect = host=${SQL_SERVER} dbname=${share_folder_db_name} user=${share_folder_db_user} password=${share_folder_db_passwd}
 map {
     pattern = shared/shared-boxes/user/\$to/\$from
     table = ${DOVECOT_SHARE_FOLDER_DB_TABLE}
         to_user = \$to
     }
 }
+
+# To share mailbox to anyone, please uncomment 'acl_anyone = allow' in
+# dovecot.conf
+map {
+    pattern = shared/shared-boxes/anyone/\$from
+    table = ${DOVECOT_SHARE_FOLDER_ANYONE_DB_TABLE}
+    value_field = dummy
+    fields {
+        from_user = \$from
+    }
+}
 EOF
 
     chown ${DOVECOT_USER}:${DOVECOT_GROUP} ${DOVECOT_SHARE_FOLDER_CONF}

iRedMail/samples/dovecot/dovecot2.conf

     acl = vfile
     acl_shared_dict = proxy::acl
 
+    # By default Dovecot doesn't allow using the IMAP "anyone" or
+    # "authenticated" identifier, because it would be an easy way to spam
+    # other users in the system. If you wish to allow it,
+    #acl_anyone = allow
+
     # Pigeonhole managesieve service.
     # Reference: http://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration
     # Per-user sieve settings.

iRedMail/samples/dovecot/imap_share_folder.sql

   dummy CHAR(1),
   PRIMARY KEY (from_user, to_user)
 );
+
+CREATE TABLE IF NOT EXISTS anyone_shares (
+    from_user VARCHAR(255) NOT NULL,
+    dummy CHAR(1) DEFAULT '1',
+    PRIMARY KEY (from_user)
+);

iRedMail/samples/iredmail.mysql

     INDEX (to_user)
 );
 
+CREATE TABLE IF NOT EXISTS anyone_shares (
+    from_user VARCHAR(255) NOT NULL,
+    dummy CHAR(1) DEFAULT '1',
+    PRIMARY KEY (from_user)
+);
+
 #
 # Table `used_quota`. Used to store realtime mailbox quota in Dovecot.
 # WARNING: Works only with Dovecot 1.2+.

iRedMail/samples/iredmail.pgsql

 CREATE INDEX idx_share_folder_from_user ON share_folder (from_user);
 CREATE INDEX idx_share_folder_to_user ON share_folder (to_user);
 
+CREATE TABLE anyone_shares (
+    from_user VARCHAR(255) NOT NULL,
+    dummy CHAR(1),
+    PRIMARY KEY (from_user)
+);
+
 --
 -- Table used_quota. Used to store realtime mailbox quota in Dovecot.
 -- WARNING: Works only with Dovecot 1.2+.