Commit 9fb504abd4415b48ae0eae94cece031ebcd48abb

Authored by David Silva
1 parent ff64e648

Defines variable to write mailman's emails in file.

config/dev/config.yaml
@@ -20,3 +20,4 @@ external_outgoing_mail_domain: serpro.gov.br @@ -20,3 +20,4 @@ external_outgoing_mail_domain: serpro.gov.br
20 raven_dsn: https://a5e2f92a83774dfc9de66486e0fe970b:1a9229a4e1d2483582144d302fb53115@sentry.tracy.com.br/19 20 raven_dsn: https://a5e2f92a83774dfc9de66486e0fe970b:1a9229a4e1d2483582144d302fb53115@sentry.tracy.com.br/19
21 google_analytics_id: 'UA-64206731-2' 21 google_analytics_id: 'UA-64206731-2'
22 dev_backup_frequency: true 22 dev_backup_frequency: true
  23 +disable_send_emails: true
cookbooks/mailman/files/centos/master.cf
@@ -126,3 +126,8 @@ scache unix - - n - 1 scache @@ -126,3 +126,8 @@ scache unix - - n - 1 scache
126 mailman unix - n n - - pipe 126 mailman unix - n n - - pipe
127 flags=FR user=mailman:mailman argv=/usr/lib/mailman/bin/postfix-to-mailman.py 127 flags=FR user=mailman:mailman argv=/usr/lib/mailman/bin/postfix-to-mailman.py
128 ${nexthop} ${user} 128 ${nexthop} ${user}
  129 +
  130 +fs_mail unix - n n - - pipe
  131 + flags=F user=spb argv=tee --append /var/tmp/fs_mail.dump
  132 +
  133 +
