Dovecot (2.0.xx) && Sieve

Get Dovecot from HERE::

tar zxvf dovecot-1.2.xx.tar.gz

cd dovecot-1.2.xx
./configure \
–prefix=/usr \
–sysconfdir=/etc/dovecot \
–with-mysql \
–with-ssl=openssl \
–with-pop3d

make && make install

Dovecot config files:
++++++++++++++++
1. dovecot.conf
++++++++++++++++
##########################
#dovecot.conf V 2.0.XX #
##########################

namespace {
      hidden = no
      inbox = yes
      list = yes
      location =
      prefix = INBOX.
      separator = .
      subscriptions = yes
      type = private
  }
  passdb {
      args = /etc/dovecot/dovecot-mysql.conf
      deny = no
      driver = sql
      master = no
      pass = no
  }
pop3_client_workarounds =
      pop3_enable_last = no
      pop3_fast_size_lookups = no
      pop3_lock_session = no
      pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s
      pop3_no_flag_updates = no
      pop3_reuse_xuidl = no
      pop3_save_uidl = no
      pop3_uidl_format = %08Xu%08Xv
      protocols = imap pop3 sieve
      quota_full_tempfail = no
      recipient_delimiter = +
      rejection_reason = Your message to <%t> was automatically rejected:%n%r
      rejection_subject = Rejected: %s
      sendmail_path = /usr/sbin/sendmail
  #SERVICES.........
  #===========================================
  service anvil {
       chroot = empty
       client_limit = 0
       drop_priv_before_exec = no
       executable = anvil
       extra_groups =
       group =
       idle_kill = 4294967295 secs
       privileged_group =
       process_limit = 1
       process_min_avail = 1
       protocol =
       service_count = 0
       type = anvil
       unix_listener anvil-auth-penalty {
       group =
       mode = 0600
       user =
       }
       unix_listener anvil {
            group =
            mode = 0600
            user =
            }
       user = $default_internal_user
       vsz_limit = 18446744073709551615 B
  }
  service auth-worker {
       chroot =
       client_limit = 1
       drop_priv_before_exec = no
       executable = auth -w
       extra_groups =
       group =
       idle_kill = 0
       privileged_group =
       process_limit = 0
       process_min_avail = 0
       protocol =
       service_count = 1
       type =
       unix_listener auth-worker {
            group =
            mode = 0600
            user = $default_internal_user
            }
       user =
       vsz_limit = 18446744073709551615 B
  }
  service auth {
       chroot =
       client_limit = 4096
       drop_priv_before_exec = no
       executable = auth
       extra_groups =
       group =
       idle_kill = 0
       privileged_group =
       process_limit = 1
       process_min_avail = 0
       protocol =
       service_count = 0
       type =
       unix_listener /var/run/auth-master {
            group = vmail
            mode = 0600
            user = vmail
            }
     unix_listener /var/spool/postfix/private/auth {
            group =
            mode = 0666
            user =
            }
       unix_listener auth-client {
            group =
            mode = 0600
            user =
            }
       unix_listener auth-login {
            group =
            mode = 0600
            user = $default_internal_user
            }
       unix_listener auth-master {
            group =
            mode = 0600
            user =
       }
       unix_listener auth-userdb {
            group =
            mode = 0600
            user =
       }
       unix_listener login/login {
            group =
            mode = 0666
            user =
            }
       user = root
       vsz_limit = 18446744073709551615 B
  }
  service config {
        chroot =
        client_limit = 0
        drop_priv_before_exec = no
        executable = config
        extra_groups =
        group =
        idle_kill = 0
        privileged_group =
        process_limit = 0
        process_min_avail = 0
        protocol =
        service_count = 0
        type = config
        unix_listener config {
              group =
              mode = 0600
              user =
        }
        user =
        vsz_limit = 18446744073709551615 B
  }
  service dict {
        chroot =
        client_limit = 1
        drop_priv_before_exec = no
        executable = dict
        extra_groups =
        group =
        idle_kill = 0
        privileged_group =
        process_limit = 0
        process_min_avail = 0
        protocol =
        service_count = 0
        type =
        unix_listener dict {
              group =
              mode = 0600
              user =
        }
        user = $default_internal_user
        vsz_limit = 18446744073709551615 B
  }
  service director {
        chroot =
        client_limit = 0
        drop_priv_before_exec = no
        executable = director
        extra_groups =
        fifo_listener login/proxy-notify {
              group =
              mode = 00
              user =
        }
        group =
        idle_kill = 4294967295 secs
        privileged_group =
        process_limit = 1
        process_min_avail = 0
        protocol =
        service_count = 0
        type =
        unix_listener director-admin {
              group =
              mode = 0600
              user =
        }
        unix_listener login/director {
              group =
              mode = 00
              user =
        }
        user = $default_internal_user
        vsz_limit = 18446744073709551615 B
  }
  service dns_client {
  chroot =
  client_limit = 1
  drop_priv_before_exec = no
  executable = dns-client
  extra_groups =
  group =
  idle_kill = 0
  privileged_group =
  process_limit = 0
  process_min_avail = 0
  protocol =
  service_count = 0
  type =
  unix_listener dns-client {
  group =
  mode = 0666
  user =
  }
  unix_listener login/dns-client {
  group =
  mode = 0666
  user =
  }
  user = $default_internal_user
  vsz_limit = 18446744073709551615 B
  }
  service doveadm {
  chroot =
  client_limit = 1
  drop_priv_before_exec = no
  executable = doveadm-server
  extra_groups =
  group =
  idle_kill = 0
  privileged_group =
  process_limit = 0
  process_min_avail = 0
  protocol =
  service_count = 1
  type =
  unix_listener doveadm-server {
  group =
  mode = 0600
  user =
  }
  user =
  vsz_limit = 18446744073709551615 B
  }
  service imap-login {
        chroot = login
        client_limit = 0
        drop_priv_before_exec = no
        executable = imap-login
        extra_groups =
        group =
        idle_kill = 0
        inet_listener imap {
        address = 0.0.0.0
        port = 143
        ssl = no
  }
  inet_listener imaps {
        address = 0.0.0.0
        port = 993
        ssl = yes
  }
        privileged_group =
        process_limit = 128
        process_min_avail = 3
        protocol = imap
        service_count = 1
        type = login
        user = postfix
        vsz_limit = 64 M
  }
  service imap {
        chroot =
        client_limit = 1
        drop_priv_before_exec = no
        executable = imap
        extra_groups =
        group =
        idle_kill = 0
        privileged_group =
        process_limit = 1024
        process_min_avail = 0
        protocol = imap
        service_count = 1
        type =
        unix_listener login/imap {
              group =
              mode = 0666
              user =
        }
        user =
        vsz_limit = 18446744073709551615 B
  }
  service lmtp {
        chroot =
        client_limit = 0
        drop_priv_before_exec = no
        executable = lmtp
        extra_groups =
        group =
        idle_kill = 0
        privileged_group =
        process_limit = 0
        process_min_avail = 0
        protocol = lmtp
        service_count = 0
        type =
        unix_listener lmtp {
              group =
              mode = 0666
              user =
        }
        user =
        vsz_limit = 0
  }
  service log {
        chroot =
        client_limit = 0
        drop_priv_before_exec = no
        executable = log
        extra_groups =
        group =
        idle_kill = 0
        privileged_group =
        process_limit = 1
        process_min_avail = 0
        protocol =
        service_count = 0
        type = log
        user =
        vsz_limit = 18446744073709551615 B
  }
  service managesieve-login {
  chroot = login
  client_limit = 0
  drop_priv_before_exec = no
  executable = managesieve-login
  extra_groups =
  group =
  idle_kill = 0
  inet_listener sieve {
  address =
  port = 4190
  ssl = no
  }
  privileged_group =
  process_limit = 128
  process_min_avail = 3
  protocol = sieve
  service_count = 1
  type = login
  user = postfix
  vsz_limit = 64 M
  }
  service managesieve {
  chroot =
  client_limit = 1
  drop_priv_before_exec = no
  executable = managesieve
  extra_groups =
  group =
  idle_kill = 0
  privileged_group =
  process_limit = 0
  process_min_avail = 0
  protocol = sieve
  service_count = 1
  type =
  unix_listener login/sieve {
  group =
  mode = 0666
  user =
  }
  user =
  vsz_limit = 18446744073709551615 B
  }
  service pop3-login {
  chroot = login
  client_limit = 0
  drop_priv_before_exec = no
  executable = pop3-login
  extra_groups =
  group =
  idle_kill = 0
  inet_listener pop3 {
  address = 0.0.0.0
  port = 110
  ssl = no
  }
  inet_listener pop3s {
  address = 0.0.0.0
  port = 995
  ssl = yes
  }
  privileged_group =
  process_limit = 128
  process_min_avail = 3
  protocol = pop3
  service_count = 1
  type = login
  user = postfix
  vsz_limit = 64 M
  }
  service pop3 {
  chroot =
  client_limit = 1
  drop_priv_before_exec = no
  executable = pop3
  extra_groups =
  group =
  idle_kill = 0
  privileged_group =
  process_limit = 1024
  process_min_avail = 0
  protocol = pop3
  service_count = 1
  type =
  unix_listener login/pop3 {
  group =
  mode = 0666
  user =
  }
  user =
  vsz_limit = 18446744073709551615 B
  }
  service ssl-params {
        chroot =
        client_limit = 0
        drop_priv_before_exec = no
        executable = ssl-params
        extra_groups =
        group =
        idle_kill = 0
        privileged_group =
        process_limit = 0
        process_min_avail = 0
        protocol =
        service_count = 0
        type = startup
        unix_listener login/ssl-params {
              group =
             mode = 0666
              user =
        }
        user =
        vsz_limit = 18446744073709551615 B
        }
        shutdown_clients = yes
        ssl = yes
        ssl_cert = </etc/postfix/ssl/smtpd.pem
        ssl_cipher_list = ALL:!LOW:!SSLv2
        ssl_key = </etc/postfix/ssl/smtpd.pem
        syslog_facility = mail
        userdb {
              args = /etc/dovecot/dovecot-mysql.conf
              driver = sql
        }
        valid_chroot_dirs =
        verbose_auth = no
        verbose_proctitle = no
        verbose_ssl = yes
        version_ignore = no
  protocol imap {
        imap_max_line_length = 64 k
        mail_plugins = quota imap_quota autocreate zlib imap_zlib expire
  }
  protocol pop3 {
       mail_plugins = quota
       pop3_uidl_format = %08Xu%08Xv
  }
  protocol sieve {
       managesieve_logout_format = bytes ( in=%i : out=%o )
  }
  protocol lda {
       auth_socket_path = /var/run/auth-master
       log_path = /var/log/dovecot_deliver.log
       mail_plugins = quota sieve
       postmaster_address = postmaster@my-domain.com
  }
 lda_mailbox_autocreate = yes
  lda_mailbox_autosubscribe = yes
  plugin {
       quota = maildir:User quota
       quota_rule = *:storage=10M
       quota_rule2 = INBOX.Trash:ignore
       quota_rule3 = INBOX.Sent:ignore
       autocreate = INBOX.Spam
       autosubscribe = INBOX.Spam
       sieve = ~/dovecot.sieve
       sieve_before = /etc/dovecot/sieve/global.sieve
       sieve_dir = ~/sieve
       sieve_global_dir = /etc/dovecot/sieve
       sieve_quota_mas_scripts = 50
       zlib_save = bz2
  }

