default_client_limit = 1500

# to improve performance, disable fsync globally - we will enable it for
# some specific services later on
mail_fsync = never

service imap-login {
  # plain-text IMAP should only be accessible from localhost
  inet_listener imap {
    address = 127.0.0.1, ::1
  }
  inet_listener imaps {
  }
  # enable high-performance mode, described here:
  # https://wiki.dovecot.org/LoginProcess
  service_count = 0
  # set to the number of CPU cores on your server
  process_min_avail = 3
  vsz_limit = 1G
}

# disable POP3 altogether
service pop3-login {
  inet_listener pop3 {
    port = 0
  }
  inet_listener pop3s {
    port = 0
  }
}

# enable semi-long-lived IMAP processes to improve performance
service imap {
  service_count = 256
  # set to the number of CPU cores on your server
  process_min_avail = 3
}

# expose an LMTP socket for postfix to deliver mail
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
}

# expose an auth socket for postfix to authenticate users
service auth {
  unix_listener /var/spool/postfix/private/auth {
    mode = 0660
    user = postfix
    group = postfix
  }
}

# no need to run this as root
service auth-worker {
  user = vmail
}