cookbooks/mailman/files/centos/master.cf.development
@@ -1,129 +0,0 @@ @@ -1,129 +0,0 @@
1 -# MANAGED WITH CHEF; DO NOT CHANGE BY HAND  
2 -#  
3 -# Postfix master process configuration file. For details on the format  
4 -# of the file, see the master(5) manual page (command: "man 5 master").  
5 -#  
6 -# Do not forget to execute "postfix reload" after editing this file.  
7 -#  
8 -# ==========================================================================  
9 -# service type private unpriv chroot wakeup maxproc command + args  
10 -# (yes) (yes) (yes) (never) (100)  
11 -# ==========================================================================  
12 -smtp inet n - n - - smtpd  
13 -#smtp inet n - n - 1 postscreen  
14 -#smtpd pass - - n - - smtpd  
15 -#dnsblog unix - - n - 0 dnsblog  
16 -#tlsproxy unix - - n - 0 tlsproxy  
17 -#submission inet n - n - - smtpd  
18 -# -o syslog_name=postfix/submission  
19 -# -o smtpd_tls_security_level=encrypt  
20 -# -o smtpd_sasl_auth_enable=yes  
21 -# -o smtpd_reject_unlisted_recipient=no  
22 -# -o smtpd_client_restrictions=$mua_client_restrictions  
23 -# -o smtpd_helo_restrictions=$mua_helo_restrictions  
24 -# -o smtpd_sender_restrictions=$mua_sender_restrictions  
25 -# -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject  
26 -# -o milter_macro_daemon_name=ORIGINATING  
27 -#smtps inet n - n - - smtpd  
28 -# -o syslog_name=postfix/smtps  
29 -# -o smtpd_tls_wrappermode=yes  
30 -# -o smtpd_sasl_auth_enable=yes  
31 -# -o smtpd_reject_unlisted_recipient=no  
32 -# -o smtpd_client_restrictions=$mua_client_restrictions  
33 -# -o smtpd_helo_restrictions=$mua_helo_restrictions  
34 -# -o smtpd_sender_restrictions=$mua_sender_restrictions  
35 -# -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject  
36 -# -o milter_macro_daemon_name=ORIGINATING  
37 -#628 inet n - n - - qmqpd  
38 -pickup unix n - n 60 1 pickup  
39 -cleanup unix n - n - 0 cleanup  
40 -qmgr unix n - n 300 1 qmgr  
41 -#qmgr unix n - n 300 1 oqmgr  
42 -tlsmgr unix - - n 1000? 1 tlsmgr  
43 -rewrite unix - - n - - trivial-rewrite  
44 -bounce unix - - n - 0 bounce  
45 -defer unix - - n - 0 bounce  
46 -trace unix - - n - 0 bounce  
47 -verify unix - - n - 1 verify  
48 -flush unix n - n 1000? 0 flush  
49 -proxymap unix - - n - - proxymap  
50 -proxywrite unix - - n - 1 proxymap  
51 -smtp unix - - n - - smtp  
52 -relay unix - - n - - smtp  
53 -# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5  
54 -showq unix n - n - - showq  
55 -error unix - - n - - error  
56 -retry unix - - n - - error  
57 -discard unix - - n - - discard  
58 -local unix - n n - - local  
59 -virtual unix - n n - - virtual  
60 -lmtp unix - - n - - lmtp  
61 -anvil unix - - n - 1 anvil  
62 -scache unix - - n - 1 scache  
63 -#  
64 -# ====================================================================  
65 -# Interfaces to non-Postfix software. Be sure to examine the manual  
66 -# pages of the non-Postfix software to find out what options it wants.  
67 -#  
68 -# Many of the following services use the Postfix pipe(8) delivery  
69 -# agent. See the pipe(8) man page for information about ${recipient}  
70 -# and other message envelope options.  
71 -# ====================================================================  
72 -#  
73 -# maildrop. See the Postfix MAILDROP_README file for details.  
74 -# Also specify in main.cf: maildrop_destination_recipient_limit=1  
75 -#  
76 -#maildrop unix - n n - - pipe  
77 -# flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}  
78 -#  
79 -# ====================================================================  
80 -#  
81 -# Recent Cyrus versions can use the existing "lmtp" master.cf entry.  
82 -#  
83 -# Specify in cyrus.conf:  
84 -# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4  
85 -#  
86 -# Specify in main.cf one or more of the following:  
87 -# mailbox_transport = lmtp:inet:localhost  
88 -# virtual_transport = lmtp:inet:localhost  
89 -#  
90 -# ====================================================================  
91 -#  
92 -# Cyrus 2.1.5 (Amos Gouaux)  
93 -# Also specify in main.cf: cyrus_destination_recipient_limit=1  
94 -#  
95 -#cyrus unix - n n - - pipe  
96 -# user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -r ${sender} -m ${extension} ${user}  
97 -#  
98 -# ====================================================================  
99 -#  
100 -# Old example of delivery via Cyrus.  
101 -#  
102 -#old-cyrus unix - n n - - pipe  
103 -# flags=R user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -m ${extension} ${user}  
104 -#  
105 -# ====================================================================  
106 -#  
107 -# See the Postfix UUCP_README file for configuration details.  
108 -#  
109 -#uucp unix - n n - - pipe  
110 -# flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)  
111 -#  
112 -# ====================================================================  
113 -#  
114 -# Other external delivery methods.  
115 -#  
116 -#ifmail unix - n n - - pipe  
117 -# flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)  
118 -#  
119 -#bsmtp unix - n n - - pipe  
120 -# flags=Fq. user=bsmtp argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient  
121 -#  
122 -#scalemail-backend unix - n n - 2 pipe  
123 -# flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store  
124 -# ${nexthop} ${user} ${extension}  
125 -#  
126 -  
127 -fs_mail unix - n n - - pipe  
128 - flags=F user=spb argv=tee --append /var/tmp/fs_mail.dump  
129 -  
cookbooks/mailman/recipes/default.rb
@@ -83,18 +83,18 @@ cookbook_file '/etc/cron.d/mailman-spb' do @@ -83,18 +83,18 @@ cookbook_file '/etc/cron.d/mailman-spb' do
83 mode 0644 83 mode 0644
84 end 84 end
85 85
86 -execute 'postfix:disable-email-prod' do 86 +execute 'postfix:disable-send-emails' do
87 command "postconf 'default_transport = fs_mail'" 87 command "postconf 'default_transport = fs_mail'"
88 - not_if "cat /etc/postfix/main.cf | grep 'default_transport = fs_mail'"  
89 - action :nothing 88 + only_if "#{node['config']['disable_send_emails']}"
  89 +end
  90 +
  91 +execute 'postfix:enable-send-emails' do
  92 + command "postconf 'default_transport = smtp'"
  93 + not_if "#{node['config']['disable_send_emails']}"
90 end 94 end
91 95
92 cookbook_file '/etc/postfix/master.cf' do 96 cookbook_file '/etc/postfix/master.cf' do
93 - unless node['environment'] == "prod"  
94 - source 'master.cf.development'  
95 - notifies :run, 'execute[postfix:disable-email-prod]'  
96 - end  
97 - notifies :restart, 'service[postfix]' 97 + notifies :reload, 'service[postfix]'
98 end 98 end
99 99
100 execute 'set-mailman-default-list' do 100 execute 'set-mailman-default-list' do