浏览代码

Make possible to customize InternalHosts with opendkim

Emmanuel Bouthenot 9 年之前
父节点
当前提交
c9d8e9ddf8

+ 11 - 0
roles/common/tasks/dkim.yml

@@ -50,6 +50,17 @@
     - 'Restart opendkim'
   when: with_opendkim
 
+- name: 'Install opendkim InternalHosts'
+  template:
+    src: 'opendkim/InternalHosts.j2'
+    dest: '/etc/opendkim/InternalHosts'
+    owner: 'root'
+    group: 'opendkim'
+    mode: '0640'
+  notify:
+    - 'Restart opendkim'
+  when: with_opendkim
+
 - name: 'Install DKIM private keys'
   copy:
     content: "{{lookup('file', 'data/dkim/' + item + '.pem')}}"

+ 10 - 0
roles/common/templates/opendkim/InternalHosts.j2

@@ -0,0 +1,10 @@
+{% if ansible_prolog -%}
+{% from 'templates/ansible/prolog.j2' import prolog with context %}
+{{ prolog() }}
+{% endif -%}
+127.0.0.1
+{% if dkim_internal_hosts is defined %}
+{% for host in dkim_internal_hosts %}
+{{ host }}
+{% endfor %}
+{% endif %}

+ 1 - 1
roles/common/templates/opendkim/opendkim.conf.j2

@@ -236,7 +236,7 @@ AlwaysAddARHeader yes
 ##  hosts from which mail should be signed rather than verified.
 ##  Automatically contains 127.0.0.1.
 
-# InternalHosts     dataset
+InternalHosts     file:/etc/opendkim/InternalHosts
 
 ##  KeepTemporaryFiles { yes | no }
 ##      default "no"