smartmachine 1.2.3 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smart_machine/apps/app.rb +1 -0
  3. data/lib/smart_machine/buildpackers/buildpacker.rb +2 -2
  4. data/lib/smart_machine/commands/grid.rb +8 -0
  5. data/lib/smart_machine/commands/grid_commands/emailer.rb +107 -0
  6. data/lib/smart_machine/commands/grid_commands/roundcube.rb +107 -0
  7. data/lib/smart_machine/configuration.rb +35 -2
  8. data/lib/smart_machine/credentials.rb +10 -0
  9. data/lib/smart_machine/engine.rb +7 -1
  10. data/lib/smart_machine/grids/adminer.rb +1 -0
  11. data/lib/smart_machine/grids/certbot.rb +1 -0
  12. data/lib/smart_machine/grids/emailer/imapsync.rb +7 -0
  13. data/lib/smart_machine/grids/emailer.rb +188 -0
  14. data/lib/smart_machine/grids/haproxy.rb +1 -0
  15. data/lib/smart_machine/grids/mariadb.rb +1 -0
  16. data/lib/smart_machine/grids/postgresql.rb +1 -0
  17. data/lib/smart_machine/grids/roundcube/.keep +0 -0
  18. data/lib/smart_machine/grids/roundcube.rb +184 -0
  19. data/lib/smart_machine/machine.rb +7 -0
  20. data/lib/smart_machine/syncer.rb +10 -0
  21. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/command.rb +50 -0
  22. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/entrypoint.rb +196 -0
  23. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/logtailer.rb +75 -0
  24. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/10-auth.conf +132 -0
  25. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/10-mail.conf +427 -0
  26. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/10-master.conf +153 -0
  27. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/10-ssl.conf +87 -0
  28. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/15-mailboxes.conf +94 -0
  29. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/20-imap.conf +102 -0
  30. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/20-lmtp.conf +43 -0
  31. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/90-quota.conf +114 -0
  32. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/90-sieve.conf +229 -0
  33. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/dovecot-sql.conf.ext +163 -0
  34. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve/learn-ham.sh +2 -0
  35. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve/learn-ham.sieve +5 -0
  36. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve/learn-spam.sh +2 -0
  37. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve/learn-spam.sieve +2 -0
  38. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve-after/spam-to-folder.sieve +6 -0
  39. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/haproxy/haproxy.cfg +58 -0
  40. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/monit/conf.d/services.cfg +70 -0
  41. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/monit/monitrc +344 -0
  42. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/opendkim.conf +71 -0
  43. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/main.cf +128 -0
  44. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/master.cf +149 -0
  45. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-sender-login-maps.cf +7 -0
  46. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-domains.cf +7 -0
  47. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-maps-domains.cf +7 -0
  48. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-maps-masters.cf +7 -0
  49. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-maps-users.cf +7 -0
  50. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-maps-userstothemselves.cf +7 -0
  51. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-mailbox-domains.cf +7 -0
  52. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-mailbox-maps.cf +7 -0
  53. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix-policyd-spf-python/policyd-spf.conf +12 -0
  54. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/spamassassin/local.cf +124 -0
  55. data/lib/smart_machine/templates/dotsmartmachine/config/emailer/usr/local/bin/quota-warning.sh +22 -0
  56. data/lib/smart_machine/templates/dotsmartmachine/config/emailer.yml +37 -0
  57. data/lib/smart_machine/templates/dotsmartmachine/config/engine.yml +2 -0
  58. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/docker/custom-docker-entrypoint.sh +185 -0
  59. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/docker/entrypoint.rb +58 -0
  60. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/etc/apache2/sites-available/000-default.conf +36 -0
  61. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/usr/local/etc/php/conf.d/zzz_roundcube-custom.ini +4 -0
  62. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/var/roundcube/config/config.custom.inc.php +25 -0
  63. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/var/www/html/plugins/password/config.inc.php +523 -0
  64. data/lib/smart_machine/templates/dotsmartmachine/config/roundcube.yml +49 -0
  65. data/lib/smart_machine/templates/dotsmartmachine/config/users.yml +1 -1
  66. data/lib/smart_machine/version.rb +2 -2
  67. data/lib/smart_machine.rb +2 -0
  68. metadata +89 -8
