Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
docker_notes:docker-mailserver [2025-01-26 Sun wk04 16:07] – [swaks] baumkpdocker_notes:docker-mailserver [2025-06-07 Sat wk23 18:45] (current) – [dovecot.conf] baumkp
Line 371: Line 371:
  
 =====dovecot===== =====dovecot=====
-''/etc/dovecot/conf.d''+In Dovecot <2.4.x the main configuration are in files ''/etc/dovecot/conf.d'', although /etc/dovecot/dovecot.conf is still used and can be used for all configuration. In Dovecot >= 2.4.x the main configuration is in /etc/dovecot/dovecot.conf, however configuration files in /etc/dovecot/conf.d may also still be used.  That being said, Dovecot version 2.4.x has significant breaking configuration setting changes from earlier versions.
 <code>/ # dovecot --version <code>/ # dovecot --version
 2.3.20 (80a5ac675d) </code> 2.3.20 (80a5ac675d) </code>
   *''doveconf -d''  to print default parameters   *''doveconf -d''  to print default parameters
   *''doveconf -n''  to print parameters specifically changed in main.cf   *''doveconf -n''  to print parameters specifically changed in main.cf
 +
 +Alpine Linux version 3.22 from May 2025 used Dovecot 2.4.1 and while I can use an older version of Alpine eventually I would need to upgrade Dovecot to the new configuration file syntax.  Basically Dovecot now recommends placing all configuration in one configuration file instead of many, ''/etc/dovecot/dovecot.conf'' It does allow the previous  configuration files under /etc/dovecot/conf.d to be used by the directive ''!include conf.d/*.conf'' in the dovecot.conf file.  The later directives will overwrite previous. Below is a copy on my update dovecot.conf file that appears to function on Dovecot 2.4.1. See [[https://doc.dovecot.org/2.4.1/core/settings/syntax.html#config-version|Dovecot Config File Syntax ]]
 +====dovecot.conf====
 +++++/etc/dovecot/dovecot.conf|
 +# Start new configs with the latest Dovecot version numbers here:\\
 +[[https://doc.dovecot.org/main/core/summaries/settings.html#dovecot_config_version|dovecot_config_version]] = 2.4.1\\
 +[[https://doc.dovecot.org/main/core/summaries/settings.html#dovecot_storage_version|dovecot_storage_version]] = 2.4.1\\
 +
 +#[[https://doc.dovecot.org/main/core/summaries/settings.html#mail_debug|mail_debug]] = yes\\
 +#[[https://doc.dovecot.org/main/core/summaries/settings.html#log_debug|log_debug]] = category=ssl\\
 +[[https://doc.dovecot.org/main/core/summaries/settings.html#mail_cache_max_size|mail_cache_max_size]] = 128M\\
 +
 +[[https://doc.dovecot.org/main/core/summaries/settings.html#auth_mechanisms|auth_mechanisms]] = plain login\\
 +[[https://doc.dovecot.org/main/core/summaries/settings.html#info_log_path|info_log_path]] = /var/log/dovecot-info.log\\
 +[[https://doc.dovecot.org/main/core/summaries/settings.html#log_path|log_path]] = /var/log/dovecot.log\\
 +[[https://doc.dovecot.org/main/core/summaries/settings.html#mail_driver|mail_driver]] = maildir\\
 +mail_path = ~/Maildir\\
 +
 +mail_plugins {\\
 +  quota = yes\\
 +}\\
 +
 +#sieve_plugins {\\
 +#  sieve_extprograms = yes\\
 +#}\\
 +
 +managesieve_notify_capability = mailto\\
 +managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext\\
 +
 +mbox_write_locks = fcntl\\
 +
 +namespace inbox {\\
 +  inbox = yes\\
 +  mailbox Drafts {\\
 +    special_use = \Drafts\\
 +  }\\
 +  mailbox Junk {\\
 +    special_use = \Junk\\
 +  }\\
 +  mailbox Sent {\\
 +    special_use = \Sent\\
 +  }\\
 +  mailbox "Sent Messages" {\\
 +    special_use = \Sent\\
 +  }\\
 +  mailbox Trash {\\
 +    special_use = \Trash\\
 +  }\\
 +  prefix = \\
 +}\\
 +
 +quota "Shared quota" {\\
 +#quota = maildir:User quota\\
 +  quota_status_nouser = DUNNO\\
 +  quota_status_overquota = 452 4.2.2 Mailbox is full and cannot receive any more emails\\
 +  quota_status_success = DUNNO\\
 +  warning warn-95 {\\
 +    quota_storage_percentage = 95 \\
 +    execute quota-warning {\\
 +      args = 95 %{user}\\
 +      }\\
 +    }\\
 +  warning warn-80 {\\
 +    quota_storage_percentage = 80\\
 +    execute quota-warning {\\
 +      args = 80 %{user}\\
 +      }\\
 +    }\\
 +}\\
 +
 +#sieve = file:~/sieve;active=~/.dovecot.sieve\\
 +sieve_script_driver = file\\
 +sieve_script_active_path = ~/.dovecot.sieve\\
 +sieve_script_type = after \\
 +sieve_script_path = /etc/dovecot/sieve-after\\
 +
 +protocols = imap lmtp\\
 +service auth {\\
 +  unix_listener /var/spool/postfix/private/auth {\\
 +    group = postfix\\
 +    mode = 0660\\
 +    user = postfix\\
 +  }\\
 +}\\
 +service lmtp {\\
 +  unix_listener /var/spool/postfix/private/dovecot-lmtp {\\
 +    group = postfix\\
 +    mode = 0600\\
 +    user = postfix\\
 +  }\\
 +}\\
 +service quota-status {\\
 +  executable = quota-status -p postfix\\
 +  unix_listener /var/spool/postfix/private/quota-status {\\
 +    user = postfix\\
 +  }\\
 +}\\
 +service quota-warning {\\
 +  executable = script /usr/local/bin/quota-warning.sh\\
 +  unix_listener quota-warning {\\
 +    group = vmail\\
 +    mode = 0660\\
 +    user = vmail\\
 +  }\\
 +}\\
 +ssl = required\\
 +ssl_server_cert_file = /app/certificates/kptree.net.cer\\
 +ssl_server_dh_file = /etc/dovecot/dh.pem \\
 +ssl_server_key_file = /app/certificates/kptree.net.key\\
 +ssl_server_prefer_ciphers = server\\
 +ssl_min_protocol = TLSv1.2\\
 +
 +sql_driver = mysql\\
 +
 +mysql localhost {\\
 +  host = mail_db \\
 +  dbname = mailserver\\
 +  user = mailserver \\
 +  password = K6oF4xOZFIo2cYrwTQ03jQWwx7t2my\\
 +}\\
 +
 +passdb sql {\\
 +  query = SELECT password FROM virtual_users WHERE email='%{user}'\\
 +}\\
 +
 +userdb sql {\\
 +  query = SELECT email as user, \
 +  concat('*:bytes=', quota) AS quota_rule, \
 +  '/var/vmail/%{user | domain}/%{user | username}' AS home, \
 +  5000 AS uid, 5000 AS gid \
 +  FROM virtual_users WHERE email='%{user}'\\
 +  iterate_query = SELECT email AS user FROM virtual_users\\
 +}\\
 +
 +protocol lmtp {\\
 +  mail_plugins = " quota sieve"\\
 +}\\
 +
 +protocol imap {\\
 +  mail_plugins = " quota imap_quota"\\
 +}\\
 +
 +#!include conf.d/*.conf\\
 +++++
  
 ====dovecot database configuration and testing==== ====dovecot database configuration and testing====
Line 492: Line 636:
  
 ====dovecot logging==== ====dovecot logging====
 +
 +====dovecot pigeonhole====
 +Pigeonhole is the name of the project that adds support for the [[http://www.sieve.info/|Sieve language (RFC 5228)]] and the [[http://tools.ietf.org/html/rfc5804|ManageSieve protocol (RFC 5804)]] to the [[http://www.dovecot.org/|Dovecot Secure IMAP Server]].
  
 ====Dovecot References==== ====Dovecot References====
   *Doc Dovecot:   *Doc Dovecot:
-    *[[https://doc.dovecot.org/configuration_manual/dovecot_ssl_configuration/|Dovecot SSL configuration]] +    *[[https://doc.dovecot.org/|Dovecot Community Edition Documentation]] 
-    *[[https://doc.dovecot.org/configuration_manual/howto/simple_virtual_install/#simple-virtual-install-smtp-auth|Simple Virtual User Installation]] +    *Dovecot 2.4.x 
-    *[[https://doc.dovecot.org/configuration_manual/namespace/|Namespaces]] +      *[[https://dovecot.org/mailman3/archives/list/dovecot@dovecot.org/message/WYKOYFBRIC622755CYOZQJV7IO7RKUM6/|Dovecot 2.4 Example config]] 
-    *[[https://wiki.dovecot.org/HowTo|HOWTOs Examples Tutorials]] +    ++++Dovecot 2.3.x| 
-    *[[https://doc.dovecot.org/settings/plugin/|Plugin Settings]] +      *[[https://doc.dovecot.org/2.3/configuration_manual/dovecot_ssl_configuration/|Dovecot SSL configuration]] 
-    *[[https://wiki2.dovecot.org/LDA/Postfix|Dovecot LDA with Postfix]] +      *[[https://doc.dovecot.org/2.3/configuration_manual/howto/simple_virtual_install/#simple-virtual-install-smtp-auth|Simple Virtual User Installation]] 
-    *[[https://doc.dovecot.org/configuration_manual/mail_location/|Mail Location Settings]] +      *[[https://doc.dovecot.org/2.3/configuration_manual/namespace/|Namespaces]] 
-    *[[https://doc.dovecot.org/admin_manual/doveadm_mailbox_commands/|Doveadm Mailbox Commands]] +      *[[https://doc.dovecot.org/2.3/settings/plugin/|Plugin Settings]] 
-    *[[https://wiki.dovecot.org/Tools/Doveadm|ToolsDoveadm]] +      *[[https://doc.dovecot.org/2.3/configuration_manual/mail_location/|Mail Location Settings]] 
-    *[[https://doc.dovecot.org/configuration_manual/authentication/password_schemes/|Password Schemes]] +      *[[https://doc.dovecot.org/2.3/admin_manual/doveadm_mailbox_commands/|Doveadm Mailbox Commands]] 
-    *[[https://wiki1.dovecot.org/AuthDatabase/SQL|AuthDatabase / SQL]] +      *[[https://doc.dovecot.org/2.3/configuration_manual/authentication/password_schemes/|Password Schemes]] 
-    *[[https://doc.dovecot.org/configuration_manual/authentication/sql/|SQL]] +      *[[https://doc.dovecot.org/2.3/configuration_manual/authentication/sql/|SQL]] 
-    *[[https://doc.dovecot.org/admin_manual/logging/|Dovecot Logging]] +      *[[https://doc.dovecot.org/2.3/admin_manual/logging/|Dovecot Logging]] 
-    *[[https://doc.dovecot.org/configuration_manual/quota_plugin/|Quota Plugin]] +      *[[https://doc.dovecot.org/2.3/configuration_manual/quota_plugin/|Quota Plugin]] 
-  *Other: +        *Other: 
-    *[[http://rob0.nodns4.us/|Postfix, DNS and general Linux system administration and consulting]] +          *[[http://rob0.nodns4.us/|Postfix, DNS and general Linux system administration and consulting]] 
-    *[[http://rob0.nodns4.us/howto/3-dovecot|F. Dovecot configuration]] +          *[[http://rob0.nodns4.us/howto/3-dovecot|F. Dovecot configuration]] 
-    *[[https://serverfault.com/questions/803533/dovecot-storing-mails-in-var-mail-but-mail-location-set-to-maildir-var-mail-v|Dovecot storing mails in /var/mail, but mail_location set to maildir:/var/mail/vhosts/%d/%n]] +          *[[https://serverfault.com/questions/803533/dovecot-storing-mails-in-var-mail-but-mail-location-set-to-maildir-var-mail-v|Dovecot storing mails in /var/mail, but mail_location set to maildir:/var/mail/vhosts/%d/%n]] 
-    *[[https://manpages.org/dovecot|man dovecot]] +++++
 =====Certificates SSL/TSL===== =====Certificates SSL/TSL=====
 Early on, before 2015 there were not many free SSL certificate providers. I used StartSSL for a free certificate.  They would purchased by a company that managed to get their certificate deregister...... So StartSSL basically became non-usable circa 2017.  Fourtunately a better solution came about a year or 2 earlier called LetsEncrypt. This could be used with certbot to get free certificates and eventually free wildcard certificates. Then came Traefik which handled certificates. Early on, before 2015 there were not many free SSL certificate providers. I used StartSSL for a free certificate.  They would purchased by a company that managed to get their certificate deregister...... So StartSSL basically became non-usable circa 2017.  Fourtunately a better solution came about a year or 2 earlier called LetsEncrypt. This could be used with certbot to get free certificates and eventually free wildcard certificates. Then came Traefik which handled certificates.
Line 858: Line 1004:
 =====Mailserver testing from CLI===== =====Mailserver testing from CLI=====
   *''telnet mail.kptree.net 25'' Tests the main SMPT mail server connectivity. Port 25 is also designated smtp.   *''telnet mail.kptree.net 25'' Tests the main SMPT mail server connectivity. Port 25 is also designated smtp.
-  *''telnet mail.kptree.net 587'' Tests the mail client SMPT server connectivity.  Port 25 is also designated submission. +  *''telnet mail.kptree.net 587'' Tests the mail client SMPT server connectivity.  Port 25 is also designated submission.  STARTTLS; Normal Password 
-  *''telnet mail.kptree.net imap'' Tests the mail client imap server connectivity.  The designation imap is port 143.+  *''telnet mail.kptree.net imap'' Tests the mail client imap server connectivity.  The designation imap is port 143.  STARTTLS; Normal Password
  
 The mailserver exit control character is '^]' or control key ]. The mailserver exit control character is '^]' or control key ].
 The SMTP and mailserver exit control character is '^]' or control key ]. The SMTP and mailserver exit control character is '^]' or control key ].
 +
  
 =====Errors===== =====Errors=====