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.
- checksums.yaml +4 -4
- data/lib/smart_machine/apps/app.rb +1 -0
- data/lib/smart_machine/buildpackers/buildpacker.rb +2 -2
- data/lib/smart_machine/commands/grid.rb +8 -0
- data/lib/smart_machine/commands/grid_commands/emailer.rb +107 -0
- data/lib/smart_machine/commands/grid_commands/roundcube.rb +107 -0
- data/lib/smart_machine/configuration.rb +35 -2
- data/lib/smart_machine/credentials.rb +10 -0
- data/lib/smart_machine/engine.rb +7 -1
- data/lib/smart_machine/grids/adminer.rb +1 -0
- data/lib/smart_machine/grids/certbot.rb +1 -0
- data/lib/smart_machine/grids/emailer/imapsync.rb +7 -0
- data/lib/smart_machine/grids/emailer.rb +188 -0
- data/lib/smart_machine/grids/haproxy.rb +1 -0
- data/lib/smart_machine/grids/mariadb.rb +1 -0
- data/lib/smart_machine/grids/postgresql.rb +1 -0
- data/lib/smart_machine/grids/roundcube/.keep +0 -0
- data/lib/smart_machine/grids/roundcube.rb +184 -0
- data/lib/smart_machine/machine.rb +7 -0
- data/lib/smart_machine/syncer.rb +10 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/command.rb +50 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/entrypoint.rb +196 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/docker/logtailer.rb +75 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/10-auth.conf +132 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/10-mail.conf +427 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/10-master.conf +153 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/10-ssl.conf +87 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/15-mailboxes.conf +94 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/20-imap.conf +102 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/20-lmtp.conf +43 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/90-quota.conf +114 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/90-sieve.conf +229 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/dovecot-sql.conf.ext +163 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve/learn-ham.sh +2 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve/learn-ham.sieve +5 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve/learn-spam.sh +2 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve/learn-spam.sieve +2 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/sieve-after/spam-to-folder.sieve +6 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/haproxy/haproxy.cfg +58 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/monit/conf.d/services.cfg +70 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/monit/monitrc +344 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/opendkim.conf +71 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/main.cf +128 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/master.cf +149 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-sender-login-maps.cf +7 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-domains.cf +7 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-maps-domains.cf +7 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-maps-masters.cf +7 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-maps-users.cf +7 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-alias-maps-userstothemselves.cf +7 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-mailbox-domains.cf +7 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix/mysql-virtual-mailbox-maps.cf +7 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/postfix-policyd-spf-python/policyd-spf.conf +12 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/spamassassin/local.cf +124 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer/usr/local/bin/quota-warning.sh +22 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/emailer.yml +37 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/engine.yml +2 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/docker/custom-docker-entrypoint.sh +185 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/docker/entrypoint.rb +58 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/etc/apache2/sites-available/000-default.conf +36 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/usr/local/etc/php/conf.d/zzz_roundcube-custom.ini +4 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/var/roundcube/config/config.custom.inc.php +25 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/roundcube/var/www/html/plugins/password/config.inc.php +523 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/roundcube.yml +49 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/users.yml +1 -1
- data/lib/smart_machine/version.rb +2 -2
- data/lib/smart_machine.rb +2 -0
- metadata +89 -8
data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/conf.d/90-sieve.conf
ADDED
@@ -0,0 +1,229 @@
|
|
1
|
+
##
|
2
|
+
## Settings for the Sieve interpreter
|
3
|
+
##
|
4
|
+
|
5
|
+
# Do not forget to enable the Sieve plugin in 15-lda.conf and 20-lmtp.conf
|
6
|
+
# by adding it to the respective mail_plugins= settings.
|
7
|
+
|
8
|
+
# The Sieve interpreter can retrieve Sieve scripts from several types of
|
9
|
+
# locations. The default `file' location type is a local filesystem path
|
10
|
+
# pointing to a Sieve script file or a directory containing multiple Sieve
|
11
|
+
# script files. More complex setups can use other location types such as
|
12
|
+
# `ldap' or `dict' to fetch Sieve scripts from remote databases.
|
13
|
+
#
|
14
|
+
# All settings that specify the location of one ore more Sieve scripts accept
|
15
|
+
# the following syntax:
|
16
|
+
#
|
17
|
+
# location = [<type>:]path[;<option>[=<value>][;...]]
|
18
|
+
#
|
19
|
+
# If the type prefix is omitted, the script location type is 'file' and the
|
20
|
+
# location is interpreted as a local filesystem path pointing to a Sieve script
|
21
|
+
# file or directory. Refer to Pigeonhole wiki or INSTALL file for more
|
22
|
+
# information.
|
23
|
+
|
24
|
+
plugin {
|
25
|
+
# The location of the user's main Sieve script or script storage. The LDA
|
26
|
+
# Sieve plugin uses this to find the active script for Sieve filtering at
|
27
|
+
# delivery. The "include" extension uses this location for retrieving
|
28
|
+
# :personal" scripts. This is also where the ManageSieve service will store
|
29
|
+
# the user's scripts, if supported.
|
30
|
+
#
|
31
|
+
# Currently only the 'file:' location type supports ManageSieve operation.
|
32
|
+
# Other location types like 'dict:' and 'ldap:' can currently only
|
33
|
+
# be used as a read-only script source ().
|
34
|
+
#
|
35
|
+
# For the 'file:' type: use the ';active=' parameter to specify where the
|
36
|
+
# active script symlink is located.
|
37
|
+
# For other types: use the ';name=' parameter to specify the name of the
|
38
|
+
# default/active script.
|
39
|
+
sieve = file:~/sieve;active=~/.dovecot.sieve
|
40
|
+
|
41
|
+
# The default Sieve script when the user has none. This is the location of a
|
42
|
+
# global sieve script file, which gets executed ONLY if user's personal Sieve
|
43
|
+
# script doesn't exist. Be sure to pre-compile this script manually using the
|
44
|
+
# sievec command line tool if the binary is not stored in a global location.
|
45
|
+
# --> See sieve_before for executing scripts before the user's personal
|
46
|
+
# script.
|
47
|
+
#sieve_default = /var/lib/dovecot/sieve/default.sieve
|
48
|
+
|
49
|
+
# The name by which the default Sieve script (as configured by the
|
50
|
+
# sieve_default setting) is visible to the user through ManageSieve.
|
51
|
+
#sieve_default_name =
|
52
|
+
|
53
|
+
# Location for ":global" include scripts as used by the "include" extension.
|
54
|
+
#sieve_global =
|
55
|
+
|
56
|
+
# The location of a Sieve script that is run for any message that is about to
|
57
|
+
# be discarded; i.e., it is not delivered anywhere by the normal Sieve
|
58
|
+
# execution. This only happens when the "implicit keep" is canceled, by e.g.
|
59
|
+
# the "discard" action, and no actions that deliver the message are executed.
|
60
|
+
# This "discard script" can prevent discarding the message, by executing
|
61
|
+
# alternative actions. If the discard script does nothing, the message is
|
62
|
+
# still discarded as it would be when no discard script is configured.
|
63
|
+
#sieve_discard =
|
64
|
+
|
65
|
+
# Location Sieve of scripts that need to be executed before the user's
|
66
|
+
# personal script. If a 'file' location path points to a directory, all the
|
67
|
+
# Sieve scripts contained therein (with the proper `.sieve' extension) are
|
68
|
+
# executed. The order of execution within that directory is determined by the
|
69
|
+
# file names, using a normal 8bit per-character comparison.
|
70
|
+
#
|
71
|
+
# Multiple script locations can be specified by appending an increasing number
|
72
|
+
# to the setting name. The Sieve scripts found from these locations are added
|
73
|
+
# to the script execution sequence in the specified order. Reading the
|
74
|
+
# numbered sieve_before settings stops at the first missing setting, so no
|
75
|
+
# numbers may be skipped.
|
76
|
+
#sieve_before = /var/lib/dovecot/sieve.d/
|
77
|
+
#sieve_before2 = ldap:/etc/sieve-ldap.conf;name=ldap-domain
|
78
|
+
#sieve_before3 = (etc...)
|
79
|
+
|
80
|
+
# Identical to sieve_before, only the specified scripts are executed after the
|
81
|
+
# user's script (only when keep is still in effect!). Multiple script
|
82
|
+
# locations can be specified by appending an increasing number.
|
83
|
+
#sieve_after =
|
84
|
+
#sieve_after2 =
|
85
|
+
#sieve_after2 = (etc...)
|
86
|
+
##### SmartMachine Begin.
|
87
|
+
sieve_after = /etc/dovecot/sieve-after
|
88
|
+
##### SmartMachine Close.
|
89
|
+
|
90
|
+
# Which Sieve language extensions are available to users. By default, all
|
91
|
+
# supported extensions are available, except for deprecated extensions or
|
92
|
+
# those that are still under development. Some system administrators may want
|
93
|
+
# to disable certain Sieve extensions or enable those that are not available
|
94
|
+
# by default. This setting can use '+' and '-' to specify differences relative
|
95
|
+
# to the default. For example `sieve_extensions = +imapflags' will enable the
|
96
|
+
# deprecated imapflags extension in addition to all extensions were already
|
97
|
+
# enabled by default.
|
98
|
+
#sieve_extensions = +notify +imapflags
|
99
|
+
|
100
|
+
# Which Sieve language extensions are ONLY available in global scripts. This
|
101
|
+
# can be used to restrict the use of certain Sieve extensions to administrator
|
102
|
+
# control, for instance when these extensions can cause security concerns.
|
103
|
+
# This setting has higher precedence than the `sieve_extensions' setting
|
104
|
+
# (above), meaning that the extensions enabled with this setting are never
|
105
|
+
# available to the user's personal script no matter what is specified for the
|
106
|
+
# `sieve_extensions' setting. The syntax of this setting is similar to the
|
107
|
+
# `sieve_extensions' setting, with the difference that extensions are
|
108
|
+
# enabled or disabled for exclusive use in global scripts. Currently, no
|
109
|
+
# extensions are marked as such by default.
|
110
|
+
#sieve_global_extensions =
|
111
|
+
##### SmartMachine Begin.
|
112
|
+
sieve_global_extensions = +vnd.dovecot.pipe
|
113
|
+
##### SmartMachine Close.
|
114
|
+
|
115
|
+
# The Pigeonhole Sieve interpreter can have plugins of its own. Using this
|
116
|
+
# setting, the used plugins can be specified. Check the Dovecot wiki
|
117
|
+
# (wiki2.dovecot.org) or the pigeonhole website
|
118
|
+
# (http://pigeonhole.dovecot.org) for available plugins.
|
119
|
+
# The sieve_extprograms plugin is included in this release.
|
120
|
+
#sieve_plugins =
|
121
|
+
##### SmartMachine Begin.
|
122
|
+
sieve_plugins = sieve_imapsieve sieve_extprograms
|
123
|
+
##### SmartMachine Close.
|
124
|
+
|
125
|
+
# The maximum size of a Sieve script. The compiler will refuse to compile any
|
126
|
+
# script larger than this limit. If set to 0, no limit on the script size is
|
127
|
+
# enforced.
|
128
|
+
#sieve_max_script_size = 1M
|
129
|
+
|
130
|
+
# The maximum number of actions that can be performed during a single script
|
131
|
+
# execution. If set to 0, no limit on the total number of actions is enforced.
|
132
|
+
#sieve_max_actions = 32
|
133
|
+
|
134
|
+
# The maximum number of redirect actions that can be performed during a single
|
135
|
+
# script execution. If set to 0, no redirect actions are allowed.
|
136
|
+
#sieve_max_redirects = 4
|
137
|
+
|
138
|
+
# The maximum number of personal Sieve scripts a single user can have. If set
|
139
|
+
# to 0, no limit on the number of scripts is enforced.
|
140
|
+
# (Currently only relevant for ManageSieve)
|
141
|
+
#sieve_quota_max_scripts = 0
|
142
|
+
|
143
|
+
# The maximum amount of disk storage a single user's scripts may occupy. If
|
144
|
+
# set to 0, no limit on the used amount of disk storage is enforced.
|
145
|
+
# (Currently only relevant for ManageSieve)
|
146
|
+
#sieve_quota_max_storage = 0
|
147
|
+
|
148
|
+
# The primary e-mail address for the user. This is used as a default when no
|
149
|
+
# other appropriate address is available for sending messages. If this setting
|
150
|
+
# is not configured, either the postmaster or null "<>" address is used as a
|
151
|
+
# sender, depending on the action involved. This setting is important when
|
152
|
+
# there is no message envelope to extract addresses from, such as when the
|
153
|
+
# script is executed in IMAP.
|
154
|
+
#sieve_user_email =
|
155
|
+
|
156
|
+
# The path to the file where the user log is written. If not configured, a
|
157
|
+
# default location is used. If the main user's personal Sieve (as configured
|
158
|
+
# with sieve=) is a file, the logfile is set to <filename>.log by default. If
|
159
|
+
# it is not a file, the default user log file is ~/.dovecot.sieve.log.
|
160
|
+
#sieve_user_log =
|
161
|
+
|
162
|
+
# Specifies what envelope sender address is used for redirected messages.
|
163
|
+
# The following values are supported for this setting:
|
164
|
+
#
|
165
|
+
# "sender" - The sender address is used (default).
|
166
|
+
# "recipient" - The final recipient address is used.
|
167
|
+
# "orig_recipient" - The original recipient is used.
|
168
|
+
# "user_email" - The user's primary address is used. This is
|
169
|
+
# configured with the "sieve_user_email" setting. If
|
170
|
+
# that setting is unconfigured, "user_mail" is equal to
|
171
|
+
# "recipient".
|
172
|
+
# "postmaster" - The postmaster_address configured for the LDA.
|
173
|
+
# "<user@domain>" - Redirected messages are always sent from user@domain.
|
174
|
+
# The angle brackets are mandatory. The null "<>" address
|
175
|
+
# is also supported.
|
176
|
+
#
|
177
|
+
# This setting is ignored when the envelope sender is "<>". In that case the
|
178
|
+
# sender of the redirected message is also always "<>".
|
179
|
+
#sieve_redirect_envelope_from = sender
|
180
|
+
|
181
|
+
##### SmartMachine Begin.
|
182
|
+
# From elsewhere to Junk folder
|
183
|
+
imapsieve_mailbox1_name = Junk
|
184
|
+
imapsieve_mailbox1_causes = COPY
|
185
|
+
imapsieve_mailbox1_before = file:/etc/dovecot/sieve/learn-spam.sieve
|
186
|
+
|
187
|
+
# From Junk folder to elsewhere
|
188
|
+
imapsieve_mailbox2_name = *
|
189
|
+
imapsieve_mailbox2_from = Junk
|
190
|
+
imapsieve_mailbox2_causes = COPY
|
191
|
+
imapsieve_mailbox2_before = file:/etc/dovecot/sieve/learn-ham.sieve
|
192
|
+
|
193
|
+
sieve_pipe_bin_dir = /etc/dovecot/sieve
|
194
|
+
##### SmartMachine Close.
|
195
|
+
|
196
|
+
## TRACE DEBUGGING
|
197
|
+
# Trace debugging provides detailed insight in the operations performed by
|
198
|
+
# the Sieve script. These settings apply to both the LDA Sieve plugin and the
|
199
|
+
# IMAPSIEVE plugin.
|
200
|
+
#
|
201
|
+
# WARNING: On a busy server, this functionality can quickly fill up the trace
|
202
|
+
# directory with a lot of trace files. Enable this only temporarily and as
|
203
|
+
# selective as possible.
|
204
|
+
|
205
|
+
# The directory where trace files are written. Trace debugging is disabled if
|
206
|
+
# this setting is not configured or if the directory does not exist. If the
|
207
|
+
# path is relative or it starts with "~/" it is interpreted relative to the
|
208
|
+
# current user's home directory.
|
209
|
+
#sieve_trace_dir =
|
210
|
+
|
211
|
+
# The verbosity level of the trace messages. Trace debugging is disabled if
|
212
|
+
# this setting is not configured. Possible values are:
|
213
|
+
#
|
214
|
+
# "actions" - Only print executed action commands, like keep,
|
215
|
+
# fileinto, reject and redirect.
|
216
|
+
# "commands" - Print any executed command, excluding test commands.
|
217
|
+
# "tests" - Print all executed commands and performed tests.
|
218
|
+
# "matching" - Print all executed commands, performed tests and the
|
219
|
+
# values matched in those tests.
|
220
|
+
#sieve_trace_level =
|
221
|
+
|
222
|
+
# Enables highly verbose debugging messages that are usually only useful for
|
223
|
+
# developers.
|
224
|
+
#sieve_trace_debug = no
|
225
|
+
|
226
|
+
# Enables showing byte code addresses in the trace output, rather than only
|
227
|
+
# the source line numbers.
|
228
|
+
#sieve_trace_addresses = no
|
229
|
+
}
|
data/lib/smart_machine/templates/dotsmartmachine/config/emailer/etc/dovecot/dovecot-sql.conf.ext
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
# This file is commonly accessed via passdb {} or userdb {} section in
|
2
|
+
# conf.d/auth-sql.conf.ext
|
3
|
+
|
4
|
+
# This file is opened as root, so it should be owned by root and mode 0600.
|
5
|
+
#
|
6
|
+
# http://wiki2.dovecot.org/AuthDatabase/SQL
|
7
|
+
#
|
8
|
+
# For the sql passdb module, you'll need a database with a table that
|
9
|
+
# contains fields for at least the username and password. If you want to
|
10
|
+
# use the user@domain syntax, you might want to have a separate domain
|
11
|
+
# field as well.
|
12
|
+
#
|
13
|
+
# If your users all have the same uig/gid, and have predictable home
|
14
|
+
# directories, you can use the static userdb module to generate the home
|
15
|
+
# dir based on the username and domain. In this case, you won't need fields
|
16
|
+
# for home, uid, or gid in the database.
|
17
|
+
#
|
18
|
+
# If you prefer to use the sql userdb module, you'll want to add fields
|
19
|
+
# for home, uid, and gid. Here is an example table:
|
20
|
+
#
|
21
|
+
# CREATE TABLE users (
|
22
|
+
# username VARCHAR(128) NOT NULL,
|
23
|
+
# domain VARCHAR(128) NOT NULL,
|
24
|
+
# password VARCHAR(64) NOT NULL,
|
25
|
+
# home VARCHAR(255) NOT NULL,
|
26
|
+
# uid INTEGER NOT NULL,
|
27
|
+
# gid INTEGER NOT NULL,
|
28
|
+
# active CHAR(1) DEFAULT 'Y' NOT NULL
|
29
|
+
# );
|
30
|
+
|
31
|
+
# Database driver: mysql, pgsql, sqlite
|
32
|
+
#driver =
|
33
|
+
##### SmartMachine Begin.
|
34
|
+
driver = mysql
|
35
|
+
##### SmartMachine Close.
|
36
|
+
|
37
|
+
# Database connection string. This is driver-specific setting.
|
38
|
+
#
|
39
|
+
# HA / round-robin load-balancing is supported by giving multiple host
|
40
|
+
# settings, like: host=sql1.host.org host=sql2.host.org
|
41
|
+
#
|
42
|
+
# pgsql:
|
43
|
+
# For available options, see the PostgreSQL documentation for the
|
44
|
+
# PQconnectdb function of libpq.
|
45
|
+
# Use maxconns=n (default 5) to change how many connections Dovecot can
|
46
|
+
# create to pgsql.
|
47
|
+
#
|
48
|
+
# mysql:
|
49
|
+
# Basic options emulate PostgreSQL option names:
|
50
|
+
# host, port, user, password, dbname
|
51
|
+
#
|
52
|
+
# But also adds some new settings:
|
53
|
+
# client_flags - See MySQL manual
|
54
|
+
# connect_timeout - Connect timeout in seconds (default: 5)
|
55
|
+
# read_timeout - Read timeout in seconds (default: 30)
|
56
|
+
# write_timeout - Write timeout in seconds (default: 30)
|
57
|
+
# ssl_ca, ssl_ca_path - Set either one or both to enable SSL
|
58
|
+
# ssl_cert, ssl_key - For sending client-side certificates to server
|
59
|
+
# ssl_cipher - Set minimum allowed cipher security (default: HIGH)
|
60
|
+
# ssl_verify_server_cert - Verify that the name in the server SSL certificate
|
61
|
+
# matches the host (default: no)
|
62
|
+
# option_file - Read options from the given file instead of
|
63
|
+
# the default my.cnf location
|
64
|
+
# option_group - Read options from the given group (default: client)
|
65
|
+
#
|
66
|
+
# You can connect to UNIX sockets by using host: host=/var/run/mysql.sock
|
67
|
+
# Note that currently you can't use spaces in parameters.
|
68
|
+
#
|
69
|
+
# sqlite:
|
70
|
+
# The path to the database file.
|
71
|
+
#
|
72
|
+
# Examples:
|
73
|
+
# connect = host=192.168.1.1 dbname=users
|
74
|
+
# connect = host=sql.example.com dbname=virtual user=virtual password=blarg
|
75
|
+
# connect = /etc/dovecot/authdb.sqlite
|
76
|
+
#
|
77
|
+
#connect =
|
78
|
+
##### SmartMachine Begin.
|
79
|
+
connect = host=%<mysql_host>s port=%<mysql_port>s dbname=%<mysql_database_name>s user=%<mysql_user>s password=%<mysql_password>s
|
80
|
+
##### SmartMachine Close.
|
81
|
+
|
82
|
+
# Default password scheme.
|
83
|
+
#
|
84
|
+
# List of supported schemes is in
|
85
|
+
# http://wiki2.dovecot.org/Authentication/PasswordSchemes
|
86
|
+
#
|
87
|
+
#default_pass_scheme = MD5
|
88
|
+
|
89
|
+
# passdb query to retrieve the password. It can return fields:
|
90
|
+
# password - The user's password. This field must be returned.
|
91
|
+
# user - user@domain from the database. Needed with case-insensitive lookups.
|
92
|
+
# username and domain - An alternative way to represent the "user" field.
|
93
|
+
#
|
94
|
+
# The "user" field is often necessary with case-insensitive lookups to avoid
|
95
|
+
# e.g. "name" and "nAme" logins creating two different mail directories. If
|
96
|
+
# your user and domain names are in separate fields, you can return "username"
|
97
|
+
# and "domain" fields instead of "user".
|
98
|
+
#
|
99
|
+
# The query can also return other fields which have a special meaning, see
|
100
|
+
# http://wiki2.dovecot.org/PasswordDatabase/ExtraFields
|
101
|
+
#
|
102
|
+
# Commonly used available substitutions (see http://wiki2.dovecot.org/Variables
|
103
|
+
# for full list):
|
104
|
+
# %u = entire user@domain
|
105
|
+
# %n = user part of user@domain
|
106
|
+
# %d = domain part of user@domain
|
107
|
+
#
|
108
|
+
# Note that these can be used only as input to SQL query. If the query outputs
|
109
|
+
# any of these substitutions, they're not touched. Otherwise it would be
|
110
|
+
# difficult to have eg. usernames containing '%' characters.
|
111
|
+
#
|
112
|
+
# Example:
|
113
|
+
# password_query = SELECT userid AS user, pw AS password \
|
114
|
+
# FROM users WHERE userid = '%u' AND active = 'Y'
|
115
|
+
#
|
116
|
+
#password_query = \
|
117
|
+
# SELECT username, domain, password \
|
118
|
+
# FROM users WHERE username = '%n' AND domain = '%d'
|
119
|
+
##### SmartMachine Begin.
|
120
|
+
password_query = SELECT password FROM virtual_users WHERE email='%u'
|
121
|
+
##### SmartMachine Close.
|
122
|
+
|
123
|
+
# userdb query to retrieve the user information. It can return fields:
|
124
|
+
# uid - System UID (overrides mail_uid setting)
|
125
|
+
# gid - System GID (overrides mail_gid setting)
|
126
|
+
# home - Home directory
|
127
|
+
# mail - Mail location (overrides mail_location setting)
|
128
|
+
#
|
129
|
+
# None of these are strictly required. If you use a single UID and GID, and
|
130
|
+
# home or mail directory fits to a template string, you could use userdb static
|
131
|
+
# instead. For a list of all fields that can be returned, see
|
132
|
+
# http://wiki2.dovecot.org/UserDatabase/ExtraFields
|
133
|
+
#
|
134
|
+
# Examples:
|
135
|
+
# user_query = SELECT home, uid, gid FROM users WHERE userid = '%u'
|
136
|
+
# user_query = SELECT dir AS home, user AS uid, group AS gid FROM users where userid = '%u'
|
137
|
+
# user_query = SELECT home, 501 AS uid, 501 AS gid FROM users WHERE userid = '%u'
|
138
|
+
#
|
139
|
+
#user_query = \
|
140
|
+
# SELECT home, uid, gid \
|
141
|
+
# FROM users WHERE username = '%n' AND domain = '%d'
|
142
|
+
##### SmartMachine Begin.
|
143
|
+
user_query = SELECT email as user, \
|
144
|
+
concat('*:bytes=', quota_bytes) AS quota_rule, \
|
145
|
+
'/var/vmail/%d/%n' AS home, \
|
146
|
+
5000 AS uid, 5000 AS gid \
|
147
|
+
FROM virtual_users WHERE email='%u'
|
148
|
+
##### SmartMachine Close.
|
149
|
+
|
150
|
+
# If you wish to avoid two SQL lookups (passdb + userdb), you can use
|
151
|
+
# userdb prefetch instead of userdb sql in dovecot.conf. In that case you'll
|
152
|
+
# also have to return userdb fields in password_query prefixed with "userdb_"
|
153
|
+
# string. For example:
|
154
|
+
#password_query = \
|
155
|
+
# SELECT userid AS user, password, \
|
156
|
+
# home AS userdb_home, uid AS userdb_uid, gid AS userdb_gid \
|
157
|
+
# FROM users WHERE userid = '%u'
|
158
|
+
|
159
|
+
# Query to get a list of all usernames.
|
160
|
+
#iterate_query = SELECT username AS user FROM users
|
161
|
+
##### SmartMachine Begin.
|
162
|
+
iterate_query = SELECT email AS user FROM virtual_users
|
163
|
+
##### SmartMachine Close.
|
@@ -0,0 +1,58 @@
|
|
1
|
+
global
|
2
|
+
log /dev/log local0
|
3
|
+
log /dev/log local1 notice
|
4
|
+
chroot /var/lib/haproxy
|
5
|
+
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
|
6
|
+
stats timeout 30s
|
7
|
+
user haproxy
|
8
|
+
group haproxy
|
9
|
+
daemon
|
10
|
+
|
11
|
+
# Default SSL material locations
|
12
|
+
ca-base /etc/ssl/certs
|
13
|
+
crt-base /etc/ssl/private
|
14
|
+
|
15
|
+
# See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate
|
16
|
+
ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
|
17
|
+
ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
|
18
|
+
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
|
19
|
+
|
20
|
+
defaults
|
21
|
+
log global
|
22
|
+
mode http
|
23
|
+
option httplog
|
24
|
+
option dontlognull
|
25
|
+
timeout connect 5000
|
26
|
+
timeout client 50000
|
27
|
+
timeout server 50000
|
28
|
+
errorfile 400 /etc/haproxy/errors/400.http
|
29
|
+
errorfile 403 /etc/haproxy/errors/403.http
|
30
|
+
errorfile 408 /etc/haproxy/errors/408.http
|
31
|
+
errorfile 500 /etc/haproxy/errors/500.http
|
32
|
+
errorfile 502 /etc/haproxy/errors/502.http
|
33
|
+
errorfile 503 /etc/haproxy/errors/503.http
|
34
|
+
errorfile 504 /etc/haproxy/errors/504.http
|
35
|
+
|
36
|
+
##### SmartMachine Begin.
|
37
|
+
frontend myfrontend
|
38
|
+
bind :80
|
39
|
+
acl oracle_ips_listed str("%<oracle_ips_allowed>s") -m len gt 0
|
40
|
+
acl oracle_ip_allowed req.hdr(X-Real-IP) -m ip %<oracle_ips_allowed>s
|
41
|
+
http-request redirect code 302 location %<oracle_deflect_url>s unless oracle_ips_listed oracle_ip_allowed
|
42
|
+
http-request redirect code 302 location /oracle/monit/ if { path /oracle/monit }
|
43
|
+
use_backend monitbackend if { path_beg -i /oracle/monit/ }
|
44
|
+
stats enable
|
45
|
+
stats uri /oracle/haproxy
|
46
|
+
stats refresh 30s
|
47
|
+
stats admin if oracle_ips_listed oracle_ip_allowed
|
48
|
+
|
49
|
+
backend monitbackend
|
50
|
+
balance roundrobin
|
51
|
+
option forwardfor
|
52
|
+
http-request add-header X-Forwarded-Proto https if { ssl_fc }
|
53
|
+
http-request set-header X-Forwarded-Host %[req.hdr(Host)]
|
54
|
+
http-request set-header X-Forwarded-Port %[dst_port]
|
55
|
+
http-request replace-path /oracle/monit(/)?(.*) /\2
|
56
|
+
option httpchk GET /
|
57
|
+
server s1 127.0.0.1:2812 check
|
58
|
+
##### SmartMachine Close.
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# system
|
2
|
+
check system $HOST
|
3
|
+
if loadavg (5min) > 3 then alert
|
4
|
+
if loadavg (15min) > 1 then alert
|
5
|
+
if memory usage > 90% for 4 cycles then alert
|
6
|
+
if swap usage > 60% for 4 cycles then alert
|
7
|
+
# Test the user part of CPU usage
|
8
|
+
if cpu usage (user) > 80% for 2 cycles then alert
|
9
|
+
# Test the system part of CPU usage
|
10
|
+
if cpu usage (system) > 20% for 2 cycles then alert
|
11
|
+
# Test the i/o wait part of CPU usage
|
12
|
+
if cpu usage (wait) > 80% for 2 cycles then alert
|
13
|
+
# Test CPU usage including user, system and wait. Note that
|
14
|
+
# multi-core systems can generate 100% per core
|
15
|
+
# so total CPU usage can be more than 100%
|
16
|
+
if cpu usage > 200% for 4 cycles then alert
|
17
|
+
|
18
|
+
# rsyslog
|
19
|
+
check process rsyslog with pidfile /run/rsyslogd.pid
|
20
|
+
start program = "/usr/sbin/service rsyslog start"
|
21
|
+
stop program = "/usr/sbin/service rsyslog stop"
|
22
|
+
|
23
|
+
# rsyslog.syslog
|
24
|
+
check file rsyslog.syslog with path /var/log/syslog
|
25
|
+
if timestamp > 65 minutes then alert
|
26
|
+
|
27
|
+
# haproxy
|
28
|
+
check process haproxy with pidfile /run/tmpfs/haproxy.pid
|
29
|
+
start program = "/usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/tmpfs/haproxy.pid -S /run/haproxy-master.sock"
|
30
|
+
stop program = "/bin/bash -c '/bin/kill --signal SIGUSR1 `cat /run/tmpfs/haproxy.pid`'"
|
31
|
+
|
32
|
+
# spamassassin
|
33
|
+
check process spamassassin with pidfile /home/spamd/spamd.pid
|
34
|
+
start program = "/usr/sbin/spamd -d --pidfile=/home/spamd/spamd.pid --create-prefs --max-children 5 --username spamd --helper-home-dir /home/spamd/ -s /home/spamd/spamd.log"
|
35
|
+
stop program = "/bin/bash -c '/bin/kill --signal SIGTERM `cat /home/spamd/spamd.pid`'"
|
36
|
+
if cpu usage > 99% for 5 cycles then alert
|
37
|
+
if mem usage > 99% for 5 cycles then alert
|
38
|
+
|
39
|
+
# spamassassin.update
|
40
|
+
check program spamassassin.update with path "/bin/bash -c '/usr/bin/sa-update && /bin/kill --signal SIGHUP `cat /home/spamd/spamd.pid`'"
|
41
|
+
every "0-15 12-1 * * *"
|
42
|
+
if changed status then alert
|
43
|
+
|
44
|
+
# opendkim
|
45
|
+
check process opendkim with pidfile /var/run/opendkim/opendkim.pid
|
46
|
+
start program = "/usr/sbin/opendkim"
|
47
|
+
stop program = "/bin/bash -c '/bin/kill --signal SIGTERM `cat /var/run/opendkim/opendkim.pid`'"
|
48
|
+
|
49
|
+
# postfix
|
50
|
+
check process postfix with pidfile /var/spool/postfix/pid/master.pid
|
51
|
+
start program = "/bin/bash -c '/usr/lib/postfix/configure-instance.sh - && /usr/sbin/postmulti -i - -p start'"
|
52
|
+
stop program = "/usr/sbin/postmulti -i - -p stop"
|
53
|
+
if failed port 25 protocol smtp then restart
|
54
|
+
|
55
|
+
# dovecot
|
56
|
+
check process dovecot with pidfile /run/dovecot/master.pid
|
57
|
+
start program = "/usr/sbin/dovecot"
|
58
|
+
stop program = "/usr/bin/doveadm stop"
|
59
|
+
if failed host %<fqdn>s port 993 type tcpssl sslauto protocol imap for 5 cycles then restart
|
60
|
+
|
61
|
+
# certbot
|
62
|
+
check file certbot.fullchain with path /etc/letsencrypt/live/%<fqdn>s/fullchain.pem
|
63
|
+
if changed checksum then exec "/bin/bash -c '/usr/sbin/postfix reload && /usr/sbin/dovecot reload'"
|
64
|
+
check file certbot.key with path /etc/letsencrypt/live/%<fqdn>s/key.pem
|
65
|
+
if changed checksum then exec "/bin/bash -c '/usr/sbin/postfix reload && /usr/sbin/dovecot reload'"
|
66
|
+
|
67
|
+
# monit
|
68
|
+
check process monit with pidfile /var/run/tmpfs/monit.pid
|
69
|
+
start program = "/usr/bin/monit"
|
70
|
+
stop program = "/usr/bin/monit quit"
|