@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
package/LICENSE.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Code Lama Software
|
|
4
|
+
|
|
5
|
+
## Noncommercial Use
|
|
6
|
+
|
|
7
|
+
This software is licensed under the [Polyform Noncommercial License 1.0.0](https://polyformproject.org/licenses/noncommercial/1.0.0/).
|
|
8
|
+
|
|
9
|
+
You may use, copy, modify, and distribute this software for any **noncommercial** purpose. This includes personal projects, academic research, education, and evaluation.
|
|
10
|
+
|
|
11
|
+
## Commercial Use
|
|
12
|
+
|
|
13
|
+
Commercial use of this software requires a commercial license, available by contacting license@codelama.com.tr.
|
|
14
|
+
|
|
15
|
+
Commercial use includes, but is not limited to:
|
|
16
|
+
|
|
17
|
+
- Using Lamaste in a business to serve data to clients or partners
|
|
18
|
+
- Deploying Lamaste as part of a revenue-generating service or product
|
|
19
|
+
- Using Lamaste internally at a for-profit organization
|
|
20
|
+
|
|
21
|
+
Sponsorship tiers and terms are listed on our GitHub Sponsors page. Once you become an active sponsor at a qualifying tier, you are granted a commercial use license for the duration of your sponsorship.
|
|
22
|
+
|
|
23
|
+
## Questions
|
|
24
|
+
|
|
25
|
+
If you are unsure whether your use qualifies as noncommercial, please open a [GitHub Discussion](https://github.com/lamalibre/lamaste/discussions) or contact us directly.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Polyform Noncommercial License 1.0.0
|
|
30
|
+
|
|
31
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0/>
|
|
32
|
+
|
|
33
|
+
### Acceptance
|
|
34
|
+
|
|
35
|
+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
36
|
+
|
|
37
|
+
### Copyright License
|
|
38
|
+
|
|
39
|
+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
|
|
40
|
+
|
|
41
|
+
### Distribution License
|
|
42
|
+
|
|
43
|
+
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
|
|
44
|
+
|
|
45
|
+
### Notices
|
|
46
|
+
|
|
47
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
|
|
48
|
+
|
|
49
|
+
> Required Notice: Copyright (c) 2026 Code Lama Software (https://github.com/lamalibre/lamaste)
|
|
50
|
+
|
|
51
|
+
### Changes and New Works License
|
|
52
|
+
|
|
53
|
+
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
|
|
54
|
+
|
|
55
|
+
### Patent License
|
|
56
|
+
|
|
57
|
+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
58
|
+
|
|
59
|
+
### Noncommercial Purposes
|
|
60
|
+
|
|
61
|
+
Any noncommercial purpose is a permitted purpose.
|
|
62
|
+
|
|
63
|
+
### Personal Uses
|
|
64
|
+
|
|
65
|
+
Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
|
|
66
|
+
|
|
67
|
+
### Noncommercial Organizations
|
|
68
|
+
|
|
69
|
+
Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
|
|
70
|
+
|
|
71
|
+
### Fair Use
|
|
72
|
+
|
|
73
|
+
You may have "fair use" rights for the software under the law. These terms do not limit them.
|
|
74
|
+
|
|
75
|
+
### No Other Rights
|
|
76
|
+
|
|
77
|
+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
78
|
+
|
|
79
|
+
### Patent Defense
|
|
80
|
+
|
|
81
|
+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
82
|
+
|
|
83
|
+
### Violations
|
|
84
|
+
|
|
85
|
+
The first time you are notified in writing that you have violated any of these terms, or any agreement made under them, you have 32 calendar days to come into compliance. If you come into compliance within that time, your licenses under these terms will not be permanently revoked.
|
|
86
|
+
|
|
87
|
+
### No Liability
|
|
88
|
+
|
|
89
|
+
**_As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim._**
|
|
90
|
+
|
|
91
|
+
### Definitions
|
|
92
|
+
|
|
93
|
+
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
|
|
94
|
+
|
|
95
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
96
|
+
|
|
97
|
+
**Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
98
|
+
|
|
99
|
+
**Your licenses** are all the licenses granted to you for the software under these terms.
|
|
100
|
+
|
|
101
|
+
**Use** means anything you do with the software requiring one of your licenses.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Disclaimer
|
|
106
|
+
|
|
107
|
+
This software is provided "as is", without warranty of any kind, express or implied. The authors and contributors accept no liability for any damages, data loss, security incidents, or legal consequences arising from the use of this software.
|
|
108
|
+
|
|
109
|
+
Lamaste is designed for self-hosted use cases — personal projects, development environments, demos, and internal tools. It is not a substitute for production infrastructure. Production workloads require dedicated hosting, load balancing, redundancy, monitoring, and operational expertise that are beyond the scope of this project.
|
|
110
|
+
|
|
111
|
+
**You are solely responsible for what you expose through Lamaste.** By tunneling an application to the public internet, you grant anyone with access the ability to interact with that application as if they were on your local network. This carries inherent risks:
|
|
112
|
+
|
|
113
|
+
- **Arbitrary code execution:** If the tunneled application contains vulnerabilities or backdoors, remote attackers may exploit them to execute code on your machine, access your file system, or compromise your operating system.
|
|
114
|
+
- **Data exposure:** Misconfigured or insecure applications may leak sensitive data, credentials, or private files to the internet.
|
|
115
|
+
- **Lateral movement:** A compromised tunneled application may be used as an entry point to attack other devices and services on your local network.
|
|
116
|
+
- **Resource abuse:** Publicly accessible applications may be used for cryptocurrency mining, spam relaying, botnet hosting, or other abuse that could result in legal action against you.
|
|
117
|
+
|
|
118
|
+
Lamaste provides authentication and access control mechanisms, but no security measure is absolute. It is your responsibility to understand the software you expose, keep it updated, and assess the risks of making it publicly accessible. The authors of Lamaste bear no responsibility for the consequences of tunneling untrusted, vulnerable, or malicious software.
|
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# @lamalibre/create-lamaste
|
|
2
|
+
|
|
3
|
+
One-command setup for secure reverse tunnels with a management dashboard.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
ssh root@<droplet-ip> "apt install -y npm && npx @lamalibre/create-lamaste"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The installer runs unattended on a fresh Ubuntu 24.04 droplet and provisions
|
|
12
|
+
the full Lamaste stack with zero prompts. When finished it prints:
|
|
13
|
+
|
|
14
|
+
- An SCP command to download the mTLS client certificate (`.p12`)
|
|
15
|
+
- The p12 password
|
|
16
|
+
- The panel URL (`https://<ip>:9292`)
|
|
17
|
+
|
|
18
|
+
Import the certificate into your browser and open the URL to begin onboarding.
|
|
19
|
+
|
|
20
|
+
### JSON Mode
|
|
21
|
+
|
|
22
|
+
For programmatic use (e.g. from the Lamaste desktop app), pass `--json` to
|
|
23
|
+
replace the interactive Listr2 terminal UI with NDJSON progress lines on stdout:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx @lamalibre/create-lamaste --json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The `--json` flag implies `--yes` (no prompts) and `--dev` (accept private IPs).
|
|
30
|
+
Each line is a JSON object with one of these shapes:
|
|
31
|
+
|
|
32
|
+
```jsonl
|
|
33
|
+
{"event":"step","step":"check_environment","status":"running"}
|
|
34
|
+
{"event":"step","step":"harden_system","status":"complete"}
|
|
35
|
+
{"event":"step","step":"install_node","status":"skipped"}
|
|
36
|
+
{"event":"complete","server":{"ip":"...","panelUrl":"...","p12Path":"...","p12PasswordPath":"..."}}
|
|
37
|
+
{"event":"error","message":"...","recoverable":false}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## What It Provisions
|
|
41
|
+
|
|
42
|
+
- **OS hardening** — swap, UFW, fail2ban, SSH lockdown
|
|
43
|
+
- **Node.js 20 LTS**
|
|
44
|
+
- **mTLS PKI** — CA, server cert, client cert + PKCS12 bundle
|
|
45
|
+
- **nginx** — TLS on port 9292 with `ssl_verify_client on`, and a port-80
|
|
46
|
+
catch-all (`lamalibre-lamaste-http-redirect`) that redirects plain HTTP to
|
|
47
|
+
HTTPS without getting in the way of Let's Encrypt HTTP-01 challenges
|
|
48
|
+
- **Panel server + client** — systemd service, `lamaste-server` CLI, static
|
|
49
|
+
frontend, docs and the gatekeeper, in a root-owned `/opt/lamalibre/lamaste`
|
|
50
|
+
(read-only for the `lamaste` user the panel runs as)
|
|
51
|
+
- **Chisel and Authelia** — the pinned releases (Chisel 1.12.0, Authelia
|
|
52
|
+
4.39.28) in `/usr/local/bin`, verified against pinned SHA-256 digests before
|
|
53
|
+
unpacking (a newer installed Authelia is kept, never downgraded), with
|
|
54
|
+
hardened systemd units. Onboarding only configures and starts them
|
|
55
|
+
- **Service accounts** — the `lamaste-chisel` group (Chisel runs as
|
|
56
|
+
`nobody:lamaste-chisel`; the panel user is a member so it can write the 0640
|
|
57
|
+
Chisel authfile without sudo) and the unprivileged `lamaste-authelia` account
|
|
58
|
+
Authelia runs as
|
|
59
|
+
- **Ownership** — `/var/www/lamaste` (`lamaste:www-data`, setgid), `/etc/authelia`
|
|
60
|
+
(`lamaste:lamaste-authelia`, setgid), `/var/log/authelia`, the Chisel key
|
|
61
|
+
and the PKI directory, so the panel manages them without privileges
|
|
62
|
+
- **Root-owned programs** in `/usr/local/sbin/` — `lamaste-priv` (installs the
|
|
63
|
+
panel's nginx vhosts after checking every directive against an allow-list,
|
|
64
|
+
stores Authelia TOTP secrets as the Authelia account, starts a self-update),
|
|
65
|
+
`lamaste-certbot` and `lamaste-cert-info` (certbot / openssl with a fixed
|
|
66
|
+
argument vector)
|
|
67
|
+
- **Sudoers** — `/etc/sudoers.d/lamaste` with no wildcards: fixed `systemctl`
|
|
68
|
+
lines, `nginx -t`, and the three programs above. Staged, checked with
|
|
69
|
+
`visudo -c`, then renamed into place
|
|
70
|
+
|
|
71
|
+
Re-running the installer on an existing server (redeploy — also what the
|
|
72
|
+
panel's self-update runs) refreshes the panel, CLI, UI, docs and gatekeeper,
|
|
73
|
+
the pinned binaries, the panel, Chisel and Authelia units, the accounts and ownership, the programs and
|
|
74
|
+
sudoers rules, and the port-80 redirect; it removes the retired
|
|
75
|
+
`lamaste-sign-csr` / `lamaste-pki-rename` wrappers and converts an install
|
|
76
|
+
directory left `lamaste`-owned by an older version. Upgrade agents before the
|
|
77
|
+
server.
|
|
78
|
+
|
|
79
|
+
Domain setup, Chisel tunnels, Authelia, and Let's Encrypt certificates are
|
|
80
|
+
configured through the browser-based onboarding wizard after installation.
|
|
81
|
+
|
|
82
|
+
## Requirements
|
|
83
|
+
|
|
84
|
+
| Requirement | Details |
|
|
85
|
+
| ----------- | ----------------------- |
|
|
86
|
+
| OS | Ubuntu 24.04 LTS |
|
|
87
|
+
| Access | root |
|
|
88
|
+
| Node.js | >= 20.0.0 |
|
|
89
|
+
| RAM | 512 MB minimum |
|
|
90
|
+
| Recommended | DigitalOcean $4 droplet |
|
|
91
|
+
|
|
92
|
+
## Further Reading
|
|
93
|
+
|
|
94
|
+
See the main repository for architecture, development plan, and full
|
|
95
|
+
documentation: <https://github.com/lamalibre/lamaste>
|
|
96
|
+
|
|
97
|
+
## Disclaimer
|
|
98
|
+
|
|
99
|
+
This software is provided "as is", without warranty of any kind, express or implied. The authors and contributors accept no liability for any damages, data loss, security incidents, or legal consequences arising from the use of this software.
|
|
100
|
+
|
|
101
|
+
Lamaste is designed for self-hosted use cases — personal projects, development environments, demos, and internal tools. It is not a substitute for production infrastructure. Production workloads require dedicated hosting, load balancing, redundancy, monitoring, and operational expertise that are beyond the scope of this project.
|
|
102
|
+
|
|
103
|
+
**You are solely responsible for what you expose through Lamaste.** By tunneling an application to the public internet, you grant anyone with access the ability to interact with that application as if they were on your local network. This carries inherent risks:
|
|
104
|
+
|
|
105
|
+
- **Arbitrary code execution:** If the tunneled application contains vulnerabilities or backdoors, remote attackers may exploit them to execute code on your machine, access your file system, or compromise your operating system.
|
|
106
|
+
- **Data exposure:** Misconfigured or insecure applications may leak sensitive data, credentials, or private files to the internet.
|
|
107
|
+
- **Lateral movement:** A compromised tunneled application may be used as an entry point to attack other devices and services on your local network.
|
|
108
|
+
- **Resource abuse:** Publicly accessible applications may be used for cryptocurrency mining, spam relaying, botnet hosting, or other abuse that could result in legal action against you.
|
|
109
|
+
|
|
110
|
+
Lamaste provides authentication and access control mechanisms, but no security measure is absolute. It is your responsibility to understand the software you expose, keep it updated, and assess the risks of making it publicly accessible. The authors of Lamaste bear no responsibility for the consequences of tunneling untrusted, vulnerable, or malicious software.
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
[Polyform Noncommercial 1.0.0](./LICENSE.md) — see [LICENSE.md](./LICENSE.md) for details.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { main } from '../src/index.js';
|
|
4
|
+
|
|
5
|
+
try {
|
|
6
|
+
await main();
|
|
7
|
+
} catch (error) {
|
|
8
|
+
console.error('\n');
|
|
9
|
+
console.error(' Lamaste installation failed.');
|
|
10
|
+
console.error(` Error: ${error.message}`);
|
|
11
|
+
console.error('\n');
|
|
12
|
+
console.error(' You can safely re-run this installer to retry.');
|
|
13
|
+
console.error('\n');
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lamalibre/create-lamaste",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "One-command setup for secure reverse tunnels with a management dashboard",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
|
+
"author": "Code Lama Software",
|
|
8
|
+
"bin": {
|
|
9
|
+
"create-lamaste": "bin/create-lamaste.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin",
|
|
13
|
+
"src",
|
|
14
|
+
"scripts",
|
|
15
|
+
"vendor"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"bundle-vendor": "node scripts/bundle-vendor.js",
|
|
19
|
+
"lint": "eslint .",
|
|
20
|
+
"prepack": "node scripts/bundle-vendor.js",
|
|
21
|
+
"prepublishOnly": "npm run lint",
|
|
22
|
+
"test": "node --test test/*.test.js"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/lamalibre/lamaste.git",
|
|
27
|
+
"directory": "packages/provisioners/server"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/lamalibre/lamaste#readme",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/lamalibre/lamaste/issues"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"tunnel",
|
|
35
|
+
"reverse-tunnel",
|
|
36
|
+
"chisel",
|
|
37
|
+
"nginx",
|
|
38
|
+
"management",
|
|
39
|
+
"dashboard",
|
|
40
|
+
"vps",
|
|
41
|
+
"self-hosted",
|
|
42
|
+
"authelia",
|
|
43
|
+
"mtls"
|
|
44
|
+
],
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@lamalibre/lamaste": "^4.0.0",
|
|
47
|
+
"chalk": "^5.3.0",
|
|
48
|
+
"execa": "^9.0.0",
|
|
49
|
+
"listr2": "^8.0.0"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=20.0.0"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundles sibling monorepo packages into vendor/ so that create-lamaste
|
|
3
|
+
* works standalone when installed via npx (outside the monorepo).
|
|
4
|
+
*
|
|
5
|
+
* Runs automatically before every `npm pack` / `npm publish` (the "prepack"
|
|
6
|
+
* script), so a packed installer never carries a stale vendor/. Progress goes
|
|
7
|
+
* to stderr: `npm pack --json` prints its JSON on stdout.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { cp, mkdir, rm } from 'node:fs/promises';
|
|
11
|
+
import { existsSync } from 'node:fs';
|
|
12
|
+
import { execFileSync } from 'node:child_process';
|
|
13
|
+
import { dirname, join } from 'node:path';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
|
|
16
|
+
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const packageRoot = join(thisDir, '..');
|
|
18
|
+
const monorepoRoot = join(packageRoot, '..', '..', '..');
|
|
19
|
+
const vendorDir = join(packageRoot, 'vendor');
|
|
20
|
+
|
|
21
|
+
async function main() {
|
|
22
|
+
// Clean vendor/ if it exists, then recreate
|
|
23
|
+
await rm(vendorDir, { recursive: true, force: true });
|
|
24
|
+
await mkdir(vendorDir, { recursive: true });
|
|
25
|
+
|
|
26
|
+
// --- lamaste-serverd: package.json + src/ ---
|
|
27
|
+
const serverSrc = join(monorepoRoot, 'packages', 'server', 'daemon');
|
|
28
|
+
if (!existsSync(serverSrc)) {
|
|
29
|
+
throw new Error(`lamaste-serverd not found at ${serverSrc}. Run from the monorepo root.`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const serverDest = join(vendorDir, 'serverd');
|
|
33
|
+
await mkdir(serverDest, { recursive: true });
|
|
34
|
+
await cp(join(serverSrc, 'package.json'), join(serverDest, 'package.json'));
|
|
35
|
+
await cp(join(serverSrc, 'src'), join(serverDest, 'src'), {
|
|
36
|
+
recursive: true,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
console.error('Bundled vendor/serverd from lamaste-serverd (package.json + src/)');
|
|
40
|
+
|
|
41
|
+
// --- lamaste-server: server operational CLI (package.json + bin/ + src/) ---
|
|
42
|
+
// The 2.0 refactor split the CLI out of the daemon; this CLI owns
|
|
43
|
+
// `lamaste-server reset-admin` (the recovery path that also supplies the
|
|
44
|
+
// legacy `lamaste-reset-admin` binary via symlink at install time).
|
|
45
|
+
const serverCliSrc = join(monorepoRoot, 'packages', 'server', 'cli');
|
|
46
|
+
if (!existsSync(serverCliSrc)) {
|
|
47
|
+
throw new Error(`lamaste-server CLI not found at ${serverCliSrc}. Run from the monorepo root.`);
|
|
48
|
+
}
|
|
49
|
+
const serverCliDest = join(vendorDir, 'server');
|
|
50
|
+
await mkdir(serverCliDest, { recursive: true });
|
|
51
|
+
await cp(join(serverCliSrc, 'package.json'), join(serverCliDest, 'package.json'));
|
|
52
|
+
await cp(join(serverCliSrc, 'bin'), join(serverCliDest, 'bin'), { recursive: true });
|
|
53
|
+
await cp(join(serverCliSrc, 'src'), join(serverCliDest, 'src'), { recursive: true });
|
|
54
|
+
console.error('Bundled vendor/server from lamaste-server CLI (package.json + bin/ + src/)');
|
|
55
|
+
|
|
56
|
+
// --- lamaste-server-ui: dist/ (pre-built assets) ---
|
|
57
|
+
const clientDist = join(monorepoRoot, 'packages', 'server', 'ui', 'dist');
|
|
58
|
+
if (!existsSync(clientDist)) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
`lamaste-server-ui/dist/ not found at ${clientDist}. Run "npm run build" first.`,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const clientDest = join(vendorDir, 'server-ui');
|
|
65
|
+
await mkdir(join(clientDest, 'dist'), { recursive: true });
|
|
66
|
+
await cp(clientDist, join(clientDest, 'dist'), { recursive: true });
|
|
67
|
+
|
|
68
|
+
console.error('Bundled vendor/server-ui (dist/)');
|
|
69
|
+
|
|
70
|
+
// --- gatekeeper: package.json + dist/ (compiled TypeScript) ---
|
|
71
|
+
const gatekeeperSrc = join(monorepoRoot, 'packages', 'sdks', 'gatekeeper');
|
|
72
|
+
const gatekeeperDist = join(gatekeeperSrc, 'dist');
|
|
73
|
+
if (existsSync(gatekeeperDist)) {
|
|
74
|
+
const gatekeeperDest = join(vendorDir, 'gatekeeper');
|
|
75
|
+
await mkdir(gatekeeperDest, { recursive: true });
|
|
76
|
+
await cp(join(gatekeeperSrc, 'package.json'), join(gatekeeperDest, 'package.json'));
|
|
77
|
+
await cp(gatekeeperDist, join(gatekeeperDest, 'dist'), { recursive: true });
|
|
78
|
+
console.error('Bundled vendor/gatekeeper (package.json + dist/)');
|
|
79
|
+
} else {
|
|
80
|
+
console.error('Skipped vendor/gatekeeper (dist/ not found — run "npm run build" first)');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// --- docs: version-stamped markdown ---
|
|
84
|
+
const docsStampScript = join(
|
|
85
|
+
monorepoRoot,
|
|
86
|
+
'packages',
|
|
87
|
+
'core',
|
|
88
|
+
'docs',
|
|
89
|
+
'scripts',
|
|
90
|
+
'version-stamp.js',
|
|
91
|
+
);
|
|
92
|
+
if (existsSync(docsStampScript)) {
|
|
93
|
+
const docsDest = join(vendorDir, 'docs');
|
|
94
|
+
execFileSync('node', [docsStampScript, docsDest], {
|
|
95
|
+
cwd: monorepoRoot,
|
|
96
|
+
// Progress on stderr: `npm pack --json` (prepack) reads stdout as JSON.
|
|
97
|
+
stdio: ['ignore', 'pipe', 'inherit'],
|
|
98
|
+
});
|
|
99
|
+
console.error('Bundled vendor/docs (version-stamped)');
|
|
100
|
+
} else {
|
|
101
|
+
console.error('Skipped vendor/docs (version-stamp script not found)');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
console.error('Vendor bundling complete.');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
main().catch((err) => {
|
|
108
|
+
console.error(err.message);
|
|
109
|
+
process.exit(1);
|
|
110
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# lamaste-cert-info — root-only, read-only queries about a Let's Encrypt
|
|
4
|
+
# certificate lineage.
|
|
5
|
+
#
|
|
6
|
+
# This script is invoked via sudo from the lamaste service user. It replaces
|
|
7
|
+
# sudoers entries of the form
|
|
8
|
+
#
|
|
9
|
+
# lamaste ALL=(root) NOPASSWD: /usr/bin/openssl x509 -enddate -noout -in /etc/letsencrypt/live/*
|
|
10
|
+
#
|
|
11
|
+
# whose trailing `*` also matched extra openssl arguments — `-engine <lib.so>`
|
|
12
|
+
# loads a shared object as root, and a traversing path reads any file. Here the
|
|
13
|
+
# lineage name is validated and openssl runs with a fixed argument vector on
|
|
14
|
+
# /etc/letsencrypt/live/<lineage>/fullchain.pem.
|
|
15
|
+
#
|
|
16
|
+
# Usage:
|
|
17
|
+
# lamaste-cert-info <lineage> enddate # prints notAfter=<date>
|
|
18
|
+
# lamaste-cert-info <lineage> checkend # exit 0 if valid for 24h more, 1 if not
|
|
19
|
+
# lamaste-cert-info <lineage> san # prints the subjectAltName extension
|
|
20
|
+
#
|
|
21
|
+
# Exit status 3 means the lineage has no certificate.
|
|
22
|
+
|
|
23
|
+
set -euo pipefail
|
|
24
|
+
|
|
25
|
+
OPENSSL=/usr/bin/openssl
|
|
26
|
+
LIVE_DIR=/etc/letsencrypt/live
|
|
27
|
+
|
|
28
|
+
err() {
|
|
29
|
+
printf '%s: %s\n' "lamaste-cert-info" "$1" >&2
|
|
30
|
+
exit 2
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
hostname_re='^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$'
|
|
34
|
+
|
|
35
|
+
[[ $# -eq 2 ]] || err "usage: lamaste-cert-info <lineage> enddate|checkend|san"
|
|
36
|
+
lineage="$1"
|
|
37
|
+
query="$2"
|
|
38
|
+
|
|
39
|
+
if (( ${#lineage} > 253 )) || ! [[ "$lineage" =~ $hostname_re ]]; then
|
|
40
|
+
err "invalid lineage name: $lineage"
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
cert="$LIVE_DIR/$lineage/fullchain.pem"
|
|
44
|
+
if [[ ! -f "$cert" ]]; then
|
|
45
|
+
printf '%s: no certificate for %s\n' "lamaste-cert-info" "$lineage" >&2
|
|
46
|
+
exit 3
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
case "$query" in
|
|
50
|
+
enddate)
|
|
51
|
+
exec "$OPENSSL" x509 -noout -enddate -in "$cert"
|
|
52
|
+
;;
|
|
53
|
+
checkend)
|
|
54
|
+
exec "$OPENSSL" x509 -noout -checkend 86400 -in "$cert"
|
|
55
|
+
;;
|
|
56
|
+
san)
|
|
57
|
+
exec "$OPENSSL" x509 -noout -ext subjectAltName -in "$cert"
|
|
58
|
+
;;
|
|
59
|
+
*)
|
|
60
|
+
err "unknown query: $query"
|
|
61
|
+
;;
|
|
62
|
+
esac
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# lamaste-certbot — root-only wrapper for the Let's Encrypt operations the
|
|
4
|
+
# panel performs.
|
|
5
|
+
#
|
|
6
|
+
# This script is invoked via sudo from the lamaste service user. It replaces
|
|
7
|
+
# sudoers entries of the form
|
|
8
|
+
#
|
|
9
|
+
# lamaste ALL=(root) NOPASSWD: /usr/bin/certbot certonly --nginx -d * --email * ...
|
|
10
|
+
# lamaste ALL=(root) NOPASSWD: /usr/bin/certbot renew --cert-name * --non-interactive
|
|
11
|
+
#
|
|
12
|
+
# A sudoers `*` matches any characters, spaces included, so those rules let the
|
|
13
|
+
# lamaste user append arbitrary certbot flags — `--deploy-hook <cmd>`,
|
|
14
|
+
# `--nginx-ctl <binary>`, `--config-dir <dir>` — and run code as root. Here every
|
|
15
|
+
# argument is validated and certbot is executed with a fixed argument vector.
|
|
16
|
+
#
|
|
17
|
+
# Usage:
|
|
18
|
+
# lamaste-certbot issue <email> <cert-name> <domain> [<domain>...]
|
|
19
|
+
# certbot certonly --nginx --cert-name <cert-name> -d <domain>... \
|
|
20
|
+
# --email <email> --agree-tos --non-interactive
|
|
21
|
+
# lamaste-certbot renew <cert-name> [force] (never with certbot's random delay)
|
|
22
|
+
# lamaste-certbot renew-all
|
|
23
|
+
# lamaste-certbot list
|
|
24
|
+
#
|
|
25
|
+
# Every <domain> and <cert-name> must be a lowercase DNS hostname (no wildcard,
|
|
26
|
+
# no path characters); at most 100 domains, as Let's Encrypt allows.
|
|
27
|
+
|
|
28
|
+
set -euo pipefail
|
|
29
|
+
|
|
30
|
+
CERTBOT=/usr/bin/certbot
|
|
31
|
+
|
|
32
|
+
err() {
|
|
33
|
+
printf '%s: %s\n' "lamaste-certbot" "$1" >&2
|
|
34
|
+
exit 2
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# A DNS hostname: dot-separated labels of [a-z0-9-], each 1-63 chars, not
|
|
38
|
+
# starting or ending with a hyphen, at least two labels, 253 chars at most.
|
|
39
|
+
hostname_re='^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$'
|
|
40
|
+
# Same rule as LETSENCRYPT_EMAIL_REGEX in @lamalibre/lamaste (onboarding rejects
|
|
41
|
+
# anything this refuses). The local part may not start with '-'.
|
|
42
|
+
email_re="^[A-Za-z0-9][A-Za-z0-9._%+'-]{0,63}@([A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?\\.)+([A-Za-z]{2,63}|xn--[A-Za-z0-9-]{1,59})\$"
|
|
43
|
+
|
|
44
|
+
check_hostname() {
|
|
45
|
+
local name="$1"
|
|
46
|
+
if (( ${#name} > 253 )) || ! [[ "$name" =~ $hostname_re ]]; then
|
|
47
|
+
err "invalid hostname: $name"
|
|
48
|
+
fi
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[[ $# -ge 1 ]] || err "usage: lamaste-certbot issue|renew|renew-all|list ..."
|
|
52
|
+
cmd="$1"
|
|
53
|
+
shift
|
|
54
|
+
|
|
55
|
+
case "$cmd" in
|
|
56
|
+
issue)
|
|
57
|
+
[[ $# -ge 3 ]] || err "usage: lamaste-certbot issue <email> <cert-name> <domain>..."
|
|
58
|
+
email="$1"
|
|
59
|
+
cert_name="$2"
|
|
60
|
+
shift 2
|
|
61
|
+
if (( ${#email} > 254 )) || ! [[ "$email" =~ $email_re ]]; then
|
|
62
|
+
err "invalid email address"
|
|
63
|
+
fi
|
|
64
|
+
check_hostname "$cert_name"
|
|
65
|
+
(( $# <= 100 )) || err "too many domains ($#); at most 100"
|
|
66
|
+
domain_args=()
|
|
67
|
+
for domain in "$@"; do
|
|
68
|
+
check_hostname "$domain"
|
|
69
|
+
domain_args+=(-d "$domain")
|
|
70
|
+
done
|
|
71
|
+
exec "$CERTBOT" certonly --nginx --cert-name "$cert_name" "${domain_args[@]}" \
|
|
72
|
+
--email "$email" --agree-tos --non-interactive
|
|
73
|
+
;;
|
|
74
|
+
renew)
|
|
75
|
+
[[ $# -ge 1 && $# -le 2 ]] || err "usage: lamaste-certbot renew <cert-name> [force]"
|
|
76
|
+
check_hostname "$1"
|
|
77
|
+
# A non-interactive renew otherwise sleeps up to ~8 minutes first (meant
|
|
78
|
+
# for certbot.timer); the panel runs these while an operator waits.
|
|
79
|
+
if [[ $# -eq 2 ]]; then
|
|
80
|
+
[[ "$2" == "force" ]] || err "the only renew option is 'force'"
|
|
81
|
+
exec "$CERTBOT" renew --cert-name "$1" --force-renewal --no-random-sleep-on-renew --non-interactive
|
|
82
|
+
fi
|
|
83
|
+
exec "$CERTBOT" renew --cert-name "$1" --no-random-sleep-on-renew --non-interactive
|
|
84
|
+
;;
|
|
85
|
+
renew-all)
|
|
86
|
+
[[ $# -eq 0 ]] || err "renew-all takes no arguments"
|
|
87
|
+
exec "$CERTBOT" renew --no-random-sleep-on-renew --non-interactive
|
|
88
|
+
;;
|
|
89
|
+
list)
|
|
90
|
+
[[ $# -eq 0 ]] || err "list takes no arguments"
|
|
91
|
+
exec "$CERTBOT" certificates --non-interactive
|
|
92
|
+
;;
|
|
93
|
+
*)
|
|
94
|
+
err "unknown command: $cmd"
|
|
95
|
+
;;
|
|
96
|
+
esac
|