emailengine-app 2.79.8 → 2.80.0
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.
- package/.github/dependabot.yml +22 -0
- package/.github/workflows/test.yml +39 -0
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +69 -0
- package/DOCKER_DEPLOYMENT.md +6 -7
- package/Dockerfile +35 -11
- package/config/default.toml +7 -2
- package/copy-static-files.sh +23 -5
- package/data/google-crawlers.json +1 -1
- package/encrypt.js +43 -0
- package/lib/account/account-state.js +62 -0
- package/lib/account.js +60 -3
- package/lib/api-routes/account-routes.js +20 -0
- package/lib/api-routes/bull-board-routes.js +3 -2
- package/lib/api-routes/index.js +1 -1
- package/lib/api-routes/route-helpers.js +8 -0
- package/lib/api-routes/settings-routes.js +17 -2
- package/lib/auth-token.js +73 -2
- package/lib/autodetect-imap-settings.js +379 -69
- package/lib/cert-handler.js +62 -0
- package/lib/consts.js +58 -7
- package/lib/db.js +12 -0
- package/lib/egress-fetch.js +145 -0
- package/lib/email-client/base-client.js +234 -66
- package/lib/email-client/credential-errors.js +118 -0
- package/lib/email-client/gmail/gmail-api.js +2 -1
- package/lib/email-client/gmail-client.js +70 -64
- package/lib/email-client/imap/connection-errors.js +52 -0
- package/lib/email-client/imap/listing-diff.js +47 -6
- package/lib/email-client/imap/mailbox.js +457 -379
- package/lib/email-client/imap/subconnection.js +15 -11
- package/lib/email-client/imap/sync-operations.js +46 -59
- package/lib/email-client/imap-client.js +136 -95
- package/lib/email-client/message-builder.js +11 -11
- package/lib/email-client/outlook/graph-api.js +2 -1
- package/lib/email-client/outlook-client.js +219 -106
- package/lib/export.js +35 -2
- package/lib/handlebars-helpers.js +129 -0
- package/lib/imap-proxy-auth.js +96 -21
- package/lib/imapproxy/imap-core/README.md +1 -0
- package/lib/imapproxy/imap-core/lib/tls-options.js +5 -46
- package/lib/imapproxy/imap-server.js +56 -66
- package/lib/lua/h-del-if-equals.lua +39 -0
- package/lib/lua/h-set-if-equals.lua +39 -0
- package/lib/openapi/index.js +3 -0
- package/lib/outbox.js +28 -3
- package/lib/rate-limit.js +23 -4
- package/lib/routes-ui.js +4 -34
- package/lib/schemas.js +42 -3
- package/lib/security-headers.js +411 -0
- package/lib/sentry.js +36 -4
- package/lib/smtp-auth.js +86 -7
- package/lib/tls/context.js +376 -0
- package/lib/tls/der.js +223 -0
- package/lib/tls/provision.js +555 -0
- package/lib/tls/self-signed.js +282 -0
- package/lib/tls/status.js +431 -0
- package/lib/tls/store.js +666 -0
- package/lib/tools.js +337 -147
- package/lib/ui-routes/account-routes.js +47 -33
- package/lib/ui-routes/admin-config-routes.js +22 -1
- package/lib/ui-routes/auth-routes.js +16 -1
- package/lib/ui-routes/export-routes.js +4 -0
- package/lib/ui-routes/internals-routes.js +3 -5
- package/lib/ui-routes/mcp-consent-routes.js +7 -0
- package/lib/ui-routes/network-config-routes.js +58 -48
- package/lib/ui-routes/route-helpers.js +24 -8
- package/lib/ui-routes/smtp-test-routes.js +7 -0
- package/lib/ui-routes/tls-config-routes.js +581 -0
- package/lib/utils/mailbox-path.js +51 -0
- package/lib/utils/severity.js +31 -0
- package/lib/webhook-egress.js +5 -0
- package/package.json +21 -24
- package/sbom.json +1 -1
- package/server.js +53 -36
- package/static/css/flyonui.css +1 -1
- package/static/css/src/app.tailwind.css +11 -0
- package/static/js/ace/css/ace.css +1462 -0
- package/static/js/ace/css/kuroir-1.png +0 -0
- package/static/js/ace/css/kuroir-2.png +0 -0
- package/static/js/ace/css/main-1.png +0 -0
- package/static/js/ace/css/main-10.svg +4 -0
- package/static/js/ace/css/main-11.svg +5 -0
- package/static/js/ace/css/main-12.svg +4 -0
- package/static/js/ace/css/main-13.png +0 -0
- package/static/js/ace/css/main-14.png +0 -0
- package/static/js/ace/css/main-15.png +0 -0
- package/static/js/ace/css/main-16.png +0 -0
- package/static/js/ace/css/main-17.png +0 -0
- package/static/js/ace/css/main-18.png +0 -0
- package/static/js/ace/css/main-19.png +0 -0
- package/static/js/ace/css/main-2.png +0 -0
- package/static/js/ace/css/main-20.png +0 -0
- package/static/js/ace/css/main-21.png +0 -0
- package/static/js/ace/css/main-22.png +0 -0
- package/static/js/ace/css/main-23.png +0 -0
- package/static/js/ace/css/main-24.png +0 -0
- package/static/js/ace/css/main-25.svg +1 -0
- package/static/js/ace/css/main-26.png +0 -0
- package/static/js/ace/css/main-3.png +0 -0
- package/static/js/ace/css/main-4.png +0 -0
- package/static/js/ace/css/main-5.svg +7 -0
- package/static/js/ace/css/main-6.svg +9 -0
- package/static/js/ace/css/main-7.svg +7 -0
- package/static/js/ace/css/main-8.svg +9 -0
- package/static/js/ace/css/main-9.svg +6 -0
- package/static/js/ace/css/theme/kuroir.css +78 -0
- package/static/js/ace/css/theme/tomorrow_night.css +128 -0
- package/static/js/ace/css/theme/tomorrow_night_eighties.css +128 -0
- package/static/js/ace/css/theme/xcode.css +106 -0
- package/static/js/ace/css/tomorrow_night-1.png +0 -0
- package/static/js/ace/css/tomorrow_night-2.png +0 -0
- package/static/js/ace/css/tomorrow_night_eighties-1.png +0 -0
- package/static/js/ace/css/tomorrow_night_eighties-2.png +0 -0
- package/static/js/ace/css/xcode-1.png +0 -0
- package/static/js/ace/css/xcode-2.png +0 -0
- package/static/js/app.js +34 -0
- package/static/js/ee-client.js +256 -102
- package/static/js/public.js +13 -2
- package/static/js/ui.js +40 -25
- package/static/licenses.html +393 -1282
- package/static/vendor/simplewebauthn/browser.min.js +2 -2
- package/translations/messages.pot +203 -157
- package/views/account/login-redirect.hbs +22 -0
- package/views/accounts/account.hbs +15 -37
- package/views/accounts/browse.hbs +3 -1
- package/views/accounts/edit.hbs +1 -1
- package/views/accounts/register/imap-server.hbs +1 -1
- package/views/config/ai.hbs +1 -1
- package/views/config/branding.hbs +2 -2
- package/views/config/document-store/chat.hbs +1 -1
- package/views/config/document-store/index.hbs +1 -1
- package/views/config/imap-proxy.hbs +1 -4
- package/views/config/license.hbs +1 -1
- package/views/config/mcp.hbs +1 -1
- package/views/config/network.hbs +14 -16
- package/views/config/oauth/app.hbs +2 -2
- package/views/config/service.hbs +1 -1
- package/views/config/smtp.hbs +1 -4
- package/views/config/tls-upload.hbs +81 -0
- package/views/config/tls.hbs +492 -0
- package/views/config/webhooks.hbs +2 -2
- package/views/error.hbs +4 -2
- package/views/internals/index.hbs +1 -1
- package/views/layout/app.hbs +3 -11
- package/views/mcp/authorize.hbs +1 -1
- package/views/partials/ace_assets.hbs +13 -0
- package/views/partials/add_account_modal.hbs +1 -1
- package/views/partials/address_list.hbs +4 -4
- package/views/partials/filter_editor_js.hbs +2 -2
- package/views/partials/gateway_js.hbs +1 -1
- package/views/partials/oauth_form.hbs +1 -1
- package/views/partials/public_theme_init.hbs +1 -1
- package/views/partials/side_menu.hbs +1 -0
- package/views/partials/template_form.hbs +2 -2
- package/views/partials/test_send.hbs +7 -4
- package/views/partials/theme_init.hbs +1 -1
- package/views/partials/tls_security_card.hbs +25 -53
- package/views/partials/ui/alert-banner.hbs +3 -2
- package/views/partials/ui/badge.hbs +6 -2
- package/views/partials/ui/btn.hbs +5 -2
- package/views/partials/ui/details.hbs +2 -2
- package/views/partials/webhooks_editor_functions.hbs +1 -1
- package/views/reference/redirect.hbs +1 -1
- package/views/templates/template.hbs +2 -2
- package/views/tokens/new.hbs +1 -1
- package/views/unsubscribe.hbs +1 -1
- package/views/webhooks/webhook.hbs +2 -2
- package/workers/api.js +131 -242
- package/workers/export.js +1 -5
- package/workers/imap-proxy.js +4 -1
- package/workers/imap.js +1 -3
- package/workers/smtp.js +59 -83
- package/workers/submit.js +6 -12
- package/workers/webhooks.js +6 -17
- package/static/front/EmailEngine_logo_horiz.png +0 -0
- package/static/front/EmailEngine_logo_vert.png +0 -0
- package/static/front/index.html +0 -57
- package/static/front/logo.png +0 -0
- package/static/vendor/handlebars/handlebars.min-v4.7.9.js +0 -29
- package/views/partials/tls_security_js.hbs +0 -64
- package/views/partials/tls_security_modal.hbs +0 -22
package/workers/smtp.js
CHANGED
|
@@ -6,22 +6,19 @@ const packageData = require('../package.json');
|
|
|
6
6
|
const config = require('@zone-eu/wild-config');
|
|
7
7
|
const logger = require('../lib/logger');
|
|
8
8
|
|
|
9
|
-
const { getDuration, emitChangeEvent, readEnvValue, threadStats, loadTlsConfig, getByteSize } = require('../lib/tools');
|
|
10
|
-
const {
|
|
9
|
+
const { getDuration, emitChangeEvent, readEnvValue, threadStats, loadTlsConfig, assertTlsCredentials, getByteSize } = require('../lib/tools');
|
|
10
|
+
const { createTlsContext, applyTlsContext } = require('../lib/tls/context');
|
|
11
|
+
const { createSmtpAuthHandler, createSmtpAccountResolver } = require('../lib/smtp-auth');
|
|
11
12
|
|
|
12
13
|
const { initSentry } = require('../lib/sentry');
|
|
13
14
|
initSentry('smtp');
|
|
14
15
|
|
|
15
16
|
const { SMTPServer } = require('smtp-server');
|
|
16
17
|
const util = require('util');
|
|
17
|
-
const { redis } = require('../lib/db');
|
|
18
|
-
const { Account } = require('../lib/account');
|
|
19
|
-
const getSecret = require('../lib/get-secret');
|
|
20
18
|
const { collectMessage } = require('../lib/smtp-message-processor');
|
|
21
19
|
const settings = require('../lib/settings');
|
|
22
20
|
|
|
23
|
-
const {
|
|
24
|
-
const { Certs } = require('@postalsys/certs');
|
|
21
|
+
const { createCertHandler } = require('../lib/cert-handler');
|
|
25
22
|
|
|
26
23
|
config.smtp = config.smtp || {
|
|
27
24
|
enabled: false,
|
|
@@ -33,7 +30,7 @@ config.smtp = config.smtp || {
|
|
|
33
30
|
|
|
34
31
|
config.service = config.service || {};
|
|
35
32
|
|
|
36
|
-
const {
|
|
33
|
+
const { DEFAULT_MAX_SMTP_MESSAGE_SIZE } = require('../lib/consts');
|
|
37
34
|
|
|
38
35
|
const DEFAULT_EENGINE_TIMEOUT = 10 * 1000;
|
|
39
36
|
|
|
@@ -48,6 +45,12 @@ const SMTP_MAX_CLIENTS = Number(readEnvValue('EENGINE_SMTP_MAX_CLIENTS') || conf
|
|
|
48
45
|
|
|
49
46
|
const ACCOUNT_CACHE = new WeakMap();
|
|
50
47
|
|
|
48
|
+
// The running listener and the TLS material it serves, kept at module level so the certificate
|
|
49
|
+
// reload command can reach both. A renewal used to terminate this worker, which cut every
|
|
50
|
+
// submission in flight; the listener can be handed a new secure context instead.
|
|
51
|
+
let smtpServer = null;
|
|
52
|
+
let tlsContext = null;
|
|
53
|
+
|
|
51
54
|
let callQueue = new Map();
|
|
52
55
|
let mids = 0;
|
|
53
56
|
|
|
@@ -113,46 +116,11 @@ for (let level of ['trace', 'debug', 'info', 'warn', 'error', 'fatal']) {
|
|
|
113
116
|
};
|
|
114
117
|
}
|
|
115
118
|
|
|
116
|
-
// Authentication
|
|
117
|
-
// without booting this worker. The shared ACCOUNT_CACHE and call() are injected
|
|
118
|
-
//
|
|
119
|
+
// Authentication and account resolution live in lib/smtp-auth.js so they can be unit tested
|
|
120
|
+
// without booting this worker. The shared ACCOUNT_CACHE and call() are injected so onAuth
|
|
121
|
+
// caches the Account that the resolver hands to the submission.
|
|
119
122
|
const onAuth = createSmtpAuthHandler({ accountCache: ACCOUNT_CACHE, call });
|
|
120
|
-
|
|
121
|
-
async function checkAccountData(session, messageMeta) {
|
|
122
|
-
let accountObject;
|
|
123
|
-
|
|
124
|
-
if (!session.eeAuthEnabled && messageMeta.requestedAccount) {
|
|
125
|
-
// load account data
|
|
126
|
-
accountObject = new Account({ account: messageMeta.requestedAccount, redis, call, secret: await getSecret() });
|
|
127
|
-
let accountData;
|
|
128
|
-
try {
|
|
129
|
-
// throws if unknown user
|
|
130
|
-
accountData = await accountObject.loadAccountData();
|
|
131
|
-
if (accountData) {
|
|
132
|
-
ACCOUNT_CACHE.set(session, accountObject);
|
|
133
|
-
logger.debug({ msg: 'Resolved requested account', account: messageMeta.requestedAccount });
|
|
134
|
-
}
|
|
135
|
-
} catch (err) {
|
|
136
|
-
logger.warn({ msg: 'Failed to resolve requested account', account: messageMeta.requestedAccount, err });
|
|
137
|
-
}
|
|
138
|
-
} else {
|
|
139
|
-
accountObject = ACCOUNT_CACHE.get(session);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (!session.eeAuthEnabled && !messageMeta.requestedAccount && !accountObject) {
|
|
143
|
-
let err = new Error('Sender account ID not provided, can not send mail');
|
|
144
|
-
err.responseCode = 451;
|
|
145
|
-
throw err;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (!accountObject) {
|
|
149
|
-
let err = new Error('Failed to load account');
|
|
150
|
-
err.responseCode = 451;
|
|
151
|
-
throw err;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return accountObject;
|
|
155
|
-
}
|
|
123
|
+
const resolveAccount = createSmtpAccountResolver({ accountCache: ACCOUNT_CACHE, call });
|
|
156
124
|
|
|
157
125
|
async function init() {
|
|
158
126
|
let server;
|
|
@@ -168,24 +136,8 @@ async function init() {
|
|
|
168
136
|
useProxy: await settings.get('smtpServerProxy')
|
|
169
137
|
};
|
|
170
138
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
namespace: `${REDIS_PREFIX}`,
|
|
174
|
-
|
|
175
|
-
environment: 'ee',
|
|
176
|
-
|
|
177
|
-
logger: logger.child({ sub: 'acme' }),
|
|
178
|
-
|
|
179
|
-
encryptFn: async value => {
|
|
180
|
-
const encryptSecret = await getSecret();
|
|
181
|
-
return encrypt(value, encryptSecret);
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
decryptFn: async value => {
|
|
185
|
-
const encryptSecret = await getSecret();
|
|
186
|
-
return decrypt(value, encryptSecret);
|
|
187
|
-
}
|
|
188
|
-
});
|
|
139
|
+
// Reads what the API worker provisioned; this one never orders a certificate itself.
|
|
140
|
+
let certs = createCertHandler(logger);
|
|
189
141
|
|
|
190
142
|
// check and update authentication settings on connection
|
|
191
143
|
serverOptions.onConnect = (session, callback) => {
|
|
@@ -239,7 +191,7 @@ async function init() {
|
|
|
239
191
|
throw err;
|
|
240
192
|
}
|
|
241
193
|
|
|
242
|
-
let accountObject = await
|
|
194
|
+
let accountObject = await resolveAccount(session, messageMeta);
|
|
243
195
|
|
|
244
196
|
let payload = {
|
|
245
197
|
envelope: {
|
|
@@ -291,30 +243,28 @@ async function init() {
|
|
|
291
243
|
serverOptions.secure = true;
|
|
292
244
|
serverOptions.allowInsecureAuth = false;
|
|
293
245
|
|
|
246
|
+
// Environment and config-file material first. It used to be loaded here and then
|
|
247
|
+
// overwritten by whatever Let's Encrypt had provisioned, so an operator who pinned a
|
|
248
|
+
// certificate through EENGINE_SMTP_TLS_CERT was silently served a different one.
|
|
249
|
+
// lib/tls/context.js keeps it ahead of every automatic source instead.
|
|
294
250
|
loadTlsConfig(serverOptions, 'EENGINE_SMTP_TLS_');
|
|
295
251
|
|
|
296
|
-
//
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
[]
|
|
306
|
-
.concat(certificateData.ca || [])
|
|
307
|
-
.flatMap(entry => entry)
|
|
308
|
-
.join('\n');
|
|
309
|
-
serverOptions.key = certificateData.privateKey;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
252
|
+
// The material loaded above is snapshotted inside, at entry. The resolved material is
|
|
253
|
+
// written back into serverOptions below, so a later refresh reading this object again would
|
|
254
|
+
// believe the operator had supplied whatever it resolved through the environment.
|
|
255
|
+
tlsContext = await createTlsContext({ certs, logger, listenerOptions: serverOptions });
|
|
256
|
+
Object.assign(serverOptions, tlsContext.options);
|
|
257
|
+
|
|
258
|
+
// Reached only when there is no material at all, which now means the self-signed fallback
|
|
259
|
+
// could not be generated either - a broken instance rather than a missing certificate.
|
|
260
|
+
assertTlsCredentials(serverOptions, 'The SMTP server');
|
|
312
261
|
} else {
|
|
313
262
|
serverOptions.disabledCommands = ['STARTTLS'];
|
|
314
263
|
serverOptions.hideSTARTTLS = true;
|
|
315
264
|
}
|
|
316
265
|
|
|
317
266
|
server = new SMTPServer(serverOptions);
|
|
267
|
+
smtpServer = server;
|
|
318
268
|
|
|
319
269
|
let port = await settings.get('smtpServerPort');
|
|
320
270
|
let host = await settings.get('smtpServerHost');
|
|
@@ -335,7 +285,7 @@ async function init() {
|
|
|
335
285
|
resolve();
|
|
336
286
|
});
|
|
337
287
|
});
|
|
338
|
-
await emitChangeEvent(logger, null, 'smtpServerState', 'listening');
|
|
288
|
+
await emitChangeEvent(logger, null, 'smtpServerState', 'listening', { tls: tlsContext ? tlsContext.active : null });
|
|
339
289
|
} catch (err) {
|
|
340
290
|
await emitChangeEvent(logger, null, 'smtpServerState', 'failed', {
|
|
341
291
|
error: { message: err.message, code: err.code || null }
|
|
@@ -346,10 +296,36 @@ async function init() {
|
|
|
346
296
|
return server;
|
|
347
297
|
}
|
|
348
298
|
|
|
299
|
+
/**
|
|
300
|
+
* Re-resolves the TLS material and hands it to the running listener.
|
|
301
|
+
*
|
|
302
|
+
* Connections already established keep the context they negotiated with; the next handshake gets
|
|
303
|
+
* the new one. Nothing here restarts the server, which is the whole point: a renewal is not a
|
|
304
|
+
* reason to drop a submission that is halfway through DATA.
|
|
305
|
+
*
|
|
306
|
+
* @returns {Promise<Object>} What the listener is serving after the reload
|
|
307
|
+
*/
|
|
308
|
+
async function reloadCertificates() {
|
|
309
|
+
const result = await applyTlsContext({
|
|
310
|
+
context: smtpServer ? tlsContext : null,
|
|
311
|
+
apply: options => smtpServer.updateSecureContext(options),
|
|
312
|
+
logger
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
if (result.updated) {
|
|
316
|
+
await emitChangeEvent(logger, null, 'smtpServerState', 'listening', { tls: result.tls });
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return result;
|
|
320
|
+
}
|
|
321
|
+
|
|
349
322
|
async function onCommand(command) {
|
|
350
323
|
switch (command.cmd) {
|
|
351
324
|
case 'resource-usage':
|
|
352
325
|
return threadStats.usage();
|
|
326
|
+
|
|
327
|
+
case 'smtpReloadCertificates':
|
|
328
|
+
return await reloadCertificates();
|
|
353
329
|
default:
|
|
354
330
|
logger.debug({ msg: 'Unhandled command', command });
|
|
355
331
|
return 999;
|
package/workers/submit.js
CHANGED
|
@@ -7,7 +7,7 @@ const config = require('@zone-eu/wild-config');
|
|
|
7
7
|
const logger = require('../lib/logger');
|
|
8
8
|
|
|
9
9
|
const { REDIS_PREFIX } = require('../lib/consts');
|
|
10
|
-
const { getDuration, readEnvValue, threadStats
|
|
10
|
+
const { getDuration, readEnvValue, threadStats } = require('../lib/tools');
|
|
11
11
|
const { webhooks: Webhooks } = require('../lib/webhooks');
|
|
12
12
|
const settings = require('../lib/settings');
|
|
13
13
|
|
|
@@ -19,7 +19,7 @@ const { redis, queueConf, submitQueue } = require('../lib/db');
|
|
|
19
19
|
const { Worker, UnrecoverableError } = require('bullmq');
|
|
20
20
|
const { Account } = require('../lib/account');
|
|
21
21
|
const getSecret = require('../lib/get-secret');
|
|
22
|
-
const
|
|
22
|
+
const { decodeQueueEntry } = require('../lib/outbox');
|
|
23
23
|
|
|
24
24
|
const { EMAIL_FAILED_NOTIFY } = require('../lib/consts');
|
|
25
25
|
|
|
@@ -179,7 +179,10 @@ const submitWorker = new Worker(
|
|
|
179
179
|
|
|
180
180
|
let queueEntry;
|
|
181
181
|
try {
|
|
182
|
-
|
|
182
|
+
// Rejects a value that decodes to something other than a map as well, otherwise the
|
|
183
|
+
// job metadata assignment below throws a TypeError against it and the entry is retried
|
|
184
|
+
// as a failed delivery instead of being dropped as the corrupt entry it is
|
|
185
|
+
queueEntry = decodeQueueEntry(queueEntryBuf);
|
|
183
186
|
} catch (err) {
|
|
184
187
|
logger.error({ msg: 'Failed to parse queued email entry', job: job.id, account: job.data.account, queueId: job.data.queueId, err });
|
|
185
188
|
try {
|
|
@@ -190,11 +193,6 @@ const submitWorker = new Worker(
|
|
|
190
193
|
return;
|
|
191
194
|
}
|
|
192
195
|
|
|
193
|
-
if (!queueEntry) {
|
|
194
|
-
//could be expired?
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
196
|
let accountObject = new Account({ account: job.data.account, redis, call, secret: await getSecret() });
|
|
199
197
|
|
|
200
198
|
logger.trace({
|
|
@@ -508,10 +506,6 @@ parentPort.on('message', message => {
|
|
|
508
506
|
parentPort.postMessage(Object.assign({ cmd: 'resp', mid: message.mid }, packRpcError(err)));
|
|
509
507
|
});
|
|
510
508
|
}
|
|
511
|
-
|
|
512
|
-
if (message && message.cmd === 'settings') {
|
|
513
|
-
maybeReloadHttpProxyAgent(message.data);
|
|
514
|
-
}
|
|
515
509
|
});
|
|
516
510
|
|
|
517
511
|
logger.info({ msg: 'Started SMTP submission worker thread', version: packageData.version });
|
package/workers/webhooks.js
CHANGED
|
@@ -10,16 +10,7 @@ const { webhooks: Webhooks } = require('../lib/webhooks');
|
|
|
10
10
|
|
|
11
11
|
const { GooglePubSub } = require('../lib/oauth/pubsub/google');
|
|
12
12
|
|
|
13
|
-
const {
|
|
14
|
-
readEnvValue,
|
|
15
|
-
threadStats,
|
|
16
|
-
getDuration,
|
|
17
|
-
httpAgent,
|
|
18
|
-
getServiceSecret,
|
|
19
|
-
maybeReloadHttpProxyAgent,
|
|
20
|
-
redactUrlCredentials,
|
|
21
|
-
splitUrlCredentials
|
|
22
|
-
} = require('../lib/tools');
|
|
13
|
+
const { readEnvValue, threadStats, getDuration, httpAgent, getServiceSecret, redactUrlCredentials, splitUrlCredentials } = require('../lib/tools');
|
|
23
14
|
const { sendWebhookRequest } = require('../lib/webhook-request');
|
|
24
15
|
const { willBeFinalAttempt, isFinalFailedAttempt } = require('../lib/delivery-error');
|
|
25
16
|
const { validateWebhookTarget } = require('../lib/webhook-egress');
|
|
@@ -198,10 +189,6 @@ parentPort.on('message', message => {
|
|
|
198
189
|
});
|
|
199
190
|
});
|
|
200
191
|
}
|
|
201
|
-
|
|
202
|
-
if (message && message.cmd === 'settings') {
|
|
203
|
-
maybeReloadHttpProxyAgent(message.data);
|
|
204
|
-
}
|
|
205
192
|
});
|
|
206
193
|
|
|
207
194
|
const notifyWorker = new Worker(
|
|
@@ -518,7 +505,9 @@ const notifyWorker = new Worker(
|
|
|
518
505
|
event: job.name,
|
|
519
506
|
message: err.message,
|
|
520
507
|
time: Date.now(),
|
|
521
|
-
|
|
508
|
+
// stored without credentials: the flag is read back through the
|
|
509
|
+
// webhook route listing, the account page and the settings API
|
|
510
|
+
url: redactUrlCredentials(customRoute.targetUrl),
|
|
522
511
|
code: err.code,
|
|
523
512
|
statusCode: err.statusCode
|
|
524
513
|
})
|
|
@@ -531,7 +520,7 @@ const notifyWorker = new Worker(
|
|
|
531
520
|
event: job.name,
|
|
532
521
|
message: err.message,
|
|
533
522
|
time: Date.now(),
|
|
534
|
-
url:
|
|
523
|
+
url: redactedWebhooks,
|
|
535
524
|
code: err.code,
|
|
536
525
|
statusCode: err.statusCode
|
|
537
526
|
})
|
|
@@ -541,7 +530,7 @@ const notifyWorker = new Worker(
|
|
|
541
530
|
event: job.name,
|
|
542
531
|
message: err.message,
|
|
543
532
|
time: Date.now(),
|
|
544
|
-
url:
|
|
533
|
+
url: redactedWebhooks,
|
|
545
534
|
code: err.code,
|
|
546
535
|
statusCode: err.statusCode
|
|
547
536
|
});
|
|
Binary file
|
|
Binary file
|
package/static/front/index.html
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en" class="h-100">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
|
6
|
-
<meta name="description" content="EmailEngine" />
|
|
7
|
-
<title>EmailEngine Set-up</title>
|
|
8
|
-
<link
|
|
9
|
-
rel="stylesheet"
|
|
10
|
-
href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css"
|
|
11
|
-
integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn"
|
|
12
|
-
crossorigin="anonymous"
|
|
13
|
-
/>
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body class="d-flex flex-column h-100">
|
|
17
|
-
<main role="main" class="flex-shrink-0">
|
|
18
|
-
<div class="container mt-4">
|
|
19
|
-
<div class="d-flex">
|
|
20
|
-
<img src="./EmailEngine_logo_horiz.png" style="display: block; max-height: 80px; max-width: 100%" />
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
<div class="row mt-4">
|
|
24
|
-
<div class="col-12 col-sm-12 col-md-12 col-lg-8">
|
|
25
|
-
<p>
|
|
26
|
-
EmailEngine is an email client software designed for applications, not individual users. It connects to users' email servers and
|
|
27
|
-
translates REST API requests from the app into IMAP and SMTP commands, or into Gmail API or Microsoft Graph API requests.
|
|
28
|
-
Additionally, it sends webhooks to notify the app of events such as new or deleted emails.
|
|
29
|
-
</p>
|
|
30
|
-
|
|
31
|
-
<div class="mt-4 alert alert-info">
|
|
32
|
-
To continue setting up your EmailEngine installation, log in to your server using SSH:<br />
|
|
33
|
-
<kbd style="display: block; padding: 1.2rem; margin-top: 1rem">$ ssh root@<span id="hostname">example.com</span></kbd>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
</main>
|
|
39
|
-
|
|
40
|
-
<footer class="footer mt-auto py-3">
|
|
41
|
-
<div class="container">
|
|
42
|
-
<div class="row">
|
|
43
|
-
<div class="col-sm-8">
|
|
44
|
-
EmailEngine
|
|
45
|
-
<span class="text-muted">© 2020-<span id="curyear">2025</span></span>
|
|
46
|
-
Postal Systems OÜ.
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</footer>
|
|
51
|
-
|
|
52
|
-
<script>
|
|
53
|
-
document.getElementById('hostname').textContent = window.location.hostname;
|
|
54
|
-
document.getElementById('curyear').textContent = new Date().getFullYear();
|
|
55
|
-
</script>
|
|
56
|
-
</body>
|
|
57
|
-
</html>
|
package/static/front/logo.png
DELETED
|
Binary file
|