help centre
For more info visit status.atmail.com

How can we help?


Search our knowledge base for answers to
common questions and latest updates.



My activities New request

Follow

atmail store(obj) configuration

Dominic -

PROBLEM

How can I configure atmail store (obj) ?

ENVIRONMENT

  • atmail mail server
  • atmail suite
  • atmail store(obj)

CAUSE

Configuration requirement.

RESOLUTION

Pre-configuration notes

System requirements

Installation

Before you configure the atmail store(obj) plugin, please make sure you have correctly performed installation.

Configuration
The following assumes you have an ext4 file system mounted as /sis/ and that an AWS S3 object store is being used as an end-point. Please see system requirements for further detais.

  1. Update the default_mbox_type from Maildir to mdbox. This is a requirement for SIS (Single Instance Storage).
    [root@localhost ~]# mysql -u root -p mailserver
    Enter password:

    TRUNCATED OUTPUT...

    MariaDB [mailserver]> UPDATE Config SET keyValue = 'mdbox' WHERE keyName = 'default_mbox_type';
    Query OK, 0 rows affected (0.02 sec)
    Rows matched: 1 Changed: 0 Warnings: 0
  2. Open your dovecot configuration for editing /etc/dovecot/dovecot.conf.
    [root@localhost ~]# vim /etc/dovecot/dovecot.conf
    Update namespace separators from '.' to '/' and add the mail_attachment_dir variable above the namespace blocks as seen below. Pass the location of your /sis/%Ld directory to this variable. %Ld = local domain.
    mail_attachment_dir = /sis/%Ld

    namespace {

    list = yes
    type = private
    inbox = yes
    prefix = INBOX/
    separator = /

    namespace {
    list = no
    type = private
    prefix = virtual/
    separator = /
    location = virtual:/var/lib/atmail/dovecot/virtual:INDEX=~/virtual
    plugin {
    #quota_rule = *:storage=1G
    quota_rule2 = INBOX/Trash:storage=+10%%
    #quota_grace = 10%%
    }

    Also add the object_store plugin to your imap section as seen below.
    ##
    ## 20_imap: IMAP specific settings
    ##

    imap_idle_notify_interval = 1 mins
    imap_client_workarounds = delay-newmail tb-extra-mailbox-sep tb-lsub-flags

    protocol imap {
    mail_plugins = $mail_plugins imap_quota object_store
    mail_max_userip_connections = 50
    }

     

  3. Within the same file, place the below contents. To get your configuration working, you should only need to define the following variables:
    - serialize_attach_size_gt = 1m # This determines how a big a file must be before its uploaded to the object storage end-point. In this case, all files above 1MB are uploaded.
    - s3_url = YOUR_S3_URL
    - s3_awsaccesskey_id = YOUR_AWSACCSESKEY_ID
    - s3_awssecretkey = YOUR_AWSSECRETKET
    - s3_ssl_ca_dir = /etc/ssl/certs
    - s3_ssl_ca_file = /etc/ssl/certs/ca-bundle.crt
    ##
    ## 80_quota: AWS s3 Configuration
    ##

    ### ###
    ## AWS ##
    ### ###

    plugin {


    object_store = aws_s3
    object_store_compression = off
    object_store_compression_type = bz2
    object_store_connection_timeout = 60
    object_store_multi_tenant_enable = true
    # currently un-tested
    # objbox_compression_exception_list = image/jpeg; image/gif; image/tiff; image/png;
    cache_expires = 15
    serialize_attach_size_gt = 1m
    cache_url = file:///var/atmailcache:0

    s3_url = YOUR_S3_URL
    s3_awsaccesskey_id = YOUR_AWSACCSESKEY_ID
    s3_awssecretkey = YOUR_AWSSECRETKET
    s3_ssl_ca_dir = /etc/ssl/certs
    s3_ssl_ca_file = /etc/ssl/certs/ca-bundle.crt
    object_store_metadata_dir = /var/atmail/s3_metadata
    s3_auth_signature = v2
    }
  4. Create required directories for store(obj).
    [root@localhost ~]# mkdir -p /var/atmailcache/
    [root@localhost ~]# mkdir -p /var/atmail/s3_metadata
    [root@localhost ~]# lsblk -f | grep sdb
    sdb ext4 c487ec34-4fe4-422e-99e5-31296639f3a6 /sis
  5. Set the following permissions on the newly created directories.
    [root@localhost ~]# chown -R vmail:atmail /var/atmail/* /var/atmailcache/ /sis/
  6. Populate /var/atmailcache with all active domains on your system. You can copy and paste the below script that will automate this process for you.
    #!/bin/bash
    ## COPYRIGHT:
    ## (C) 2016-2017 atmail Pty Ltd
    ## @author (dominic.finn)

    read -p "database username: " DBUSER
    read -s -p "database password (won't be echoed): " DBPASS
    GETDOMAINS="SELECT domainName FROM domains WHERE domainEnabled = 1;"

    printf "\nCreating required directories for active domains\n"
    read -ra DOMAINS <<< $(mysql -u$DBUSER -p$DBPASS -Dmailserver -se "$GETDOMAINS")
    for DOM in "${DOMAINS[@]}"; do
    if [ ! -d /var/atmailcache/$DOM ]; then
    mkdir /var/atmailcache/$DOM
    printf "\n Created /var/atmailcache/$DOM"
    fi
    printf "\n"
    chown -R vmail:atmail /var/atmailcache/*
    done;
  7. Restart dovecot and check its status.

Your atmail store(obj) should now be fully functional. To test, create some new users that will be using the new mdbox namespace and upload some attachments. The following logs may be useful why testing.

  • # /var/log/maillog
  • # journalctl -f /usr/sbin/dovecot

 

Have more questions? Submit a request

Comments


Contact our support team


+61 (7) 5357 6605       support@atmail.com