/
main.yml
482 lines (409 loc) · 17.2 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# .. _opendkim__ref_defaults:
# debops.opendkim default variables [[[
# =====================================
# .. contents:: Sections
# :local:
#
# .. include:: ../../../../includes/global.rst
# APT packages, application version [[[
# -------------------------------------
# .. envvar:: opendkim__base_packages [[[
#
# List of APT packages to install for OpenDKIM support.
opendkim__base_packages: [ 'opendkim', 'opendkim-tools' ]
# ]]]
# .. envvar:: opendkim__packages [[[
#
# List of additional APT packages to install with OpenDKIM.
opendkim__packages: []
# ]]]
# .. envvar:: opendkim__version [[[
#
# The version of the installed OpenDKIM service, gathered automatically by
# Ansible local facts.
opendkim__version: '{{ ansible_local.opendkim.version
if (ansible_local|d() and ansible_local.opendkim|d() and
ansible_local.opendkim.version|d())
else "0.0.0" }}'
# ]]]
# ]]]
# Application environment, Postfix support [[[
# --------------------------------------------
# .. envvar:: opendkim__user [[[
#
# The UNIX system account used by the OpenDKIM service.
opendkim__user: 'opendkim'
# ]]]
# .. envvar:: opendkim__group [[[
#
# The UNIX system group used by the OpenDKIM service.
opendkim__group: 'opendkim'
# ]]]
# .. envvar:: opendkim__postfix_integration [[[
#
# Enable or disable integration with Postfix SMTP server.
# See :ref:`opendkim__ref_postfix` for more details.
opendkim__postfix_integration: '{{ ansible_local.postfix.installed
if (ansible_local|d() and ansible_local.postfix|d() and
ansible_local.postfix.installed is defined)
else False }}'
# ]]]
# .. envvar:: opendkim__postfix_group [[[
#
# Name of the UNIX system group used by Postfix SMTP server. This variable is
# used to create the OpenDKIM socket directory with correct access permissions
# for Postfix.
opendkim__postfix_group: '{{ ansible_local.postfix.system_group
if (ansible_local|d() and ansible_local.postfix|d() and
ansible_local.postfix.system_group|d())
else "postfix" }}'
# ]]]
# .. envvar:: opendkim__pidfile [[[
#
# Path to the PID file used by OpenDKIM.
opendkim__pidfile: '/var/run/opendkim/opendkim.pid'
# ]]]
# .. envvar:: opendkim__socket [[[
#
# path to the UNIX socket used by OpenDKIM.
opendkim__socket: '{{ "/var/spool/postfix/opendkim/opendkim.sock"
if opendkim__postfix_integration|bool
else "/var/run/opendkim/opendkim.sock" }}'
# ]]]
# .. envvar:: opendkim__domain [[[
#
# The main DNS domain used in the OpenDKIM configuration.
opendkim__domain: '{{ ansible_local.core.domain
if (ansible_local|d() and ansible_local.core|d() and
ansible_local.core.domain|d())
else ansible_domain }}'
# ]]]
# .. envvar:: opendkim__fqdn [[[
#
# The Fully Qualified Domain Name of the current host used in the OpenDKIM
# configuration.
opendkim__fqdn: '{{ ansible_local.core.fqdn
if (ansible_local|d() and ansible_local.core|d() and
ansible_local.core.domain|d())
else ansible_fqdn }}'
# ]]]
# .. envvar:: opendkim__domainkeys_path [[[
#
# Directory where DomainKeys are stored on the remote host.
opendkim__dkimkeys_path: '/etc/dkimkeys'
# ]]]
# .. envvar:: opendkim__default_key_size [[[
#
# The default size of the RSA DomainKeys generated by the role.
opendkim__default_key_size: '2048'
# ]]]
# ]]]
# DomainKeys configuration [[[
# ----------------------------
# These variables configure the DomainKeys used by OpenDKIM.
# See :ref:`opendkim__ref_keys` for more details.
# .. envvar:: opendkim__default_keys [[[
#
# The list of default DomainKeys configured by the role.
opendkim__default_keys:
- name: 'mail'
# ]]]
# .. envvar:: opendkim__keys [[[
#
# List of DomainKeys which should be present on all hosts in the Ansible
# inventory.
opendkim__keys: []
# ]]]
# .. envvar:: opendkim__group_keys [[[
#
# List of DomainKeys which should be present on hosts in specific Ansible
# inventory group.
opendkim__group_keys: []
# ]]]
# .. envvar:: opendkim__host_keys [[[
#
# List of DomainKeys which should be present on specific hosts in the Ansible
# inventory.
opendkim__host_keys: []
# ]]]
# .. envvar:: opendkim__combined_keys [[[
#
# This list combines the other DomainKey lists and is used in the Ansible
# tasks.
opendkim__combined_keys: '{{ opendkim__default_keys
+ opendkim__keys
+ opendkim__group_keys
+ opendkim__host_keys }}'
# ]]]
# ]]]
# DKIM Signing Table [[[
# ----------------------
# These variables configure the OpenDKIM Signing Table, which specifies what
# messages should be signed by which DomainKeys.
# See :ref:`opendkim__ref_signing_table` for more details.
# .. envvar:: opendkim__default_signing_table [[[
#
# List of default signing table entries defined by the role.
opendkim__default_signing_table:
- name: 'mail'
from: '{{ opendkim__domain }}'
domain: '{{ opendkim__domain }}'
subdomains: True
# ]]]
# .. envvar:: opendkim__signing_table [[[
#
# List of signing table entries which should be present on all hosts in the
# Ansible inventory.
opendkim__signing_table: []
# ]]]
# .. envvar:: opendkim__group_signing_table [[[
#
# List of signing table entries which should be present on hosts in specific
# Ansible inventory group.
opendkim__group_signing_table: []
# ]]]
# .. envvar:: opendkim__host_signing_table [[[
#
# List of signing table entries which should be present on specific hosts in
# the Ansible inventory.
opendkim__host_signing_table: []
# ]]]
# .. envvar:: opendkim__combined_signing_table [[[
#
# The variable that combines all of the signing table list variables and is
# used in the configuration template.
opendkim__combined_signing_table: '{{ opendkim__default_signing_table
+ opendkim__signing_table
+ opendkim__group_signing_table
+ opendkim__host_signing_table }}'
# ]]]
# ]]]
# Trusted hosts [[[
# -----------------
# These variables define lists of "trusted hosts" which will be used in the
# ``InternalHosts`` and ``ExternalIgnoreList`` configuration options.
# See :ref:`opendkim__ref_trusted_hosts` for more details.
# .. envvar:: opendkim__default_trusted_hosts [[[
#
# The default list of trusted hosts defined by the role.
opendkim__default_trusted_hosts:
- '127.0.0.1'
- '::1'
- 'localhost'
- '{{ opendkim__fqdn }}'
# ]]]
# .. envvar:: opendkim__trusted_hosts [[[
#
# The list of trusted hosts which should be defined on all hosts in the Ansible
# inventory.
opendkim__trusted_hosts: []
# ]]]
# .. envvar:: opendkim__group_trusted_hosts [[[
#
# The list of trusted hosts which should be defined on hosts in specific
# Ansible inventory group.
opendkim__group_trusted_hosts: []
# ]]]
# .. envvar:: opendkim__host_trusted_hosts [[[
#
# The list of trusted hosts which should be defined on specific hosts in the
# Ansible inventory.
opendkim__host_trusted_hosts: []
# ]]]
# .. envvar:: opendkim__combined_trusted_hosts [[[
#
# The variable that combines all of the trusted host lists and passes them to
# the configuration template.
opendkim__combined_trusted_hosts: '{{ opendkim__default_trusted_hosts
+ opendkim__trusted_hosts
+ opendkim__group_trusted_hosts
+ opendkim__host_trusted_hosts }}'
# ]]]
# ]]]
# OpenDKIM main configuration [[[
# -------------------------------
# These variables define the contents of the :file:`/etc/opendkim.conf`
# configuration file. See :ref:`opendkim__ref_config` for more details.
# .. envvar:: opendkim__original_config [[[
#
# The configuration set by default by the Debian package after installation.
opendkim__original_config:
- name: 'config-header'
comment: |
This is a basic configuration that can easily be adapted to suit a standard
installation. For more advanced options, see opendkim.conf(5) and/or
/usr/share/doc/opendkim/examples/opendkim.conf.sample.
state: 'hidden'
- name: 'Syslog'
comment: 'Log to syslog'
value: True
- name: 'UMask'
comment: |
Required to use local socket with MTAs that access the socket as a non-
privileged user (e. g. Postfix)
value: '002'
- name: 'Domain'
comment: |
Sign for example.com with key in /etc/mail/dkim.key using
selector '2007' (e. g. 2007._domainkey.example.com)
value: 'example.com'
state: 'comment'
- name: 'KeyFile'
value: '/etc/mail/dkim.key'
state: 'comment'
- name: 'Selector'
value: '2007'
state: 'comment'
- name: 'Canonicalization'
comment: 'Commonly-used options; the commented-out versions show the defaults.'
value: 'simple'
state: 'comment'
- name: 'Mode'
value: 'sv'
state: 'comment'
- name: 'Subdomains'
value: False
state: 'comment'
- name: 'ADSPAction'
value: 'continue'
state: '{{ "comment"
if (ansible_distribution_release in [ "wheezy", "jessie" ])
else "absent" }}'
- name: 'OversignHeaders'
comment: |
Always oversign From (sign using actual From and a null From to prevent
malicious signatures header fields (From and/or others) between the signer
and the verifier. From is oversigned by default in the Debian pacakge
because it is often the identity key used by reputation systems and thus
somewhat security sensitive.
value: [ 'From' ]
- name: 'ResolverConfiguration'
comment: |
ResolverConfiguration filename
default (none)
Specifies a configuration file to be passed to the Unbound library that
performs DNS queries applying the DNSSEC protocol. See the Unbound
documentation at http://unbound.net for the expected content of this file.
The results of using this and the TrustAnchorFile setting at the same
time are undefined.
In Debian, /etc/unbound/unbound.conf is shipped as part of the Suggested
unbound package
value: '/etc/unbound/unbound.conf'
state: '{{ "absent"
if (ansible_distribution_release in [ "wheezy", "jessie" ])
else "comment" }}'
- name: 'TrustAnchorFile'
comment: |
TrustAnchorFile filename
default (none)
Specifies a file from which trust anchor data should be read when doing
DNS queries and applying the DNSSEC protocol. See the Unbound documentation
at http://unbound.net for the expected format of this file.
value: '/usr/share/dns/root.key'
state: '{{ "absent"
if (ansible_distribution_release in [ "wheezy", "jessie" ])
else "present" }}'
- name: 'ATPSDomains'
comment: |
List domains to use for RFC 6541 DKIM Authorized Third-Party Signatures
(ATPS) (experimental)
value: [ 'example.com' ]
state: '{{ "comment"
if (ansible_distribution_release in [ "wheezy", "jessie" ])
else "absent" }}'
# ]]]
# .. envvar:: opendkim__default_config [[[
#
# The OpenDKIM configuration defined by the ``debops.opendkim`` Ansible role.
opendkim__default_config:
- name: 'ResolverConfiguration'
state: '{{ "present"
if (ansible_local|d() and ansible_local.unbound|d() and
(ansible_local.unbound.installed|d()) | bool)
else "ignore" }}'
- name: 'TrustAnchorFile'
state: '{{ "absent"
if (ansible_local|d() and ansible_local.unbound|d() and
(ansible_local.unbound.installed|d()) | bool)
else "ignore" }}'
- name: 'Socket'
comment: 'Listen for connections in the Postfix chroot'
value: 'local:{{ opendkim__socket }}'
state: '{{ "present" if opendkim__postfix_integration|bool else "ignore" }}'
- name: 'UserID'
comment: 'Required by the systemd opendkim.service unit'
value: '{{ opendkim__user + ":" + opendkim__group }}'
state: '{{ "comment"
if (ansible_distribution_release in [ "wheezy", "jessie" ])
else "present" }}'
- name: 'PidFile'
comment: 'Required by the systemd opendkim.service unit'
value: '/run/opendkim/opendkim.pid'
state: '{{ "comment"
if (ansible_distribution_release in [ "wheezy", "jessie" ])
else "present" }}'
- name: 'KeyTable'
value: '{{ opendkim__dkimkeys_path + "/KeyTable" }}'
copy_id_from: 'Selector'
weight: 1
- name: 'SigningTable'
value: '{{ opendkim__dkimkeys_path + "/SigningTable" }}'
copy_id_from: 'KeyTable'
weight: 2
- name: 'InternalHosts'
value: '{{ opendkim__dkimkeys_path + "/TrustedHosts" }}'
copy_id_from: 'KeyTable'
weight: 3
- name: 'ExternalIgnoreList'
value: '{{ opendkim__dkimkeys_path + "/TrustedHosts" }}'
copy_id_from: 'KeyTable'
weight: 4
# ]]]
# .. envvar:: opendkim__config [[[
#
# The configuration which should be set on all hosts in the Ansible inventory.
opendkim__config: []
# ]]]
# .. envvar:: opendkim__group_config [[[
#
# The configuration which should be set on hosts in specific Ansible inventory
# group.
opendkim__group_config: []
# ]]]
# .. envvar:: opendkim__host_config [[[
#
# The configuration which should be set on specific hosts in the Ansible
# inventory.
opendkim__host_config: []
# ]]]
# .. envvar:: opendkim__combined_config [[[
#
# The combined OpenDKIM configuration passed to the config file template.
opendkim__combined_config: '{{ opendkim__original_config
+ opendkim__default_config
+ opendkim__config
+ opendkim__group_config
+ opendkim__host_config }}'
# ]]]
# ]]]
# Configuration for other Ansible roles [[[
# -----------------------------------------
# .. envvar:: opendkim__postfix__dependent_maincf [[[
#
# The :file:`main.cf` configuration for :ref:`debops.postfix` Ansible role.
opendkim__postfix__dependent_maincf:
- name: 'smtpd_milters'
value:
- name: 'unix:/opendkim/opendkim.sock'
weight: -300
state: 'present'
- name: 'non_smtpd_milters'
value:
- name: 'unix:/opendkim/opendkim.sock'
weight: -300
state: 'present'
# ]]]
# ]]]
# ]]]