Simple yet functional dovecot+postfix
parent
508c741ffa
commit
47272df96b
@ -1,13 +0,0 @@
|
|||||||
auth_mechanisms = plain login cram-md5
|
|
||||||
|
|
||||||
passdb {
|
|
||||||
driver = sql
|
|
||||||
args = /etc/dovecot/dovecot-sql.conf.ext
|
|
||||||
}
|
|
||||||
|
|
||||||
userdb {
|
|
||||||
driver = sql
|
|
||||||
args = /etc/dovecot/dovecot-sql.conf.ext
|
|
||||||
}
|
|
||||||
|
|
||||||
#!include auth-system.conf.ext
|
|
@ -1,6 +0,0 @@
|
|||||||
# mailbox configuration
|
|
||||||
|
|
||||||
first_valid_gid = 70000
|
|
||||||
first_valid_uid = 70000
|
|
||||||
mail_access_groups = mail
|
|
||||||
mail_location = maildir:~/Maildir
|
|
@ -1,43 +0,0 @@
|
|||||||
service imap-login {
|
|
||||||
inet_listener imap {
|
|
||||||
port = 143
|
|
||||||
}
|
|
||||||
inet_listener imaps {
|
|
||||||
port = 993
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
service lmtp {
|
|
||||||
unix_listener /var/spool/postfix/private/dovecot-lmtp {
|
|
||||||
user = postfix
|
|
||||||
group = postfix
|
|
||||||
mode = 0600
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
service auth {
|
|
||||||
user = doveauth
|
|
||||||
unix_listener auth-userdb {
|
|
||||||
}
|
|
||||||
unix_listener /var/spool/postfix/private/dovecot-auth {
|
|
||||||
user = postfix
|
|
||||||
group = postfix
|
|
||||||
mode = 0600
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
service auth-worker {
|
|
||||||
unix_listener auth-worker {
|
|
||||||
user = mail
|
|
||||||
group = $default_internal_user
|
|
||||||
mode = 0660
|
|
||||||
}
|
|
||||||
user = mail
|
|
||||||
}
|
|
||||||
|
|
||||||
service dict {
|
|
||||||
unix_listener dict {
|
|
||||||
group = mail
|
|
||||||
mode = 0660
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
# SSL/TLS support
|
|
||||||
ssl = yes
|
|
||||||
ssl_cert = </etc/ssl/cert.pem
|
|
||||||
ssl_key = </etc/ssl/key.pem
|
|
@ -1,6 +0,0 @@
|
|||||||
# delivery configuration
|
|
||||||
postmaster_address = admin@domain.tld
|
|
||||||
recipient_delimiter = +
|
|
||||||
protocol lda {
|
|
||||||
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
# mail browsing
|
|
||||||
protocol imap {
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
# mail delivery
|
|
||||||
protocol lmtp {
|
|
||||||
}
|
|
@ -1,18 +1,10 @@
|
|||||||
driver = pgsql
|
driver = sqlite
|
||||||
connect = host=localhost dbname=mailsys user=dovecot password=$Dovecot_PASS
|
connect = /data/freeposte.db
|
||||||
|
|
||||||
|
# Return the user hashed password
|
||||||
password_query = \
|
password_query = \
|
||||||
SELECT userid AS "user", password FROM dovecotpassword('%Ln', '%Ld') WHERE %Ls
|
SELECT password FROM users, domains WHERE username = '%n' AND domain = '%d'
|
||||||
|
|
||||||
# uncomment this user_query if you want to use the quota plugin
|
# Mostly get the user quota
|
||||||
#user_query = \
|
user_query = \
|
||||||
# SELECT home, uid, gid, mail, quota_rule FROM dovecotquotauser('%Ln', '%Ld')
|
SELECT '*:bytes=' || quota_bytes AS quota_rule FROM users WHERE username = '%n' AND domain = '%d'
|
||||||
|
|
||||||
# otherwise uncomment the following user_query
|
|
||||||
#user_query = SELECT home, uid, gid, mail FROM dovecotuser('%Ln', '%Ld')
|
|
||||||
|
|
||||||
iterate_query = \
|
|
||||||
SELECT local_part AS username, domain_name.domainname AS domain \
|
|
||||||
FROM users \
|
|
||||||
LEFT JOIN domain_data USING (gid) \
|
|
||||||
LEFT JOIN domain_name USING (gid)
|
|
||||||
|
@ -1,2 +1,123 @@
|
|||||||
# handled protocols
|
###############
|
||||||
protocols = imap lmtp
|
# General
|
||||||
|
###############
|
||||||
|
protocols = imap lmtp sieve
|
||||||
|
postmaster_address = %{env:POSTMASTER_ADDRESS}
|
||||||
|
hostname = %{env:MAIL_HOSTNAME}
|
||||||
|
|
||||||
|
###############
|
||||||
|
# Mailboxes
|
||||||
|
###############
|
||||||
|
first_valid_gid = 8
|
||||||
|
first_valid_uid = 8
|
||||||
|
mail_location = maildir:/data/mail/%u
|
||||||
|
mail_home = /data/mail/%u
|
||||||
|
mail_uid = mail
|
||||||
|
mail_gid = mail
|
||||||
|
mail_privileged_group = mail
|
||||||
|
mail_access_groups = mail
|
||||||
|
|
||||||
|
###############
|
||||||
|
# TLS
|
||||||
|
###############
|
||||||
|
ssl = yes
|
||||||
|
ssl_cert = </data/ssl/cert.pem
|
||||||
|
ssl_key = </data/ssl/key.pem
|
||||||
|
|
||||||
|
###############
|
||||||
|
# Authentication
|
||||||
|
###############
|
||||||
|
auth_mechanisms = plain login cram-md5
|
||||||
|
|
||||||
|
passdb {
|
||||||
|
driver = sql
|
||||||
|
args = /etc/dovecot/dovecot-sql.conf.ext
|
||||||
|
}
|
||||||
|
|
||||||
|
userdb {
|
||||||
|
driver = sql
|
||||||
|
args = /etc/dovecot/dovecot-sql.conf.ext
|
||||||
|
}
|
||||||
|
|
||||||
|
service auth {
|
||||||
|
user = dovecot
|
||||||
|
unix_listener auth-userdb {
|
||||||
|
}
|
||||||
|
unix_listener /var/spool/postfix/private/dovecot-auth {
|
||||||
|
user = postfix
|
||||||
|
group = postfix
|
||||||
|
mode = 0600
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
service auth-worker {
|
||||||
|
unix_listener auth-worker {
|
||||||
|
user = mail
|
||||||
|
group = $default_internal_user
|
||||||
|
mode = 0660
|
||||||
|
}
|
||||||
|
user = mail
|
||||||
|
}
|
||||||
|
|
||||||
|
###############
|
||||||
|
# IMAP
|
||||||
|
###############
|
||||||
|
|
||||||
|
protocol imap {
|
||||||
|
}
|
||||||
|
|
||||||
|
service imap-login {
|
||||||
|
inet_listener imap {
|
||||||
|
port = 143
|
||||||
|
}
|
||||||
|
inet_listener imaps {
|
||||||
|
port = 993
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
###############
|
||||||
|
# Delivery
|
||||||
|
###############
|
||||||
|
|
||||||
|
protocol lmtp {
|
||||||
|
}
|
||||||
|
|
||||||
|
protocol lda {
|
||||||
|
recipient_delimiter = +
|
||||||
|
}
|
||||||
|
|
||||||
|
service lmtp {
|
||||||
|
unix_listener /var/spool/postfix/private/dovecot-lmtp {
|
||||||
|
user = postfix
|
||||||
|
group = postfix
|
||||||
|
mode = 0600
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
service dict {
|
||||||
|
unix_listener dict {
|
||||||
|
group = mail
|
||||||
|
mode = 0660
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
###############
|
||||||
|
# Filtering
|
||||||
|
###############
|
||||||
|
|
||||||
|
service managesieve-login {
|
||||||
|
inet_listener sieve {
|
||||||
|
port = 4190
|
||||||
|
}
|
||||||
|
inet_listener sieve_deprecated {
|
||||||
|
port = 2000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin {
|
||||||
|
sieve = ~/.sieve
|
||||||
|
sieve_dir = ~/sieve
|
||||||
|
sieve_before = /var/lib/dovecot/sieve/before.sieve
|
||||||
|
sieve_default = /var/lib/dovecot/sieve/default.sieve
|
||||||
|
sieve_after = /var/lib/dovecot/sieve/after.sieve
|
||||||
|
}
|
||||||
|
@ -1,33 +1,43 @@
|
|||||||
# aliases
|
###############
|
||||||
sql = pgsql:${config_directory}/
|
# General
|
||||||
proxysql = proxy:${sql}
|
###############
|
||||||
|
|
||||||
# relocated users from the database
|
# The list of relayed networks is still loaded from a configuration file
|
||||||
relocated_maps = ${proxysql}pgsql-relocated_maps.cf
|
mynetworks = /data/relaynets
|
||||||
|
# Empty alias list to override the configuration variable and disable NIS
|
||||||
|
alias_maps = hash:/etc/aliases
|
||||||
|
# SQLite configuration
|
||||||
|
sql = sqlite:${config_directory}/
|
||||||
|
|
||||||
# transport settings from our database
|
###############
|
||||||
transport_maps = ${proxysql}pgsql-transport_maps.cf
|
# TLS
|
||||||
|
###############
|
||||||
|
smtpd_use_tls = yes
|
||||||
|
smtpd_tls_cert_file=/data/ssl/cert.pem
|
||||||
|
smtpd_tls_key_file=/data/ssl/key.pem
|
||||||
|
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
|
||||||
|
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
|
||||||
|
|
||||||
# virtual domains, mailboxes and aliases
|
###############
|
||||||
virtual_mailbox_domains = ${proxysql}pgsql-virtual_mailbox_domains.cf
|
# SASL
|
||||||
virtual_alias_maps = ${proxysql}pgsql-virtual_alias_maps.cf
|
###############
|
||||||
virtual_minimum_uid = 70000
|
smtpd_sasl_local_domain = $myhostname
|
||||||
virtual_uid_maps = ${sql}pgsql-virtual_uid_maps.cf
|
|
||||||
virtual_gid_maps = ${sql}pgsql-virtual_gid_maps.cf
|
|
||||||
virtual_mailbox_base = /
|
|
||||||
virtual_mailbox_maps = ${proxysql}pgsql-virtual_mailbox_maps.cf
|
|
||||||
|
|
||||||
# delivery transport
|
|
||||||
virtual_transport = lmtp:unix:private/dovecot-lmtp
|
|
||||||
|
|
||||||
# dovecot SASL
|
|
||||||
smtpd_sasl_type = dovecot
|
smtpd_sasl_type = dovecot
|
||||||
smtpd_sasl_path = private/dovecot-auth
|
smtpd_sasl_path = private/dovecot-auth
|
||||||
smtpd_sasl_auth_enable = yes
|
smtpd_sasl_auth_enable = yes
|
||||||
smtpd_sasl_security_options = noplaintext, noanonymous
|
smtpd_sasl_security_options = noanonymous
|
||||||
|
|
||||||
# submission restrictions
|
###############
|
||||||
smtpd_recipient_restrictions =
|
# Virtual
|
||||||
permit_mynetworks
|
###############
|
||||||
permit_sasl_authenticated
|
virtual_mailbox_domains = ${sql}sqlite-virtual_mailbox_domains.cf
|
||||||
reject_unauth_destination
|
virtual_alias_maps = ${sql}sqlite-virtual_alias_maps.cf
|
||||||
|
virtual_transport = lmtp:unix:private/dovecot-lmtp
|
||||||
|
|
||||||
|
###############
|
||||||
|
# Milter
|
||||||
|
###############
|
||||||
|
milter_default_action = tempfail
|
||||||
|
milter_protocol = 6
|
||||||
|
smtpd_milters =
|
||||||
|
non_smtpd_milters =
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
# All parameters are described in pgsql_table(5) / PGSQL PARAMETERS
|
|
||||||
#
|
|
||||||
# The hosts that Postfix will try to connect to and query from.
|
|
||||||
hosts = localhost
|
|
||||||
|
|
||||||
# The user name and password to log into the pgsql server.
|
|
||||||
user = postfix
|
|
||||||
password = some_password
|
|
||||||
|
|
||||||
# The database name on the servers.
|
|
||||||
dbname = mailsys
|
|
||||||
|
|
||||||
# The SQL query template used to search the database
|
|
||||||
query = SELECT destination FROM postfix_relocated_map('%u', '%d')
|
|
@ -1,18 +0,0 @@
|
|||||||
# All parameters are described in pgsql_table(5) / PGSQL PARAMETERS
|
|
||||||
#
|
|
||||||
# The hosts that Postfix will try to connect to and query from.
|
|
||||||
hosts = localhost
|
|
||||||
|
|
||||||
# The user name and password to log into the pgsql server.
|
|
||||||
user = postfix
|
|
||||||
password = some_password
|
|
||||||
|
|
||||||
# The database name on the servers.
|
|
||||||
dbname = mailsys
|
|
||||||
|
|
||||||
# XXX see create_optional_types_and_functions.pgsql
|
|
||||||
# * line 9: type sender_login
|
|
||||||
# * line 26: function postfix_smtpd_sender_login_map + comment above
|
|
||||||
#
|
|
||||||
# The SQL query template used to search the database
|
|
||||||
query = SELECT login FROM postfix_smtpd_sender_login_map('%u', '%d')
|
|
@ -1,14 +0,0 @@
|
|||||||
# All parameters are described in pgsql_table(5) / PGSQL PARAMETERS
|
|
||||||
#
|
|
||||||
# The hosts that Postfix will try to connect to and query from.
|
|
||||||
hosts = localhost
|
|
||||||
|
|
||||||
# The user name and password to log into the pgsql server.
|
|
||||||
user = postfix
|
|
||||||
password = some_password
|
|
||||||
|
|
||||||
# The database name on the servers.
|
|
||||||
dbname = mailsys
|
|
||||||
|
|
||||||
# The SQL query template used to search the database
|
|
||||||
query = SELECT transport FROM postfix_transport_map('%u', '%d')
|
|
@ -1,14 +0,0 @@
|
|||||||
# All parameters are described in pgsql_table(5) / PGSQL PARAMETERS
|
|
||||||
#
|
|
||||||
# The hosts that Postfix will try to connect to and query from.
|
|
||||||
hosts = localhost
|
|
||||||
|
|
||||||
# The user name and password to log into the pgsql server.
|
|
||||||
user = postfix
|
|
||||||
password = some_password
|
|
||||||
|
|
||||||
# The database name on the servers.
|
|
||||||
dbname = mailsys
|
|
||||||
|
|
||||||
# The SQL query template used to search the database
|
|
||||||
query = SELECT destination FROM postfix_virtual_alias_map('%u', '%d')
|
|
@ -1,14 +0,0 @@
|
|||||||
# All parameters are described in pgsql_table(5) / PGSQL PARAMETERS
|
|
||||||
#
|
|
||||||
# The hosts that Postfix will try to connect to and query from.
|
|
||||||
hosts = localhost
|
|
||||||
|
|
||||||
# The user name and password to log into the pgsql server.
|
|
||||||
user = postfix
|
|
||||||
password = some_password
|
|
||||||
|
|
||||||
# The database name on the servers.
|
|
||||||
dbname = mailsys
|
|
||||||
|
|
||||||
# The SQL query template used to search the database
|
|
||||||
query = SELECT gid FROM postfix_gid WHERE domainname='%d'
|
|
@ -1,14 +0,0 @@
|
|||||||
# All parameters are described in pgsql_table(5) / PGSQL PARAMETERS
|
|
||||||
#
|
|
||||||
# The hosts that Postfix will try to connect to and query from.
|
|
||||||
hosts = localhost
|
|
||||||
|
|
||||||
# The user name and password to log into the pgsql server.
|
|
||||||
user = postfix
|
|
||||||
password = some_password
|
|
||||||
|
|
||||||
# The database name on the servers.
|
|
||||||
dbname = mailsys
|
|
||||||
|
|
||||||
# The SQL query template used to search the database
|
|
||||||
query = SELECT gid FROM postfix_gid WHERE domainname='%s'
|
|
@ -1,14 +0,0 @@
|
|||||||
# All parameters are described in pgsql_table(5) / PGSQL PARAMETERS
|
|
||||||
#
|
|
||||||
# The hosts that Postfix will try to connect to and query from.
|
|
||||||
hosts = localhost
|
|
||||||
|
|
||||||
# The user name and password to log into the pgsql server.
|
|
||||||
user = postfix
|
|
||||||
password = some_password
|
|
||||||
|
|
||||||
# The database name on the servers.
|
|
||||||
dbname = mailsys
|
|
||||||
|
|
||||||
# The SQL query template used to search the database
|
|
||||||
query = SELECT maildir FROM postfix_virtual_mailbox_map('%u', '%d')
|
|
@ -1,14 +0,0 @@
|
|||||||
# All parameters are described in pgsql_table(5) / PGSQL PARAMETERS
|
|
||||||
#
|
|
||||||
# The hosts that Postfix will try to connect to and query from.
|
|
||||||
hosts = localhost
|
|
||||||
|
|
||||||
# The user name and password to log into the pgsql server.
|
|
||||||
user = postfix
|
|
||||||
password = some_password
|
|
||||||
|
|
||||||
# The database name on the servers.
|
|
||||||
dbname = mailsys
|
|
||||||
|
|
||||||
# The SQL query template used to search the database
|
|
||||||
query = SELECT uid FROM postfix_virtual_uid_map('%u', '%d')
|
|
@ -0,0 +1,2 @@
|
|||||||
|
dbpath = /data/freeposte.db
|
||||||
|
query = SELECT destination FROM aliases WHERE localpart = '%u' AND domain = '%d'
|
@ -0,0 +1,2 @@
|
|||||||
|
dbpath = /data/freeposte.db
|
||||||
|
query = SELECT domain FROM domains WHERE domain='%s'
|
@ -1,8 +1,12 @@
|
|||||||
[supervisord]
|
[supervisord]
|
||||||
nodaemon = true
|
nodaemon = true
|
||||||
|
loglevel=debug
|
||||||
|
|
||||||
[program:postfix]
|
[program:postfix]
|
||||||
command = /usr/lib/postfix/master -d
|
command = /usr/lib/postfix/master -d
|
||||||
|
|
||||||
[program:dovecot]
|
[program:dovecot]
|
||||||
command = /usr/sbin/dovecot -c /etc/dovecot/dovecot.conf -F
|
command = /usr/sbin/dovecot -c /etc/dovecot/dovecot.conf -F
|
||||||
|
|
||||||
|
[program:rsyslog]
|
||||||
|
command = rsyslogd -n
|
||||||
|
Loading…
Reference in New Issue