-
Notifications
You must be signed in to change notification settings - Fork 1
/
response.cfg
331 lines (284 loc) · 8.65 KB
/
response.cfg
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
#########################################################################
# The Response Project -- Configuration File #
#########################################################################
#
# INI format syntax primer :-)
#
# [SECTION-NAME]
#
# String options:
# key = value
# key = value continues on
# lines starting with
# whitespace
# key = listitem1 listitem2 listitem3
# listitem4 listitem5 ...
#
# Integer options:
# key = value
#
# Boolean options:
# key = False
# key = True
#
# All options:
# - no quotes
# - leading whitespace is always stripped
# - substitutions within the same section are supported, e.g.:
# foo = bar
# baz = /qux/%(foo)s/bax
# results in:
# baz = /qux/bar/bax
#
[LMTPD]
# TCP server socket we listen on. IPv4 only for now.
SOCKET_ADDR = 127.0.0.1
SOCKET_PORT = 10024
# Who may connect? Single IPv4 addresses only for now, whitespace separated.
SOCKET_ACL = 127.0.0.1
# Error Handling / Informing the client of problems
#
# Note: If all of the following options hardfail, softfail and failsafe
# are False the default behaviour if softfail.
#
# Hint: In the following comments, the "client" is the application
# speaking to us. This is most probably your MTA.
# Indicate an error to the client if we're unable to process the message.
# This will most probably result in a non-delivery status-notification
# issued by the MTA back to the sender!
# Note: Protocol-level errors (trying to use SMTP or unknown commands)
# will always cause a hard 5xx error-code pushed back to the client.
# Configure your client to connect to us using LMTP and run response-lmtp
# in debug mode to see protocol errors.
HARDFAIL = False
# Ask the client to re-send a message if we have problems?
# Note: This might cause a delivery-status-notification of type
# delayed issued by the MTA back to the sender, so be careful
# and configure your MTA accordingly!
SOFTFAIL = True
# Never inform the client of problems and silently discard/drop a
# message if we have problems processing it.
#
# Warning: Most importantly, this option will silently drop a message
# if the backend is unavailable (and hence will - if all validation
# would have been successful - result in a missing autoresponse).
# Use softfail if you want the MTA to try again later instead.
FAILSAFE = False
# Regular expression with named groups "user" and "domain",
# resulting in the real recipient address if joined with "@".
#
# Assume the original recipient is [email protected]:
#
# In case of Postfix, we silently create a copy of each message
# whose original recipient has configured and enabled an autoresponse.
#
# The internal recipient of this message is, for example:
#
# john#[email protected]
#
# The original @ was replaced by # and the new target domain is
# response.internal.
#
# This regexp is used for the reverse operation:
#
RECIPIENT_ADDRESS_REWRITE_RE = (?P<user>\S+)#(?P<domain>\S+)@
[BACKEND]
# Database adapter (see backend.py)
ADAPTER = MySQL
#ADAPTER = PostgreSQL # TODO
# How can we connect the database?
DATABASE_HOST = 127.0.0.1
DATABASE_PORT = 3306
# Credentials
USERNAME = response
PASSWORD = FIXME
# Database
#
# Note: this is currently used nowhere else in the code, only as a
# substitution in the following query definitions. If you want to use
# different databases for different queries, go for it.
DATABASE = response
# Should we do local recipient address validation?
# Note: For better performance this should be performed directly by the MTA,
# so it can evaluate if we are a suitable transport in the first place and
# save the whole overhead. (sending the message to us, additional db
# connection...)
query_validate_recipient_enabled = False
#
# Example queries for the MySQL backend adapter
#
# Must return 1 if recipient is valid and has an enabled autoresponse
# configuration. Only needed if query_validate_recipient_enabled = True.
#
# Parameters:
#
# address = E-Mail address of the local recipient
#
query_validate_recipient =
SELECT
1
FROM
`%(database)s`.`autoresponse_config`
WHERE
`address` = '%%(address)s'
AND
`enabled` = 1
# Query to insert a new or update an existing response record.
#
# Parameters:
#
# date = Current date
# sender = E-Mail address of the sender
#
query_record_response =
INSERT INTO
`%(database)s`.`autoresponse_record`
(
`sender_id`,
`recipient`,
`hit`
)
SELECT
`id` AS `sender_id`,
'%%(recipient)s' AS `recipient`,
'%%(date)s' AS `hit`
FROM
`%(database)s`.`autoresponse_config`
WHERE
`address` = '%%(sender)s'
ON DUPLICATE KEY
UPDATE
`hit` = '%%(date)s'
# Query to get pending responses.
#
# Parameters:
#
# limit = Upper limit of rows returned.
#
query_pending_responses =
SELECT
`record`.`id` AS `id`,
`config`.`address` AS `sender`,
`record`.`recipient` AS `recipient`,
`config`.`subject` AS `subject`,
`config`.`message` AS `message`,
`record`.`sent` AS `sent`
FROM
`%(database)s`.`autoresponse_config` `config`,
`%(database)s`.`autoresponse_record` `record`
WHERE
`config`.`id` = `record`.`sender_id`
AND
`config`.`enabled` = 1
AND
`record`.`sent` = 0
LIMIT %%(limit)d
# Query to update the sent timestamp of successfully sent responses.
#
# Parameters:
#
# id = The id of the record.
# date = The current date.
#
query_update_sent_timestamp =
UPDATE
`%(database)s`.`autoresponse_record` `record`
SET
`sent` = '%%(date)s'
WHERE
`record`.`id` = %%(id)d
# Query to disable autoresponders if they have expired.
#
# Parameters:
#
# date = The current date.
#
query_disable_expired_configs =
UPDATE
`%(database)s`.`autoresponse_config` `config`
SET
`enabled` = 0
WHERE
`config`.`enabled` = 1
AND
`config`.`expires` < '%%(date)s'
# Query to delete old response records with no activity after the
# given date.
#
# Parameters:
#
# date = The earliest sent-date back in history when we consider a
# record to be deleted.
#
query_delete_old_response_records =
DELETE
`%(database)s`.`record`
FROM
`%(database)s`.`autoresponse_record` `record`
WHERE
(
`record`.`sent` > 0
AND
`record`.`sent` < '%%(date)s'
)
# Query to delete records of disabled response configs.
#
# Parameters:
#
# None
#
query_delete_records_of_disabled_configs =
DELETE
`%(database)s`.`record`
FROM
`%(database)s`.`autoresponse_record` `record`
LEFT JOIN
`%(database)s`.`autoresponse_config` `config`
ON
`record`.`sender_id` = `config`.`id`
WHERE
`config`.`enabled` = 0
[NOTIFY]
#
# Using a local sendmail binary
#
# TODO: Not implemented yet. Is it worth the effort?
# Let's use some real (E)SMTP relay!
# Use local sendmail command, if yes, which?
# sendmail_command = ['/usr/bin/sendmail', 'arg1', 'arg2', ...]
#
# Using a SMTP relay
#
SMTP_HOST = localhost
SMTP_PORT = 25
SMTP_TIMEOUT = 20
SMTP_AUTH = False
SMTP_USERNAME =
SMTP_PASSWORD =
SMTP_STARTTLS = False
# http://en.wikipedia.org/wiki/Envelope_sender
# This is the sender address given in the command channel of the SMTP protocol
# using "MAIL FROM". The null sender ("<>") is *strongly* recommended to avoid
# loops and other bad stuff!
SMTP_ENVELOPE_FROM = <>
#
# Configuration of autoresponse message creation
#
# Message charset
MESSAGE_CHARSET = UTF-8
# Insert special headers to prevent other systems responding to our
# autoresponses? This is *strongly* recommended!
MESSAGE_INSERT_SPECIAL_HEADERS = True
# Set a realname to use in the "From" header.
MESSAGE_HEADER_FROM_NAME = Autoresponder
# Override the address in the "From" header of the response? (The
# default is to use the e-mail address of the original local recipient)
MESSAGE_HEADER_FROM_ADDRESS =
# Prepend something to all subjects of all response messages?
MESSAGE_HEADER_SUBJECT_PREFIX =
[CLEANUP]
# Delete response records for which we sent an response this many seconds ago.
# This controls the amount of time that must pass before we send another
# response to the same recipient.
# Used with -O, --delete-old-response-records.
TIMEDELTA = 604800