@@ -0,0 +1,344 @@
1
+ ###############################################################################
2
+ ## Monit control file
3
+ ###############################################################################
4
+ ##
5
+ ## Comments begin with a '#' and extend through the end of the line. Keywords
6
+ ## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
7
+ ##
8
+ ## Below you will find examples of some frequently used statements. For
9
+ ## information about the control file and a complete list of statements and
10
+ ## options, please have a look in the Monit manual.
11
+ ##
12
+ ##
13
+ ###############################################################################
14
+ ## Global section
15
+ ###############################################################################
16
+ ##
17
+ ## Start Monit in the background (run as a daemon):
18
+ #
19
+ set daemon 120 # check services at 2-minute intervals
20
+ # with start delay 240 # optional: delay the first check by 4-minutes (by
21
+ # # default Monit check immediately after Monit start)
22
+ #
23
+ #
24
+ ## Set syslog logging. If you want to log to a standalone log file instead,
25
+ ## specify the full path to the log file
26
+ #
27
+ set log /var/log/monit.log
28
+
29
+ #
30
+ #
31
+ ## Set the location of the Monit lock file which stores the process id of the
32
+ ## running Monit instance. By default this file is stored in $HOME/.monit.pid
33
+ #
34
+ # set pidfile /var/run/monit.pid
35
+ ##### SmartMachine Begin.
36
+ set pidfile /run/tmpfs/monit.pid
37
+ ##### SmartMachine Close.
38
+ #
39
+ ## Set the location of the Monit id file which stores the unique id for the
40
+ ## Monit instance. The id is generated and stored on first Monit start. By
41
+ ## default the file is placed in $HOME/.monit.id.
42
+ #
43
+ # set idfile /var/.monit.id
44
+ set idfile /var/lib/monit/id
45
+ #
46
+ ## Set the location of the Monit state file which saves monitoring states
47
+ ## on each cycle. By default the file is placed in $HOME/.monit.state. If
48
+ ## the state file is stored on a persistent filesystem, Monit will recover
49
+ ## the monitoring state across reboots. If it is on temporary filesystem, the
50
+ ## state will be lost on reboot which may be convenient in some situations.
51
+ #
52
+ set statefile /var/lib/monit/state
53
+ #
54
+ #
55
+
56
+ ## Set limits for various tests. The following example shows the default values:
57
+ ##
58
+ # set limits {
59
+ # programOutput: 512 B, # check program's output truncate limit
60
+ # sendExpectBuffer: 256 B, # limit for send/expect protocol test
61
+ # fileContentBuffer: 512 B, # limit for file content test
62
+ # httpContentBuffer: 1 MB, # limit for HTTP content test
63
+ # networkTimeout: 5 seconds # timeout for network I/O
64
+ # programTimeout: 300 seconds # timeout for check program
65
+ # stopTimeout: 30 seconds # timeout for service stop
66
+ # startTimeout: 30 seconds # timeout for service start
67
+ # restartTimeout: 30 seconds # timeout for service restart
68
+ # }
69
+
70
+ ## Set global SSL options (just most common options showed, see manual for
71
+ ## full list).
72
+ #
73
+ # set ssl {
74
+ # verify : enable, # verify SSL certificates (disabled by default but STRONGLY RECOMMENDED)
75
+ # selfsigned : allow # allow self signed SSL certificates (reject by default)
76
+ # }
77
+ #
78
+ #
79
+ ## Set the list of mail servers for alert delivery. Multiple servers may be
80
+ ## specified using a comma separator. If the first mail server fails, Monit
81
+ # will use the second mail server in the list and so on. By default Monit uses
82
+ # port 25 - it is possible to override this with the PORT option.
83
+ #
84
+ # set mailserver mail.bar.baz, # primary mailserver
85
+ # backup.bar.baz port 10025, # backup mailserver on port 10025
86
+ # localhost # fallback relay
87
+ ##### SmartMachine Begin.
88
+ set mailserver %<monit_smtp_host>s port %<monit_smtp_port>s username "%<monit_smtp_username>s" password "%<monit_smtp_password>s" using SSL using HOSTNAME %<container_name>s.%<fqdn>s
89
+ ##### SmartMachine Close.
90
+ #
91
+ #
92
+ ## By default Monit will drop alert events if no mail servers are available.
93
+ ## If you want to keep the alerts for later delivery retry, you can use the
94
+ ## EVENTQUEUE statement. The base directory where undelivered alerts will be
95
+ ## stored is specified by the BASEDIR option. You can limit the queue size
96
+ ## by using the SLOTS option (if omitted, the queue is limited by space
97
+ ## available in the back end filesystem).
98
+ #
99
+ set eventqueue
100
+ basedir /var/lib/monit/events # set the base directory where events will be stored
101
+ slots 100 # optionally limit the queue size
102
+ #
103
+ #
104
+ ## Send status and events to M/Monit (for more information about M/Monit
105
+ ## see https://mmonit.com/). By default Monit registers credentials with
106
+ ## M/Monit so M/Monit can smoothly communicate back to Monit and you don't
107
+ ## have to register Monit credentials manually in M/Monit. It is possible to
108
+ ## disable credential registration using the commented out option below.
109
+ ## Though, if safety is a concern we recommend instead using https when
110
+ ## communicating with M/Monit and send credentials encrypted. The password
111
+ ## should be URL encoded if it contains URL-significant characters like
112
+ ## ":", "?", "@". Default timeout is 5 seconds, you can customize it by
113
+ ## adding the timeout option.
114
+ #
115
+ # set mmonit http://monit:monit@192.168.1.10:8080/collector
116
+ # # with timeout 30 seconds # Default timeout is 5 seconds
117
+ # # and register without credentials # Don't register credentials
118
+ #
119
+ #
120
+ ## Monit by default uses the following format for alerts if the mail-format
121
+ ## statement is missing::
122
+ ## --8<--
123
+ ## set mail-format {
124
+ ## from: Monit <monit@$HOST>
125
+ ## subject: monit alert -- $EVENT $SERVICE
126
+ ## message: $EVENT Service $SERVICE
127
+ ## Date: $DATE
128
+ ## Action: $ACTION
129
+ ## Host: $HOST
130
+ ## Description: $DESCRIPTION
131
+ ##
132
+ ## Your faithful employee,
133
+ ## Monit
134
+ ## }
135
+ ## --8<--
136
+ ##
137
+ ## You can override this message format or parts of it, such as subject
138
+ ## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc.
139
+ ## are expanded at runtime. For example, to override the sender, use:
140
+ #
141
+ # set mail-format { from: monit@foo.bar }
142
+ ##### SmartMachine Begin.
143
+ set mail-format {
144
+ from: %<monit_smtp_email_name>s <%<monit_smtp_email_address>s>
145
+ subject: Monit | $SERVICE | $EVENT
146
+ message:
147
+ While monitoring the system, I observed a change and have performed the actions you had asked.
148
+
149
+ Date: $DATE
150
+ Timezone: %<timezone>s
151
+ Host: $HOST
152
+ FQDN: %<fqdn>s
153
+ Container: %<container_name>s
154
+ Service: $SERVICE
155
+ Event: $EVENT
156
+ Action: $ACTION
157
+ Description: $DESCRIPTION
158
+
159
+ Please check if you need to do something about it further.
160
+
161
+ Your Faithful Employee,
162
+ Monit
163
+ }
164
+ ##### SmartMachine Close.
165
+ #
166
+ #
167
+ ## You can set alert recipients whom will receive alerts if/when a
168
+ ## service defined in this file has errors. Alerts may be restricted on
169
+ ## events by using a filter as in the second example below.
170
+ #
171
+ # set alert sysadm@foo.bar # receive all alerts
172
+ ##### SmartMachine Begin.
173
+ set alert %<sysadmin_email>s
174
+ ##### SmartMachine Close.
175
+ #
176
+ ## Do not alert when Monit starts, stops or performs a user initiated action.
177
+ ## This filter is recommended to avoid getting alerts for trivial cases.
178
+ #
179
+ # set alert your-name@your.domain not on { instance, action }
180
+ #
181
+ #
182
+ ## Monit has an embedded HTTP interface which can be used to view status of
183
+ ## services monitored and manage services from a web interface. The HTTP
184
+ ## interface is also required if you want to issue Monit commands from the
185
+ ## command line, such as 'monit status' or 'monit restart service' The reason
186
+ ## for this is that the Monit client uses the HTTP interface to send these
187
+ ## commands to a running Monit daemon. See the Monit Wiki if you want to
188
+ ## enable SSL for the HTTP interface.
189
+ #
190
+ # set httpd port 2812 and
191
+ # use address localhost # only accept connection from localhost (drop if you use M/Monit)
192
+ # allow localhost # allow localhost to connect to the server and
193
+ # allow admin:monit # require user 'admin' with password 'monit'
194
+ # #with ssl { # enable SSL/TLS and set path to server certificate
195
+ # # pemfile: /etc/ssl/certs/monit.pem
196
+ # #}
197
+ ##### SmartMachine Begin.
198
+ set httpd port 2812 and
199
+ use address localhost
200
+ allow localhost
201
+ ##### SmartMachine Close.
202
+
203
+ ###############################################################################
204
+ ## Services
205
+ ###############################################################################
206
+ ##
207
+ ## Check general system resources such as load average, cpu and memory
208
+ ## usage. Each test specifies a resource, conditions and the action to be
209
+ ## performed should a test fail.
210
+ #
211
+ # check system $HOST
212
+ # if loadavg (1min) per core > 2 for 5 cycles then alert
213
+ # if loadavg (5min) per core > 1.5 for 10 cycles then alert
214
+ # if cpu usage > 95% for 10 cycles then alert
215
+ # if memory usage > 75% then alert
216
+ # if swap usage > 25% then alert
217
+ #
218
+ #
219
+ ## Check if a file exists, checksum, permissions, uid and gid. In addition
220
+ ## to alert recipients in the global section, customized alert can be sent to
221
+ ## additional recipients by specifying a local alert handler. The service may
222
+ ## be grouped using the GROUP option. More than one group can be specified by
223
+ ## repeating the 'group name' statement.
224
+ #
225
+ # check file apache_bin with path /usr/local/apache/bin/httpd
226
+ # if failed checksum and
227
+ # expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor
228
+ # if failed permission 755 then unmonitor
229
+ # if failed uid "root" then unmonitor
230
+ # if failed gid "root" then unmonitor
231
+ # alert security@foo.bar on {
232
+ # checksum, permission, uid, gid, unmonitor
233
+ # } with the mail-format { subject: Alarm! }
234
+ # group server
235
+ #
236
+ #
237
+ ## Check that a process is running, in this case Apache, and that it respond
238
+ ## to HTTP and HTTPS requests. Check its resource usage such as cpu and memory,
239
+ ## and number of children. If the process is not running, Monit will restart
240
+ ## it by default. In case the service is restarted very often and the
241
+ ## problem remains, it is possible to disable monitoring using the TIMEOUT
242
+ ## statement. This service depends on another service (apache_bin) which
243
+ ## is defined above.
244
+ #
245
+ # check process apache with pidfile /usr/local/apache/logs/httpd.pid
246
+ # start program = "/etc/init.d/httpd start" with timeout 60 seconds
247
+ # stop program = "/etc/init.d/httpd stop"
248
+ # if cpu > 60% for 2 cycles then alert
249
+ # if cpu > 80% for 5 cycles then restart
250
+ # if totalmem > 200.0 MB for 5 cycles then restart
251
+ # if children > 250 then restart
252
+ # if disk read > 500 kb/s for 10 cycles then alert
253
+ # if disk write > 500 kb/s for 10 cycles then alert
254
+ # if failed host www.tildeslash.com port 80 protocol http and request "/somefile.html" then restart
255
+ # if failed port 443 protocol https with timeout 15 seconds then restart
256
+ # if 3 restarts within 5 cycles then unmonitor
257
+ # depends on apache_bin
258
+ # group server
259
+ #
260
+ #
261
+ ## Check filesystem permissions, uid, gid, space usage, inode usage and disk I/O.
262
+ ## Other services, such as databases, may depend on this resource and an automatically
263
+ ## graceful stop may be cascaded to them before the filesystem will become full and data
264
+ ## lost.
265
+ #
266
+ # check filesystem datafs with path /dev/sdb1
267
+ # start program = "/bin/mount /data"
268
+ # stop program = "/bin/umount /data"
269
+ # if failed permission 660 then unmonitor
270
+ # if failed uid "root" then unmonitor
271
+ # if failed gid "disk" then unmonitor
272
+ # if space usage > 80% for 5 times within 15 cycles then alert
273
+ # if space usage > 99% then stop
274
+ # if inode usage > 30000 then alert
275
+ # if inode usage > 99% then stop
276
+ # if read rate > 1 MB/s for 5 cycles then alert
277
+ # if read rate > 500 operations/s for 5 cycles then alert
278
+ # if write rate > 1 MB/s for 5 cycles then alert
279
+ # if write rate > 500 operations/s for 5 cycles then alert
280
+ # if service time > 10 milliseconds for 3 times within 5 cycles then alert
281
+ # group server
282
+ #
283
+ #
284
+ ## Check a file's timestamp. In this example, we test if a file is older
285
+ ## than 15 minutes and assume something is wrong if its not updated. Also,
286
+ ## if the file size exceed a given limit, execute a script
287
+ #
288
+ # check file database with path /data/mydatabase.db
289
+ # if failed permission 700 then alert
290
+ # if failed uid "data" then alert
291
+ # if failed gid "data" then alert
292
+ # if timestamp > 15 minutes then alert
293
+ # if size > 100 MB then exec "/my/cleanup/script" as uid dba and gid dba
294
+ #
295
+ #
296
+ ## Check directory permission, uid and gid. An event is triggered if the
297
+ ## directory does not belong to the user with uid 0 and gid 0. In addition,
298
+ ## the permissions have to match the octal description of 755 (see chmod(1)).
299
+ #
300
+ # check directory bin with path /bin
301
+ # if failed permission 755 then unmonitor
302
+ # if failed uid 0 then unmonitor
303
+ # if failed gid 0 then unmonitor
304
+ #
305
+ #
306
+ ## Check a remote host availability by issuing a ping test and check the
307
+ ## content of a response from a web server. Up to three pings are sent and
308
+ ## connection to a port and an application level network check is performed.
309
+ #
310
+ # check host myserver with address 192.168.1.1
311
+ # if failed ping then alert
312
+ # if failed port 3306 protocol mysql with timeout 15 seconds then alert
313
+ # if failed port 80 protocol http
314
+ # and request /some/path with content = "a string"
315
+ # then alert
316
+ #
317
+ #
318
+ ## Check a network link status (up/down), link capacity changes, saturation
319
+ ## and bandwidth usage.
320
+ #
321
+ # check network public with interface eth0
322
+ # if failed link then alert
323
+ # if changed link then alert
324
+ # if saturation > 90% then alert
325
+ # if download > 10 MB/s then alert
326
+ # if total uploaded > 1 GB in last hour then alert
327
+ #
328
+ #
329
+ ## Check custom program status output.
330
+ #
331
+ # check program myscript with path /usr/local/bin/myscript.sh
332
+ # if status != 0 then alert
333
+ #
334
+ #
335
+ ###############################################################################
336
+ ## Includes
337
+ ###############################################################################
338
+ ##
339
+ ## It is possible to include additional configuration parts from other files or
340
+ ## directories.
341
+ #
342
+ include /etc/monit/conf.d/*
343
+ include /etc/monit/conf-enabled/*
344
+ #
@@ -0,0 +1,71 @@
1
+ # This is a basic configuration for signing and verifying. It can easily be
2
+ # adapted to suit a basic installation. See opendkim.conf(5) and
3
+ # /usr/share/doc/opendkim/examples/opendkim.conf.sample for complete
4
+ # documentation of available configuration parameters.
5
+
6
+ Syslog yes
7
+ SyslogSuccess yes
8
+ #LogWhy no
9
+
10
+ # Common signing and verification parameters. In Debian, the "From" header is
11
+ # oversigned, because it is often the identity key used by reputation systems
12
+ # and thus somewhat security sensitive.
13
+ Canonicalization relaxed/simple
14
+ #Mode sv
15
+ #SubDomains no
16
+ OversignHeaders From
17
+
18
+ # Signing domain, selector, and key (required). For example, perform signing
19
+ # for domain "example.com" with selector "2020" (2020._domainkey.example.com),
20
+ # using the private key stored in /etc/dkimkeys/example.private. More granular
21
+ # setup options can be found in /usr/share/doc/opendkim/README.opendkim.
22
+ #Domain example.com
23
+ #Selector 2020
24
+ #KeyFile /etc/dkimkeys/example.private
25
+
26
+ # In Debian, opendkim runs as user "opendkim". A umask of 007 is required when
27
+ # using a local socket with MTAs that access the socket as a non-privileged
28
+ # user (for example, Postfix). You may need to add user "postfix" to group
29
+ # "opendkim" in that case.
30
+ UserID opendkim
31
+ UMask 007
32
+
33
+ # Socket for the MTA connection (required). If the MTA is inside a chroot jail,
34
+ # it must be ensured that the socket is accessible. In Debian, Postfix runs in
35
+ # a chroot in /var/spool/postfix, therefore a Unix socket would have to be
36
+ # configured as shown on the last line below.
37
+ ##### SmartMachine Begin.
38
+ #Socket local:/run/opendkim/opendkim.sock
39
+ Socket local:/var/spool/postfix/opendkim/opendkim.sock
40
+ ##### SmartMachine Close.
41
+ #Socket inet:8891@localhost
42
+ #Socket inet:8891
43
+ #Socket local:/var/spool/postfix/opendkim/opendkim.sock
44
+
45
+ ##### SmartMachine Begin.
46
+ #PidFile /run/opendkim/opendkim.pid
47
+ PidFile /var/run/opendkim/opendkim.pid
48
+ ##### SmartMachine Close.
49
+
50
+ # Hosts for which to sign rather than verify, default is 127.0.0.1. See the
51
+ # OPERATION section of opendkim(8) for more information.
52
+ #InternalHosts 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
53
+
54
+ # The trust anchor enables DNSSEC. In Debian, the trust anchor file is provided
55
+ # by the package dns-root-data.
56
+ TrustAnchorFile /usr/share/dns/root.key
57
+ #Nameservers 127.0.0.1
58
+
59
+ ##### SmartMachine Begin.
60
+ # Map domains in From addresses to keys used to sign messages
61
+ KeyTable /etc/opendkim/key.table
62
+ SigningTable refile:/etc/opendkim/signing.table
63
+
64
+ # Hosts to ignore when verifying signatures
65
+ ExternalIgnoreList /etc/opendkim/trusted.hosts
66
+ InternalHosts /etc/opendkim/trusted.hosts
67
+
68
+ # Commonly-used options
69
+ AutoRestart yes
70
+ AutoRestartRate 10/1M
71
+ ##### SmartMachine Close.
@@ -0,0 +1,128 @@
1
+ # See /usr/share/postfix/main.cf.dist for a commented, more complete version
2
+
3
+
4
+ # Debian specific: Specifying a file name will cause the first
5
+ # line of that file to be used as the name. The Debian default
6
+ # is /etc/mailname.
7
+ #myorigin = /etc/mailname
8
+
9
+ smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
10
+ biff = no
11
+
12
+ # appending .domain is the MUA's job.
13
+ append_dot_mydomain = no
14
+
15
+ # Uncomment the next line to generate "delayed mail" warnings
16
+ #delay_warning_time = 4h
17
+
18
+ readme_directory = no
19
+
20
+ # See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
21
+ # fresh installs.
22
+ compatibility_level = 2
23
+
24
+
25
+
26
+ # TLS parameters
27
+ ##### SmartMachine Begin.
28
+ #smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
29
+ smtpd_tls_cert_file=/etc/letsencrypt/live/%<fqdn>s/fullchain.pem
30
+ #smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
31
+ smtpd_tls_key_file=/etc/letsencrypt/live/%<fqdn>s/key.pem
32
+ smtpd_tls_security_level=may
33
+ smtpd_tls_auth_only=yes
34
+
35
+ smtpd_sasl_type=dovecot
36
+ smtpd_sasl_path=private/auth
37
+ smtpd_sasl_auth_enable=yes
38
+ smtpd_sasl_security_options=noanonymous, noplaintext
39
+ smtpd_sasl_tls_security_options=noanonymous
40
+
41
+ smtpd_sender_login_maps=mysql:/etc/postfix/mysql-sender-login-maps.cf
42
+ ##### SmartMachine Close.
43
+
44
+ smtp_tls_CApath=/etc/ssl/certs
45
+ smtp_tls_security_level=may
46
+ smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
47
+
48
+ ##### SmartMachine Begin.
49
+ smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname
50
+ smtpd_sender_restrictions = reject_sender_login_mismatch, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_sender, reject_unknown_sender_domain
51
+ smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unlisted_recipient, reject_unauth_destination, check_policy_service unix:private/policyd-spf, check_policy_service unix:private/quota-status
52
+ ##### SmartMachine Close.
53
+ smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
54
+ ##### SmartMachine Begin.
55
+ #myhostname = 3df7015f65ea
56
+ myhostname = %<fqdn>s
57
+ ##### SmartMachine Close.
58
+ alias_maps = hash:/etc/aliases
59
+ alias_database = hash:/etc/aliases
60
+ ##### SmartMachine Begin.
61
+ mydomain = %<mailname>s
62
+ ##### SmartMachine Close.
63
+ myorigin = $mydomain
64
+ ##### SmartMachine Begin.
65
+ #mydestination = <mailname>, $myhostname, 3df7015f65ea, localhost.localdomain, localhost
66
+ mydestination = localhost
67
+ ##### SmartMachine Close.
68
+ relayhost =
69
+ mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
70
+ mailbox_size_limit = 0
71
+ recipient_delimiter = +
72
+ inet_interfaces = all
73
+ inet_protocols = all
74
+
75
+ ##### SmartMachine Begin.
76
+ # Handing off local delivery to Dovecot's LMTP, and telling it where to store mail
77
+ virtual_transport = lmtp:unix:private/dovecot-lmtp
78
+
79
+ # Virtual domains, users, and aliases
80
+ # Domains that are not aliases
81
+ virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
82
+ # Users
83
+ virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
84
+ # Domains that are aliases of other domains
85
+ virtual_alias_domains = mysql:/etc/postfix/mysql-virtual-alias-domains.cf
86
+ # Alias mappings for domains, users and users to themselves.
87
+ virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps-domains.cf, mysql:/etc/postfix/mysql-virtual-alias-maps-masters.cf, mysql:/etc/postfix/mysql-virtual-alias-maps-users.cf, mysql:/etc/postfix/mysql-virtual-alias-maps-userstothemselves.cf
88
+
89
+ # Setting Message Size (default: 10240000).
90
+ # Changed to 37.5MB to allow approximately 25MB of file attachments (includes mime expansion bloat).
91
+ # https://serverfault.com/questions/189508/considering-mime-expansion-bloat-how-does-that-affect-settings-for-exchange-200/189510#189510
92
+ message_size_limit = 39321600
93
+
94
+ # Even more Restrictions and MTA params
95
+ disable_vrfy_command = yes
96
+ strict_rfc821_envelopes = yes
97
+ #smtpd_etrn_restrictions = reject
98
+ #smtpd_reject_unlisted_sender = yes
99
+ #smtpd_reject_unlisted_recipient = yes
100
+ smtpd_helo_required = yes
101
+ smtpd_timeout = 30s
102
+ smtp_helo_timeout = 15s
103
+ smtp_rcpt_timeout = 15s
104
+ smtpd_recipient_limit = 40
105
+ minimal_backoff_time = 180s
106
+ maximal_backoff_time = 3h
107
+
108
+ # Reply Rejection Codes
109
+ invalid_hostname_reject_code = 550
110
+ non_fqdn_reject_code = 550
111
+ unknown_address_reject_code = 550
112
+ unknown_client_reject_code = 550
113
+ unknown_hostname_reject_code = 550
114
+ unverified_recipient_reject_code = 550
115
+ unverified_sender_reject_code = 550
116
+
117
+ # SPF
118
+ # postfix-policyd-spf-python
119
+ policyd-spf_time_limit = 3600
120
+
121
+ # OpenDKIM
122
+ # Milter configuration
123
+ milter_default_action = accept
124
+ # Postfix >= 2.6 milter_protocol = 6, Postfix <= 2.5 milter_protocol = 2
125
+ milter_protocol = 6
126
+ smtpd_milters = local:opendkim/opendkim.sock
127
+ non_smtpd_milters = local:opendkim/opendkim.sock
128
+ ##### SmartMachine Close.