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.
Files changed (182) hide show
  1. package/.github/dependabot.yml +22 -0
  2. package/.github/workflows/test.yml +39 -0
  3. package/.release-please-manifest.json +1 -1
  4. package/CHANGELOG.md +69 -0
  5. package/DOCKER_DEPLOYMENT.md +6 -7
  6. package/Dockerfile +35 -11
  7. package/config/default.toml +7 -2
  8. package/copy-static-files.sh +23 -5
  9. package/data/google-crawlers.json +1 -1
  10. package/encrypt.js +43 -0
  11. package/lib/account/account-state.js +62 -0
  12. package/lib/account.js +60 -3
  13. package/lib/api-routes/account-routes.js +20 -0
  14. package/lib/api-routes/bull-board-routes.js +3 -2
  15. package/lib/api-routes/index.js +1 -1
  16. package/lib/api-routes/route-helpers.js +8 -0
  17. package/lib/api-routes/settings-routes.js +17 -2
  18. package/lib/auth-token.js +73 -2
  19. package/lib/autodetect-imap-settings.js +379 -69
  20. package/lib/cert-handler.js +62 -0
  21. package/lib/consts.js +58 -7
  22. package/lib/db.js +12 -0
  23. package/lib/egress-fetch.js +145 -0
  24. package/lib/email-client/base-client.js +234 -66
  25. package/lib/email-client/credential-errors.js +118 -0
  26. package/lib/email-client/gmail/gmail-api.js +2 -1
  27. package/lib/email-client/gmail-client.js +70 -64
  28. package/lib/email-client/imap/connection-errors.js +52 -0
  29. package/lib/email-client/imap/listing-diff.js +47 -6
  30. package/lib/email-client/imap/mailbox.js +457 -379
  31. package/lib/email-client/imap/subconnection.js +15 -11
  32. package/lib/email-client/imap/sync-operations.js +46 -59
  33. package/lib/email-client/imap-client.js +136 -95
  34. package/lib/email-client/message-builder.js +11 -11
  35. package/lib/email-client/outlook/graph-api.js +2 -1
  36. package/lib/email-client/outlook-client.js +219 -106
  37. package/lib/export.js +35 -2
  38. package/lib/handlebars-helpers.js +129 -0
  39. package/lib/imap-proxy-auth.js +96 -21
  40. package/lib/imapproxy/imap-core/README.md +1 -0
  41. package/lib/imapproxy/imap-core/lib/tls-options.js +5 -46
  42. package/lib/imapproxy/imap-server.js +56 -66
  43. package/lib/lua/h-del-if-equals.lua +39 -0
  44. package/lib/lua/h-set-if-equals.lua +39 -0
  45. package/lib/openapi/index.js +3 -0
  46. package/lib/outbox.js +28 -3
  47. package/lib/rate-limit.js +23 -4
  48. package/lib/routes-ui.js +4 -34
  49. package/lib/schemas.js +42 -3
  50. package/lib/security-headers.js +411 -0
  51. package/lib/sentry.js +36 -4
  52. package/lib/smtp-auth.js +86 -7
  53. package/lib/tls/context.js +376 -0
  54. package/lib/tls/der.js +223 -0
  55. package/lib/tls/provision.js +555 -0
  56. package/lib/tls/self-signed.js +282 -0
  57. package/lib/tls/status.js +431 -0
  58. package/lib/tls/store.js +666 -0
  59. package/lib/tools.js +337 -147
  60. package/lib/ui-routes/account-routes.js +47 -33
  61. package/lib/ui-routes/admin-config-routes.js +22 -1
  62. package/lib/ui-routes/auth-routes.js +16 -1
  63. package/lib/ui-routes/export-routes.js +4 -0
  64. package/lib/ui-routes/internals-routes.js +3 -5
  65. package/lib/ui-routes/mcp-consent-routes.js +7 -0
  66. package/lib/ui-routes/network-config-routes.js +58 -48
  67. package/lib/ui-routes/route-helpers.js +24 -8
  68. package/lib/ui-routes/smtp-test-routes.js +7 -0
  69. package/lib/ui-routes/tls-config-routes.js +581 -0
  70. package/lib/utils/mailbox-path.js +51 -0
  71. package/lib/utils/severity.js +31 -0
  72. package/lib/webhook-egress.js +5 -0
  73. package/package.json +21 -24
  74. package/sbom.json +1 -1
  75. package/server.js +53 -36
  76. package/static/css/flyonui.css +1 -1
  77. package/static/css/src/app.tailwind.css +11 -0
  78. package/static/js/ace/css/ace.css +1462 -0
  79. package/static/js/ace/css/kuroir-1.png +0 -0
  80. package/static/js/ace/css/kuroir-2.png +0 -0
  81. package/static/js/ace/css/main-1.png +0 -0
  82. package/static/js/ace/css/main-10.svg +4 -0
  83. package/static/js/ace/css/main-11.svg +5 -0
  84. package/static/js/ace/css/main-12.svg +4 -0
  85. package/static/js/ace/css/main-13.png +0 -0
  86. package/static/js/ace/css/main-14.png +0 -0
  87. package/static/js/ace/css/main-15.png +0 -0
  88. package/static/js/ace/css/main-16.png +0 -0
  89. package/static/js/ace/css/main-17.png +0 -0
  90. package/static/js/ace/css/main-18.png +0 -0
  91. package/static/js/ace/css/main-19.png +0 -0
  92. package/static/js/ace/css/main-2.png +0 -0
  93. package/static/js/ace/css/main-20.png +0 -0
  94. package/static/js/ace/css/main-21.png +0 -0
  95. package/static/js/ace/css/main-22.png +0 -0
  96. package/static/js/ace/css/main-23.png +0 -0
  97. package/static/js/ace/css/main-24.png +0 -0
  98. package/static/js/ace/css/main-25.svg +1 -0
  99. package/static/js/ace/css/main-26.png +0 -0
  100. package/static/js/ace/css/main-3.png +0 -0
  101. package/static/js/ace/css/main-4.png +0 -0
  102. package/static/js/ace/css/main-5.svg +7 -0
  103. package/static/js/ace/css/main-6.svg +9 -0
  104. package/static/js/ace/css/main-7.svg +7 -0
  105. package/static/js/ace/css/main-8.svg +9 -0
  106. package/static/js/ace/css/main-9.svg +6 -0
  107. package/static/js/ace/css/theme/kuroir.css +78 -0
  108. package/static/js/ace/css/theme/tomorrow_night.css +128 -0
  109. package/static/js/ace/css/theme/tomorrow_night_eighties.css +128 -0
  110. package/static/js/ace/css/theme/xcode.css +106 -0
  111. package/static/js/ace/css/tomorrow_night-1.png +0 -0
  112. package/static/js/ace/css/tomorrow_night-2.png +0 -0
  113. package/static/js/ace/css/tomorrow_night_eighties-1.png +0 -0
  114. package/static/js/ace/css/tomorrow_night_eighties-2.png +0 -0
  115. package/static/js/ace/css/xcode-1.png +0 -0
  116. package/static/js/ace/css/xcode-2.png +0 -0
  117. package/static/js/app.js +34 -0
  118. package/static/js/ee-client.js +256 -102
  119. package/static/js/public.js +13 -2
  120. package/static/js/ui.js +40 -25
  121. package/static/licenses.html +393 -1282
  122. package/static/vendor/simplewebauthn/browser.min.js +2 -2
  123. package/translations/messages.pot +203 -157
  124. package/views/account/login-redirect.hbs +22 -0
  125. package/views/accounts/account.hbs +15 -37
  126. package/views/accounts/browse.hbs +3 -1
  127. package/views/accounts/edit.hbs +1 -1
  128. package/views/accounts/register/imap-server.hbs +1 -1
  129. package/views/config/ai.hbs +1 -1
  130. package/views/config/branding.hbs +2 -2
  131. package/views/config/document-store/chat.hbs +1 -1
  132. package/views/config/document-store/index.hbs +1 -1
  133. package/views/config/imap-proxy.hbs +1 -4
  134. package/views/config/license.hbs +1 -1
  135. package/views/config/mcp.hbs +1 -1
  136. package/views/config/network.hbs +14 -16
  137. package/views/config/oauth/app.hbs +2 -2
  138. package/views/config/service.hbs +1 -1
  139. package/views/config/smtp.hbs +1 -4
  140. package/views/config/tls-upload.hbs +81 -0
  141. package/views/config/tls.hbs +492 -0
  142. package/views/config/webhooks.hbs +2 -2
  143. package/views/error.hbs +4 -2
  144. package/views/internals/index.hbs +1 -1
  145. package/views/layout/app.hbs +3 -11
  146. package/views/mcp/authorize.hbs +1 -1
  147. package/views/partials/ace_assets.hbs +13 -0
  148. package/views/partials/add_account_modal.hbs +1 -1
  149. package/views/partials/address_list.hbs +4 -4
  150. package/views/partials/filter_editor_js.hbs +2 -2
  151. package/views/partials/gateway_js.hbs +1 -1
  152. package/views/partials/oauth_form.hbs +1 -1
  153. package/views/partials/public_theme_init.hbs +1 -1
  154. package/views/partials/side_menu.hbs +1 -0
  155. package/views/partials/template_form.hbs +2 -2
  156. package/views/partials/test_send.hbs +7 -4
  157. package/views/partials/theme_init.hbs +1 -1
  158. package/views/partials/tls_security_card.hbs +25 -53
  159. package/views/partials/ui/alert-banner.hbs +3 -2
  160. package/views/partials/ui/badge.hbs +6 -2
  161. package/views/partials/ui/btn.hbs +5 -2
  162. package/views/partials/ui/details.hbs +2 -2
  163. package/views/partials/webhooks_editor_functions.hbs +1 -1
  164. package/views/reference/redirect.hbs +1 -1
  165. package/views/templates/template.hbs +2 -2
  166. package/views/tokens/new.hbs +1 -1
  167. package/views/unsubscribe.hbs +1 -1
  168. package/views/webhooks/webhook.hbs +2 -2
  169. package/workers/api.js +131 -242
  170. package/workers/export.js +1 -5
  171. package/workers/imap-proxy.js +4 -1
  172. package/workers/imap.js +1 -3
  173. package/workers/smtp.js +59 -83
  174. package/workers/submit.js +6 -12
  175. package/workers/webhooks.js +6 -17
  176. package/static/front/EmailEngine_logo_horiz.png +0 -0
  177. package/static/front/EmailEngine_logo_vert.png +0 -0
  178. package/static/front/index.html +0 -57
  179. package/static/front/logo.png +0 -0
  180. package/static/vendor/handlebars/handlebars.min-v4.7.9.js +0 -29
  181. package/views/partials/tls_security_js.hbs +0 -64
  182. package/views/partials/tls_security_modal.hbs +0 -22
