@rocket.chat/houston 0.27.0-next.2 → 2.1.8
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/LICENSE +1 -1
- package/README.md +108 -15
- package/bin/houston +62 -0
- package/data/docs/ARCHITECTURE.md +387 -0
- package/data/docs/automation.md +107 -0
- package/data/docs/e2ee.md +76 -0
- package/data/docs/eks.md +258 -0
- package/data/docs/gui.md +282 -0
- package/data/docs/guide.md +669 -0
- package/data/docs/kubernetes.md +138 -0
- package/data/docs/troubleshooting.md +193 -0
- package/data/docs/upgrading.md +84 -0
- package/data/docs/voice.md +253 -0
- package/data/iam/engineer-policy.json +11 -0
- package/data/iam/engineer-rbac.yaml +42 -0
- package/data/iam/operator-policy.json +211 -0
- package/data/loadtest/badbot.js +22 -0
- package/data/loadtest/common.js +168 -0
- package/data/loadtest/custom.js +20 -0
- package/data/loadtest/journey.js +58 -0
- package/data/loadtest/login.js +18 -0
- package/data/loadtest/messages.js +13 -0
- package/data/loadtest/mixed.js +39 -0
- package/data/loadtest/read.js +12 -0
- package/data/loadtest/webhook.js +20 -0
- package/data/monitoring/houston-logs.json +98 -0
- package/data/monitoring/k6-loadtest.json +610 -0
- package/data/monitoring/mongodb-exporter.json +3007 -0
- package/data/monitoring/node-exporter-full.json +16114 -0
- package/data/monitoring/rocketchat-metrics.json +6471 -0
- package/data/presets/airgapped.yaml +16 -0
- package/data/presets/default.yaml +9 -0
- package/data/seed/avatar-0.png +0 -0
- package/data/seed/avatar-1.png +0 -0
- package/data/seed/avatar-2.png +0 -0
- package/data/seed/avatar-3.png +0 -0
- package/data/seed/avatar-4.png +0 -0
- package/data/seed/avatar-5.png +0 -0
- package/data/seed/avatar-6.png +0 -0
- package/data/seed/avatar-7.png +0 -0
- package/data/seed/seed-metrics.csv +3 -0
- package/data/seed/seed-preview.png +0 -0
- package/data/seed/seed-report.pdf +32 -0
- package/data/seed/seed-runbook.txt +3 -0
- package/data/skill/SKILL.md +399 -0
- package/data/versions.yaml +55 -0
- package/data/voice/freeswitch/drachtio.xml +52 -0
- package/data/voice/freeswitch/public.xml +87 -0
- package/data/webui/app.css +2003 -0
- package/data/webui/index.html +678 -0
- package/data/webui/js/api.js +561 -0
- package/data/webui/js/boot.js +44 -0
- package/data/webui/js/clusters-tail.js +1377 -0
- package/data/webui/js/clusters.js +896 -0
- package/data/webui/js/create.js +276 -0
- package/data/webui/js/detail.js +507 -0
- package/data/webui/js/jobs.js +636 -0
- package/data/webui/js/logs.js +634 -0
- package/data/webui/js/main.js +14 -0
- package/data/webui/js/options.js +408 -0
- package/data/webui/js/people.js +438 -0
- package/data/webui/js/perf.js +303 -0
- package/data/webui/js/render.js +438 -0
- package/data/webui/js/shared.js +3 -0
- package/data/webui/js/state.js +583 -0
- package/data/webui/js/theme.js +123 -0
- package/data/webui/js/util.js +584 -0
- package/dist/cli/app.js +593 -0
- package/dist/cli/capabilities.js +76 -0
- package/dist/cli/cell-widths.js +495 -0
- package/dist/cli/entry.js +10 -0
- package/dist/cli/error-panel.js +492 -0
- package/dist/cli/handlers/actor.js +84 -0
- package/dist/cli/handlers/https.js +614 -0
- package/dist/cli/handlers/prompt.js +299 -0
- package/dist/cli/handlers/users.js +226 -0
- package/dist/cli/handlers.js +3678 -0
- package/dist/cli/help.js +183 -0
- package/dist/cli/index.js +15 -0
- package/dist/cli/perf.js +810 -0
- package/dist/cli/render.js +254 -0
- package/dist/cli/serve.js +858 -0
- package/dist/cli/spec-data.js +2593 -0
- package/dist/cli/spec-types.js +8 -0
- package/dist/cli/usage-error.js +520 -0
- package/dist/cli/wire.js +70 -0
- package/dist/core/audit.js +346 -0
- package/dist/core/backup-compat.js +85 -0
- package/dist/core/backup.js +1639 -0
- package/dist/core/cluster.js +1398 -0
- package/dist/core/configimport.js +344 -0
- package/dist/core/data.js +267 -0
- package/dist/core/database-of.js +82 -0
- package/dist/core/diagnose.js +159 -0
- package/dist/core/doctor.js +1518 -0
- package/dist/core/edge/acme.js +338 -0
- package/dist/core/edge/engine.js +500 -0
- package/dist/core/edge/networks.js +174 -0
- package/dist/core/edge/paths.js +107 -0
- package/dist/core/edge/routes.js +251 -0
- package/dist/core/edge/routeyml.js +195 -0
- package/dist/core/edge/runtime.js +493 -0
- package/dist/core/edge/spec.js +305 -0
- package/dist/core/edge/types.js +202 -0
- package/dist/core/eks-docs.js +135 -0
- package/dist/core/eks.js +2240 -0
- package/dist/core/envvars.js +562 -0
- package/dist/core/eventlog.js +541 -0
- package/dist/core/firstrun.js +153 -0
- package/dist/core/journal.js +691 -0
- package/dist/core/kube/ask.js +231 -0
- package/dist/core/kube/capabilities.js +269 -0
- package/dist/core/kube/certmanager.js +452 -0
- package/dist/core/kube/chart.js +413 -0
- package/dist/core/kube/cluster.js +196 -0
- package/dist/core/kube/context.js +545 -0
- package/dist/core/kube/endpoints.js +448 -0
- package/dist/core/kube/exec.js +195 -0
- package/dist/core/kube/forward.js +732 -0
- package/dist/core/kube/grafana-ingress.js +110 -0
- package/dist/core/kube/ingress.js +218 -0
- package/dist/core/kube/manifests.js +361 -0
- package/dist/core/kube/monitoring.js +768 -0
- package/dist/core/kube/names.js +237 -0
- package/dist/core/kube/namespace.js +678 -0
- package/dist/core/kube/operator.js +941 -0
- package/dist/core/kube/probe.js +202 -0
- package/dist/core/kube/reachability.js +163 -0
- package/dist/core/kube/release.js +439 -0
- package/dist/core/kube/replicaset.js +180 -0
- package/dist/core/kube/scale.js +398 -0
- package/dist/core/kube/status.js +633 -0
- package/dist/core/kube/tools.js +238 -0
- package/dist/core/kube/transfer.js +173 -0
- package/dist/core/kube/workspace.js +423 -0
- package/dist/core/lifecycle/admin.js +64 -0
- package/dist/core/lifecycle/create-docker.js +1533 -0
- package/dist/core/lifecycle/create-k8s.js +939 -0
- package/dist/core/lifecycle/destroy.js +339 -0
- package/dist/core/lifecycle/inspect.js +635 -0
- package/dist/core/lifecycle/naming.js +298 -0
- package/dist/core/lifecycle/notes.js +726 -0
- package/dist/core/lifecycle/ownership.js +313 -0
- package/dist/core/lifecycle/payload.js +401 -0
- package/dist/core/lifecycle/ports.js +388 -0
- package/dist/core/lifecycle/preconditions.js +367 -0
- package/dist/core/lifecycle/pruning.js +551 -0
- package/dist/core/lifecycle/ready.js +753 -0
- package/dist/core/lifecycle/request.js +525 -0
- package/dist/core/lifecycle/seeding.js +281 -0
- package/dist/core/lifecycle/sizing.js +392 -0
- package/dist/core/lifecycle/state.js +286 -0
- package/dist/core/lifecycle/tlsplan.js +704 -0
- package/dist/core/lifecycle/types.js +232 -0
- package/dist/core/loadtest.js +995 -0
- package/dist/core/migrate.js +612 -0
- package/dist/core/monitor.js +494 -0
- package/dist/core/postready.js +969 -0
- package/dist/core/promote.js +804 -0
- package/dist/core/rcapi.js +1285 -0
- package/dist/core/recovery.js +75 -0
- package/dist/core/runner/engine.js +394 -0
- package/dist/core/runner/host.js +298 -0
- package/dist/core/runner/locks.js +129 -0
- package/dist/core/runner/paths.js +173 -0
- package/dist/core/runner/ports.js +172 -0
- package/dist/core/runner/queries.js +612 -0
- package/dist/core/runner/record.js +563 -0
- package/dist/core/scaleseed.js +271 -0
- package/dist/core/seed-db.js +208 -0
- package/dist/core/sessions.js +472 -0
- package/dist/core/skill.js +326 -0
- package/dist/core/sso-identities.js +172 -0
- package/dist/core/sso.js +703 -0
- package/dist/core/tls-local.js +311 -0
- package/dist/core/tls.js +878 -0
- package/dist/core/topology.js +482 -0
- package/dist/core/upgrade.js +868 -0
- package/dist/core/users.js +739 -0
- package/dist/lib/audit.js +100 -0
- package/dist/lib/close-matches.js +238 -0
- package/dist/lib/compose.js +672 -0
- package/dist/lib/config.js +1398 -0
- package/dist/lib/context.js +18 -0
- package/dist/lib/errors.js +305 -0
- package/dist/lib/events.js +208 -0
- package/dist/lib/float-text.js +126 -0
- package/dist/lib/format.js +1320 -0
- package/dist/lib/home.js +325 -0
- package/dist/lib/journal.js +122 -0
- package/dist/lib/json-text.js +733 -0
- package/dist/lib/jsonout.js +382 -0
- package/dist/lib/lock.js +516 -0
- package/dist/lib/login-name.js +202 -0
- package/dist/lib/map-limit.js +29 -0
- package/dist/lib/mkdir-parents.js +90 -0
- package/dist/lib/mongo-kernel.js +67 -0
- package/dist/lib/monitoring.js +492 -0
- package/dist/lib/platform-name.js +59 -0
- package/dist/lib/presets/common.js +390 -0
- package/dist/lib/presets/composite.js +326 -0
- package/dist/lib/presets/e2ee.js +143 -0
- package/dist/lib/presets/email.js +172 -0
- package/dist/lib/presets/guides.js +27 -0
- package/dist/lib/presets/index.js +490 -0
- package/dist/lib/presets/keycloak.js +369 -0
- package/dist/lib/presets/ldap.js +1285 -0
- package/dist/lib/presets/livechat.js +220 -0
- package/dist/lib/presets/multi-instance.js +124 -0
- package/dist/lib/presets/oidc.js +161 -0
- package/dist/lib/presets/public.js +496 -0
- package/dist/lib/presets/registry.js +64 -0
- package/dist/lib/presets/s3-minio.js +300 -0
- package/dist/lib/presets/saml.js +149 -0
- package/dist/lib/presets/scenario.js +51 -0
- package/dist/lib/presets/types.js +86 -0
- package/dist/lib/presets/voice-pbx.js +320 -0
- package/dist/lib/presets/voice.js +345 -0
- package/dist/lib/presets/webhooks.js +182 -0
- package/dist/lib/redact.js +106 -0
- package/dist/lib/seed-options.js +68 -0
- package/dist/lib/seed-profiles.js +59 -0
- package/dist/lib/targz.js +1383 -0
- package/dist/lib/teammode.js +25 -0
- package/dist/lib/tempdir.js +162 -0
- package/dist/lib/unicode-tables.js +2335 -0
- package/dist/lib/version-spec.js +357 -0
- package/dist/lib/versions.js +463 -0
- package/dist/lib/yaml-dump.js +1361 -0
- package/dist/perf/baseline.js +168 -0
- package/dist/perf/constrain.js +296 -0
- package/dist/perf/k6.js +235 -0
- package/dist/perf/mongoprof.js +171 -0
- package/dist/perf/rcmetrics.js +178 -0
- package/dist/perf/report.js +386 -0
- package/dist/perf/resources.js +224 -0
- package/dist/perf/slo.js +111 -0
- package/dist/perf/timeline.js +187 -0
- package/dist/perf/timings.js +85 -0
- package/dist/perf/verdict.js +201 -0
- package/dist/seams/aws-cli.js +126 -0
- package/dist/seams/docker-cli.js +280 -0
- package/dist/seams/exec.js +861 -0
- package/dist/seams/fs/lock.js +528 -0
- package/dist/seams/kubectl.js +83 -0
- package/dist/seams/rc-http.js +921 -0
- package/dist/seed/apply.js +190 -0
- package/dist/seed/assets.js +76 -0
- package/dist/seed/check.js +391 -0
- package/dist/seed/client.js +172 -0
- package/dist/seed/executor.js +726 -0
- package/dist/seed/history.js +281 -0
- package/dist/seed/kinds.js +91 -0
- package/dist/seed/plan.js +432 -0
- package/dist/seed/receipt.js +339 -0
- package/dist/seed/repairs.js +75 -0
- package/dist/seed/verification.js +363 -0
- package/dist/seed/wording.js +248 -0
- package/dist/web/app.js +326 -0
- package/dist/web/jobs.js +510 -0
- package/dist/web/route-deps.js +211 -0
- package/dist/web/route-table.js +213 -0
- package/dist/web/routes/backup.js +244 -0
- package/dist/web/routes/clusters.js +303 -0
- package/dist/web/routes/data.js +187 -0
- package/dist/web/routes/edge.js +82 -0
- package/dist/web/routes/index.js +63 -0
- package/dist/web/routes/jobs.js +95 -0
- package/dist/web/routes/logs.js +297 -0
- package/dist/web/routes/meta.js +191 -0
- package/dist/web/routes/people.js +151 -0
- package/dist/web/routes/perf.js +95 -0
- package/dist/web/routes/repros.js +550 -0
- package/dist/web/routes/session.js +361 -0
- package/dist/web/routes/spa.js +198 -0
- package/dist/web/security.js +475 -0
- package/dist/web/signin.js +246 -0
- package/package.json +67 -32
- package/.eslintrc +0 -94
- package/.swcrc +0 -18
- package/dist/bin.js +0 -3
- package/dist/cli.js +0 -184
- package/dist/commands/createBranch.js +0 -192
- package/src/bin.js +0 -4
- package/src/cli.ts +0 -25
- package/src/commands/createBranch.ts +0 -25
- package/src-old/logs.js +0 -323
- package/src-old/md.js +0 -191
- package/src-old/release-table.js +0 -60
- package/src-old/set-version.js +0 -614
- package/src-old/utils.js +0 -15
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.SEPARATOR = void 0;
|
|
37
|
+
exports.compositeName = compositeName;
|
|
38
|
+
exports.presetsLabel = presetsLabel;
|
|
39
|
+
exports.qualifiedParams = qualifiedParams;
|
|
40
|
+
exports.namesOf = namesOf;
|
|
41
|
+
exports.composePresets = composePresets;
|
|
42
|
+
/**
|
|
43
|
+
* Several presets in one workspace: `--preset ldap --preset email`.
|
|
44
|
+
*
|
|
45
|
+
* PURE AND SYNCHRONOUS. It takes presets already resolved for one runtime, each with its own
|
|
46
|
+
* params, and returns one Preset that Compose and the Kubernetes adapters build exactly as they
|
|
47
|
+
* build a single one. Nothing downstream has to know there were several.
|
|
48
|
+
*
|
|
49
|
+
* ORDER NEVER DECIDES. The inputs are sorted by name before anything is merged, and every
|
|
50
|
+
* collision is either resolvable by a rule that does not look at order, or refused naming both
|
|
51
|
+
* presets and the colliding item. The rules:
|
|
52
|
+
*
|
|
53
|
+
* - env: a preset may mark a value SOFT (`softEnv`): a default it sets only because of what
|
|
54
|
+
* the workspace lacks, such as email 2FA off because there is no mail server. A hard value
|
|
55
|
+
* beats a soft one; two hard (or two soft) values that differ are refused unless the user
|
|
56
|
+
* names the key with `--env` or `--setting`, which then decides. User YAML presets are hard.
|
|
57
|
+
* - services, files, ports, post-ready actions and Kubernetes objects are unions, refused on
|
|
58
|
+
* a name both presets claim. The Rocket.Chat patch is deep-merged, refused on a leaf both
|
|
59
|
+
* set differently. `extra` likewise.
|
|
60
|
+
* - notes are concatenated; `requiresLicense` is OR'd; `default` is the identity.
|
|
61
|
+
*
|
|
62
|
+
* One preset in (after dropping `default`) is that preset UNCHANGED, so every single-preset
|
|
63
|
+
* workspace builds byte-identically to before.
|
|
64
|
+
*/
|
|
65
|
+
const YAML = __importStar(require("yaml"));
|
|
66
|
+
const errors_1 = require("../errors");
|
|
67
|
+
const redact_1 = require("../redact");
|
|
68
|
+
const types_1 = require("./types");
|
|
69
|
+
/** Joins a composite's names, sorted, into its one `preset` string. Never a valid name char. */
|
|
70
|
+
exports.SEPARATOR = '+';
|
|
71
|
+
/** Presets that each bring a Keycloak of their own: one per workspace until it is shared. */
|
|
72
|
+
const ONE_SSO = ['oidc', 'saml'];
|
|
73
|
+
/** The canonical `preset` string for a set of names: sorted, deduplicated, `default` dropped. */
|
|
74
|
+
function compositeName(names) {
|
|
75
|
+
// Each name split on `+` first: `--preset ldap+email` is one token, and it was kept as
|
|
76
|
+
// typed -- a second workspace for the same set, and a Kubernetes re-up spelled
|
|
77
|
+
// `--preset email --preset ldap` refused as "a different set".
|
|
78
|
+
const parts = [...new Set(names.flatMap((name) => name.split(exports.SEPARATOR)))]
|
|
79
|
+
.filter((name) => name !== '' && name !== 'default')
|
|
80
|
+
.sort();
|
|
81
|
+
return parts.length === 0 ? 'default' : parts.join(exports.SEPARATOR);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The presets a `preset` string asks for, as a person reads them: every one of the set, and
|
|
85
|
+
* not `multi-instance`, which is how Compose builds that deployment (`--deployment
|
|
86
|
+
* multi-instance`), not a preset. A workspace that is the deployment alone keeps its name.
|
|
87
|
+
*/
|
|
88
|
+
function presetsLabel(preset) {
|
|
89
|
+
const asked = namesOf(preset).filter((name) => name !== 'multi-instance');
|
|
90
|
+
return compositeName(asked.length > 0 ? asked : namesOf(preset));
|
|
91
|
+
}
|
|
92
|
+
/** `{ldap: {users: 5}}` as the `--set` keys that say it: `{'ldap.users': 5}`. */
|
|
93
|
+
function qualifiedParams(byPreset) {
|
|
94
|
+
const out = {};
|
|
95
|
+
for (const [name, params] of Object.entries(byPreset)) {
|
|
96
|
+
if (params === null || typeof params !== 'object' || Array.isArray(params))
|
|
97
|
+
continue;
|
|
98
|
+
for (const [key, value] of Object.entries(params))
|
|
99
|
+
out[`${name}.${key}`] = value;
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
/** The names a canonical `preset` string stands for. */
|
|
104
|
+
function namesOf(preset) {
|
|
105
|
+
return preset === '' ? ['default'] : preset.split(exports.SEPARATOR);
|
|
106
|
+
}
|
|
107
|
+
function refuse(message) {
|
|
108
|
+
throw new errors_1.ValidationError(`these presets cannot be combined: ${message}`);
|
|
109
|
+
}
|
|
110
|
+
function same(a, b) {
|
|
111
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
112
|
+
}
|
|
113
|
+
/** Record `key` for `owner`, refusing it when another preset already claimed it. */
|
|
114
|
+
function claim(owners, key, owner, what, equal = false) {
|
|
115
|
+
const first = owners.get(key);
|
|
116
|
+
if (first === undefined) {
|
|
117
|
+
owners.set(key, owner);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
if (equal)
|
|
121
|
+
return false;
|
|
122
|
+
return refuse(`'${first}' and '${owner}' both define ${what} ${JSON.stringify(key)}`);
|
|
123
|
+
}
|
|
124
|
+
function isBag(value) {
|
|
125
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
126
|
+
}
|
|
127
|
+
/** Merge `from` into `into`, refusing a leaf two presets set differently. */
|
|
128
|
+
function mergeStrict(into, from, owners, owner, path) {
|
|
129
|
+
for (const [key, value] of Object.entries(from)) {
|
|
130
|
+
const at = path === '' ? key : `${path}.${key}`;
|
|
131
|
+
const there = into[key];
|
|
132
|
+
if (isBag(there) && isBag(value)) {
|
|
133
|
+
mergeStrict(there, value, owners, owner, at);
|
|
134
|
+
}
|
|
135
|
+
else if (there === undefined) {
|
|
136
|
+
into[key] = structuredClone(value);
|
|
137
|
+
owners.set(at, owner);
|
|
138
|
+
}
|
|
139
|
+
else if (!same(there, value)) {
|
|
140
|
+
refuse(`'${owners.get(at) ?? '?'}' and '${owner}' set Rocket.Chat's ${JSON.stringify(at)} ` +
|
|
141
|
+
'differently');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/** `Kind/name` of every object a Kubernetes manifest holds. */
|
|
146
|
+
function objectsOf(manifest) {
|
|
147
|
+
return YAML.parseAllDocuments(manifest, { uniqueKeys: false })
|
|
148
|
+
.map((doc) => doc.toJS())
|
|
149
|
+
.filter(isBag)
|
|
150
|
+
.map((object) => {
|
|
151
|
+
const meta = isBag(object.metadata) ? object.metadata : {};
|
|
152
|
+
return `${String(object.kind ?? '')}/${String(meta.name ?? '')}`;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/** The env map, by the soft/hard rule; `overridden` keys are left to the user's own value. */
|
|
156
|
+
function mergeEnv(parts, overridden) {
|
|
157
|
+
const byKey = new Map();
|
|
158
|
+
for (const preset of parts) {
|
|
159
|
+
for (const [key, value] of Object.entries(preset.env)) {
|
|
160
|
+
const entries = byKey.get(key) ?? [];
|
|
161
|
+
entries.push({ preset: preset.name, value, soft: preset.softEnv?.includes(key) === true });
|
|
162
|
+
byKey.set(key, entries);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const env = {};
|
|
166
|
+
const soft = [];
|
|
167
|
+
for (const [key, entries] of byKey) {
|
|
168
|
+
const hard = entries.filter((entry) => !entry.soft);
|
|
169
|
+
const pool = hard.length > 0 ? hard : entries;
|
|
170
|
+
if (new Set(pool.map((entry) => entry.value)).size === 1) {
|
|
171
|
+
env[key] = pool[0].value;
|
|
172
|
+
if (hard.length === 0)
|
|
173
|
+
soft.push(key);
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (overridden.has(key))
|
|
177
|
+
continue;
|
|
178
|
+
const setting = key.startsWith('OVERWRITE_SETTING_')
|
|
179
|
+
? `--setting ${key.slice('OVERWRITE_SETTING_'.length)}=<value>`
|
|
180
|
+
: `--env ${key}=<value>`;
|
|
181
|
+
refuse(`${pool.map((entry) => `'${entry.preset}' sets ${key}=${(0, redact_1.redactEnv)(key, entry.value)}`).join(', ')}. ` +
|
|
182
|
+
`Say which with ${setting}.`);
|
|
183
|
+
}
|
|
184
|
+
return [env, soft];
|
|
185
|
+
}
|
|
186
|
+
/** Notes only a combination needs, keyed by the presets that make it. */
|
|
187
|
+
const COMBINED_NOTES = [
|
|
188
|
+
[
|
|
189
|
+
['email', 'ldap'],
|
|
190
|
+
[
|
|
191
|
+
// `info` wraps a first line at 78 columns and prints a continuation as given.
|
|
192
|
+
"LDAP + email: email two-factor is ON, and Rocket.Chat marks LDAP users' emails",
|
|
193
|
+
' as verified, so an LDAP login asks for a code: read it in Mailpit.',
|
|
194
|
+
],
|
|
195
|
+
],
|
|
196
|
+
[
|
|
197
|
+
['ldap', 'saml'],
|
|
198
|
+
[
|
|
199
|
+
'LDAP + SAML: two separate user stores. Directory users are user1..N; Keycloak',
|
|
200
|
+
' users are sso-user1..N (sso-userN@example.com), so SAML never merges into',
|
|
201
|
+
' an LDAP account.',
|
|
202
|
+
],
|
|
203
|
+
],
|
|
204
|
+
[
|
|
205
|
+
['ldap', 'oidc'],
|
|
206
|
+
[
|
|
207
|
+
'LDAP + OIDC: two separate user stores. Directory users are user1..N; Keycloak',
|
|
208
|
+
' users are sso-user1..N (sso-userN@example.com), so OIDC never collides with',
|
|
209
|
+
' an LDAP account.',
|
|
210
|
+
],
|
|
211
|
+
],
|
|
212
|
+
];
|
|
213
|
+
/**
|
|
214
|
+
* One Preset from several, or a refusal naming both presets and what they both claim.
|
|
215
|
+
*
|
|
216
|
+
* `overridden` names the env keys the user sets with `--env`/`--setting`: a conflict on one of
|
|
217
|
+
* those is theirs to decide, so it is left out here and their value is applied over the top.
|
|
218
|
+
*/
|
|
219
|
+
function composePresets(presets, overridden = new Set()) {
|
|
220
|
+
const byName = new Map(presets.map((preset) => [preset.name, preset]));
|
|
221
|
+
const parts = [...byName.values()]
|
|
222
|
+
.filter((preset) => preset.name !== 'default')
|
|
223
|
+
.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
224
|
+
if (parts.length === 0)
|
|
225
|
+
return presets[0] ?? (0, types_1.emptyPreset)('default');
|
|
226
|
+
if (parts.length === 1)
|
|
227
|
+
return parts[0];
|
|
228
|
+
const names = parts.map((preset) => preset.name);
|
|
229
|
+
if (ONE_SSO.every((name) => names.includes(name))) {
|
|
230
|
+
refuse("'oidc' and 'saml' each run their own Keycloak; use one SSO preset per workspace " +
|
|
231
|
+
'(a shared Keycloak is not built yet)');
|
|
232
|
+
}
|
|
233
|
+
const out = (0, types_1.emptyPreset)(names.join(exports.SEPARATOR));
|
|
234
|
+
out.source = 'composite';
|
|
235
|
+
out.description = parts.map((preset) => preset.description).join(' + ');
|
|
236
|
+
[out.env, out.softEnv] = mergeEnv(parts, overridden);
|
|
237
|
+
const services = new Map();
|
|
238
|
+
const files = new Map();
|
|
239
|
+
const volumes = new Map();
|
|
240
|
+
const ports = new Map();
|
|
241
|
+
const actions = new Map();
|
|
242
|
+
const objects = new Map();
|
|
243
|
+
const patch = new Map();
|
|
244
|
+
const extra = new Map();
|
|
245
|
+
for (const preset of parts) {
|
|
246
|
+
const owner = preset.name;
|
|
247
|
+
for (const [name, service] of Object.entries(preset.services)) {
|
|
248
|
+
claim(services, name, owner, 'the service');
|
|
249
|
+
out.services[name] = structuredClone(service);
|
|
250
|
+
}
|
|
251
|
+
for (const [file, body] of preset.files) {
|
|
252
|
+
claim(files, file, owner, 'the file');
|
|
253
|
+
out.files.push([file, body]);
|
|
254
|
+
}
|
|
255
|
+
if (preset.keepFiles !== undefined) {
|
|
256
|
+
out.keepFiles = [...(out.keepFiles ?? []), ...preset.keepFiles];
|
|
257
|
+
}
|
|
258
|
+
for (const [name, volume] of Object.entries(preset.volumes)) {
|
|
259
|
+
const owned = volumes.get(name);
|
|
260
|
+
if (owned !== undefined && !same(out.volumes[name], volume)) {
|
|
261
|
+
refuse(`'${owned}' and '${owner}' both define the volume ${JSON.stringify(name)}`);
|
|
262
|
+
}
|
|
263
|
+
volumes.set(name, owner);
|
|
264
|
+
out.volumes[name] = structuredClone(volume);
|
|
265
|
+
}
|
|
266
|
+
for (const port of preset.ports) {
|
|
267
|
+
if (claim(ports, String(port), owner, 'the host port'))
|
|
268
|
+
out.ports.push(port);
|
|
269
|
+
}
|
|
270
|
+
for (const action of preset.postReady) {
|
|
271
|
+
claim(actions, `${String(action.action)} ${String(action.service ?? '')}`.trim(), owner, 'the post-ready action');
|
|
272
|
+
out.postReady.push(structuredClone(action));
|
|
273
|
+
}
|
|
274
|
+
for (const manifest of preset.kubernetesManifests) {
|
|
275
|
+
for (const object of objectsOf(manifest))
|
|
276
|
+
claim(objects, object, owner, 'the Kubernetes object');
|
|
277
|
+
out.kubernetesManifests.push(manifest);
|
|
278
|
+
}
|
|
279
|
+
mergeStrict(out.rocketchat, preset.rocketchat, patch, owner, '');
|
|
280
|
+
for (const [key, value] of Object.entries(preset.extra)) {
|
|
281
|
+
const owned = extra.get(key);
|
|
282
|
+
if (owned !== undefined && !same(out.extra[key], value)) {
|
|
283
|
+
refuse(`'${owned}' and '${owner}' both record ${JSON.stringify(key)}`);
|
|
284
|
+
}
|
|
285
|
+
extra.set(key, owner);
|
|
286
|
+
out.extra[key] = structuredClone(value);
|
|
287
|
+
}
|
|
288
|
+
for (const dependency of preset.dependsOn) {
|
|
289
|
+
if (!out.dependsOn.includes(dependency))
|
|
290
|
+
out.dependsOn.push(dependency);
|
|
291
|
+
}
|
|
292
|
+
for (const [key, help] of Object.entries(preset.paramsHelp)) {
|
|
293
|
+
out.paramsHelp[`${owner}.${key}`] = help;
|
|
294
|
+
}
|
|
295
|
+
for (const [old, now] of Object.entries(preset.paramAliases)) {
|
|
296
|
+
out.paramAliases[`${owner}.${old}`] = `${owner}.${now}`;
|
|
297
|
+
}
|
|
298
|
+
out.guides.push(...preset.guides.map((one) => structuredClone(one)));
|
|
299
|
+
out.notes.push(...preset.notes);
|
|
300
|
+
out.requiresLicense || (out.requiresLicense = preset.requiresLicense);
|
|
301
|
+
}
|
|
302
|
+
const one = (field, values) => {
|
|
303
|
+
const set = [...new Set(values.filter((value) => value !== ''))];
|
|
304
|
+
if (set.length > 1)
|
|
305
|
+
refuse(`they disagree on ${field}: ${set.join(' vs ')}`);
|
|
306
|
+
return set[0] ?? '';
|
|
307
|
+
};
|
|
308
|
+
out.entryService = one('the entry service', parts.map((preset) => preset.entryService));
|
|
309
|
+
out.topology = one('the deployment type', parts.map((preset) => preset.topology));
|
|
310
|
+
out.instances = Number(one('the instance count', parts.map((preset) => (preset.instances > 1 ? String(preset.instances) : ''))) || 1);
|
|
311
|
+
out.scenario = parts
|
|
312
|
+
.map((preset) => preset.scenario)
|
|
313
|
+
.filter((scenario) => scenario !== '')
|
|
314
|
+
.join(exports.SEPARATOR);
|
|
315
|
+
out.scenarioParams = Object.fromEntries(parts.map((preset) => [preset.name, preset.scenarioParams]));
|
|
316
|
+
for (const [needs, note] of COMBINED_NOTES) {
|
|
317
|
+
if (!needs.every((name) => names.includes(name)))
|
|
318
|
+
continue;
|
|
319
|
+
out.notes.push(...note);
|
|
320
|
+
// The card says it under the first preset the combination names.
|
|
321
|
+
const owner = out.guides.find((one) => one.name === needs[0]);
|
|
322
|
+
if (owner !== undefined)
|
|
323
|
+
owner.know.push(note.map((line) => line.trim()).join(' '));
|
|
324
|
+
}
|
|
325
|
+
return out;
|
|
326
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.E2EE_TEST_USERS = void 0;
|
|
4
|
+
exports.refuseEnforcedBefore880 = refuseEnforcedBefore880;
|
|
5
|
+
exports.scenario = scenario;
|
|
6
|
+
exports.build = build;
|
|
7
|
+
/**
|
|
8
|
+
* Dynamic `e2ee` preset: Rocket.Chat's own end-to-end encryption, switched on, and test users.
|
|
9
|
+
*
|
|
10
|
+
* Encryption happens in the browser. Each user's keys are made, and their encryption password
|
|
11
|
+
* shown, the first time they sign in with E2EE on, so this preset sets only the server settings
|
|
12
|
+
* (Workspace > Settings > End-to-end encryption) and creates users to sign in as. Houston never
|
|
13
|
+
* holds a key or an encryption password; a backup, restore or upgrade carries the keys as the
|
|
14
|
+
* ordinary database data they are.
|
|
15
|
+
*
|
|
16
|
+
* Parameters (via `--set`):
|
|
17
|
+
* policy optional|default|enforced (default optional).
|
|
18
|
+
* files on|off (default on).
|
|
19
|
+
* allow_unencrypted on|off (default off).
|
|
20
|
+
* users on|off (default on).
|
|
21
|
+
*/
|
|
22
|
+
const errors_1 = require("../errors");
|
|
23
|
+
const version_spec_1 = require("../version-spec");
|
|
24
|
+
const guides_1 = require("./guides");
|
|
25
|
+
const common_1 = require("./common");
|
|
26
|
+
const registry_1 = require("./registry");
|
|
27
|
+
const scenario_1 = require("./scenario");
|
|
28
|
+
const types_1 = require("./types");
|
|
29
|
+
/** Created by the `e2ee_users` post-ready action, each with its username as its password. */
|
|
30
|
+
exports.E2EE_TEST_USERS = Object.freeze([
|
|
31
|
+
'e2e-alice',
|
|
32
|
+
'e2e-bob',
|
|
33
|
+
'e2e-carol',
|
|
34
|
+
]);
|
|
35
|
+
const FORCE = 'OVERWRITE_SETTING_E2E_Force_Encryption_For_Private_Rooms';
|
|
36
|
+
const PARAMS_HELP = Object.freeze({
|
|
37
|
+
policy: 'optional|default|enforced (default optional); default encrypts new DMs and private rooms, enforced also refuses unencrypted new private rooms (Rocket.Chat 8.8.0 or later)',
|
|
38
|
+
files: 'on|off (default on); encrypt files sent in encrypted rooms',
|
|
39
|
+
allow_unencrypted: 'on|off (default off); accept plaintext messages in encrypted rooms',
|
|
40
|
+
users: `on|off (default on); create ${exports.E2EE_TEST_USERS.join(', ')}, each with its username as its password`,
|
|
41
|
+
});
|
|
42
|
+
function resolveIntent(params) {
|
|
43
|
+
// choiceParam's first choice is the default.
|
|
44
|
+
const on = (key, fallback) => (0, common_1.choiceParam)(params, key, fallback === 'on' ? ['on', 'off'] : ['off', 'on']) === 'on';
|
|
45
|
+
return {
|
|
46
|
+
policy: (0, common_1.choiceParam)(params, 'policy', ['optional', 'default', 'enforced']),
|
|
47
|
+
files: on('files', 'on'),
|
|
48
|
+
allow_unencrypted: on('allow_unencrypted', 'off'),
|
|
49
|
+
users: on('users', 'on'),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function adapter(intent) {
|
|
53
|
+
const encryptNew = String(intent.policy !== 'optional');
|
|
54
|
+
return {
|
|
55
|
+
...(0, types_1.emptyPreset)('e2ee'),
|
|
56
|
+
description: "Rocket.Chat's end-to-end encryption switched on, with test users; a browser on another computer needs the workspace over HTTPS. Each user's keys are made in their own browser.",
|
|
57
|
+
source: 'built-in (scenario)',
|
|
58
|
+
scenario: 'e2ee',
|
|
59
|
+
scenarioParams: { ...intent },
|
|
60
|
+
paramsHelp: { ...PARAMS_HELP },
|
|
61
|
+
env: {
|
|
62
|
+
OVERWRITE_SETTING_E2E_Enable: 'true',
|
|
63
|
+
OVERWRITE_SETTING_E2E_Enabled_Default_DirectRooms: encryptNew,
|
|
64
|
+
OVERWRITE_SETTING_E2E_Enabled_Default_PrivateRooms: encryptNew,
|
|
65
|
+
...(intent.policy === 'enforced' ? { [FORCE]: 'true' } : {}),
|
|
66
|
+
OVERWRITE_SETTING_E2E_Enable_Encrypt_Files: String(intent.files),
|
|
67
|
+
OVERWRITE_SETTING_E2E_Allow_Unencrypted_Messages: String(intent.allow_unencrypted),
|
|
68
|
+
// The test users' emails are verified, and a repro has no mail server to send them a
|
|
69
|
+
// code; composed with `email`, Mailpit catches it and email's value wins.
|
|
70
|
+
...(intent.users ? { [common_1.EMAIL_2FA]: 'false' } : {}),
|
|
71
|
+
},
|
|
72
|
+
softEnv: intent.users ? [common_1.EMAIL_2FA] : [],
|
|
73
|
+
postReady: intent.users ? [{ action: 'e2ee_users' }] : [],
|
|
74
|
+
guides: [
|
|
75
|
+
(0, guides_1.guide)('e2ee', {
|
|
76
|
+
summary: `End-to-end encryption switched on${intent.users ? ', with test users' : ''}; policy ${intent.policy}.`,
|
|
77
|
+
signIn: intent.users ? exports.E2EE_TEST_USERS.map((user) => [user, user, '']) : [],
|
|
78
|
+
steps: [
|
|
79
|
+
'Open Rocket.Chat over HTTPS, or at localhost in a browser on the machine running houston.',
|
|
80
|
+
'Sign in as two users, in separate browser profiles.',
|
|
81
|
+
'Save the encryption password Rocket.Chat shows once, at the first sign-in.',
|
|
82
|
+
],
|
|
83
|
+
know: [
|
|
84
|
+
{
|
|
85
|
+
optional: 'Encryption policy: optional. People choose it for each DM or private room.',
|
|
86
|
+
default: 'Encryption policy: default. New DMs and private rooms start encrypted; people may turn it off.',
|
|
87
|
+
enforced: 'Encryption policy: enforced. Private rooms created from now on must be encrypted; federated rooms are exempt.',
|
|
88
|
+
}[intent.policy] ?? `Encryption policy: ${intent.policy}.`,
|
|
89
|
+
'Keys are made in the browser at the first sign-in; a browser encrypts only on a secure origin.',
|
|
90
|
+
intent.files ? '' : 'Files are not encrypted (files=off).',
|
|
91
|
+
],
|
|
92
|
+
}),
|
|
93
|
+
],
|
|
94
|
+
notes: [
|
|
95
|
+
`End-to-end encryption is on (policy=${intent.policy}). A user's keys are made in their browser the first time they sign in, and Rocket.Chat shows their encryption password once; save it.`,
|
|
96
|
+
...(intent.users
|
|
97
|
+
? [
|
|
98
|
+
`Test users: ${exports.E2EE_TEST_USERS.join(', ')}, each with its username as its password. Sign in as two of them in separate browser profiles.`,
|
|
99
|
+
]
|
|
100
|
+
: []),
|
|
101
|
+
'Open Rocket.Chat over HTTPS, or at localhost in a browser on the machine running houston: a browser encrypts only on a secure origin.',
|
|
102
|
+
...(intent.policy === 'enforced'
|
|
103
|
+
? ['Enforced applies to private rooms created from now on; federated rooms are exempt.']
|
|
104
|
+
: []),
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* `policy=enforced` sets a setting Rocket.Chat added in 8.8.0. An older server ignores it and
|
|
110
|
+
* enforces nothing, so the workspace would not be what was asked for: refused before anything
|
|
111
|
+
* is created. A version that is not a number (a build tag) is let through, unknowable here.
|
|
112
|
+
*/
|
|
113
|
+
function refuseEnforcedBefore880(pre, rcVersion) {
|
|
114
|
+
if (pre.env[FORCE] !== 'true')
|
|
115
|
+
return;
|
|
116
|
+
let release;
|
|
117
|
+
try {
|
|
118
|
+
release = (0, version_spec_1.parseVersion)(rcVersion).release;
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const [major = 0, minor = 0] = release;
|
|
124
|
+
if (major > 8 || (major === 8 && minor >= 8))
|
|
125
|
+
return;
|
|
126
|
+
throw new errors_1.ValidationError(`e2ee policy=enforced needs Rocket.Chat 8.8.0 or later; ${rcVersion} would not enforce it. ` +
|
|
127
|
+
'Choose a newer version, or policy=default.');
|
|
128
|
+
}
|
|
129
|
+
const SCENARIO = new scenario_1.Scenario({
|
|
130
|
+
name: 'e2ee',
|
|
131
|
+
paramsHelp: PARAMS_HELP,
|
|
132
|
+
resolveIntent,
|
|
133
|
+
// Settings and REST-created users: the same on both runtimes, monolith or microservices.
|
|
134
|
+
adapters: { docker: adapter, kubernetes: adapter },
|
|
135
|
+
});
|
|
136
|
+
function scenario() {
|
|
137
|
+
return SCENARIO;
|
|
138
|
+
}
|
|
139
|
+
function build(params) {
|
|
140
|
+
return SCENARIO.resolve(params, 'docker');
|
|
141
|
+
}
|
|
142
|
+
(0, registry_1.register)('e2ee', build);
|
|
143
|
+
(0, registry_1.registerScenario)('e2ee', SCENARIO);
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.build = build;
|
|
37
|
+
/**
|
|
38
|
+
* Dynamic `email` preset: a Mailpit mailcatcher wired to Rocket.Chat's SMTP.
|
|
39
|
+
*
|
|
40
|
+
* Mailpit is a sink, not a relay: it accepts all outgoing mail on SMTP :1025 and shows it in
|
|
41
|
+
* a web UI -- nothing leaves the machine, so you can read a password reset link, invite,
|
|
42
|
+
* verification mail or 2FA code seconds after RC sends it, for ANY user, without owning a
|
|
43
|
+
* real mailbox.
|
|
44
|
+
*
|
|
45
|
+
* Email-2FA is enabled globally, but RC only applies it to users with a VERIFIED email --
|
|
46
|
+
* seeded users (alice/alice, ...) are verified, so they get the full OTP flow (code lands
|
|
47
|
+
* in Mailpit); the admin is not verified, so it logs in plain until you verify it.
|
|
48
|
+
* houston's own admin logins keep working either way: the preset records Mailpit's URL in
|
|
49
|
+
* the repro metadata (`Preset.extra`) and `rcapi.login` fetches a required code from
|
|
50
|
+
* Mailpit automatically.
|
|
51
|
+
*
|
|
52
|
+
* Parameters (via `--set`):
|
|
53
|
+
* verification require email verification on new accounts (default false).
|
|
54
|
+
*/
|
|
55
|
+
const config = __importStar(require("../config"));
|
|
56
|
+
const guides_1 = require("./guides");
|
|
57
|
+
const common_1 = require("./common");
|
|
58
|
+
const registry_1 = require("./registry");
|
|
59
|
+
const types_1 = require("./types");
|
|
60
|
+
/** Mailpit's web UI + API inside its container; SMTP :1025 stays compose-internal. */
|
|
61
|
+
const MAILPIT_WEB_PORT = 8025;
|
|
62
|
+
const SMTP_PORT = 1025;
|
|
63
|
+
const FROM = 'rocketchat@example.com';
|
|
64
|
+
const IMAGE = 'docker.io/axllent/mailpit:v1.20';
|
|
65
|
+
/** Compose service for the SMTP sink and its browser inbox, published on `webPort`. */
|
|
66
|
+
function mailpitService(webPort) {
|
|
67
|
+
return {
|
|
68
|
+
mailpit: {
|
|
69
|
+
// Multi-arch (amd64/arm64) -- native on Apple Silicon.
|
|
70
|
+
image: IMAGE,
|
|
71
|
+
restart: 'unless-stopped',
|
|
72
|
+
environment: {
|
|
73
|
+
// Accept any/plain SMTP so RC connects without credentials.
|
|
74
|
+
MP_SMTP_AUTH_ACCEPT_ANY: '1',
|
|
75
|
+
MP_SMTP_AUTH_ALLOW_INSECURE: '1',
|
|
76
|
+
},
|
|
77
|
+
ports: [`${String(webPort)}:${String(MAILPIT_WEB_PORT)}`],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** Rocket.Chat settings that deliver all mail to Mailpit. */
|
|
82
|
+
function smtpSettings(verification) {
|
|
83
|
+
const env = {
|
|
84
|
+
// Wire RC's SMTP at Mailpit -- plain SMTP, no TLS, no auth.
|
|
85
|
+
OVERWRITE_SETTING_SMTP_Host: 'mailpit',
|
|
86
|
+
OVERWRITE_SETTING_SMTP_Port: String(SMTP_PORT),
|
|
87
|
+
OVERWRITE_SETTING_SMTP_Protocol: 'smtp',
|
|
88
|
+
OVERWRITE_SETTING_SMTP_IgnoreTLS: 'true',
|
|
89
|
+
OVERWRITE_SETTING_SMTP_Username: '',
|
|
90
|
+
OVERWRITE_SETTING_SMTP_Password: '',
|
|
91
|
+
OVERWRITE_SETTING_From_Email: FROM,
|
|
92
|
+
OVERWRITE_SETTING_Accounts_TwoFactorAuthentication_By_Email_Enabled: 'true',
|
|
93
|
+
};
|
|
94
|
+
if (verification)
|
|
95
|
+
env.OVERWRITE_SETTING_Accounts_EmailVerification = 'true';
|
|
96
|
+
return env;
|
|
97
|
+
}
|
|
98
|
+
/** The Mailpit workload and both of its in-cluster ports; the inbox forwarded to `webPort`. */
|
|
99
|
+
function mailpitManifests(webPort) {
|
|
100
|
+
return (0, common_1.k8sManifests)({
|
|
101
|
+
name: 'mailpit',
|
|
102
|
+
image: IMAGE,
|
|
103
|
+
ports: [
|
|
104
|
+
[webPort, MAILPIT_WEB_PORT],
|
|
105
|
+
[1025, 1025],
|
|
106
|
+
],
|
|
107
|
+
env: { MP_SMTP_AUTH_ACCEPT_ANY: '1', MP_SMTP_AUTH_ALLOW_INSECURE: '1' },
|
|
108
|
+
// Only the web UI is published to the host; SMTP is reached in-cluster by
|
|
109
|
+
// Rocket.Chat, exactly as it is over the compose network.
|
|
110
|
+
readiness: {
|
|
111
|
+
httpGet: { path: '/', port: MAILPIT_WEB_PORT },
|
|
112
|
+
initialDelaySeconds: 3,
|
|
113
|
+
periodSeconds: 3,
|
|
114
|
+
failureThreshold: 40,
|
|
115
|
+
},
|
|
116
|
+
ui: { mailpit: [webPort, MAILPIT_WEB_PORT] },
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function build(params, ports) {
|
|
120
|
+
const verification = (0, common_1.truthyParam)(params, 'verification');
|
|
121
|
+
const webPort = (0, common_1.presetPort)('email', 0, ports);
|
|
122
|
+
const mailpitUrl = `http://localhost:${String(webPort)}`;
|
|
123
|
+
return {
|
|
124
|
+
...(0, types_1.emptyPreset)('email'),
|
|
125
|
+
description:
|
|
126
|
+
// The GUI's create list shows only the first sentence: it has to say what this is.
|
|
127
|
+
'A web inbox (Mailpit) that catches every email Rocket.Chat sends; nothing is ' +
|
|
128
|
+
'delivered and nothing can be sent in. Password resets, invites, verification, ' +
|
|
129
|
+
'notification and 2FA mail all land there: at <workspace URL>/mailpit/ over HTTPS, ' +
|
|
130
|
+
`otherwise at ${mailpitUrl} on the machine running houston. ` +
|
|
131
|
+
'Pair with --seed for users with verified emails.',
|
|
132
|
+
env: smtpSettings(verification),
|
|
133
|
+
services: mailpitService(webPort),
|
|
134
|
+
dependsOn: ['mailpit'],
|
|
135
|
+
requiresLicense: false,
|
|
136
|
+
source: 'built-in (dynamic)',
|
|
137
|
+
paramsHelp: {
|
|
138
|
+
verification: 'require email verification on new accounts (default false)',
|
|
139
|
+
},
|
|
140
|
+
extra: { [config.EXTRA_MAILPIT_URL]: mailpitUrl },
|
|
141
|
+
ports: [webPort],
|
|
142
|
+
kubernetesManifests: [mailpitManifests(webPort)],
|
|
143
|
+
guides: [
|
|
144
|
+
(0, guides_1.guide)('email', {
|
|
145
|
+
summary: 'Mailpit catches every email Rocket.Chat sends and shows it in a web inbox; it delivers nothing and receives nothing.',
|
|
146
|
+
steps: [
|
|
147
|
+
"Admin → Email → 'Send test email', then open Mailpit.",
|
|
148
|
+
'A seeded user is asked for a sign-in code: read it in Mailpit (one shared inbox; tell users apart by the To column).',
|
|
149
|
+
],
|
|
150
|
+
know: [
|
|
151
|
+
'Email 2FA is on, but enforced only for verified emails: seeded users get the code flow, admin signs in plain.',
|
|
152
|
+
"houston's own token, api and seed calls fetch a required code from Mailpit by themselves.",
|
|
153
|
+
'Seeded users (--seed) are created with verified emails, ready for 2FA.',
|
|
154
|
+
verification
|
|
155
|
+
? 'New accounts must verify their email before they can sign in (verification=true).'
|
|
156
|
+
: '',
|
|
157
|
+
],
|
|
158
|
+
}),
|
|
159
|
+
],
|
|
160
|
+
notes: [
|
|
161
|
+
`Mailpit (EVERY email RC sends, for ALL users, lands here): ${mailpitUrl}`,
|
|
162
|
+
' — one shared inbox; tell users apart by the To: column.',
|
|
163
|
+
"Quick SMTP check: Admin → Email → 'Send test email', then open Mailpit.",
|
|
164
|
+
'Email-2FA is ON globally, but RC only enforces it on VERIFIED emails:',
|
|
165
|
+
' seeded users (alice/…) get the OTP flow (code in Mailpit); admin is',
|
|
166
|
+
" unverified so it logs in plain. houston's own token/api/seed calls",
|
|
167
|
+
' fetch any required code from Mailpit automatically.',
|
|
168
|
+
'Seeded users (--seed) are created with verified emails, ready for 2FA.',
|
|
169
|
+
],
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
(0, registry_1.register)('email', build);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.guide = guide;
|
|
4
|
+
exports.withoutLocalSetup = withoutLocalSetup;
|
|
5
|
+
/** A guide, with the empty parts filled in and blank lines (a conditional that gave '') dropped. */
|
|
6
|
+
function guide(name, parts) {
|
|
7
|
+
const lines = (list) => (list ?? []).filter((line) => line.trim() !== '');
|
|
8
|
+
return {
|
|
9
|
+
name,
|
|
10
|
+
summary: parts.summary ?? '',
|
|
11
|
+
setup: parts.setup ?? null,
|
|
12
|
+
signIn: (parts.signIn ?? []).map(([user, password, where]) => [user, password, where]),
|
|
13
|
+
steps: lines(parts.steps),
|
|
14
|
+
know: lines(parts.know),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** The guides with nothing that needs the reader's own machine: a public URL serves every UI. */
|
|
18
|
+
function withoutLocalSetup(guides) {
|
|
19
|
+
const local = (line) => /hosts entry/iu.test(line);
|
|
20
|
+
return guides.map((one) => ({
|
|
21
|
+
...one,
|
|
22
|
+
setup: null,
|
|
23
|
+
// The steps too: "Add the hosts entry above." outlived the box it pointed at.
|
|
24
|
+
steps: one.steps.filter((line) => !local(line)),
|
|
25
|
+
know: one.know.filter((line) => !local(line)),
|
|
26
|
+
}));
|
|
27
|
+
}
|