Browse Source

Better permission handling for OpenDMARC.

Resolves #400.
Alex Payne 9 years ago
parent
commit
58a4532fe7

+ 3
- 0
roles/mailserver/tasks/dmarc.yml View File

@@ -37,6 +37,9 @@
37 37
 - name: Copy nightly OpenDMARC report generation script into place
38 38
   template: src=etc_opendmarc_report.sh.j2 dest=/etc/opendmarc/report.sh owner=root group=root mode="755"
39 39
 
40
+- name: Touch initial report dat file with correct permissions
41
+  file: path=/var/run/opendmarc/opendmarc.dat state=touch owner=opendmarc group=opendmarc
42
+
40 43
 - name: Activate OpenDMARC report cronjob
41 44
   cron: name="OpenDMARC report" hour="2" minute="0" job="/bin/bash /etc/opendmarc/report.sh >> /var/log/opendmarc_report.log"
42 45
 

+ 2
- 1
roles/mailserver/templates/etc_opendmarc_report.sh.j2 View File

@@ -8,7 +8,8 @@ WORK_DIR='/var/run/opendmarc'
8 8
 REPORT_EMAIL='{{ admin_email }}'
9 9
 
10 10
 mv ${WORK_DIR}/opendmarc.dat ${WORK_DIR}/opendmarc_import.dat -f
11
-cat /dev/null > ${WORK_DIR}/opendmarc.dat
11
+touch ${WORK_DIR}/opendmarc.dat
12
+chown opendmarc:opendmarc ${WORK_DIR}/opendmarc.dat
12 13
 
13 14
 /usr/sbin/opendmarc-import --dbhost=${DB_SERVER} --dbuser=${DB_USER} --dbpasswd=${DB_PASS} --dbname=${DB_NAME} --verbose < ${WORK_DIR}/opendmarc_import.dat
14 15
 

Loading…
Cancel
Save