@@ -0,0 +1,22 @@
1
+ {{!-- Forced-SSO hand-off. This page exists instead of an HTTP redirect because Chrome checks a
2
+ form submission's redirect target against the SUBMITTING page's form-action: when a session expires
3
+ mid-form, the browser follows POST /admin/x -> /admin/login -> the provider as one submission, and
4
+ the admin policy's `form-action 'self'` kills that last hop, so the form silently does nothing. A
5
+ navigation this page starts is not part of that submission, so the policy no longer applies to it.
6
+
7
+ The per-route relaxation that lets the account page's Re-authenticate button redirect to a provider
8
+ (OAUTH_REDIRECT_FORM_DIRECTIVES) cannot help here: the policy being enforced belongs to whichever
9
+ admin page held the form, which is any of them.
10
+
11
+ location.replace() rather than a meta refresh: it leaves no history entry, so Back does not land
12
+ here and bounce the user straight out again, which is how the HTTP redirect behaved. The link is
13
+ what a browser that did not run the script gets. --}}
14
+ <h1 class="text-base-content mb-2 text-xl font-semibold">Signing in&mldr;</h1>
15
+
16
+ <p class="text-base-content/60 mb-6 text-sm">Taking you to {{providers.oidc.name}} to sign in.</p>
17
+
18
+ {{> ui/btn label="Continue" href=ssoRedirectUrl id="sso-continue" icon="icon-[tabler--login-2]" class="btn-block"}}
19
+
20
+ <script nonce="{{cspNonce}}">
21
+ window.location.replace(document.getElementById('sso-continue').href);
22
+ </script>
@@ -285,8 +285,13 @@
285
285
  To
