This is how I set up my mail server on
uid=5000(vmail) gid=5000(vmail) groups=5000(vmail)
# See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings delay_warning_time = 4h readme_directory = no # TLS parameters smtpd_tls_cert_file = /etc/ssl/certs/ssl-mail.pem smtpd_tls_key_file = /etc/ssl/private/ssl-mail.key smtpd_tls_loglevel = 1 smtpd_tls_security_level = may smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache tls_random_source = dev:/dev/urandom tls_random_bytes = 32 tls_random_reseed_period = 3600s # home_mailbox = Maildir/ smtpd_sasl_auth_enable = yes smtpd_sasl_type = dovecot smtpd_sasl_path = private/dovecot-auth smtpd_sasl_authenticated_header = yes smtpd_sasl_security_options = noanonymous smtpd_sasl_local_domain = $myhostname broken_sasl_auth_clients = yes smtpd_sender_restrictions = reject_unknown_sender_domain smtpd_use_tls = yes smtpd_tls_received_header = yes smtpd_tls_mandatory_protocols = SSLv3, TLSv1 smtpd_tls_mandatory_ciphers = medium smtpd_tls_auth_only = yes # smtp_tls_cert_file=/etc/postfix/ssl/smtpd.pem smtp_tls_key_file=$smtp_tls_cert_file smtp_tls_loglevel = 1 smtp_tls_security_level = may smtp_tls_note_starttls_offer = yes smtp_use_tls = yes # # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client. myhostname = example.org alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname #mydestination = example.org, www.example.org, example.cc, www.example.cc, myserverhostname, localhost.localdomain, localhost mydestination = relayhost = smtp-server.example.com # This was commented out as it gives a "unused parameter" warning on Precise - works on Hardy #relay_domain = $mydestination mynetworks_style = subnet #mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_command = /usr/lib/dovecot/deliver -c /etc/dovecot/conf.d/01-mail-stack-delivery.conf -m "${EXTENSION}" mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all owner_request_special = no # # Virtual Mailbox Domain Settings virtual_alias_maps = mysql:/etc/postfix/mysql/alias_maps.cf virtual_mailbox_domains = mysql:/etc/postfix/mysql/domains_maps.cf virtual_mailbox_maps = mysql:/etc/postfix/mysql/mailbox_maps.cf virtual_mailbox_limit = 51200000 virtual_minimum_uid = 5000 virtual_uid_maps = static:5000 virtual_gid_maps = static:5000 virtual_mailbox_base = /home/vmail virtual_transport = virtual # Additional for quota support # This was commented out as it gives a "unused parameter" warning on Precise - works on Hardy #virtual_create_maildirsize = yes #virtual_mailbox_extended = yes #virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql/mailbox_limit_maps.cf #virtual_mailbox_limit_override = yes #virtual_maildir_limit_message = Sorry, the your maildir has overdrawn your diskspace quota, please free up some of spaces of your mailbox try again. #virtual_overquota_bounce = yes # # Spam reduction parameters. May be aggresive for some, but seems to work well. access_map_reject_code = 554 invalid_hostname_reject_code = 554 maps_rbl_reject_code = 554 multi_recipient_bounce_reject_code = 554 non_fqdn_reject_code = 554 plaintext_reject_code = 554 reject_code = 554 relay_domains_reject_code = 554 unknown_local_recipient_reject_code = 550 unknown_address_reject_code = 550 unknown_client_reject_code = 550 unknown_hostname_reject_code = 550 unknown_relay_recipient_reject_code = 550 unknown_virtual_alias_reject_code = 550 unknown_virtual_mailbox_reject_code = 550 unverified_recipient_reject_code = 550 unverified_sender_reject_code = 550 # default_process_limit = 20 smtpd_client_connection_count_limit = 10 # Value of 60 should translate to 1 per second limit smtpd_client_connection_rate_limit = 60 smtpd_client_message_rate_limit = 60 smtpd_client_new_tls_session_rate_limit = 60 # smtpd_helo_required = yes smtpd_delay_reject = yes address_verify_map = btree:${data_directory}/verify_cache smtpd_reject_unlisted_sender=yes smtpd_recipient_restrictions = check_client_access hash:/etc/postfix/white_lists, reject_invalid_hostname, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unknown_client_hostname, reject_unverified_sender, permit_mynetworks, reject_unauth_destination, reject_rbl_client zen.spamhaus.org, reject_rbl_client cbl.abuseat.org, permit smtpd_data_restrictions = reject_unauth_pipelining, permit #
user=<mysql_db_user> password=<mysql_db_password> dbname=<mysql_db_name> table=mailbox select_field=username where_field=username hosts=127.0.0.1:<mysql_db_port>
user=<mysql_db_user> password=<mysql_db_password> dbname=<mysql_db_name> table=mailbox select_field=username where_field=username hosts=127.0.0.1:<mysql_db_port>
user=<mysql_db_user> password=<mysql_db_password> dbname=<mysql_db_name> table=mailbox select_field=maildir where_field=username hosts=127.0.0.1:<mysql_db_port> additional_conditions = and active = 1
user=<mysql_db_user> password=<mysql_db_password> dbname=<mysql_db_name> table=mailbox select_field=quota where_field=username hosts=127.0.0.1:<mysql_db_port> additional_conditions = and active = 1
user=<mysql_db_user> password=<mysql_db_password> dbname=<mysql_db_name> table=alias select_field=goto where_field=address hosts=127.0.0.1:<mysql_db_port> additional_conditions = and active = 1
user=<mysql_db_user> password=<mysql_db_password> dbname=<mysql_db_name> table=domain select_field=domain where_field=domain hosts=127.0.0.1:<mysql_db_port> additional_conditions = and backupmx = 0 and active = 1
user=<mysql_db_user> password=<mysql_db_password> dbname=<mysql_db_name> table=domain select_field=domain where_field=domain hosts=127.0.0.1:<mysql_db_port> additional_conditions = and active = 1 and backupmx = 1
driver = mysql connect = host=127.0.0.1 port=3306 user=root password=rootpassword dbname=postfixadmindbname default_pass_scheme = CRAM-MD5 user_query = \ SELECT \ concat('/home/vmail/', maildir) as home, \ 5000 as uid, 5000 as gid \ FROM mailbox \ WHERE username = '%u' AND active = '1' password_query = \ SELECT username as user, password, \ concat('/home/vmail/', maildir) as userdb_home, \ concat('maildir:/home/vmail/', maildir) as userdb_mail, \ 5000 as userdb_uid, 5000 as userdb_gid \ FROM mailbox \ WHERE username = '%u' AND active = '1'
# Some general options protocols = imap pop3 sieve disable_plaintext_auth = yes ssl = yes ssl_cert = </etc/ssl/certs/ssl-mail.pem ssl_key = </etc/ssl/private/ssl-mail.key ssl_cipher_list = ALL:!LOW:!SSLv2:ALL:!aNULL:!ADH:!eNULL:!EXP:RC4+RSA:+HIGH:+MEDIUM mail_location = maildir:~/Maildir auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@ # IMAP configuration protocol imap { mail_max_userip_connections = 10 imap_client_workarounds = delay-newmail } # POP3 configuration protocol pop3 { mail_max_userip_connections = 10 pop3_client_workarounds = outlook-no-nuls oe-ns-eoh } # LDA configuration protocol lda { postmaster_address = postmaster mail_plugins = sieve quota_full_tempfail = yes deliver_log_format = msgid=%m: %$ rejection_reason = Your message to <%t> was automatically rejected:%n%r } # Plugins configuration plugin { sieve=~/.dovecot.sieve sieve_dir=~/sieve } # Authentication configuration auth_mechanisms = plain login service auth { # Postfix smtp-auth unix_listener /var/spool/postfix/private/dovecot-auth { mode = 0660 user = postfix group = postfix } }
auth_verbose = yes auth_debug = yes plugin { # Events to log. Also available: flag_change append #mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename # Available fields: uid, box, msgid, from, subject, size, vsize, flags # size and vsize are available only for expunge and copy events. #mail_log_fields = uid box msgid size }
auth_mechanisms = plain cram-md5 !include auth-system.conf.ext
passdb { driver = sql args = /etc/dovecot/dovecot-sql.conf.ext # [session=yes] [setcred=yes] [failure_show_msg=yes] [max_requests=<n>] # [cache_key=<key>] [<service name>] #args = dovecot } userdb { # <doc/wiki/AuthDatabase.Passwd.txt> driver = sql args = /etc/dovecot/dovecot-sql.conf.ext # [blocking=no] #args = }
mail_location = maildir:/home/vmail/%d/%u mail_uid = vmail mail_gid = vmail maildir_copy_with_hardlinks = yes
Just the changes …
$CONF['create_mailbox_subdirs_prefix']=''; $CONF['encrypt'] = 'dovecot:CRAM-MD5'; $CONF['dovecotpw'] = "/usr/bin/doveadm pw"; $CONF['new_quota_table'] = 'YES';
If you are moving to a new machine make sure that you tar and untar files to preserver permissions and most importantly timestamps. Or all your old mail will have the same date/time!
/home/vmail/courier-dovecot-migrate.pl --to-dovecot --recursive --convert --overwrite /home/vmail/example.org/
Sample output:
Converting to Dovecot format
Finding maildirs under /home/vmail/example.org/
Total: 70 mailboxes / 38 users
0 errors
46 dovecot-uidlist files written
WARNING: Badly done migration will cause your IMAP and/or POP3 clients to re-download all mails. Read http://wiki.dovecot.org/Migration carefully.
One way to get the courier subfolders to show up in dovecot is to add this to the configuration:
namespace private { prefix = INBOX. separator = . inbox = yes }
Alternatively, I created the subfolders (from squirrel mail) and then delete the newly created folders from the Linux file folders and renamed the existing file folders to the name I just deleted. So here goes for example:
mv .INBOX.SomeSubFolder/ junk mv .SomeSubFolder .INBOX.SomeSubFolder
Here I moved the newly created folder to a “junk” location (an alternative to just deleting it). Then renamed the original folder to the new folder name.
Just make sure you choose dovecot in the settings
dovecot --build-options find /usr/lib/dovecot/modules/ doveconf -a
Discussion
Hi
Now I have a problem:
When running a mail server using MySql in Ubuntu 12.04 LTS, this interfers with other installation that also uses MySql, namely GlobalSight.
How can I resolve this problem?
They use following syntax:
” Installing the MySQL Database Server
If you want to install the MySQL Database Server and GlobalSight application on separate servers, you need to install either the MySQL server or MySQL client on same server as the GlobalSight application.
The instructions below apply to MySQL Database Server version 5.1.25. Instructions for other versions may vary. Installing MySQL from tar.gz Packages
Pre-requisites:
To install MySQL:
Configuring the database
Creating the GlobalSight database and user using the MySQL command line
”
Not sure why this is a problem. You can have multiple databases on MySQL and one will not “interfere” with the other.
You have MySQL instructions, yet do not have a Postfix MySQL Maps Section, just wondering how you did it? So far your HowTo is the best out there as it describes where to put entries in each file.
Thanks Daniel for pointing it out. I have included the MySQL configuration as well now. I am glad it is helping folks as it did take me a bit to get all this together.