Page MenuHomeDevCentral

D3364.id8677.diff
No OneTemporary

D3364.id8677.diff

diff --git a/roles/mailserver/dovecot/files/conf.d/10-auth.conf b/roles/mailserver/dovecot/files/conf.d/10-auth.conf
new file mode 100644
--- /dev/null
+++ b/roles/mailserver/dovecot/files/conf.d/10-auth.conf
@@ -0,0 +1,18 @@
+# -------------------------------------------------------------
+# Dovecot configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/mailserver/dovecot/files/conf.d/10-auth.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+auth_mechanisms = plain login
+
+!include auth-sql.conf.ext
diff --git a/roles/mailserver/dovecot/files/conf.d/10-mail.conf b/roles/mailserver/dovecot/files/conf.d/10-mail.conf
new file mode 100644
--- /dev/null
+++ b/roles/mailserver/dovecot/files/conf.d/10-mail.conf
@@ -0,0 +1,18 @@
+# -------------------------------------------------------------
+# Dovecot configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/mailserver/dovecot/files/conf.d/10-mail.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+mail_location = maildir:{{ mailbox.dir }}
+
+mail_plugins = quota
diff --git a/roles/mailserver/dovecot/files/conf.d/10-master.conf b/roles/mailserver/dovecot/files/conf.d/10-master.conf
new file mode 100644
--- /dev/null
+++ b/roles/mailserver/dovecot/files/conf.d/10-master.conf
@@ -0,0 +1,30 @@
+# -------------------------------------------------------------
+# Dovecot configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/mailserver/dovecot/files/conf.d/10-master.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+# Postfix smtp-auth
+unix_listener /var/spool/postfix/private/auth {
+ mode = 0660
+ user = postfix
+ group = postfix
+}
+
+
+service lmtp {
+ unix_listener /var/spool/postfix/private/dovecot-lmtp {
+ group = postfix
+ mode = 0600
+ user = postfix
+ }
+}
diff --git a/roles/mailserver/dovecot/files/conf.d/10-ssl.conf b/roles/mailserver/dovecot/files/conf.d/10-ssl.conf
new file mode 100644
--- /dev/null
+++ b/roles/mailserver/dovecot/files/conf.d/10-ssl.conf
@@ -0,0 +1,19 @@
+# -------------------------------------------------------------
+# Dovecot configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/mailserver/dovecot/files/conf.d/10-ssl.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+ssl_cert = </usr/local/etc/letsencrypt/live/admin.mail.nasqueron.org/certs.pem
+ssl_key = </usr/local/etc/letsencrypt/live/admin.mail.nasqueron.org/private.pem
+
+ssl = required
diff --git a/roles/mailserver/dovecot/files/conf.d/auth-sql.conf.ext b/roles/mailserver/dovecot/files/conf.d/auth-sql.conf.ext
new file mode 100644
--- /dev/null
+++ b/roles/mailserver/dovecot/files/conf.d/auth-sql.conf.ext
@@ -0,0 +1,24 @@
+# -------------------------------------------------------------
+# Dovecot configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/mailserver/dovecot/files/conf.d/auth-sql.conf.ext
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+passdb {
+ driver = pgsql
+ args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
+}
+
+userdb {
+ driver = pgsql
+ args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
+}
diff --git a/roles/mailserver/dovecot/files/dovecot-sql.conf.ext b/roles/mailserver/dovecot/files/dovecot-sql.conf.ext
new file mode 100644
--- /dev/null
+++ b/roles/mailserver/dovecot/files/dovecot-sql.conf.ext
@@ -0,0 +1,64 @@
+# -------------------------------------------------------------
+# Dovecot configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/mailserver/dovecot/files/dovecot-sql.conf.ext
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+
+# This file is commonly accessed via passdb {} or userdb {} section in
+# conf.d/auth-sql.conf.ext
+
+# This file is opened as root, so it should be owned by root and mode 0600.
+#
+# http://wiki2.dovecot.org/AuthDatabase/SQL
+#
+# For the sql passdb module, you'll need a database with a table that
+# contains fields for at least the username and password. If you want to
+# use the user@domain syntax, you might want to have a separate domain
+# field as well.
+#
+# If your users all have the same uig/gid, and have predictable home
+# directories, you can use the static userdb module to generate the home
+# dir based on the username and domain. In this case, you won't need fields
+# for home, uid, or gid in the database.
+#
+# If you prefer to use the sql userdb module, you'll want to add fields
+# for home, uid, and gid. Here is an example table:
+#
+# CREATE TABLE users (
+# username VARCHAR(128) NOT NULL,
+# domain VARCHAR(128) NOT NULL,
+# password VARCHAR(64) NOT NULL,
+# home VARCHAR(255) NOT NULL,
+# uid INTEGER NOT NULL,
+# gid INTEGER NOT NULL,
+# active CHAR(1) DEFAULT 'Y' NOT NULL
+# );
+
+driver = pgsql
+
+connect == \
+ host={{ db.hostname }} \
+ dbname={{ db.name }} \
+ user={{ db.user }} \
+ password={{ db.password }}
+
+password_query = SELECT username as user, password as password, \
+ homedir AS userdb_home, maildir AS userdb_mail, \
+ concat('*:bytes=', quota) as userdb_quota_rule, uid AS userdb_uid, gid AS userdb_gid \
+ FROM mailbox \
+ WHERE username = '%Lu' AND active = '1' \
+ AND ( access_restriction = 'ALL' OR POSITION( '%Us' IN access_restriction ) > 0 )
+
+user_query = SELECT homedir AS home, maildir AS mail, \
+ concat('*:bytes=', quota) as quota_rule, uid, gid \
+ FROM mailbox WHERE username = '%u'
diff --git a/roles/mailserver/dovecot/files/dovecot.conf b/roles/mailserver/dovecot/files/dovecot.conf
new file mode 100644
--- /dev/null
+++ b/roles/mailserver/dovecot/files/dovecot.conf
@@ -0,0 +1,16 @@
+# -------------------------------------------------------------
+# dovecot main configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/mailserver/dovecot/files/dovecot.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+!include conf.d/*.conf
diff --git a/roles/mailserver/dovecot/init.sls b/roles/mailserver/dovecot/init.sls
new file mode 100644
--- /dev/null
+++ b/roles/mailserver/dovecot/init.sls
@@ -0,0 +1,34 @@
+# -------------------------------------------------------------
+# Salt — Provision dovecot Config
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+dovecot:
+ pkg.installed
+
+{{ dirs.etc }}/dovecot/conf.d:
+ file.directory:
+ - mode: 600
+ - user: root
+ - group: wheel
+ - makedirs: True
+
+{{ dirs.etc }}/dovecot/dovecot.conf:
+ file.managed:
+ - source: salt://roles/mailserver/dovecot/files/dovecot.conf
+ - template: jinja
+
+{{ dirs.etc }}/dovecot/conf.d:
+ file.recurse:
+ - source: salt://roles/mailserver/dovecot/files/conf.d
+ - mode: 644
+ - context:
+ db:
+ hostname: host1
+ name: host2
+ password: hpst3
+ user: host4
+ mailbox:
+ dir: /var/mail/_virtual

File Metadata

Mime Type
text/plain
Expires
Fri, Sep 20, 01:41 (3 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2154489
Default Alt Text
D3364.id8677.diff (9 KB)

Event Timeline