@lamalibre/create-lamaste 4.0.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/LICENSE.md +118 -0
- package/README.md +114 -0
- package/bin/create-lamaste.js +15 -0
- package/package.json +54 -0
- package/scripts/bundle-vendor.js +110 -0
- package/scripts/lamaste-cert-info +62 -0
- package/scripts/lamaste-certbot +96 -0
- package/scripts/lamaste-priv +693 -0
- package/src/index.js +646 -0
- package/src/lib/accounts.js +86 -0
- package/src/lib/binaries.js +137 -0
- package/src/lib/cert-help-page.js +160 -0
- package/src/lib/env.js +132 -0
- package/src/lib/http-redirect.js +38 -0
- package/src/lib/ownership.js +231 -0
- package/src/lib/relay-services.js +103 -0
- package/src/lib/secrets.js +19 -0
- package/src/lib/service-config.js +311 -0
- package/src/lib/summary.js +131 -0
- package/src/lib/wrappers.js +63 -0
- package/src/tasks/gatekeeper.js +233 -0
- package/src/tasks/harden.js +293 -0
- package/src/tasks/mtls.js +193 -0
- package/src/tasks/nginx.js +265 -0
- package/src/tasks/node.js +110 -0
- package/src/tasks/panel.js +408 -0
- package/src/tasks/redeploy.js +438 -0
- package/vendor/docs/00-introduction/how-it-works.md +447 -0
- package/vendor/docs/00-introduction/quickstart.md +472 -0
- package/vendor/docs/00-introduction/what-is-lamaste.md +112 -0
- package/vendor/docs/01-concepts/authentication.md +464 -0
- package/vendor/docs/01-concepts/authorization.md +242 -0
- package/vendor/docs/01-concepts/certificates.md +452 -0
- package/vendor/docs/01-concepts/dns-and-domains.md +343 -0
- package/vendor/docs/01-concepts/mtls.md +490 -0
- package/vendor/docs/01-concepts/nginx-reverse-proxy.md +540 -0
- package/vendor/docs/01-concepts/security-model.md +600 -0
- package/vendor/docs/01-concepts/tickets.md +414 -0
- package/vendor/docs/01-concepts/tunneling.md +367 -0
- package/vendor/docs/02-guides/agent-setup.md +194 -0
- package/vendor/docs/02-guides/certificate-management.md +341 -0
- package/vendor/docs/02-guides/cloud-provisioning.md +406 -0
- package/vendor/docs/02-guides/desktop-app-setup.md +226 -0
- package/vendor/docs/02-guides/disaster-recovery.md +464 -0
- package/vendor/docs/02-guides/first-tunnel.md +230 -0
- package/vendor/docs/02-guides/installation.md +393 -0
- package/vendor/docs/02-guides/managing-users.md +255 -0
- package/vendor/docs/02-guides/onboarding.md +244 -0
- package/vendor/docs/02-guides/standalone-plugin-with-tickets.md +375 -0
- package/vendor/docs/02-guides/static-sites.md +364 -0
- package/vendor/docs/03-architecture/e2e-three-vm-sequences.md +457 -0
- package/vendor/docs/03-architecture/installer-flow.md +151 -0
- package/vendor/docs/03-architecture/installer.md +445 -0
- package/vendor/docs/03-architecture/management-flow.md +288 -0
- package/vendor/docs/03-architecture/nginx-configuration.md +830 -0
- package/vendor/docs/03-architecture/onboarding-flow.md +164 -0
- package/vendor/docs/03-architecture/overview.md +541 -0
- package/vendor/docs/03-architecture/panel-client.md +416 -0
- package/vendor/docs/03-architecture/panel-server.md +695 -0
- package/vendor/docs/03-architecture/state-management.md +529 -0
- package/vendor/docs/03-architecture/system-overview.md +167 -0
- package/vendor/docs/04-api-reference/certificates.md +1141 -0
- package/vendor/docs/04-api-reference/gatekeeper.md +592 -0
- package/vendor/docs/04-api-reference/onboarding.md +473 -0
- package/vendor/docs/04-api-reference/overview.md +404 -0
- package/vendor/docs/04-api-reference/services.md +267 -0
- package/vendor/docs/04-api-reference/settings.md +343 -0
- package/vendor/docs/04-api-reference/sites.md +716 -0
- package/vendor/docs/04-api-reference/system.md +268 -0
- package/vendor/docs/04-api-reference/tickets.md +618 -0
- package/vendor/docs/04-api-reference/tunnels.md +417 -0
- package/vendor/docs/04-api-reference/users.md +333 -0
- package/vendor/docs/05-operations/backup-and-restore.md +342 -0
- package/vendor/docs/05-operations/monitoring.md +285 -0
- package/vendor/docs/05-operations/uninstalling.md +344 -0
- package/vendor/docs/05-operations/upgrades.md +270 -0
- package/vendor/docs/06-reference/config-files.md +1080 -0
- package/vendor/docs/06-reference/glossary.md +528 -0
- package/vendor/docs/06-reference/installer-flags.md +260 -0
- package/vendor/docs/06-reference/ports-and-services.md +244 -0
- package/vendor/docs/06-reference/troubleshooting.md +665 -0
- package/vendor/docs/_index.json +233 -0
- package/vendor/docs/gatekeeper-design.md +953 -0
- package/vendor/docs/package.json +15 -0
- package/vendor/docs/todo/lib-cli-desktop-refactor.md +641 -0
- package/vendor/gatekeeper/dist/boot.d.ts +1 -0
- package/vendor/gatekeeper/dist/boot.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/boot.js +17 -0
- package/vendor/gatekeeper/dist/boot.js.map +1 -0
- package/vendor/gatekeeper/dist/cli/commands/access.d.ts +2 -0
- package/vendor/gatekeeper/dist/cli/commands/access.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/cli/commands/access.js +33 -0
- package/vendor/gatekeeper/dist/cli/commands/access.js.map +1 -0
- package/vendor/gatekeeper/dist/cli/commands/grants.d.ts +2 -0
- package/vendor/gatekeeper/dist/cli/commands/grants.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/cli/commands/grants.js +110 -0
- package/vendor/gatekeeper/dist/cli/commands/grants.js.map +1 -0
- package/vendor/gatekeeper/dist/cli/commands/groups.d.ts +2 -0
- package/vendor/gatekeeper/dist/cli/commands/groups.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/cli/commands/groups.js +98 -0
- package/vendor/gatekeeper/dist/cli/commands/groups.js.map +1 -0
- package/vendor/gatekeeper/dist/cli/index.d.ts +3 -0
- package/vendor/gatekeeper/dist/cli/index.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/cli/index.js +45 -0
- package/vendor/gatekeeper/dist/cli/index.js.map +1 -0
- package/vendor/gatekeeper/dist/index.d.ts +9 -0
- package/vendor/gatekeeper/dist/index.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/index.js +13 -0
- package/vendor/gatekeeper/dist/index.js.map +1 -0
- package/vendor/gatekeeper/dist/lib/authz.d.ts +16 -0
- package/vendor/gatekeeper/dist/lib/authz.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/lib/authz.js +42 -0
- package/vendor/gatekeeper/dist/lib/authz.js.map +1 -0
- package/vendor/gatekeeper/dist/lib/cache-bust.d.ts +15 -0
- package/vendor/gatekeeper/dist/lib/cache-bust.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/lib/cache-bust.js +19 -0
- package/vendor/gatekeeper/dist/lib/cache-bust.js.map +1 -0
- package/vendor/gatekeeper/dist/lib/constants.d.ts +82 -0
- package/vendor/gatekeeper/dist/lib/constants.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/lib/constants.js +79 -0
- package/vendor/gatekeeper/dist/lib/constants.js.map +1 -0
- package/vendor/gatekeeper/dist/lib/grants.d.ts +32 -0
- package/vendor/gatekeeper/dist/lib/grants.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/lib/grants.js +314 -0
- package/vendor/gatekeeper/dist/lib/grants.js.map +1 -0
- package/vendor/gatekeeper/dist/lib/groups.d.ts +10 -0
- package/vendor/gatekeeper/dist/lib/groups.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/lib/groups.js +247 -0
- package/vendor/gatekeeper/dist/lib/groups.js.map +1 -0
- package/vendor/gatekeeper/dist/lib/migration.d.ts +17 -0
- package/vendor/gatekeeper/dist/lib/migration.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/lib/migration.js +79 -0
- package/vendor/gatekeeper/dist/lib/migration.js.map +1 -0
- package/vendor/gatekeeper/dist/lib/migrations/gatekeeper/0001_groups.sql +7 -0
- package/vendor/gatekeeper/dist/lib/migrations/gatekeeper/0002_access_grants.sql +14 -0
- package/vendor/gatekeeper/dist/lib/migrations/gatekeeper/0003_access_request_log.sql +9 -0
- package/vendor/gatekeeper/dist/lib/migrations/migrations/gatekeeper/0001_groups.sql +7 -0
- package/vendor/gatekeeper/dist/lib/migrations/migrations/gatekeeper/0002_access_grants.sql +14 -0
- package/vendor/gatekeeper/dist/lib/migrations/migrations/gatekeeper/0003_access_request_log.sql +9 -0
- package/vendor/gatekeeper/dist/lib/state-db.d.ts +16 -0
- package/vendor/gatekeeper/dist/lib/state-db.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/lib/state-db.js +154 -0
- package/vendor/gatekeeper/dist/lib/state-db.js.map +1 -0
- package/vendor/gatekeeper/dist/lib/templates.d.ts +21 -0
- package/vendor/gatekeeper/dist/lib/templates.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/lib/templates.js +151 -0
- package/vendor/gatekeeper/dist/lib/templates.js.map +1 -0
- package/vendor/gatekeeper/dist/lib/types.d.ts +178 -0
- package/vendor/gatekeeper/dist/lib/types.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/lib/types.js +2 -0
- package/vendor/gatekeeper/dist/lib/types.js.map +1 -0
- package/vendor/gatekeeper/dist/server/index.d.ts +15 -0
- package/vendor/gatekeeper/dist/server/index.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/server/index.js +251 -0
- package/vendor/gatekeeper/dist/server/index.js.map +1 -0
- package/vendor/gatekeeper/dist/server/routes/access-request.d.ts +7 -0
- package/vendor/gatekeeper/dist/server/routes/access-request.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/server/routes/access-request.js +17 -0
- package/vendor/gatekeeper/dist/server/routes/access-request.js.map +1 -0
- package/vendor/gatekeeper/dist/server/routes/authz.d.ts +3 -0
- package/vendor/gatekeeper/dist/server/routes/authz.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/server/routes/authz.js +279 -0
- package/vendor/gatekeeper/dist/server/routes/authz.js.map +1 -0
- package/vendor/gatekeeper/dist/server/routes/diagnostic.d.ts +13 -0
- package/vendor/gatekeeper/dist/server/routes/diagnostic.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/server/routes/diagnostic.js +249 -0
- package/vendor/gatekeeper/dist/server/routes/diagnostic.js.map +1 -0
- package/vendor/gatekeeper/dist/server/routes/grants.d.ts +3 -0
- package/vendor/gatekeeper/dist/server/routes/grants.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/server/routes/grants.js +112 -0
- package/vendor/gatekeeper/dist/server/routes/grants.js.map +1 -0
- package/vendor/gatekeeper/dist/server/routes/groups.d.ts +3 -0
- package/vendor/gatekeeper/dist/server/routes/groups.d.ts.map +1 -0
- package/vendor/gatekeeper/dist/server/routes/groups.js +139 -0
- package/vendor/gatekeeper/dist/server/routes/groups.js.map +1 -0
- package/vendor/gatekeeper/package.json +49 -0
- package/vendor/server/bin/lamaste-server.js +204 -0
- package/vendor/server/package.json +31 -0
- package/vendor/server/src/commands/certs.js +224 -0
- package/vendor/server/src/commands/chisel.js +132 -0
- package/vendor/server/src/commands/logs.js +49 -0
- package/vendor/server/src/commands/plugins.js +321 -0
- package/vendor/server/src/commands/reset-admin.js +478 -0
- package/vendor/server/src/commands/restart.js +94 -0
- package/vendor/server/src/commands/sites.js +257 -0
- package/vendor/server/src/commands/status.js +158 -0
- package/vendor/server/src/commands/tunnels.js +365 -0
- package/vendor/server/src/commands/uninstall.js +326 -0
- package/vendor/server/src/config.js +38 -0
- package/vendor/server/src/exec.js +26 -0
- package/vendor/server/src/logger.js +39 -0
- package/vendor/server/src/ndjson.js +56 -0
- package/vendor/server/src/panel-api.js +85 -0
- package/vendor/server/src/state.js +45 -0
- package/vendor/server-ui/dist/assets/index-B0nWuUyL.js +257 -0
- package/vendor/server-ui/dist/assets/index-BqWWFlTU.css +1 -0
- package/vendor/server-ui/dist/index.html +13 -0
- package/vendor/serverd/package.json +44 -0
- package/vendor/serverd/src/boot.js +13 -0
- package/vendor/serverd/src/index.js +191 -0
- package/vendor/serverd/src/lib/app-error.js +14 -0
- package/vendor/serverd/src/lib/authelia.js +85 -0
- package/vendor/serverd/src/lib/certbot.js +74 -0
- package/vendor/serverd/src/lib/chisel-args.js +6 -0
- package/vendor/serverd/src/lib/chisel-reconcile.js +232 -0
- package/vendor/serverd/src/lib/chisel-runtime.js +46 -0
- package/vendor/serverd/src/lib/chisel-users.js +109 -0
- package/vendor/serverd/src/lib/chisel.js +81 -0
- package/vendor/serverd/src/lib/config.js +190 -0
- package/vendor/serverd/src/lib/constants.js +8 -0
- package/vendor/serverd/src/lib/csr-signing.js +331 -0
- package/vendor/serverd/src/lib/enrollment.js +302 -0
- package/vendor/serverd/src/lib/files.js +19 -0
- package/vendor/serverd/src/lib/gatekeeper-client.js +135 -0
- package/vendor/serverd/src/lib/invite-page.js +281 -0
- package/vendor/serverd/src/lib/ip-utils.js +79 -0
- package/vendor/serverd/src/lib/migrations/state/0001_enrollment_tokens.sql +17 -0
- package/vendor/serverd/src/lib/migrations/state/0002_tickets.sql +70 -0
- package/vendor/serverd/src/lib/migrations/state/0003_plugins.sql +15 -0
- package/vendor/serverd/src/lib/migrations/state/0004_agents.sql +19 -0
- package/vendor/serverd/src/lib/mtls.js +795 -0
- package/vendor/serverd/src/lib/nginx.js +1090 -0
- package/vendor/serverd/src/lib/pki-paths.js +41 -0
- package/vendor/serverd/src/lib/pki-sign.js +103 -0
- package/vendor/serverd/src/lib/plugins.js +538 -0
- package/vendor/serverd/src/lib/push-install.js +390 -0
- package/vendor/serverd/src/lib/revocation.js +112 -0
- package/vendor/serverd/src/lib/services.js +131 -0
- package/vendor/serverd/src/lib/session.js +151 -0
- package/vendor/serverd/src/lib/state-db.js +130 -0
- package/vendor/serverd/src/lib/state.js +140 -0
- package/vendor/serverd/src/lib/storage.js +63 -0
- package/vendor/serverd/src/lib/system-stats.js +58 -0
- package/vendor/serverd/src/lib/tickets.js +1556 -0
- package/vendor/serverd/src/lib/totp.js +76 -0
- package/vendor/serverd/src/lib/tunnel-deps.js +41 -0
- package/vendor/serverd/src/lib/user-access-session.js +142 -0
- package/vendor/serverd/src/lib/user-access.js +52 -0
- package/vendor/serverd/src/middleware/errors.js +63 -0
- package/vendor/serverd/src/middleware/mtls.js +120 -0
- package/vendor/serverd/src/middleware/onboarding-guard.js +30 -0
- package/vendor/serverd/src/middleware/role-guard.js +58 -0
- package/vendor/serverd/src/middleware/twofa-session.js +65 -0
- package/vendor/serverd/src/middleware/user-access-session.js +52 -0
- package/vendor/serverd/src/routes/enrollment.js +120 -0
- package/vendor/serverd/src/routes/health.js +22 -0
- package/vendor/serverd/src/routes/invite.js +163 -0
- package/vendor/serverd/src/routes/management/agents.js +182 -0
- package/vendor/serverd/src/routes/management/certs.js +911 -0
- package/vendor/serverd/src/routes/management/gatekeeper-proxy.js +160 -0
- package/vendor/serverd/src/routes/management/identity.js +107 -0
- package/vendor/serverd/src/routes/management/invitations.js +166 -0
- package/vendor/serverd/src/routes/management/logs.js +218 -0
- package/vendor/serverd/src/routes/management/plugins.js +560 -0
- package/vendor/serverd/src/routes/management/services.js +63 -0
- package/vendor/serverd/src/routes/management/settings.js +325 -0
- package/vendor/serverd/src/routes/management/sites.js +522 -0
- package/vendor/serverd/src/routes/management/storage.js +192 -0
- package/vendor/serverd/src/routes/management/system.js +201 -0
- package/vendor/serverd/src/routes/management/tickets.js +457 -0
- package/vendor/serverd/src/routes/management/tunnels.js +709 -0
- package/vendor/serverd/src/routes/management/users.js +377 -0
- package/vendor/serverd/src/routes/management.js +36 -0
- package/vendor/serverd/src/routes/onboarding/dns.js +101 -0
- package/vendor/serverd/src/routes/onboarding/domain.js +42 -0
- package/vendor/serverd/src/routes/onboarding/index.js +18 -0
- package/vendor/serverd/src/routes/onboarding/provision.js +327 -0
- package/vendor/serverd/src/routes/onboarding/status.js +12 -0
- package/vendor/serverd/src/routes/plugin-router.js +79 -0
- package/vendor/serverd/src/routes/user-access.js +389 -0
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
# Onboarding API
|
|
2
|
+
|
|
3
|
+
> The onboarding endpoints guide a fresh Lamaste installation through domain setup, DNS verification, and stack provisioning.
|
|
4
|
+
|
|
5
|
+
## In Plain English
|
|
6
|
+
|
|
7
|
+
When you first install Lamaste and open the admin panel, the system does not know your domain name yet. The onboarding API is the set of endpoints that walk you through the initial setup: telling the system your domain, checking that DNS is correctly configured, and then provisioning all the backend services (Chisel, Authelia, nginx vhosts, TLS certificates).
|
|
8
|
+
|
|
9
|
+
Once onboarding completes, these endpoints permanently return "410 Gone" — they are a one-time setup flow, not something you revisit.
|
|
10
|
+
|
|
11
|
+
## Authentication
|
|
12
|
+
|
|
13
|
+
All onboarding endpoints require a valid mTLS client certificate, the same as every other API endpoint. See the [API Overview](./overview.md) for details.
|
|
14
|
+
|
|
15
|
+
## Availability
|
|
16
|
+
|
|
17
|
+
| Endpoint | Available When |
|
|
18
|
+
| ------------------------------ | --------------------- |
|
|
19
|
+
| `GET /api/onboarding/status` | Always (no guard) |
|
|
20
|
+
| All other onboarding endpoints | `status != COMPLETED` |
|
|
21
|
+
|
|
22
|
+
After onboarding completes, all endpoints except `/status` return:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
HTTP/1.1 410 Gone
|
|
26
|
+
|
|
27
|
+
{
|
|
28
|
+
"error": "Onboarding already completed"
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Onboarding State Machine
|
|
33
|
+
|
|
34
|
+
The onboarding progresses through a linear sequence of states. Each API call validates the current state before proceeding.
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
FRESH ──POST /domain──▶ DOMAIN_SET ──POST /verify-dns──▶ DNS_READY
|
|
38
|
+
│
|
|
39
|
+
POST /provision
|
|
40
|
+
│
|
|
41
|
+
▼
|
|
42
|
+
PROVISIONING
|
|
43
|
+
│
|
|
44
|
+
(background)
|
|
45
|
+
│
|
|
46
|
+
▼
|
|
47
|
+
COMPLETED
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Endpoints
|
|
51
|
+
|
|
52
|
+
### `GET /api/onboarding/status`
|
|
53
|
+
|
|
54
|
+
Returns the current onboarding state. This is the first endpoint the panel client calls on load to determine whether to show the onboarding wizard or the management UI.
|
|
55
|
+
|
|
56
|
+
This endpoint is always accessible regardless of onboarding state — it has no guard.
|
|
57
|
+
|
|
58
|
+
**Request:**
|
|
59
|
+
|
|
60
|
+
No request body.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Create a curl config file (do this once):
|
|
64
|
+
# echo 'cert = "client.p12:YOUR_P12_PASSWORD"' > ~/.curl-lamaste
|
|
65
|
+
# chmod 600 ~/.curl-lamaste
|
|
66
|
+
|
|
67
|
+
curl -s -K ~/.curl-lamaste \
|
|
68
|
+
https://203.0.113.42:9292/api/onboarding/status
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Response (200):**
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"status": "FRESH",
|
|
76
|
+
"domain": null,
|
|
77
|
+
"ip": "203.0.113.42"
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
| Field | Type | Description |
|
|
82
|
+
| -------- | ---------------- | ----------------------------------------------------------------------- |
|
|
83
|
+
| `status` | `string` | One of: `FRESH`, `DOMAIN_SET`, `DNS_READY`, `PROVISIONING`, `COMPLETED` |
|
|
84
|
+
| `domain` | `string \| null` | The configured domain, or `null` if not yet set |
|
|
85
|
+
| `ip` | `string` | The droplet's public IP address |
|
|
86
|
+
|
|
87
|
+
After domain is set:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"status": "DOMAIN_SET",
|
|
92
|
+
"domain": "example.com",
|
|
93
|
+
"ip": "203.0.113.42"
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### `POST /api/onboarding/domain`
|
|
100
|
+
|
|
101
|
+
Sets the domain name and Let's Encrypt contact email. This is the first step in the onboarding flow.
|
|
102
|
+
|
|
103
|
+
**Request:**
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"domain": "example.com",
|
|
108
|
+
"email": "admin@example.com"
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
| Field | Type | Validation | Description |
|
|
113
|
+
| -------- | -------- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
114
|
+
| `domain` | `string` | FQDN regex, min 1 char | Fully qualified domain name |
|
|
115
|
+
| `email` | `string` | `LETSENCRYPT_EMAIL_REGEX` | Contact email for Let's Encrypt registration. The local part must start with a letter or digit; this is the same rule the root-owned `lamaste-certbot` wrapper enforces, so an address accepted here is never refused at certificate issuance |
|
|
116
|
+
|
|
117
|
+
The domain is validated against this pattern:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
curl -s -K ~/.curl-lamaste \
|
|
125
|
+
-X POST \
|
|
126
|
+
-H "Content-Type: application/json" \
|
|
127
|
+
-d '{"domain":"example.com","email":"admin@example.com"}' \
|
|
128
|
+
https://203.0.113.42:9292/api/onboarding/domain
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Response (200):**
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"ok": true,
|
|
136
|
+
"domain": "example.com",
|
|
137
|
+
"email": "admin@example.com"
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Errors:**
|
|
142
|
+
|
|
143
|
+
| Status | Body | When |
|
|
144
|
+
| ------ | ---------------------------------------------------------------------------------- | ----------------------------------------------- |
|
|
145
|
+
| 400 | `{"error":"Validation failed","details":{"issues":[...]}}` | Invalid domain format, missing or invalid email |
|
|
146
|
+
| 409 | `{"error":"Cannot change domain in current state","onboardingStatus":"DNS_READY"}` | Onboarding has progressed past `DOMAIN_SET` |
|
|
147
|
+
| 410 | `{"error":"Onboarding already completed"}` | Onboarding is finished |
|
|
148
|
+
|
|
149
|
+
**State transition:** `FRESH` or `DOMAIN_SET` → `DOMAIN_SET`
|
|
150
|
+
|
|
151
|
+
The endpoint is idempotent during the `FRESH` and `DOMAIN_SET` states — you can call it multiple times to correct the domain before verifying DNS. Once DNS verification succeeds, the domain is locked.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
### `POST /api/onboarding/verify-dns`
|
|
156
|
+
|
|
157
|
+
Checks whether the three subdomains Lamaste itself serves — `panel.`, `auth.` and `tunnel.` — resolve to the droplet's IP address. These are the names provisioning issues certificates for. It also reports the wildcard and the base domain itself, neither of which is required.
|
|
158
|
+
|
|
159
|
+
**Request:**
|
|
160
|
+
|
|
161
|
+
No request body. The domain is read from the server's configuration.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
curl -s -K ~/.curl-lamaste \
|
|
165
|
+
-X POST \
|
|
166
|
+
https://203.0.113.42:9292/api/onboarding/verify-dns
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Response (200) — DNS correct:**
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"ok": true,
|
|
174
|
+
"domain": "example.com",
|
|
175
|
+
"expectedIp": "203.0.113.42",
|
|
176
|
+
"records": [
|
|
177
|
+
{ "name": "panel.example.com", "resolvedIps": ["203.0.113.42"], "ok": true },
|
|
178
|
+
{ "name": "auth.example.com", "resolvedIps": ["203.0.113.42"], "ok": true },
|
|
179
|
+
{ "name": "tunnel.example.com", "resolvedIps": ["203.0.113.42"], "ok": true }
|
|
180
|
+
],
|
|
181
|
+
"apexOk": true,
|
|
182
|
+
"apexResolvedIps": ["203.0.113.42"],
|
|
183
|
+
"wildcardOk": true,
|
|
184
|
+
"wildcardResolvedIps": ["203.0.113.42"],
|
|
185
|
+
"message": "DNS is correctly configured. panel, auth and tunnel resolve to your server."
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Response (200) — DNS not yet propagated:**
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"ok": false,
|
|
194
|
+
"domain": "example.com",
|
|
195
|
+
"expectedIp": "203.0.113.42",
|
|
196
|
+
"records": [
|
|
197
|
+
{ "name": "panel.example.com", "resolvedIps": [], "ok": false },
|
|
198
|
+
{ "name": "auth.example.com", "resolvedIps": [], "ok": false },
|
|
199
|
+
{ "name": "tunnel.example.com", "resolvedIps": [], "ok": false }
|
|
200
|
+
],
|
|
201
|
+
"apexOk": false,
|
|
202
|
+
"apexResolvedIps": [],
|
|
203
|
+
"wildcardOk": false,
|
|
204
|
+
"wildcardResolvedIps": [],
|
|
205
|
+
"message": "panel.example.com does not resolve; auth.example.com does not resolve; tunnel.example.com does not resolve. Point panel.example.com, auth.example.com, tunnel.example.com (or a wildcard *.example.com) at 203.0.113.42. DNS propagation can take up to 48 hours, but usually completes within minutes."
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Response (200) — base domain served by another host:**
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"ok": true,
|
|
214
|
+
"domain": "example.com",
|
|
215
|
+
"expectedIp": "203.0.113.42",
|
|
216
|
+
"records": [
|
|
217
|
+
{ "name": "panel.example.com", "resolvedIps": ["203.0.113.42"], "ok": true },
|
|
218
|
+
{ "name": "auth.example.com", "resolvedIps": ["203.0.113.42"], "ok": true },
|
|
219
|
+
{ "name": "tunnel.example.com", "resolvedIps": ["203.0.113.42"], "ok": true }
|
|
220
|
+
],
|
|
221
|
+
"apexOk": false,
|
|
222
|
+
"apexResolvedIps": ["198.51.100.7"],
|
|
223
|
+
"wildcardOk": true,
|
|
224
|
+
"wildcardResolvedIps": ["203.0.113.42"],
|
|
225
|
+
"message": "DNS is correctly configured. panel, auth and tunnel resolve to your server. example.com itself does not point to this server — that is only needed to serve a site on it."
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
| Field | Type | Description |
|
|
230
|
+
| --------------------- | ---------- | ------------------------------------------------------------------- |
|
|
231
|
+
| `ok` | `boolean` | `true` if `panel.`, `auth.` and `tunnel.` all resolve to the server |
|
|
232
|
+
| `domain` | `string` | The domain being verified |
|
|
233
|
+
| `expectedIp` | `string` | The droplet's public IP |
|
|
234
|
+
| `records` | `object[]` | One entry per required name: `name`, `resolvedIps`, `ok` |
|
|
235
|
+
| `apexOk` | `boolean` | `true` if the base domain itself resolves to the server (optional) |
|
|
236
|
+
| `apexResolvedIps` | `string[]` | IP addresses the base domain resolves to |
|
|
237
|
+
| `wildcardOk` | `boolean` | `true` if wildcard DNS is configured (optional) |
|
|
238
|
+
| `wildcardResolvedIps` | `string[]` | IP addresses the wildcard resolves to |
|
|
239
|
+
| `message` | `string` | Human-readable diagnostic message |
|
|
240
|
+
|
|
241
|
+
**Errors:**
|
|
242
|
+
|
|
243
|
+
| Status | Body | When |
|
|
244
|
+
| ------ | ----------------------------------------------------------------------------------- | --------------------------- |
|
|
245
|
+
| 409 | `{"error":"Domain must be set before DNS verification","onboardingStatus":"FRESH"}` | Domain has not been set yet |
|
|
246
|
+
| 410 | `{"error":"Onboarding already completed"}` | Onboarding is finished |
|
|
247
|
+
|
|
248
|
+
**State transition:** `DOMAIN_SET` or `DNS_READY` → `DNS_READY` (only when `ok` is `true`)
|
|
249
|
+
|
|
250
|
+
The endpoint can be called repeatedly — it is safe to poll while waiting for DNS propagation. The state only advances when verification succeeds.
|
|
251
|
+
|
|
252
|
+
The wildcard check probes `test-lamaste-check.<domain>`. Wildcard DNS is optional; tunnels will still work with individual A records. The base domain is optional too: it can keep pointing at another host, and is only needed once a site is served on it.
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
### `POST /api/onboarding/provision`
|
|
257
|
+
|
|
258
|
+
Starts the full stack provisioning process in the background. This configures and starts Chisel and Authelia, issues certbot certificates, and writes nginx vhosts. The Chisel and Authelia binaries and units are installed by `create-lamaste`, not here: if one is missing, the task fails with the error "Chisel is not installed. Run `npx @lamalibre/create-lamaste@4.0.0` on the server to repair the installation." (likewise for Authelia). Task IDs are unchanged from earlier versions; only the titles changed.
|
|
259
|
+
|
|
260
|
+
Provisioning runs asynchronously. This endpoint returns immediately with a 202 status. Use the WebSocket stream endpoint to follow progress in real time.
|
|
261
|
+
|
|
262
|
+
**Request:**
|
|
263
|
+
|
|
264
|
+
No request body.
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
curl -s -K ~/.curl-lamaste \
|
|
268
|
+
-X POST \
|
|
269
|
+
https://203.0.113.42:9292/api/onboarding/provision
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Response (202):**
|
|
273
|
+
|
|
274
|
+
```json
|
|
275
|
+
{
|
|
276
|
+
"ok": true,
|
|
277
|
+
"message": "Provisioning started"
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**Errors:**
|
|
282
|
+
|
|
283
|
+
| Status | Body | When |
|
|
284
|
+
| ------ | ------------------------------------------------------ | --------------------------------- |
|
|
285
|
+
| 409 | `{"error":"DNS must be verified before provisioning"}` | State is `FRESH` or `DOMAIN_SET` |
|
|
286
|
+
| 409 | `{"error":"Provisioning already in progress"}` | Provisioning is currently running |
|
|
287
|
+
| 410 | `{"error":"Onboarding already completed"}` | Onboarding is finished |
|
|
288
|
+
|
|
289
|
+
**State transition:** `DNS_READY` → `PROVISIONING` → `COMPLETED` (on success)
|
|
290
|
+
|
|
291
|
+
### Provisioning Tasks
|
|
292
|
+
|
|
293
|
+
The provisioning sequence runs these tasks in order:
|
|
294
|
+
|
|
295
|
+
| Task ID | Title | What It Does |
|
|
296
|
+
| ------------------ | ------------------------ | --------------------------------------------------------------------------------- |
|
|
297
|
+
| `install-chisel` | Starting Chisel | Checks the binary is installed, creates key and authfile, starts service |
|
|
298
|
+
| `install-authelia` | Configuring Authelia | Checks the binary is installed, writes config, creates admin user, starts service |
|
|
299
|
+
| `issue-certs` | Issuing TLS certificates | Issues Let's Encrypt cert for `panel.<domain>`, sets up auto-renewal |
|
|
300
|
+
| `configure-nginx` | Configuring nginx | Writes panel/auth/tunnel vhosts, enables sites, tests and reloads |
|
|
301
|
+
| `verify-services` | Verifying services | Checks all services are running (Chisel, Authelia, nginx, panel) |
|
|
302
|
+
| `finalize` | Finalizing setup | Updates config to `COMPLETED` state |
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
### `WS /api/onboarding/provision/stream`
|
|
307
|
+
|
|
308
|
+
WebSocket endpoint for real-time provisioning progress. Connects via the standard WebSocket upgrade handshake.
|
|
309
|
+
|
|
310
|
+
```javascript
|
|
311
|
+
const ws = new WebSocket('wss://203.0.113.42:9292/api/onboarding/provision/stream');
|
|
312
|
+
|
|
313
|
+
ws.onmessage = (event) => {
|
|
314
|
+
const data = JSON.parse(event.data);
|
|
315
|
+
console.log(data);
|
|
316
|
+
};
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**Initial message (sent immediately on connect):**
|
|
320
|
+
|
|
321
|
+
When a client connects, the server sends the full current state so late-joining clients can catch up:
|
|
322
|
+
|
|
323
|
+
```json
|
|
324
|
+
{
|
|
325
|
+
"type": "state",
|
|
326
|
+
"isRunning": true,
|
|
327
|
+
"tasks": [
|
|
328
|
+
{
|
|
329
|
+
"id": "install-chisel",
|
|
330
|
+
"title": "Starting Chisel",
|
|
331
|
+
"status": "done",
|
|
332
|
+
"message": "Chisel 1.12.0 running",
|
|
333
|
+
"log": null
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"id": "install-authelia",
|
|
337
|
+
"title": "Configuring Authelia",
|
|
338
|
+
"status": "running",
|
|
339
|
+
"message": "Creating admin user...",
|
|
340
|
+
"log": null
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"id": "issue-certs",
|
|
344
|
+
"title": "Issuing TLS certificates",
|
|
345
|
+
"status": "pending",
|
|
346
|
+
"message": null,
|
|
347
|
+
"log": null
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"id": "configure-nginx",
|
|
351
|
+
"title": "Configuring nginx",
|
|
352
|
+
"status": "pending",
|
|
353
|
+
"message": null,
|
|
354
|
+
"log": null
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"id": "verify-services",
|
|
358
|
+
"title": "Verifying services",
|
|
359
|
+
"status": "pending",
|
|
360
|
+
"message": null,
|
|
361
|
+
"log": null
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"id": "finalize",
|
|
365
|
+
"title": "Finalizing setup",
|
|
366
|
+
"status": "pending",
|
|
367
|
+
"message": null,
|
|
368
|
+
"log": null
|
|
369
|
+
}
|
|
370
|
+
],
|
|
371
|
+
"error": null,
|
|
372
|
+
"result": null
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
**Progress messages (sent as tasks advance):**
|
|
377
|
+
|
|
378
|
+
```json
|
|
379
|
+
{
|
|
380
|
+
"task": "install-authelia",
|
|
381
|
+
"title": "Configuring Authelia",
|
|
382
|
+
"status": "running",
|
|
383
|
+
"message": "Writing configuration...",
|
|
384
|
+
"log": null,
|
|
385
|
+
"progress": { "current": 2, "total": 6 }
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
| Field | Type | Description |
|
|
390
|
+
| ---------- | ---------------- | -------------------------------------------------------- |
|
|
391
|
+
| `task` | `string` | Task identifier |
|
|
392
|
+
| `title` | `string` | Human-readable task title |
|
|
393
|
+
| `status` | `string` | One of: `pending`, `running`, `done`, `error` |
|
|
394
|
+
| `message` | `string \| null` | Current step description within the task |
|
|
395
|
+
| `log` | `string \| null` | Additional log output (version numbers, skipped notices) |
|
|
396
|
+
| `progress` | `object` | `{ current, total }` — overall progress counter |
|
|
397
|
+
|
|
398
|
+
**Completion message:**
|
|
399
|
+
|
|
400
|
+
```json
|
|
401
|
+
{
|
|
402
|
+
"task": "complete",
|
|
403
|
+
"status": "done",
|
|
404
|
+
"message": "Provisioning complete",
|
|
405
|
+
"result": {
|
|
406
|
+
"adminUsername": "admin",
|
|
407
|
+
"adminPassword": "aB3dEf7hIjKlMn0p",
|
|
408
|
+
"panelUrl": "https://panel.example.com",
|
|
409
|
+
"authUrl": "https://auth.example.com"
|
|
410
|
+
},
|
|
411
|
+
"progress": { "current": 6, "total": 6 }
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
The `result` object contains the initial Authelia admin credentials. The password is randomly generated and shown only once.
|
|
416
|
+
|
|
417
|
+
**Error message:**
|
|
418
|
+
|
|
419
|
+
```json
|
|
420
|
+
{
|
|
421
|
+
"task": "configure-nginx",
|
|
422
|
+
"status": "error",
|
|
423
|
+
"message": "Failed: Configuring nginx",
|
|
424
|
+
"error": "nginx configuration test failed: ...",
|
|
425
|
+
"progress": { "current": 3, "total": 6 }
|
|
426
|
+
}
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
If a task fails, all subsequent tasks remain in `pending` status and provisioning stops.
|
|
430
|
+
|
|
431
|
+
## Quick Reference
|
|
432
|
+
|
|
433
|
+
| Method | Path | State Required | Returns |
|
|
434
|
+
| ------ | ---------------------------------- | --------------------------- | ------------------------- |
|
|
435
|
+
| GET | `/api/onboarding/status` | Any | Current state, domain, IP |
|
|
436
|
+
| POST | `/api/onboarding/domain` | `FRESH` or `DOMAIN_SET` | Confirmation |
|
|
437
|
+
| POST | `/api/onboarding/verify-dns` | `DOMAIN_SET` or `DNS_READY` | DNS resolution results |
|
|
438
|
+
| POST | `/api/onboarding/provision` | `DNS_READY` | 202 Accepted |
|
|
439
|
+
| WS | `/api/onboarding/provision/stream` | Any (read-only) | Real-time progress |
|
|
440
|
+
|
|
441
|
+
### State Machine
|
|
442
|
+
|
|
443
|
+
```
|
|
444
|
+
FRESH ──▶ DOMAIN_SET ──▶ DNS_READY ──▶ PROVISIONING ──▶ COMPLETED
|
|
445
|
+
│ │ │
|
|
446
|
+
└───────────┘ │
|
|
447
|
+
(domain can be changed) │
|
|
448
|
+
└── (provision runs in background)
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### curl Cheat Sheet
|
|
452
|
+
|
|
453
|
+
```bash
|
|
454
|
+
# Check current state
|
|
455
|
+
curl -s -K ~/.curl-lamaste \
|
|
456
|
+
https://203.0.113.42:9292/api/onboarding/status | jq
|
|
457
|
+
|
|
458
|
+
# Set domain
|
|
459
|
+
curl -s -K ~/.curl-lamaste \
|
|
460
|
+
-X POST -H "Content-Type: application/json" \
|
|
461
|
+
-d '{"domain":"example.com","email":"admin@example.com"}' \
|
|
462
|
+
https://203.0.113.42:9292/api/onboarding/domain | jq
|
|
463
|
+
|
|
464
|
+
# Verify DNS
|
|
465
|
+
curl -s -K ~/.curl-lamaste \
|
|
466
|
+
-X POST \
|
|
467
|
+
https://203.0.113.42:9292/api/onboarding/verify-dns | jq
|
|
468
|
+
|
|
469
|
+
# Start provisioning
|
|
470
|
+
curl -s -K ~/.curl-lamaste \
|
|
471
|
+
-X POST \
|
|
472
|
+
https://203.0.113.42:9292/api/onboarding/provision | jq
|
|
473
|
+
```
|