Page MenuHomeDevCentral

D3591.id9271.diff
No OneTemporary

D3591.id9271.diff

diff --git a/roles/mailserver/dkim/config.sls b/roles/mailserver/dkim/config.sls
--- a/roles/mailserver/dkim/config.sls
+++ b/roles/mailserver/dkim/config.sls
@@ -18,7 +18,9 @@
- template: jinja
- context:
dirs: {{ dirs }}
- socket: /var/run/milteropendkim/opendkim.sock
+ socket: /var/run/opendkim/opendkim.sock
+ user: opendkim
+ group: mail
# -------------------------------------------------------------
# OpenDKIM configuration tables
diff --git a/roles/mailserver/dkim/files/opendkim.conf b/roles/mailserver/dkim/files/opendkim.conf
--- a/roles/mailserver/dkim/files/opendkim.conf
+++ b/roles/mailserver/dkim/files/opendkim.conf
@@ -19,6 +19,12 @@
Socket local:{{ socket }}
+UMask 002
+UserID {{ user }}:{{ group }}
+
+PidFile /var/run/opendkim/opendkim.pid
+
+
# -------------------------------------------------------------
# Tables
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/roles/mailserver/dkim/files/rc/opendkim b/roles/mailserver/dkim/files/rc/opendkim
new file mode 100644
--- /dev/null
+++ b/roles/mailserver/dkim/files/rc/opendkim
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# PROVIDE: opendkim
+# REQUIRE: DAEMON
+# BEFORE: mail
+# KEYWORD: shutdown
+
+# -------------------------------------------------------------
+# OpenDKIM
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/mailserver/dkim/files/rc/opendkim
+# -------------------------------------------------------------
+#
+# <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>
+
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+# opendkim_enable (bool): Set it to YES to enable the service.
+# Default is "NO"
+# opendkim_user (user): Set user to run opendkim
+# Default is "opendkim".
+# opendkim_group (group): Set user to run opendkim
+# Default is "mail".
+# opendkim_config (config file path): Set config to run opendkim
+# Default is "/usr/local/etc/opendkim/opendkim.conf".
+# opendkim_perms (perms): Set config to run opendkim
+# Default is "0755".
+
+. /etc/rc.subr
+
+name="opendkim"
+rcvar="${name}_enable"
+
+load_rc_config $name
+
+: ${opendkim_enable:="NO"}
+: ${opendkim_user:="opendkim"}
+: ${opendkim_group:="mail"}
+: ${opendkim_config:="/usr/local/etc/opendkim/opendkim.conf"}
+: ${opendkim_perms:="0755"}
+
+pidfile="/var/run/opendkim/opendkim.pid"
+socketfile="/var/run/opendkim/opendkim.sock"
+command="/usr/local/sbin/opendkim"
+command_args="-l -u ${opendkim_user}:${opendkim_group} -P ${pidfile} -x ${opendkim_config}"
+
+start_precmd=opendkim_exec_startprecmd
+stop_postcmd=opendkim_exec_stop_postcmd
+
+opendkim_exec_startprecmd()
+{
+ mkdir -p /var/run/opendkim
+ chmod ${opendkim_perms} /var/run/opendkim
+ chown ${opendkim_user}:${opendkim_group} /var/run/opendkim
+}
+
+opendkim_exec_stop_postcmd()
+{
+ rm -f ${pidfile}
+ rm -f ${socketfile}
+}
+
+run_rc_command "$1"
diff --git a/roles/mailserver/dkim/files/rc/milteropendkim.conf b/roles/mailserver/dkim/files/rc/opendkim.conf
rename from roles/mailserver/dkim/files/rc/milteropendkim.conf
rename to roles/mailserver/dkim/files/rc/opendkim.conf
--- a/roles/mailserver/dkim/files/rc/milteropendkim.conf
+++ b/roles/mailserver/dkim/files/rc/opendkim.conf
@@ -3,7 +3,7 @@
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
-# Source file: roles/mailserver/dkim/files/rc/milteropendkim.conf
+# Source file: roles/mailserver/dkim/files/rc/opendkim.conf
# -------------------------------------------------------------
#
# <auto-generated>
@@ -13,7 +13,5 @@
# and will be lost if the state is redeployed.
# </auto-generated>
-milteropendkim_enable="YES"
-milteropendkim_uid="{{ user }}"
-milteropendkim_gid="{{ group }}"
-milteropendkim_cfgfile="{{ config }}"
+opendkim_enable="YES"
+opendkim_perms="0775"
diff --git a/roles/mailserver/dkim/service.sls b/roles/mailserver/dkim/service.sls
--- a/roles/mailserver/dkim/service.sls
+++ b/roles/mailserver/dkim/service.sls
@@ -14,13 +14,13 @@
{% if services["manager"] == "rc" %}
-/etc/rc.conf.d/milter-opendkim:
+/etc/rc.conf.d/opendkim:
file.managed:
- - source: salt://roles/mailserver/dkim/files/rc/milteropendkim.conf
- - template: jinja
- - context:
- user: opendkim
- group: mail
- config: {{ dirs.etc }}/opendkim/opendkim.conf
+ - source: salt://roles/mailserver/dkim/files/rc/opendkim.conf
+
+/usr/local/etc/rc.d/opendkim:
+ file.managed:
+ - source: salt://roles/mailserver/dkim/files/rc/opendkim
+ - mode: 775
{% endif %}
diff --git a/roles/mailserver/postfix/files/main.cf b/roles/mailserver/postfix/files/main.cf
--- a/roles/mailserver/postfix/files/main.cf
+++ b/roles/mailserver/postfix/files/main.cf
@@ -130,5 +130,5 @@
milter_default_action = accept
milter_protocol = 6
-smtpd_milters = unix:/var/run/milteropendkim/opendkim.sock
-non_smtpd_milters = unix:/var/run/milteropendkim/opendkim.sock
+smtpd_milters = unix:/var/run/opendkim/opendkim.sock
+non_smtpd_milters = unix:/var/run/opendkim/opendkim.sock

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 21, 07:27 (21 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2254874
Default Alt Text
D3591.id9271.diff (5 KB)

Event Timeline