286
286
  {{/if}}
287
287
 
288
+ {{#if account.oauth2.accessTokenInvalidated}}
289
+ {{!-- the expiry was rewound to force a renewal, so the stored end is meaningless --}}
290
+ invalidated, a new token is requested on the next connection
291
+ {{else}}
288
292
  <span class="local-date-time code-link" data-time="{{account.oauth2.expiresStr}}"
289
293
  title="{{account.oauth2.expiresStr}}"></span>
294
+ {{/if}}
290
295
  </dd>
291
296
  {{/if}}
292
297
 
@@ -946,7 +951,7 @@ submitLabel="Delete account"}}
946
951
  {{!-- no #crumb input: the layout already renders the element the script reads --}}
947
952
  <input type="hidden" id="account-id" value="{{account.account}}">
948
953
 
949
- <script>
954
+ <script nonce="{{cspNonce}}">
950
955
  document.addEventListener('DOMContentLoaded', () => {
951
956
 
952
957
  const reconnectAccount = async () => {
@@ -1340,11 +1345,14 @@ submitLabel="Delete account"}}
1340
1345
  const account = document.getElementById('account-id').value.trim();
1341
1346
 
1342
1347
  try {
1343
- await fetch(`/admin/accounts/${account}/export/${currentExportId}`, {
1348
+ // the crumb travels in the header: the route validates DELETE in restful mode
1349
+ const res = await fetch(`/admin/accounts/${account}/export/${currentExportId}`, {
1344
1350
  method: 'DELETE',
1345
- headers: { 'Content-Type': 'application/json' },
1346
- body: JSON.stringify({ crumb: document.getElementById('crumb').value })
1351
+ headers: { 'X-CSRF-Token': document.getElementById('crumb').value }
1347
1352
  });
1353
+ if (!res.ok) {
1354
+ throw new Error(`HTTP ${res.status}`);
1355
+ }
1348
1356
 
1349
1357
  stopPolling();
1350
1358
  currentExportId = null;
@@ -1357,39 +1365,8 @@ submitLabel="Delete account"}}
1357
1365
  });
1358
1366
  </script>
1359
1367
 
1360
- <script id="test-send-template" type="text/x-handlebars-template">{{{testSendTemplate}}}</script>
1361
-
1362
- <script>
1368
+ <script nonce="{{cspNonce}}">
1363
1369
  document.addEventListener('DOMContentLoaded', () => {
1364
- Handlebars.registerHelper('equals', function (compareVal, baseVal, options) {
1365
- if (baseVal == compareVal) {
1366
- return options.fn(this);
1367
- }
1368
- return options.inverse(this);
1369
- });
1370
-
1371
- Handlebars.registerHelper('inc', function (nr, inc, options) {
1372
- return Number(nr) + Number(inc);
1373
- });
1374
-
1375
- // status -> FlyonUI color/icon maps for the delivery-test results template
1376
- const STATUS_COLORS = { pass: 'success', softfail: 'warning', fail: 'error', permerror: 'info', temperror: 'info' };
1377
- Handlebars.registerHelper('statusColor', result => STATUS_COLORS[result] || 'neutral');
1378
-
1379
- Handlebars.registerHelper('statusIcon', result => {
1380
- switch (result) {
1381
- case 'pass':
1382
- return 'icon-[tabler--circle-check]';
1383
- case 'neutral':
1384
- case 'none':
1385
- return 'icon-[tabler--circle-off]';
1386
- default:
1387
- return 'icon-[tabler--alert-triangle]';
1388
- }
1389
- });
1390
-
1391
- const testSendTemplate = Handlebars.compile(document.getElementById('test-send-template').innerHTML);
1392
-
1393
1370
  let aborted = false;
1394
1371
 
1395
1372
  const createSmtpTestAccount = async (account, gateway) => {
@@ -1462,7 +1439,8 @@ submitLabel="Delete account"}}
1462
1439
  return false
1463
1440
  }
1464
1441
  document.getElementById('test-send-results').classList.remove('hidden');
1465
- document.getElementById('test-send-results').innerHTML = testSendTemplate(results);
1442
+ // rendered server-side by /admin/smtp/check-test from views/partials/test_send.hbs
1443
+ document.getElementById('test-send-results').innerHTML = results.html;
1466
1444
  }).catch(err => {
1467
1445
  if (aborted) {
1468
1446
  return false
@@ -26,7 +26,7 @@
26
26
  </div>
27
27
  {{/ui/modal}}
28
28
 
29
- <script type="module">
29
+ <script type="module" nonce="{{cspNonce}}">
30
30
  import { EmailEngineClient } from '/static/js/ee-client.js';
31
31
 
32
32
  // Create client with UI container. The embed follows the admin theme -
@@ -36,6 +36,8 @@
36
36
  apiUrl: window.location.origin,
37
37
  account: '{{account}}',
38
38
  accessToken: '{{sessionToken}}',
39
+ // the widget appends its own stylesheet element; the admin policy accepts it with this nonce
40
+ styleNonce: '{{cspNonce}}',
39
41
  container: document.getElementById('email-client'),
40
42
  darkMode: uiEffectiveTheme() === 'dark',
41
43
  showDarkModeToggle: false,
@@ -140,7 +140,7 @@
140
140
 
141
141
  <input type="hidden" id="availablePaths" value="{{availablePaths}}">
142
142
 
143
- <script>
143
+ <script nonce="{{cspNonce}}">
144
144
  document.addEventListener('DOMContentLoaded', () => {
145
145
  let availablePaths = JSON.parse(document.getElementById('availablePaths').value);
146
146
  // native datalist suggestions for the Sent Mail folder input (the
@@ -290,7 +290,7 @@ focus ring on) the corner close button --}}
290
290
 
291
291
  <input type="hidden" id="autoTest" value="{{#if autoTest}}true{{/if}}">
292
292
 
293
- <script>
293
+ <script nonce="{{cspNonce}}">
294
294
  document.addEventListener('DOMContentLoaded', () => {
295
295
 
296
296
  let formTested = false;
@@ -311,7 +311,7 @@ defaultTestPayload='{"account":"test","path":"INBOX","subject":"test email"}'}}
311
311
 
312
312
  <input type="hidden" id="defaultPromptJson" value="{{defaultPromptJson}}">
313
313
 
314
- <script>
314
+ <script nonce="{{cspNonce}}">
315
315
  document.addEventListener('DOMContentLoaded', () => {
316
316
 
317
317
  const editorPrompt = uiAceEditor("editor-prompt", "markdown", document.getElementById('openAiPromptElement').value, {
@@ -78,10 +78,10 @@
78
78
  </form>
79
79
 
80
80
 
81
- <script src="/static/js/ace/ace.js"></script>
81
+ {{> ace_assets}}
82
82
  <script src="/static/js/ace/ext-language_tools.js"></script>
83
83
 
84
- <script>
84
+ <script nonce="{{cspNonce}}">
85
85
  document.addEventListener('DOMContentLoaded', () => {
86
86
 
87
87
  const editors = new Map();
@@ -171,7 +171,7 @@
171
171
  </form>
172
172
  {{/ui/modal}}
173
173
 
174
- <script>
174
+ <script nonce="{{cspNonce}}">
175
175
  document.addEventListener('DOMContentLoaded', () => {
176
176
 
177
177
  const sendQuestionPayload = async () => {
@@ -116,7 +116,7 @@
116
116
 
117
117
  </form>
118
118
 
119
- <script>
119
+ <script nonce="{{cspNonce}}">
120
120
  document.addEventListener('DOMContentLoaded', () => {
121
121
 
122
122
  const sendTestPayload = async () => {
@@ -136,11 +136,10 @@
136
136
 
137
137
  </form>
138
138
 
139
- {{> tls_security_modal}}
140
139
 
141
140
  <input type="hidden" id="availableAddresses" value="{{availableAddresses}}">
142
141
 
143
- <script>
142
+ <script nonce="{{cspNonce}}">
144
143
  document.addEventListener('DOMContentLoaded', () => {
145
144
 
146
145
  let availableAddresses = document.getElementById('availableAddresses').value.split(',').map(e => e.trim()).filter(e => e);
@@ -185,7 +184,5 @@ $client = $cm->make([
185
184
  ]);`}
186
185
  }
187
186
  });
188
-
189
- {{> tls_security_js field="imapProxyServerTLSEnabled"}}
190
187
  });
191
188
  </script>
@@ -122,7 +122,7 @@ submitLabel="Remove License"}}
122
122
  Remove the current license key from this EmailEngine instance?
123
123
  {{/ui/confirm-modal}}
124
124
 
125
- <script>
125
+ <script nonce="{{cspNonce}}">
126
126
  document.addEventListener('DOMContentLoaded', () => {
127
127
  let licenseTextElm = document.getElementById('licenseTextElement')
128
128
  let fileSelectElm = document.getElementById('licenseFile');
@@ -291,7 +291,7 @@
291
291
 
292
292
  </div>
293
293
 
294
- <script>
294
+ <script nonce="{{cspNonce}}">
295
295
  (() => {
296
296
  let container = document.getElementById('mcpTokenGen');
297
297
  let presets = JSON.parse(container.dataset.presets || '{}');
@@ -9,13 +9,15 @@
9
9
  <input type="hidden" name="crumb" value="{{crumb}}" />
10
10
 
11
11
  {{#> ui/card title="Proxy Settings" bodyClass="space-y-4"}}
12
- <p>Route all email server connections through a proxy. Supports HTTP CONNECT, SOCKS4, and SOCKS5.</p>
12
+ <p>Route all outbound connections through a proxy: IMAP and SMTP sessions, Gmail API and Microsoft
13
+ Graph requests, OAuth2 token exchange, webhook delivery, and EmailEngine's own requests such as
14
+ license validation. Supports HTTP CONNECT, SOCKS4, and SOCKS5.</p>
13
15
 
14
16
  <div>
15
17
  {{> ui/setting-ref name="proxyEnabled"}}
16
18
  {{> ui/checkbox id="proxy_enabled" name="proxyEnabled" label="Enable Global Proxy" class="proxy-status"
17
19
  checked=values.proxyEnabled error=errors.proxyEnabled
18
- hint="Routes all connections through the proxy below. Individual accounts can override this setting."}}
20
+ hint="Routes all outbound connections through the proxy below. Individual accounts can override it for their IMAP and SMTP connections."}}
19
21
  </div>
20
22
 
21
23
  <div>
@@ -43,14 +45,15 @@
43
45
  {{/ui/card}}
44
46
 
45
47
  {{#> ui/card title="HTTP Proxy Settings" bodyClass="space-y-4"}}
46
- <p>Route all outbound HTTP/HTTPS requests through a proxy. This applies to webhook delivery, OAuth token
47
- exchange, and API calls to Gmail/Outlook. This is separate from the IMAP/SMTP proxy above.</p>
48
+ <p>Optional. Use a different proxy for HTTP/HTTPS requests only: webhook delivery, OAuth2 token exchange,
49
+ Gmail API and Microsoft Graph calls, and license validation. When disabled, these requests use the
50
+ global proxy above.</p>
48
51
 
49
52
  <div>
50
53
  {{> ui/setting-ref name="httpProxyEnabled"}}
51
54
  {{> ui/checkbox id="http_proxy_enabled" name="httpProxyEnabled" label="Enable HTTP Proxy"
52
55
  class="http-proxy-status" checked=values.httpProxyEnabled error=errors.httpProxyEnabled
53
- hint="Routes all outbound HTTP/HTTPS requests through the proxy below."}}
56
+ hint="Routes outbound HTTP/HTTPS requests through the proxy below instead of the global proxy."}}
54
57
  </div>
55
58
 
56
59
  <div>
@@ -181,11 +184,7 @@ Remove this IP from the list? It will be re-added if found during the next scan.
181
184
  {{/ui/confirm-modal}}
182
185
 
183
186
 
184
- <script id="address-list-template" type="text/x-handlebars-template">
185
- {{{addressListTemplate}}}
186
- </script>
187
-
188
- <script>
187
+ <script nonce="{{cspNonce}}">
189
188
  document.addEventListener('DOMContentLoaded', () => {
190
189
  let reloadBtn = document.getElementById('reload-btn');
191
190
 
@@ -223,10 +222,9 @@ Remove this IP from the list? It will be re-added if found during the next scan.
223
222
 
224
223
  checkCheckboxes()
225
224
 
226
- const addressListTemplate = Handlebars.compile(document.getElementById('address-list-template').innerHTML);
227
-
228
- let redrawAddressList = data => {
229
- let html = addressListTemplate(data);
225
+ let redrawAddressList = html => {
226
+ // rendered server-side by /admin/config/network/reload from the same
227
+ // address_list partial as the initial page
230
228
  document.getElementById('address-list').innerHTML = html;
231
229
 
232
230
  for (let elm of document.querySelectorAll('#address-list .checkbox-entry')) {
@@ -250,8 +248,8 @@ Remove this IP from the list? It will be re-added if found during the next scan.
250
248
  return;
251
249
  }
252
250
 
253
- if (data.addresses) {
254
- redrawAddressList(data);
251
+ if (data.html) {
252
+ redrawAddressList(data.html);
255
253
  }
256
254
 
257
255
  }).catch(err => {
@@ -355,7 +355,7 @@ fieldName="app" fieldValue=app.id submitLabel="Delete app" submitIcon="icon-[tab
355
355
  </form>
356
356
  {{/ui/modal}}
357
357
 
358
- <script>
358
+ <script nonce="{{cspNonce}}">
359
359
  document.addEventListener('DOMContentLoaded', () => {
360
360
  document.getElementById('addServiceAccountModal').addEventListener('open.overlay', () => {
361
361
  document.getElementById('service-account-name').focus();
@@ -364,7 +364,7 @@ fieldName="app" fieldValue=app.id submitLabel="Delete app" submitIcon="icon-[tab
364
364
  </script>
365
365
  {{/if}}
366
366
 
367
- <script>
367
+ <script nonce="{{cspNonce}}">
368
368
  document.addEventListener('DOMContentLoaded', () => {
369
369
  const appId = "{{app.id}}";
370
370
  const stepsElm = document.getElementById('verify-steps');
@@ -123,7 +123,7 @@
123
123
 
124
124
  </form>
125
125
 
126
- <script>
126
+ <script nonce="{{cspNonce}}">
127
127
  document.addEventListener('DOMContentLoaded', () => {
128
128
 
129
129
  const sendCleanPayload = async () => {
@@ -140,11 +140,10 @@
140
140
 
141
141
  </form>
142
142
 
143
- {{> tls_security_modal}}
144
143
 
145
144
  <input type="hidden" id="availableAddresses" value="{{availableAddresses}}">
146
145
 
147
- <script>
146
+ <script nonce="{{cspNonce}}">
148
147
  document.addEventListener('DOMContentLoaded', () => {
149
148
 
150
149
  let availableAddresses = document.getElementById('availableAddresses').value.split(',').map(e => e.trim()).filter(e => e);
@@ -214,7 +213,5 @@ $mail->addCustomHeader('X-EE-Account', 'USERNAME');
214
213
  `}
215
214
  }
216
215
  });
217
-
218
- {{> tls_security_js field="smtpServerTLSEnabled"}}
219
216
  });
220
217
  </script>
@@ -0,0 +1,81 @@
1
+ {{> ui/page-header title="Upload a certificate" icon="icon-[tabler--upload]" class="mb-1"}}
2
+
3
+ {{> ui/breadcrumb parentHref="/admin/config/tls" parentLabel="TLS Certificates" current="Upload a certificate" class="mb-6"}}
4
+
5
+ <p class="mb-6">An uploaded certificate is served for every name it covers, ahead of anything EmailEngine obtains on its
6
+ own. It is never renewed automatically, so replace it here before it expires.</p>
7
+
8
+ {{#if manual}}
9
+ {{#> ui/alert-banner variant="info" icon="icon-[tabler--info-circle]"}}
10
+ <div>A certificate for <span class="font-mono">{{manual.subject}}</span> is installed and valid until <span
11
+ class="local-date-time" data-time="{{manual.validToIso}}">{{manual.validToIso}}</span>. Installing another one
12
+ replaces it.</div>
13
+ {{/ui/alert-banner}}
14
+ {{/if}}
15
+
16
+ {{!-- The "Choose file" buttons and drag-and-drop onto a field are wired by static/js/app.js
17
+ (.file-picker-btn with data-file-target, and .droptxt), so this page carries no script. --}}
18
+ <form method="post" action="/admin/config/tls/upload">
19
+ {{!-- no id: the layout already renders the #crumb element the scripts read --}}
20
+ <input type="hidden" name="crumb" value="{{crumb}}" />
21
+
22
+ <div class="card bg-base-100 shadow-md mb-6">
23
+ <div class="card-header">
24
+ <h6 class="card-title text-primary">Certificate and key</h6>
25
+ </div>
26
+
27
+ <div class="card-body space-y-4">
28
+ <div>
29
+ {{#> ui/form-field id="uploadCert" label="Certificate"}}
30
+ <div class="flex items-start gap-2">
31
+ <textarea class="textarea font-mono text-xs grow droptxt" id="uploadCert" name="cert" rows="6" required
32
+ spellcheck="false" placeholder="-----BEGIN CERTIFICATE-----"></textarea>
33
+ {{> ui/btn label="Choose file" variant="neutral" style="soft" size="sm" icon="icon-[tabler--file-import]"
34
+ class="file-picker-btn shrink-0" dataName="file-target" dataValue="#uploadCert" id="uploadCertFile"}}
35
+ </div>
36
+ <span class="helper-text">PEM encoded, pasted or dropped onto the field. The server certificate first;
37
+ intermediates may follow it here or go in the chain field below.</span>
38
+ {{/ui/form-field}}
39
+ </div>
40
+
41
+ <div>
42
+ {{#> ui/form-field id="uploadKey" label="Private key"}}
43
+ <div class="flex items-start gap-2">
44
+ <textarea class="textarea font-mono text-xs grow droptxt" id="uploadKey" name="privateKey" rows="6" required
45
+ spellcheck="false" placeholder="-----BEGIN PRIVATE KEY-----"></textarea>
46
+ {{> ui/btn label="Choose file" variant="neutral" style="soft" size="sm" icon="icon-[tabler--file-import]"
47
+ class="file-picker-btn shrink-0" dataName="file-target" dataValue="#uploadKey" id="uploadKeyFile"}}
48
+ </div>
49
+ <span class="helper-text">Stored encrypted with the instance secret and never shown again.</span>
50
+ {{/ui/form-field}}
51
+ </div>
52
+
53
+ <div>
54
+ {{#> ui/form-field id="uploadPassphrase" label="Key passphrase"}}
55
+ <input type="password" class="input" id="uploadPassphrase" name="passphrase" autocomplete="new-password"
56
+ data-lpignore="true" />
57
+ <span class="helper-text">Only if the private key is encrypted. It is used to read the key and is not
58
+ stored.</span>
59
+ {{/ui/form-field}}
60
+ </div>
61
+
62
+ <div>
63
+ {{#> ui/form-field id="uploadCa" label="Chain"}}
64
+ <div class="flex items-start gap-2">
65
+ <textarea class="textarea font-mono text-xs grow droptxt" id="uploadCa" name="ca" rows="4" spellcheck="false"
66
+ placeholder="-----BEGIN CERTIFICATE-----"></textarea>
67
+ {{> ui/btn label="Choose file" variant="neutral" style="soft" size="sm" icon="icon-[tabler--file-import]"
68
+ class="file-picker-btn shrink-0" dataName="file-target" dataValue="#uploadCa" id="uploadCaFile"}}
69
+ </div>
70
+ <span class="helper-text">Optional. Intermediate certificates, if they are not already in the certificate
71
+ field.</span>
72
+ {{/ui/form-field}}
73
+ </div>
74
+ </div>
75
+ </div>
76
+
77
+ <div class="mb-6 flex flex-wrap gap-2">
78
+ {{> ui/btn label=(when manual "Replace certificate" "Install certificate") type="submit" icon="icon-[tabler--upload]"}}
79
+ {{> ui/btn label="Cancel" variant="neutral" style="soft" href="/admin/config/tls"}}
80
+ </div>
81
+ </form>