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
|
'use strict';
'require view';
'require form';
return view.extend({
render: function () {
var docsRefAttrs = 'target="_blank" rel="noreferrer" href="https://emailrelay.sourceforge.net/';
var m, s, o;
m = new form.Map('emailrelay', _('Email Server Configuration'),
_('E-MailRelay Server Configuration.') + '<br />' +
_('For further information <a %s>check the documentation</a>')
.format('href="https://openwrt.org/docs/guide-user/services/email/emailrelay" target="_blank" rel="noreferrer"')
);
s = m.section(form.GridSection, 'emailrelay', _('Instance config'));
s.anonymous = false;
s.addremove = true;
s.nodescriptions = true;
o = s.tab('smtp_server', _('SMTP Server'));
o = s.tab('smtp_client', _('SMTP Client'));
o = s.tab('pop_server', _('POP3'));
o = s.tab('advanced', _('Advanced Settings'));
o = s.taboption('smtp_server', form.Flag, 'enabled', _('Enabled'));
o.rmempty = false;
o = s.taboption('smtp_server', form.ListValue, 'mode', _('Mode'),
_('See <a %s>Running E-MailRelay</a>')
.format(docsRefAttrs + '#userguide_md_Running_E_MailRelay"')
);
o.value('server', _('Server: receive incoming mail'));
o.value('proxy', _('Proxy: submission outgoing mail, store and forward to smarthost SMTP server'));
o.value('cmdline', _('Manual command line options (deprecated)'));
o.default = 'server';
o.rmempty = false;
o = s.taboption('smtp_server', form.Value, 'port', _('SMTP Port'),
_('SMTP Port to listen for incoming emails.') + '<br />' +
_('Incoming mail by default received on <em>25</em> port.') + '<br />' +
_('Outcoming mail by usually received on <em>587</em> or <em>465</em> (TLS only) ' +
'but the <em>25</em> is also used often.')
);
o.datatype = 'port';
o.default = '25';
o = s.taboption('smtp_server', form.Flag, 'remote_clients', _('Allow remote clients'),
_('Allow connections from the public internet.') + '<br />' +
_('<b>You may receive spam so be careful</b>.') + '<br />' +
_('Enable ports in firewall.') + '<br />' +
_('See <a %s>--remote-clients</a>')
.format(docsRefAttrs + '#__remote_clients"')
);
o.modalonly = true;
o.default = '0';
o = s.taboption('smtp_server', form.Flag, 'anonymous', _('Anonymous'),
_('Reduce the amount of information leaked to remote clients.') + '<br />' +
_('See <a %s>--anonymous</a>')
.format(docsRefAttrs + '#__anonymous"')
);
o.modalonly = true;
o.default = '0';
o = s.taboption('smtp_server', form.Value, 'domain', _('Domain'),
_('Specifies the server\'s domain name that is used in SMTP EHLO.') + '<br />' +
_('By default, the local hostname is used.') + '<br />' +
_('See <a %s>--domain</a>')
.format(docsRefAttrs + '#__domain"')
);
o.datatype = 'hostname';
o.optional = true;
o.rmempty = false;
o.depends('anonymous', '0');
o = s.taboption('smtp_server', form.FileUpload, 'server_auth', _('Auth file'),
_('Server/proxy authorization file.') + '<br />' +
_('See <a %s>Authentication</a>')
.format(docsRefAttrs + '#reference_md_Authentication"')
);
o.datatype = 'file';
o.root_directory = '/';
o.default = '/etc/emailrelay.auth';
o.optional = true;
o.rmempty = true;
o.modalonly = true;
o = s.taboption('smtp_server', form.Flag, 'server_tls', _('Enable TLS for server'),
_('Use TLS encryption for SMTP and POP connections.') + '<br />' +
_('Configure <a %s>acme.sh to issue a TLS cert</a>.')
.format('href="https://openwrt.org/docs/guide-user/services/tls/acmesh" target="_blank" rel="noreferrer"') + '<br />' +
_('See <a %s>TLS encryption</a>')
.format(docsRefAttrs + '#reference_md_TLS_encryption"')
);
o.default = '0';
o.optional = true;
o.rmempty = true;
o.modalonly = true;
o = s.taboption('smtp_server', form.FileUpload, 'server_tls_key', _('TLS private key'),
_('Path to TLS private key.') + '<br />' +
_('E.g. ') + '<code>/etc/ssl/acme/example.com.key</code>'
);
o.datatype = 'file';
o.root_directory = '/';
o.optional = true;
o.rmempty = true;
o.modalonly = true;
o.depends('server_tls', '1');
o = s.taboption('smtp_server', form.FileUpload, 'server_tls_certificate', _('TLS certificate'),
_('Path to TLS cert.') + '<br />' +
_('E.g. ') + '<code>/etc/ssl/acme/example.com.fullchain.crt</code>'
);
o.datatype = 'file';
o.root_directory = '/';
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o.depends('server_tls', '1');
o = s.taboption('smtp_server', form.Value, 'server_tls_verify', _('CA certificate'),
_('Verify an SMTP and POP client\'s certificates ' +
'against trusted CA certificates in the specified file or directory.') + '<br />' +
_('In many use cases this should be your self-signed root certificate.') + '<br />' +
_('Use <code><default></code> to use the system trusted CAs.')
);
o.datatype = 'or(file, directory, "<default>")';
o.default = '<default>';
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o.depends('server_tls', '1');
o = s.taboption('smtp_server', form.Value, 'spool_dir', _('Mail storage directory'),
_('The directory used for holding received mail messages.') + '<br />' +
_('<b>Note:</b> The <code>/var/</code> is a small in-memory folder and you\'ll lose mail in reboot.') + '<br />' +
_('Instead, use a mounted disk with enough of space.')
);
o.datatype = 'directory';
o.default = '/var/spool/emailrelay';
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o = s.taboption('smtp_client', form.Value, 'smarthost', _('Smarthost'),
_('The SMTP server to forward emails')
);
o.datatype = 'host';
o.optional = false;
o.rmempty = false;
o.depends('mode', 'proxy');
o = s.taboption('smtp_client', form.FileUpload, 'client_auth', _('Client authorization file'),
_('A file that contains credentials for SMTP smarthost client.') + '<br />' +
_('See <a %s>Authentication</a>')
.format(docsRefAttrs + '#reference_md_Authentication"')
);
o.datatype = 'file';
o.root_directory = '/';
o.default = '/etc/emailrelay.auth';
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o.depends('mode', 'proxy');
o = s.taboption('smtp_client', form.Flag, 'client_tls', _('Enable SMTP client TLS'),
_('Use TLS encryption for SMTP proxy client.') + '<br />' +
_('See example for <a %s>Gmail</a>')
.format(docsRefAttrs + '#userguide_md_Google_mail"')
);
o.default = '0';
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o.depends('mode', 'proxy');
o = s.taboption('smtp_client', form.FileUpload, 'client_tls_key', _('TLS private key'),
_('Path to TLS private key.')
);
o.datatype = 'file';
o.root_directory = '/';
o.optional = true;
o.rmempty = true;
o.modalonly = true;
o.depends('client_tls', '1');
o = s.taboption('smtp_client', form.FileUpload, 'client_tls_certificate', _('TLS certificate'),
_('Path to TLS cert.')
);
o.datatype = 'file';
o.root_directory = '/';
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o.depends('client_tls', '1');
o = s.taboption('smtp_client', form.Value, 'client_tls_verify', _('CA certificate'),
_('Verify an SMTP server\'s certificate ' +
'against trusted CA certificates in the specified file or directory.') + '<br />' +
_('Use <code><default></code> to use the system trusted CAs.')
);
o.datatype = 'or(file, directory, "<default>")';
o.default = '<default>';
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o.depends('client_tls', '1');
o = s.taboption('pop_server', form.Flag, 'pop', _('Enable POP3'),
_('The POP3 used to fetch a mail.') + '<br />' +
_('See <a %s>Running as a POP server</a>')
.format(docsRefAttrs + '#userguide_md_Running_as_a_POP_server"')
);
o.default = '0';
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o.depends('mode', 'server');
o = s.taboption('pop_server', form.FileUpload, 'pop_auth', _('POP Auth file'),
_('A file containing POP accounts and their credentials.')
);
o.datatype = 'file';
o.root_directory = '/';
o.default = '/etc/emailrelay.auth';
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o.depends('pop', '1');
o = s.taboption('pop_server', form.Flag, 'pop_by_name', _('POP by name'),
_('Modifies the spool directory used by the POP server to be a sub-directory ' +
'with the same name as the POP authentication user-id.')
);
o.default = '1';
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o.depends('pop', '1');
o = s.taboption('advanced', form.Value, 'dnsbl', _('DNSBL'),
_('<a %s>DNS Block List (DNSBL)</a> used to block connections from known spammers.')
.format('href="https://en.wikipedia.org/wiki/DNSBL" target="_blank" rel="noreferrer"') + '<br />' +
_('Starts with the transport DNS server\'s address:port, a timeout in milliseconds, a rejection threshold and list of DNSBL servers.') + '<br />' +
_('E.g. ') + '<code>127.0.0.1:53,5000,1,zen.spamhaus.org,bl.mailspike.net</code><br />' +
_('If the threshold number of servers deny the incoming connection\'s network address then it\'s dropped.') + '<br />' +
_('A threshold of zero is useful for testing and means only to log a result code but allow a connection.') + '<br />' +
_('See <a %s>Connection blocking</a>')
.format(docsRefAttrs + '#reference_md_Connection_blocking"')
);
o.datatype = 'string';
o.optional = true;
o.rmempty = true;
o.modalonly = true;
o = s.taboption('advanced', form.Value, 'address_verifier', _('Address verifier'),
_('Runs the specified external program to verify a message recipient\'s email address.') + '<br />' +
_('See <a %s>Address verification</a>')
.format(docsRefAttrs + '#reference_md_Address_verification"')
);
// o.default = "allow:/etc/emailrelay.auth";
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o = s.taboption('advanced', form.Value, 'filter', _('Filter'),
_('Runs the specified external filter program whenever a mail message is stored.') + '<br />' +
_('See <a %s>--filter</a>')
.format(docsRefAttrs + '#__filter"')
);
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o = s.taboption('advanced', form.Value, 'extra_cmdline', _('Extra command line options'),
_('Specify additional arguments that should be passed to the EmailRelay.') + '<br />' +
_('See <a %s>Command line reference</a>')
.format(docsRefAttrs + '#reference_md_Reference"')
);
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o.modalonly = true;
return m.render();
},
});
|