++++++++++++++++
2. dovecot-mysql.conf
++++++++++++++++

driver=mysql
default_pass_scheme = crypt
connect = \
         host=localhost \
         dbname=email_db \
         user=user1 \
         password=password1
password_query = SELECT password \
                  FROM (select email,password,disableimap as imap \
                                ,disablepop3 as pop3,sieve \
                  FROM users WHERE email = '%u') as tb1 where %s='0'
user_query = SELECT  CONCAT(home,SUBSTRING_INDEX(email,'@',-1),'/', \
              SUBSTRING_INDEX(email,'@',1),'/') as \
              home, uid , gid, CONCAT('*:storage=',quota) as quota_rule \
              FROM users WHERE email = '%u';
~~~~~~~~~
 Table: users
Create Table: CREATE TABLE `users` (
  `email` varchar(80) NOT NULL,
  `home` varchar(255) NOT NULL default '',
  `password` varchar(255) NOT NULL default '',
  `quota` varchar(10) default '10485760S',
  `uid` int(11) NOT NULL default '0',
  `gid` int(11) NOT NULL default '0',
  `disablepop3` char(1) NOT NULL default '0',
  `disableimap` char(1) NOT NULL default '0',
  `sieve` char(1) NOT NULL default '0',
  PRIMARY KEY  (`email`)
) ENGINE=MyISAM
~~~~~~~~~~~ 

++++++++++++++++++++++++++++++++++
3. dovecot-sieve
++++++++++++++++++++++++++++++++++
tar zxvf DOVECOT2/dovecot-2.0-pigeonhole-$Sieve_VER.tar.gz
 cd dovecot-2.0-pigeonhole-$Sieve_VER
 ./configure --prefix=/usr \
 --with-dovecot=../dovecot-$Dove_VER
 sleep 1
 make && make install
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s