'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.') + '
' +
_('For further information check the documentation')
.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 Running E-MailRelay')
.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.') + '
' +
_('Incoming mail by default received on 25 port.') + '
' +
_('Outcoming mail by usually received on 587 or 465 (TLS only) ' +
'but the 25 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.') + '
' +
_('You may receive spam so be careful.') + '
' +
_('Enable ports in firewall.') + '
' +
_('See --remote-clients')
.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.') + '
' +
_('See --anonymous')
.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.') + '
' +
_('By default, the local hostname is used.') + '
' +
_('See --domain')
.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.') + '
' +
_('See Authentication')
.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.') + '
' +
_('Configure acme.sh to issue a TLS cert.')
.format('href="https://openwrt.org/docs/guide-user/services/tls/acmesh" target="_blank" rel="noreferrer"') + '
' +
_('See TLS encryption')
.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.') + '
' +
_('E.g. ') + '/etc/ssl/acme/example.com.key
'
);
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.') + '
' +
_('E.g. ') + '/etc/ssl/acme/example.com.fullchain.crt
'
);
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.') + '
' +
_('In many use cases this should be your self-signed root certificate.') + '
' +
_('Use <default>
to use the system trusted CAs.')
);
o.datatype = 'or(file, directory, "")';
o.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.') + '
' +
_('Note: The /var/
is a small in-memory folder and you\'ll lose mail in reboot.') + '
' +
_('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.') + '
' +
_('See Authentication')
.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.') + '
' +
_('See example for Gmail')
.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.') + '
' +
_('Use <default>
to use the system trusted CAs.')
);
o.datatype = 'or(file, directory, "")';
o.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.') + '
' +
_('See Running as a POP server')
.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'),
_('DNS Block List (DNSBL) used to block connections from known spammers.')
.format('href="https://en.wikipedia.org/wiki/DNSBL" target="_blank" rel="noreferrer"') + '
' +
_('Starts with the transport DNS server\'s address:port, a timeout in milliseconds, a rejection threshold and list of DNSBL servers.') + '
' +
_('E.g. ') + '127.0.0.1:53,5000,1,zen.spamhaus.org,bl.mailspike.net
' +
_('If the threshold number of servers deny the incoming connection\'s network address then it\'s dropped.') + '
' +
_('A threshold of zero is useful for testing and means only to log a result code but allow a connection.') + '
' +
_('See Connection blocking')
.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.') + '
' +
_('See Address verification')
.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.') + '
' +
_('See --filter')
.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.') + '
' +
_('See Command line reference')
.format(docsRefAttrs + '#reference_md_Reference"')
);
o.optional = true;
o.rmempty = false;
o.modalonly = true;
o.modalonly = true;
return m.render();
},
});