mirror of
https://github.com/Alvin-Zilverstand/nginx-proxy-manager.git
synced 2026-11-21 13:52:59 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cd8b57a3c | ||
|
|
2cfd3395cf | ||
|
|
c41ec008bb | ||
|
|
900bb1e480 | ||
|
|
633b653f79 | ||
|
|
58566c9d75 | ||
|
|
c53f52ab51 | ||
|
|
9445038b36 | ||
|
|
b1e0473a19 | ||
|
|
95f1b74757 | ||
|
|
8509e1b378 | ||
|
|
5f35e4916f | ||
|
|
da12ee5b0c | ||
|
|
61af8e23d8 | ||
|
|
c4e421e679 | ||
|
|
1e18bf9212 | ||
|
|
af1d4dd60f | ||
|
|
f47d85da9e | ||
|
|
ee33ecdfc2 | ||
|
|
f48c3e583a | ||
|
|
a1713b79e8 | ||
|
|
4282d6c6e9 | ||
|
|
50144205a0 | ||
|
|
73f784ea95 | ||
|
|
c8fe9abe38 | ||
|
|
1cb352847a | ||
|
|
d11e0f6c51 | ||
|
|
9ad799c13f | ||
|
|
5d0be3a5d5 | ||
|
|
735149210e | ||
|
|
dba90c36be | ||
|
|
0e152e8afe | ||
|
|
f2b1711549 | ||
|
|
568c105945 | ||
|
|
3105a23834 | ||
|
|
803f4968a2 | ||
|
|
d8488048ca | ||
|
|
0596581ec9 | ||
|
|
58605cbc70 | ||
|
|
280fcde528 | ||
|
|
c70fcb9f7c | ||
|
|
f477946bd9 | ||
|
|
18f1fe22b1 | ||
|
|
9fc56a2209 | ||
|
|
37b19d892c | ||
|
|
17f126482f | ||
|
|
81ec7e8d6a | ||
|
|
dd45ad8f51 | ||
|
|
33250a0e38 | ||
|
|
2070fd186a | ||
|
|
e4585ac688 | ||
|
|
1ffe3609f4 | ||
|
|
24b072a120 | ||
|
|
e482522792 | ||
|
|
23b4e7d6f7 | ||
|
|
a2d427902a | ||
|
|
05b867c21d | ||
|
|
ebbd262e06 | ||
|
|
5e6c53f0e2 | ||
|
|
baa5683bba | ||
|
|
386a166025 | ||
|
|
f7a696cf08 | ||
|
|
ec65105db2 | ||
|
|
aa211ea423 | ||
|
|
cd4448ebef | ||
|
|
e2546bfb51 | ||
|
|
c19182d978 | ||
|
|
1cbfe370ec | ||
|
|
6c2a57ad83 | ||
|
|
210366cca0 | ||
|
|
b75b0adaf2 | ||
|
|
918728fcac | ||
|
|
0453ddca35 | ||
|
|
a570c0e503 | ||
|
|
6383017b4c | ||
|
|
3f2cd26913 | ||
|
|
ece5dea0ad | ||
|
|
a75eb467ca | ||
|
|
708ea5cfbb | ||
|
|
d77d5c643d | ||
|
|
934a3fafe5 | ||
|
|
08b4bbdbd4 | ||
|
|
a7677c18c3 | ||
|
|
1d894f8ed1 | ||
|
|
7cde02c446 | ||
|
|
190b7a606d | ||
|
|
61e74cbb7f | ||
|
|
ba8117fbcf | ||
|
|
5e7fea7d56 | ||
|
|
4f1d309a90 | ||
|
|
58ff491dc0 | ||
|
|
85ee5e2200 | ||
|
|
09300941af | ||
|
|
c4fa8daa87 | ||
|
|
3d800c7138 | ||
|
|
2ed0c47de8 | ||
|
|
4d30946d2f | ||
|
|
a5e49a53c0 | ||
|
|
41539c027f | ||
|
|
046d3e022f | ||
|
|
c98b1685bd | ||
|
|
b7772016ba | ||
|
|
29687987b2 | ||
|
|
ab893706da | ||
|
|
246c54503e | ||
|
|
4ecb047299 | ||
|
|
4e2b052b50 | ||
|
|
ce4e35a3d4 | ||
|
|
4cbeecaad2 | ||
|
|
fc8b1eb1fb | ||
|
|
d64d9a8ab2 | ||
|
|
70f00d60be | ||
|
|
f43ef16fb5 | ||
|
|
35ad8227d7 | ||
|
|
4a0f212289 | ||
|
|
ab96d78f4d | ||
|
|
a42614094f | ||
|
|
2cd346d054 | ||
|
|
20b8068aaa | ||
|
|
9aa7fd5722 | ||
|
|
553f879c06 | ||
|
|
cbf2782571 | ||
|
|
a62c2a6dc3 | ||
|
|
a5db5ed156 | ||
|
|
101595b90b | ||
|
|
45a3659ffd | ||
|
|
a457fe4d96 | ||
|
|
33ef7c859e | ||
|
|
bfa2dca1b1 | ||
|
|
32fc268edf | ||
|
|
300d0653e0 | ||
|
|
06f060dc0f | ||
|
|
7e447acfcc | ||
|
|
acd26d7adb | ||
|
|
1f5a56d0bd | ||
|
|
258b522725 | ||
|
|
179c27e382 | ||
|
|
94176d2f9c | ||
|
|
76f09db610 | ||
|
|
d51602b150 | ||
|
|
af2de98c41 | ||
|
|
6311329772 | ||
|
|
a08f821c54 | ||
|
|
fc4a409292 | ||
|
|
62ed330053 | ||
|
|
0d832092a5 | ||
|
|
6629abed32 | ||
|
|
52a7b7dca1 | ||
|
|
8e042ba79f | ||
|
|
79a4128b78 | ||
|
|
fc1adb64a3 | ||
|
|
a6b7a7dd9d | ||
|
|
dc2c05aeb3 | ||
|
|
0c15125830 | ||
|
|
e48695401e | ||
|
|
7211bf3500 | ||
|
|
f7516304cb | ||
|
|
a89410ddd7 | ||
|
|
d08f1498c7 | ||
|
|
e703a9adc4 | ||
|
|
5fd8a30508 | ||
|
|
b7ca25a574 | ||
|
|
063950cbb4 | ||
|
|
f7d72e7cc5 | ||
|
|
f2e8ab5202 | ||
|
|
6bb9a90103 | ||
|
|
79a0deedf7 | ||
|
|
a47d401d86 | ||
|
|
33bf6d412d | ||
|
|
c94cbb235b | ||
|
|
553a69a9ef | ||
|
|
7e9cc32f97 | ||
|
|
03c70e3902 | ||
|
|
c354238c35 | ||
|
|
dff978a63c | ||
|
|
11955e5dff | ||
|
|
f53bf88f4d | ||
|
|
ee1f7ba551 | ||
|
|
586dfd36a9 | ||
|
|
8b256c33e9 | ||
|
|
2bf9e9b213 | ||
|
|
7330d0441c | ||
|
|
84886383a7 | ||
|
|
1e22574000 | ||
|
|
32a74d9781 | ||
|
|
aa66badcd8 | ||
|
|
840a720d09 | ||
|
|
ef0ec0b188 | ||
|
|
387f8d9424 | ||
|
|
6008a666dd | ||
|
|
52c32b473d | ||
|
|
43e0911ce4 | ||
|
|
0242187db0 | ||
|
|
f6a9c5865b | ||
|
|
ba2f714b55 | ||
|
|
cd32dbdc4d | ||
|
|
ebcd2a209c | ||
|
|
2a6d0d8b32 | ||
|
|
661b1005ee | ||
|
|
d099b00463 | ||
|
|
2da9e0330b | ||
|
|
9875a7650d | ||
|
|
6694df668e | ||
|
|
6aa629864f | ||
|
|
d3ba40e066 | ||
|
|
868d0b08ad | ||
|
|
31500c225d | ||
|
|
13cfa340de | ||
|
|
673082ab5b | ||
|
|
70538af311 | ||
|
|
a38fb8d311 | ||
|
|
c8e6010ac3 | ||
|
|
5fafeff7c0 | ||
|
|
edb56c285f | ||
|
|
ce55f8ebcd | ||
|
|
f4e37dff1f | ||
|
|
982c16a86d | ||
|
|
5dbfd63477 | ||
|
|
f2e3a3dd81 | ||
|
|
5af25c2d9c | ||
|
|
f8fca5bd19 | ||
|
|
0703c6589b | ||
|
|
b29bc1a66e | ||
|
|
9bb4476366 | ||
|
|
a68f993571 | ||
|
|
ea4604ffa4 | ||
|
|
9cb9512bfa | ||
|
|
7bb34a7273 | ||
|
|
6719cfc6a0 | ||
|
|
b5a26574ec | ||
|
|
a0fb4510f7 | ||
|
|
dc5e71f28c | ||
|
|
0173dd6b49 | ||
|
|
980097683f | ||
|
|
e49af3cc87 | ||
|
|
2fe460557a | ||
|
|
f06c53330a | ||
|
|
6ed6210a7b | ||
|
|
dad08083c6 | ||
|
|
8b24059e3b | ||
|
|
6537fb248e | ||
|
|
738afde96e | ||
|
|
dc84b4b94b | ||
|
|
41c32ebf0a | ||
|
|
04b43d072c | ||
|
|
7d58c579fa | ||
|
|
c17475968f | ||
|
|
18b3404f46 | ||
|
|
b66fd9d3ae | ||
|
|
c869d5a42b | ||
|
|
ff066d5626 | ||
|
|
a6f8b7dd1d | ||
|
|
f7c2219680 | ||
|
|
1ad78af5a0 | ||
|
|
46bf3274d8 | ||
|
|
26a2bcab42 | ||
|
|
cea69e4ba5 | ||
|
|
69d94b4a53 | ||
|
|
218e32bf15 | ||
|
|
a03c47932e | ||
|
|
871787ac95 | ||
|
|
d161b944b1 | ||
|
|
82a326ea0b | ||
|
|
986c4cae6c | ||
|
|
65b905789f | ||
|
|
7cfac7354d | ||
|
|
34374cbe09 | ||
|
|
1635e512c7 | ||
|
|
40f39a7f19 | ||
|
|
1b782997ef | ||
|
|
cafb614b80 | ||
|
|
9e4c92a066 | ||
|
|
10e33b39d7 | ||
|
|
d88f0b2618 | ||
|
|
4a9ad2baf7 | ||
|
|
15896132ff | ||
|
|
604b32ffbf | ||
|
|
eb67b3bfb6 | ||
|
|
f1e95c9c52 | ||
|
|
d6e1d15996 | ||
|
|
99886f3111 | ||
|
|
6b2d9a77a3 | ||
|
|
d37ab95ed8 | ||
|
|
18fc3fe770 | ||
|
|
e869518dd1 | ||
|
|
37712ba2a4 | ||
|
|
a714b41fd6 | ||
|
|
b87bedc347 | ||
|
|
a62068275d | ||
|
|
cbcbd95812 | ||
|
|
278b1c92b3 | ||
|
|
c1d09eaceb | ||
|
|
9c509f30de | ||
|
|
c85b11ee33 | ||
|
|
cd5ef390b9 | ||
|
|
d49cab1c0e | ||
|
|
dea7007802 | ||
|
|
7e5f8d824b | ||
|
|
33b1a993ec | ||
|
|
67d40e186f | ||
|
|
52be66c43e | ||
|
|
ec46cabcd4 | ||
|
|
a7a9cc3acb | ||
|
|
020b3ebb33 | ||
|
|
c1c4baf389 | ||
|
|
672b5d6dd9 | ||
|
|
cd230b5878 | ||
|
|
a8f35062af | ||
|
|
da5955412d | ||
|
|
adb27fe67d | ||
|
|
d874af8692 | ||
|
|
0844dade98 | ||
|
|
71d59516e8 | ||
|
|
06e220e184 | ||
|
|
dc53647e76 | ||
|
|
4c04e89483 | ||
|
|
7241869a9e | ||
|
|
94f6191a21 | ||
|
|
cac52dd0ff | ||
|
|
906f177960 | ||
|
|
f52afced5d | ||
|
|
e8224ff0af | ||
|
|
a4fa83d0ce | ||
|
|
770716ebf8 | ||
|
|
f1067d3308 | ||
|
|
85c1a935ea | ||
|
|
51ef7f3b86 | ||
|
|
846b94f7e8 | ||
|
|
19e24c7e7e | ||
|
|
c1bc471dac | ||
|
|
608dc0b6bf | ||
|
|
0dbf268f37 | ||
|
|
e72dfc3bfd |
No files matched your search
@@ -0,0 +1,31 @@
|
|||||||
|
<!-- WARNING: Any PR without a description will be closed. The title is not enough! -->
|
||||||
|
|
||||||
|
<!-- ANOTHER WARNING: Don't go creating a duplicate PR! Check that someone hasn't already created something that tackles your fix and if so, help them first -->
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
<!-- Provide a brief description of WHY you are making your changes -->
|
||||||
|
|
||||||
|
<!-- Consider if you are changing the API, then go in to detail why and/or if
|
||||||
|
you change will break API for existing users -->
|
||||||
|
|
||||||
|
## Type of Change
|
||||||
|
|
||||||
|
<!-- Mark the relevant options with an "x" -->
|
||||||
|
|
||||||
|
- [ ] Bug fix (non-breaking change that fixes an issue)
|
||||||
|
- [ ] New feature (non-breaking change that adds functionality)
|
||||||
|
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
||||||
|
- [ ] Documentation update
|
||||||
|
- [ ] Code refactoring
|
||||||
|
- [ ] API changes
|
||||||
|
- [ ] Performance improvement
|
||||||
|
- [ ] Test addition or update
|
||||||
|
|
||||||
|
## AI Usage
|
||||||
|
|
||||||
|
<!-- Mark the relevant options with an "x" -->
|
||||||
|
|
||||||
|
- [ ] AI was used to write this
|
||||||
|
- [ ] AI was used to review this
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ jobs:
|
|||||||
stale:
|
stale:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v10
|
- uses: actions/stale@v11
|
||||||
with:
|
with:
|
||||||
stale-issue-label: 'stale'
|
stale-issue-label: 'stale'
|
||||||
stale-pr-label: 'stale'
|
stale-pr-label: 'stale'
|
||||||
|
|||||||
@@ -8,3 +8,5 @@ test/node_modules
|
|||||||
*/node_modules
|
*/node_modules
|
||||||
docker/dev/dnsrouter-config.json.tmp
|
docker/dev/dnsrouter-config.json.tmp
|
||||||
docker/dev/resolv.conf
|
docker/dev/resolv.conf
|
||||||
|
.claude
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://nginxproxymanager.com/github.png">
|
<img src="https://nginxproxymanager.com/github.png">
|
||||||
<br><br>
|
<br><br>
|
||||||
<img src="https://img.shields.io/badge/version-2.14.0-green.svg?style=for-the-badge">
|
<img src="https://img.shields.io/badge/version-2.16.0-green.svg?style=for-the-badge">
|
||||||
<a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
|
<a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
|
||||||
<img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
|
<img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
|
||||||
</a>
|
</a>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
This project comes as a pre-built docker image that enables you to easily forward to your websites
|
This project comes as a pre-built Docker image that enables you to easily forward to your websites
|
||||||
running at home or otherwise, including free SSL, without having to know too much about Nginx or Letsencrypt.
|
running at home or otherwise, including free SSL, without having to know too much about Nginx or Letsencrypt.
|
||||||
|
|
||||||
- [Quick Setup](#quick-setup)
|
- [Quick Setup](#quick-setup)
|
||||||
@@ -20,9 +20,9 @@ running at home or otherwise, including free SSL, without having to know too muc
|
|||||||
## Project Goal
|
## Project Goal
|
||||||
|
|
||||||
I created this project to fill a personal need to provide users with an easy way to accomplish reverse
|
I created this project to fill a personal need to provide users with an easy way to accomplish reverse
|
||||||
proxying hosts with SSL termination and it had to be so easy that a monkey could do it. This goal hasn't changed.
|
proxying hosts with SSL termination, and it had to be so easy that a monkey could do it. This goal hasn't changed.
|
||||||
While there might be advanced options they are optional and the project should be as simple as possible
|
While there might be advanced options, they are optional, and the project should be as simple as possible
|
||||||
so that the barrier for entry here is low.
|
so that the barrier to entry here is low.
|
||||||
|
|
||||||
<a href="https://www.buymeacoffee.com/jc21" target="_blank"><img src="http://public.jc21.com/github/by-me-a-coffee.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>
|
<a href="https://www.buymeacoffee.com/jc21" target="_blank"><img src="http://public.jc21.com/github/by-me-a-coffee.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>
|
||||||
|
|
||||||
@@ -30,11 +30,11 @@ so that the barrier for entry here is low.
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Beautiful and Secure Admin Interface based on [Tabler](https://tabler.github.io/)
|
- Beautiful and Secure Admin Interface based on [Tabler](https://tabler.github.io/)
|
||||||
- Easily create forwarding domains, redirections, streams and 404 hosts without knowing anything about Nginx
|
- Easily create forwarding domains, redirections, streams, and 404 hosts without knowing anything about Nginx
|
||||||
- Free SSL using Let's Encrypt or provide your own custom SSL certificates
|
- Free SSL using Let's Encrypt or provide your own custom SSL certificates
|
||||||
- Access Lists and basic HTTP Authentication for your hosts
|
- Access Lists and basic HTTP Authentication for your hosts
|
||||||
- Advanced Nginx configuration available for super users
|
- Advanced Nginx configuration available for super users
|
||||||
- User management, permissions and audit log
|
- User management, permissions, and audit log
|
||||||
|
|
||||||
::: warning
|
::: warning
|
||||||
`armv7` is no longer supported in version 2.14+. This is due to Nodejs dropping support for armhf. Please
|
`armv7` is no longer supported in version 2.14+. This is due to Nodejs dropping support for armhf. Please
|
||||||
@@ -43,15 +43,15 @@ use the `2.13.7` image tag if this applies to you.
|
|||||||
|
|
||||||
## Hosting your home network
|
## Hosting your home network
|
||||||
|
|
||||||
I won't go in to too much detail here but here are the basics for someone new to this self-hosted world.
|
I won't go into too much detail here, but here are the basics for someone new to this self-hosted world.
|
||||||
|
|
||||||
1. Your home router will have a Port Forwarding section somewhere. Log in and find it
|
1. Your home router will have a Port Forwarding section somewhere. Log in and find it
|
||||||
2. Add port forwarding for port 80 and 443 to the server hosting this project
|
2. Add port forwarding for ports 80 and 443 to the server hosting this project
|
||||||
3. Configure your domain name details to point to your home, either with a static ip or a service like
|
3. Configure your domain name details to point to your home, either with a static ip or a service like
|
||||||
- DuckDNS
|
- DuckDNS
|
||||||
- [Amazon Route53](https://github.com/jc21/route53-ddns)
|
- [Amazon Route53](https://github.com/jc21/route53-ddns)
|
||||||
- [Cloudflare](https://github.com/jc21/cloudflare-ddns)
|
- [Cloudflare](https://github.com/jc21/cloudflare-ddns)
|
||||||
4. Use the Nginx Proxy Manager as your gateway to forward to your other web based services
|
4. Use the Nginx Proxy Manager as your gateway to forward to your other web-based services
|
||||||
|
|
||||||
## Quick Setup
|
## Quick Setup
|
||||||
|
|
||||||
|
|||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
Only the latest stable release receives security updates.
|
||||||
|
Older versions are not actively maintained.
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| ------- | --------- |
|
||||||
|
| 2.16.x (latest) | :white_check_mark: |
|
||||||
|
| < 2.16.0 | :x: |
|
||||||
|
|
||||||
|
Docker images: `jc21/nginx-proxy-manager:latest`, `jc21/nginx-proxy-manager:2`
|
||||||
|
|
||||||
|
See all releases: https://github.com/NginxProxyManager/nginx-proxy-manager/releases
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
**Do NOT open a public GitHub Issue to report a security vulnerability.**
|
||||||
|
|
||||||
|
Use GitHub's private vulnerability reporting:
|
||||||
|
https://github.com/NginxProxyManager/nginx-proxy-manager/security/advisories/new
|
||||||
|
|
||||||
|
Please include:
|
||||||
|
- Affected version (Docker image tag or release)
|
||||||
|
- Description of the vulnerability
|
||||||
|
- Steps to reproduce
|
||||||
|
- Potential impact
|
||||||
|
|
||||||
|
Once a fix is available, a public GitHub Security Advisory will be published.
|
||||||
+1
-1
@@ -62,7 +62,7 @@ app.use("/", mainRoutes);
|
|||||||
app.use((err, req, res, _) => {
|
app.use((err, req, res, _) => {
|
||||||
const payload = {
|
const payload = {
|
||||||
error: {
|
error: {
|
||||||
code: err.status,
|
code: err.status || 500,
|
||||||
message: err.public ? err.message : "Internal Error",
|
message: err.public ? err.message : "Internal Error",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
+7
-24
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/2.3.14/schema.json",
|
"$schema": "https://biomejs.dev/schemas/2.5.10/schema.json",
|
||||||
"vcs": {
|
"vcs": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"clientKind": "git",
|
"clientKind": "git",
|
||||||
@@ -7,13 +7,7 @@
|
|||||||
},
|
},
|
||||||
"files": {
|
"files": {
|
||||||
"ignoreUnknown": false,
|
"ignoreUnknown": false,
|
||||||
"includes": [
|
"includes": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "!**/dist/**/*"]
|
||||||
"**/*.ts",
|
|
||||||
"**/*.tsx",
|
|
||||||
"**/*.js",
|
|
||||||
"**/*.jsx",
|
|
||||||
"!**/dist/**/*"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"formatter": {
|
"formatter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
@@ -31,24 +25,13 @@
|
|||||||
"groups": [
|
"groups": [
|
||||||
":BUN:",
|
":BUN:",
|
||||||
":NODE:",
|
":NODE:",
|
||||||
[
|
["npm:*", "npm:*/**"],
|
||||||
"npm:*",
|
|
||||||
"npm:*/**"
|
|
||||||
],
|
|
||||||
":PACKAGE_WITH_PROTOCOL:",
|
":PACKAGE_WITH_PROTOCOL:",
|
||||||
":URL:",
|
":URL:",
|
||||||
":PACKAGE:",
|
":PACKAGE:",
|
||||||
[
|
["/src/*", "/src/**"],
|
||||||
"/src/*",
|
["/**"],
|
||||||
"/src/**"
|
["#*", "#*/**"],
|
||||||
],
|
|
||||||
[
|
|
||||||
"/**"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"#*",
|
|
||||||
"#*/**"
|
|
||||||
],
|
|
||||||
":PATH:"
|
":PATH:"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -59,7 +42,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"rules": {
|
"rules": {
|
||||||
"recommended": true,
|
"preset": "recommended",
|
||||||
"correctness": {
|
"correctness": {
|
||||||
"useUniqueElementIds": "off"
|
"useUniqueElementIds": "off"
|
||||||
},
|
},
|
||||||
|
|||||||
+587
-539
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -24,7 +24,7 @@ const generateDbConfig = () => {
|
|||||||
password: cfg.password,
|
password: cfg.password,
|
||||||
database: cfg.name,
|
database: cfg.name,
|
||||||
port: cfg.port,
|
port: cfg.port,
|
||||||
...(cfg.ssl ? { ssl: cfg.ssl } : {})
|
...(cfg.ssl ? { ssl: cfg.ssl } : {}),
|
||||||
},
|
},
|
||||||
migrations: {
|
migrations: {
|
||||||
tableName: "migrations",
|
tableName: "migrations",
|
||||||
@@ -37,6 +37,6 @@ const getInstance = () => {
|
|||||||
instance = knex(generateDbConfig());
|
instance = knex(generateDbConfig());
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default getInstance;
|
export default getInstance;
|
||||||
@@ -288,11 +288,7 @@ const internal2fa = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getUserPasswordAuth: async (userId) => {
|
getUserPasswordAuth: async (userId) => {
|
||||||
const auth = await authModel
|
const auth = await authModel.query().where("user_id", userId).andWhere("type", "password").first();
|
||||||
.query()
|
|
||||||
.where("user_id", userId)
|
|
||||||
.andWhere("type", "password")
|
|
||||||
.first();
|
|
||||||
|
|
||||||
if (!auth) {
|
if (!auth) {
|
||||||
throw new errs.ItemNotFoundError("Auth not found");
|
throw new errs.ItemNotFoundError("Auth not found");
|
||||||
|
|||||||
+110
-63
@@ -2,7 +2,9 @@ import fs from "node:fs";
|
|||||||
import batchflow from "batchflow";
|
import batchflow from "batchflow";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import errs from "../lib/error.js";
|
import errs from "../lib/error.js";
|
||||||
|
import { isMysql, isPostgres } from "../lib/config.js";
|
||||||
import utils from "../lib/utils.js";
|
import utils from "../lib/utils.js";
|
||||||
|
import db from "../db.js";
|
||||||
import { access as logger } from "../logger.js";
|
import { access as logger } from "../logger.js";
|
||||||
import accessListModel from "../models/access_list.js";
|
import accessListModel from "../models/access_list.js";
|
||||||
import accessListAuthModel from "../models/access_list_auth.js";
|
import accessListAuthModel from "../models/access_list_auth.js";
|
||||||
@@ -15,6 +17,38 @@ const omissions = () => {
|
|||||||
return ["is_deleted"];
|
return ["is_deleted"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find proxy hosts that reference an access list in their locations JSON.
|
||||||
|
*
|
||||||
|
* @param {Integer} accessListId
|
||||||
|
* @returns {Promise<Array>}
|
||||||
|
*/
|
||||||
|
const getProxyHostsUsingAccessListInLocations = async (accessListId) => {
|
||||||
|
let result;
|
||||||
|
if (isMysql()) {
|
||||||
|
const searchObj = JSON.stringify([{ access_list_id: accessListId }]);
|
||||||
|
result = await db().raw(
|
||||||
|
"SELECT id FROM proxy_host WHERE is_deleted = 0 AND JSON_CONTAINS(locations, ?, ?)",
|
||||||
|
[searchObj, "$"],
|
||||||
|
);
|
||||||
|
} else if (isPostgres()) {
|
||||||
|
result = await db().raw(
|
||||||
|
"SELECT id FROM proxy_host WHERE is_deleted = 0 AND locations::jsonb @> ?::jsonb",
|
||||||
|
[JSON.stringify([{ access_list_id: accessListId }])],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
result = await db().raw(
|
||||||
|
"SELECT id FROM proxy_host WHERE is_deleted = 0 AND locations LIKE ?",
|
||||||
|
[`%"access_list_id":${accessListId}%`],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// knex raw() returns [rows, metadata] for MySQL, { rows } for Postgres and rows for SQLite
|
||||||
|
if (!Array.isArray(result)) {
|
||||||
|
return result?.rows || [];
|
||||||
|
}
|
||||||
|
return (Array.isArray(result[0]) ? result[0] : result) || [];
|
||||||
|
};
|
||||||
|
|
||||||
const internalAccessList = {
|
const internalAccessList = {
|
||||||
/**
|
/**
|
||||||
* @param {Access} access
|
* @param {Access} access
|
||||||
@@ -48,19 +82,16 @@ const internalAccessList = {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await Promise.all(promises);
|
||||||
|
|
||||||
// Clients
|
// Clients
|
||||||
data.clients?.map((client) => {
|
for (const client of data.clients ?? []) {
|
||||||
promises.push(
|
await accessListClientModel.query().insert({
|
||||||
accessListClientModel.query().insert({
|
|
||||||
access_list_id: row.id,
|
access_list_id: row.id,
|
||||||
address: client.address,
|
address: client.address,
|
||||||
directive: client.directive,
|
directive: client.directive,
|
||||||
}),
|
|
||||||
);
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
await Promise.all(promises);
|
|
||||||
|
|
||||||
// re-fetch with expansions
|
// re-fetch with expansions
|
||||||
const freshRow = await internalAccessList.get(
|
const freshRow = await internalAccessList.get(
|
||||||
@@ -69,7 +100,7 @@ const internalAccessList = {
|
|||||||
id: data.id,
|
id: data.id,
|
||||||
expand: ["owner", "items", "clients", "proxy_hosts.access_list.[clients,items]"],
|
expand: ["owner", "items", "clients", "proxy_hosts.access_list.[clients,items]"],
|
||||||
},
|
},
|
||||||
true // skip masking
|
true, // skip masking
|
||||||
);
|
);
|
||||||
|
|
||||||
// Audit log
|
// Audit log
|
||||||
@@ -154,25 +185,17 @@ const internalAccessList = {
|
|||||||
|
|
||||||
// Check for clients and add/update/remove them
|
// Check for clients and add/update/remove them
|
||||||
if (typeof data.clients !== "undefined" && data.clients) {
|
if (typeof data.clients !== "undefined" && data.clients) {
|
||||||
const clientPromises = [];
|
const query = accessListClientModel.query().delete().where("access_list_id", data.id);
|
||||||
data.clients.map((client) => {
|
await query;
|
||||||
|
|
||||||
|
for (const client of data.clients) {
|
||||||
if (client.address) {
|
if (client.address) {
|
||||||
clientPromises.push(
|
await accessListClientModel.query().insert({
|
||||||
accessListClientModel.query().insert({
|
|
||||||
access_list_id: data.id,
|
access_list_id: data.id,
|
||||||
address: client.address,
|
address: client.address,
|
||||||
directive: client.directive,
|
directive: client.directive,
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
const query = accessListClientModel.query().delete().where("access_list_id", data.id);
|
|
||||||
await query;
|
|
||||||
// Add new clitens
|
|
||||||
if (clientPromises.length) {
|
|
||||||
await Promise.all(clientPromises);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,13 +214,31 @@ const internalAccessList = {
|
|||||||
id: data.id,
|
id: data.id,
|
||||||
expand: ["owner", "items", "clients", "proxy_hosts.[certificate,access_list.[clients,items]]"],
|
expand: ["owner", "items", "clients", "proxy_hosts.[certificate,access_list.[clients,items]]"],
|
||||||
},
|
},
|
||||||
true // skip masking
|
true, // skip masking
|
||||||
);
|
);
|
||||||
|
|
||||||
await internalAccessList.build(freshRow)
|
await internalAccessList.build(freshRow);
|
||||||
if (Number.parseInt(freshRow.proxy_host_count, 10)) {
|
if (Number.parseInt(freshRow.proxy_host_count, 10)) {
|
||||||
await internalNginx.bulkGenerateConfigs("proxy_host", freshRow.proxy_hosts);
|
await internalNginx.bulkGenerateConfigs("proxy_host", freshRow.proxy_hosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Also regenerate configs for proxy hosts that reference this access list in their locations
|
||||||
|
const locationHostRows = await getProxyHostsUsingAccessListInLocations(data.id);
|
||||||
|
if (locationHostRows?.length) {
|
||||||
|
const locationHostIds = locationHostRows.map((r) => r.id).filter((id) => {
|
||||||
|
// Exclude hosts already regenerated above
|
||||||
|
return !freshRow.proxy_hosts?.find((h) => h.id === id);
|
||||||
|
});
|
||||||
|
if (locationHostIds.length) {
|
||||||
|
const locationHosts = await proxyHostModel.query()
|
||||||
|
.where("is_deleted", 0)
|
||||||
|
.whereIn("id", locationHostIds)
|
||||||
|
.allowGraph(proxyHostModel.defaultAllowGraph)
|
||||||
|
.withGraphFetched("[owner, certificate, access_list.[clients,items]]");
|
||||||
|
await internalNginx.bulkGenerateConfigs("proxy_host", locationHosts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await internalNginx.reload();
|
await internalNginx.reload();
|
||||||
return internalAccessList.maskItems(freshRow);
|
return internalAccessList.maskItems(freshRow);
|
||||||
},
|
},
|
||||||
@@ -213,17 +254,13 @@ const internalAccessList = {
|
|||||||
*/
|
*/
|
||||||
get: async (access, data, skipMasking) => {
|
get: async (access, data, skipMasking) => {
|
||||||
const thisData = data || {};
|
const thisData = data || {};
|
||||||
const accessData = await access.can("access_lists:get", thisData.id)
|
const accessData = await access.can("access_lists:get", thisData.id);
|
||||||
|
|
||||||
const query = accessListModel
|
const query = accessListModel
|
||||||
.query()
|
.query()
|
||||||
.select("access_list.*", accessListModel.raw("COUNT(proxy_host.id) as proxy_host_count"))
|
.select("access_list.*", accessListModel.raw("COUNT(proxy_host.id) as proxy_host_count"))
|
||||||
.leftJoin("proxy_host", function () {
|
.leftJoin("proxy_host", function () {
|
||||||
this.on("proxy_host.access_list_id", "=", "access_list.id").andOn(
|
this.on("proxy_host.access_list_id", "=", "access_list.id").andOn("proxy_host.is_deleted", "=", 0);
|
||||||
"proxy_host.is_deleted",
|
|
||||||
"=",
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.where("access_list.is_deleted", 0)
|
.where("access_list.is_deleted", 0)
|
||||||
.andWhere("access_list.id", thisData.id)
|
.andWhere("access_list.id", thisData.id)
|
||||||
@@ -241,7 +278,7 @@ const internalAccessList = {
|
|||||||
|
|
||||||
let row = await query.then(utils.omitRow(omissions()));
|
let row = await query.then(utils.omitRow(omissions()));
|
||||||
|
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(thisData.id);
|
throw new errs.ItemNotFoundError(thisData.id);
|
||||||
}
|
}
|
||||||
if (!skipMasking && typeof row.items !== "undefined" && row.items) {
|
if (!skipMasking && typeof row.items !== "undefined" && row.items) {
|
||||||
@@ -268,7 +305,7 @@ const internalAccessList = {
|
|||||||
expand: ["proxy_hosts", "items", "clients"],
|
expand: ["proxy_hosts", "items", "clients"],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,28 +315,41 @@ const internalAccessList = {
|
|||||||
// 4. audit log
|
// 4. audit log
|
||||||
|
|
||||||
// 1. update row to be deleted
|
// 1. update row to be deleted
|
||||||
await accessListModel
|
await accessListModel.query().where("id", row.id).patch({
|
||||||
.query()
|
|
||||||
.where("id", row.id)
|
|
||||||
.patch({
|
|
||||||
is_deleted: 1,
|
is_deleted: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 2. update any proxy hosts that were using it (ignoring permissions)
|
// 2. update any proxy hosts that were using it (ignoring permissions)
|
||||||
if (row.proxy_hosts) {
|
const affectedHostIds = new Set((row.proxy_hosts || []).map((h) => h.id));
|
||||||
await proxyHostModel
|
if (affectedHostIds.size) {
|
||||||
.query()
|
await proxyHostModel.query().where("access_list_id", "=", row.id).patch({ access_list_id: 0 });
|
||||||
.where("access_list_id", "=", row.id)
|
}
|
||||||
.patch({ access_list_id: 0 });
|
|
||||||
|
|
||||||
// 3. reconfigure those hosts, then reload nginx
|
// Also clear it from any proxy host locations using it, these will then inherit the host's access list
|
||||||
// set the access_list_id to zero for these items
|
const locationHostRows = await getProxyHostsUsingAccessListInLocations(row.id);
|
||||||
row.proxy_hosts.map((_val, idx) => {
|
for (const { id: hostId } of locationHostRows) {
|
||||||
row.proxy_hosts[idx].access_list_id = 0;
|
const host = await proxyHostModel.query().where("id", hostId).first();
|
||||||
return true;
|
if (host?.locations?.some((loc) => loc.access_list_id === row.id)) {
|
||||||
|
const updatedLocations = host.locations.map((loc) => {
|
||||||
|
if (loc.access_list_id === row.id) {
|
||||||
|
return { ...loc, access_list_id: 0 };
|
||||||
|
}
|
||||||
|
return loc;
|
||||||
});
|
});
|
||||||
|
await proxyHostModel.query().where("id", hostId).patch({ locations: updatedLocations });
|
||||||
|
affectedHostIds.add(hostId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await internalNginx.bulkGenerateConfigs("proxy_host", row.proxy_hosts);
|
// 3. reconfigure those hosts from fresh rows, then reload nginx
|
||||||
|
if (affectedHostIds.size) {
|
||||||
|
const affectedHosts = await proxyHostModel
|
||||||
|
.query()
|
||||||
|
.where("is_deleted", 0)
|
||||||
|
.whereIn("id", [...affectedHostIds])
|
||||||
|
.allowGraph(proxyHostModel.defaultAllowGraph)
|
||||||
|
.withGraphFetched("[owner, certificate, access_list.[clients,items]]");
|
||||||
|
await internalNginx.bulkGenerateConfigs("proxy_host", affectedHosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
await internalNginx.reload();
|
await internalNginx.reload();
|
||||||
@@ -336,11 +386,7 @@ const internalAccessList = {
|
|||||||
.query()
|
.query()
|
||||||
.select("access_list.*", accessListModel.raw("COUNT(proxy_host.id) as proxy_host_count"))
|
.select("access_list.*", accessListModel.raw("COUNT(proxy_host.id) as proxy_host_count"))
|
||||||
.leftJoin("proxy_host", function () {
|
.leftJoin("proxy_host", function () {
|
||||||
this.on("proxy_host.access_list_id", "=", "access_list.id").andOn(
|
this.on("proxy_host.access_list_id", "=", "access_list.id").andOn("proxy_host.is_deleted", "=", 0);
|
||||||
"proxy_host.is_deleted",
|
|
||||||
"=",
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.where("access_list.is_deleted", 0)
|
.where("access_list.is_deleted", 0)
|
||||||
.groupBy("access_list.id")
|
.groupBy("access_list.id")
|
||||||
@@ -382,10 +428,7 @@ const internalAccessList = {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
getCount: async (userId, visibility) => {
|
getCount: async (userId, visibility) => {
|
||||||
const query = accessListModel
|
const query = accessListModel.query().count("id as count").where("is_deleted", 0);
|
||||||
.query()
|
|
||||||
.count("id as count")
|
|
||||||
.where("is_deleted", 0);
|
|
||||||
|
|
||||||
if (visibility !== "all") {
|
if (visibility !== "all") {
|
||||||
query.andWhere("owner_user_id", userId);
|
query.andWhere("owner_user_id", userId);
|
||||||
@@ -447,20 +490,24 @@ const internalAccessList = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. create empty access file
|
// 2. create empty access file
|
||||||
fs.writeFileSync(htpasswdFile, '', {encoding: 'utf8'});
|
fs.writeFileSync(htpasswdFile, "", { encoding: "utf8" });
|
||||||
|
|
||||||
// 3. generate password for each user
|
// 3. generate password for each user
|
||||||
if (list.items.length) {
|
if (list.items.length) {
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
batchflow(list.items).sequential()
|
batchflow(list.items)
|
||||||
|
.sequential()
|
||||||
.each((_i, item, next) => {
|
.each((_i, item, next) => {
|
||||||
if (item.password?.length) {
|
if (item.password?.length) {
|
||||||
logger.info(`Adding: ${item.username}`);
|
logger.info(`Adding: ${item.username}`);
|
||||||
|
|
||||||
utils.execFile('openssl', ['passwd', '-apr1', item.password])
|
utils
|
||||||
|
.execFile("openssl", ["passwd", "-apr1", item.password])
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
try {
|
try {
|
||||||
fs.appendFileSync(htpasswdFile, `${item.username}:${res}\n`, {encoding: 'utf8'});
|
fs.appendFileSync(htpasswdFile, `${item.username}:${res}\n`, {
|
||||||
|
encoding: "utf8",
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
@@ -482,7 +529,7 @@ const internalAccessList = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
export default internalAccessList;
|
export default internalAccessList;
|
||||||
@@ -3,7 +3,6 @@ import { castJsonIfNeed } from "../lib/helpers.js";
|
|||||||
import auditLogModel from "../models/audit-log.js";
|
import auditLogModel from "../models/audit-log.js";
|
||||||
|
|
||||||
const internalAuditLog = {
|
const internalAuditLog = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All logs
|
* All logs
|
||||||
*
|
*
|
||||||
@@ -46,11 +45,7 @@ const internalAuditLog = {
|
|||||||
get: async (access, data) => {
|
get: async (access, data) => {
|
||||||
await access.can("auditlog:list");
|
await access.can("auditlog:list");
|
||||||
|
|
||||||
const query = auditLogModel
|
const query = auditLogModel.query().andWhere("id", data.id).allowGraph("[user]").first();
|
||||||
.query()
|
|
||||||
.andWhere("id", data.id)
|
|
||||||
.allowGraph("[user]")
|
|
||||||
.first();
|
|
||||||
|
|
||||||
if (typeof data.expand !== "undefined" && data.expand !== null) {
|
if (typeof data.expand !== "undefined" && data.expand !== null) {
|
||||||
query.withGraphFetched(`[${data.expand.join(", ")}]`);
|
query.withGraphFetched(`[${data.expand.join(", ")}]`);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import https from "node:https";
|
import https from "node:https";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import archiver from "archiver";
|
import { ZipArchive } from "archiver";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { ProxyAgent } from "proxy-agent";
|
import { ProxyAgent } from "proxy-agent";
|
||||||
@@ -66,7 +66,7 @@ const internalCertificate = {
|
|||||||
.andWhere("provider", "letsencrypt")
|
.andWhere("provider", "letsencrypt")
|
||||||
.andWhere("expires_on", "<", expirationThreshold)
|
.andWhere("expires_on", "<", expirationThreshold)
|
||||||
.then((certificates) => {
|
.then((certificates) => {
|
||||||
if (!certificates || !certificates.length) {
|
if (!certificates?.length) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ const internalCertificate = {
|
|||||||
await internalCertificate.disableInUseHosts(inUseResult);
|
await internalCertificate.disableInUseHosts(inUseResult);
|
||||||
|
|
||||||
const user = await userModel.query().where("is_deleted", 0).andWhere("id", data.owner_user_id).first();
|
const user = await userModel.query().where("is_deleted", 0).andWhere("id", data.owner_user_id).first();
|
||||||
if (!user || !user.email) {
|
if (!user?.email) {
|
||||||
throw new error.ValidationError(
|
throw new error.ValidationError(
|
||||||
"A valid email address must be set on your user account to use Let's Encrypt",
|
"A valid email address must be set on your user account to use Let's Encrypt",
|
||||||
);
|
);
|
||||||
@@ -305,7 +305,7 @@ const internalCertificate = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const row = await query.then(utils.omitRow(omissions()));
|
const row = await query.then(utils.omitRow(omissions()));
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new error.ItemNotFoundError(data.id);
|
throw new error.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
// Custom omissions
|
// Custom omissions
|
||||||
@@ -370,7 +370,7 @@ const internalCertificate = {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
zipFiles: async (source, out) => {
|
zipFiles: async (source, out) => {
|
||||||
const archive = archiver("zip", { zlib: { level: 9 } });
|
const archive = new ZipArchive({ zlib: { level: 9 } });
|
||||||
const stream = fs.createWriteStream(out);
|
const stream = fs.createWriteStream(out);
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@@ -397,7 +397,7 @@ const internalCertificate = {
|
|||||||
await access.can("certificates:delete", data.id);
|
await access.can("certificates:delete", data.id);
|
||||||
const row = await internalCertificate.get(access, { id: data.id });
|
const row = await internalCertificate.get(access, { id: data.id });
|
||||||
|
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new error.ItemNotFoundError(data.id);
|
throw new error.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,7 +614,7 @@ const internalCertificate = {
|
|||||||
const certificate = await internalCertificate.update(access, {
|
const certificate = await internalCertificate.update(access, {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
expires_on: moment(validations.certificate.dates.to, "X").format("YYYY-MM-DD HH:mm:ss"),
|
expires_on: moment(validations.certificate.dates.to, "X").format("YYYY-MM-DD HH:mm:ss"),
|
||||||
domain_names: [validations.certificate.cn],
|
domain_names: validations.certificate.cn ? [validations.certificate.cn] : [],
|
||||||
meta: _.clone(row.meta), // Prevent the update method from changing this value that we'll use later
|
meta: _.clone(row.meta), // Prevent the update method from changing this value that we'll use later
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -683,13 +683,15 @@ const internalCertificate = {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await utils.execFile("openssl", ["x509", "-in", certificateFile, "-subject", "-noout"]);
|
const result = await utils.execFile("openssl", ["x509", "-in", certificateFile, "-subject", "-noout"]);
|
||||||
|
|
||||||
// Examples:
|
// Examples:
|
||||||
// subject=CN = *.jc21.com
|
// subject=CN = *.jc21.com
|
||||||
// subject=CN = something.example.com
|
// subject=CN = something.example.com
|
||||||
const regex = /(?:subject=)?[^=]+=\s+(\S+)/gim;
|
// subject=CN=*.jc21.com
|
||||||
|
const regex = /(?:subject=)?[^=]+=\s*(\S+)/gim;
|
||||||
const match = regex.exec(result);
|
const match = regex.exec(result);
|
||||||
if (match && typeof match[1] !== "undefined") {
|
if (match && typeof match[1] !== "undefined") {
|
||||||
certData.cn = match[1];
|
certData.cn = match[1].trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
const result2 = await utils.execFile("openssl", ["x509", "-in", certificateFile, "-issuer", "-noout"]);
|
const result2 = await utils.execFile("openssl", ["x509", "-in", certificateFile, "-issuer", "-noout"]);
|
||||||
@@ -779,6 +781,7 @@ const internalCertificate = {
|
|||||||
|
|
||||||
const args = [
|
const args = [
|
||||||
"certonly",
|
"certonly",
|
||||||
|
"-n", // non-interactive
|
||||||
"--config",
|
"--config",
|
||||||
letsencryptConfig,
|
letsencryptConfig,
|
||||||
"--work-dir",
|
"--work-dir",
|
||||||
@@ -834,6 +837,7 @@ const internalCertificate = {
|
|||||||
|
|
||||||
const args = [
|
const args = [
|
||||||
"certonly",
|
"certonly",
|
||||||
|
"-n", // non-interactive
|
||||||
"--config",
|
"--config",
|
||||||
letsencryptConfig,
|
letsencryptConfig,
|
||||||
"--work-dir",
|
"--work-dir",
|
||||||
@@ -877,10 +881,20 @@ const internalCertificate = {
|
|||||||
const result = await utils.execFile(certbotCommand, args, adds.opts);
|
const result = await utils.execFile(certbotCommand, args, adds.opts);
|
||||||
logger.info(result);
|
logger.info(result);
|
||||||
return result;
|
return result;
|
||||||
} catch (err) {
|
} finally {
|
||||||
// Don't fail if file does not exist, so no need for action in the callback
|
// Remove the credentials file whether certbot succeeded or failed.
|
||||||
|
//
|
||||||
|
// This cleanup used to sit in a catch block, so it only ran when issuance FAILED.
|
||||||
|
// A certificate that issued successfully left its DNS provider API credentials in
|
||||||
|
// /etc/letsencrypt/credentials for the entire life of that certificate. Nothing
|
||||||
|
// reads the file between certbot runs, so there is no reason to keep it:
|
||||||
|
// renewLetsEncryptSslWithDnsChallenge() writes it again immediately before each
|
||||||
|
// renewal.
|
||||||
|
//
|
||||||
|
// unlink is fire-and-forget with an empty callback. If the file is already gone
|
||||||
|
// that is the end state we wanted anyway, and a missing file must never turn a
|
||||||
|
// successful issuance into a failure.
|
||||||
fs.unlink(credentialsLocation, () => {});
|
fs.unlink(credentialsLocation, () => {});
|
||||||
throw err;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -977,6 +991,43 @@ const internalCertificate = {
|
|||||||
`Renewing LetsEncrypt certificates via ${dnsPlugin.name} for Cert #${certificate.id}: ${certificate.domain_names.join(", ")}`,
|
`Renewing LetsEncrypt certificates via ${dnsPlugin.name} for Cert #${certificate.id}: ${certificate.domain_names.join(", ")}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// certbot reads the DNS credentials back from the path recorded in the renewal config
|
||||||
|
// it wrote at issuance time, for example:
|
||||||
|
//
|
||||||
|
// authenticator = dns-cloudflare
|
||||||
|
// dns_cloudflare_credentials = /etc/letsencrypt/credentials/credentials-27
|
||||||
|
//
|
||||||
|
// so the file has to be present for the duration of this run. Write it here and remove
|
||||||
|
// it again below rather than leaving it on disk between renewals.
|
||||||
|
//
|
||||||
|
// Leaving it is an avoidable exposure. Anything running as root - a compromised
|
||||||
|
// process, a script, malware - can read the token and use it to issue valid Let's
|
||||||
|
// Encrypt certificates for the domain. Those certificates are genuinely trusted, so
|
||||||
|
// traffic presented with them passes TLS inspection, IDS/IPS and DLP that would
|
||||||
|
// otherwise flag it, and an exfiltration path built on them looks like ordinary
|
||||||
|
// HTTPS. The exposure window should be one certbot run, not the life of the
|
||||||
|
// certificate.
|
||||||
|
//
|
||||||
|
// The value is not on the certificate object we were handed: renew() sources that from
|
||||||
|
// internalCertificate.get(), which pipes the row through utils.omitRow(omissions()) so
|
||||||
|
// meta.dns_provider_credentials can never travel out over the API. Read the row from
|
||||||
|
// the model directly to get at it.
|
||||||
|
const row = await certificateModel.query().where("id", certificate.id).first();
|
||||||
|
const credentials = row?.meta?.dns_provider_credentials;
|
||||||
|
const credentialsLocation = `/etc/letsencrypt/credentials/credentials-${certificate.id}`;
|
||||||
|
|
||||||
|
if (credentials) {
|
||||||
|
fs.mkdirSync("/etc/letsencrypt/credentials", { recursive: true });
|
||||||
|
fs.writeFileSync(credentialsLocation, credentials, { mode: 0o600 });
|
||||||
|
} else {
|
||||||
|
// Nothing stored to write. A certificate issued under the previous behaviour may
|
||||||
|
// still have its file on disk; leave it be and let certbot decide. Throwing here
|
||||||
|
// would break a renewal that would otherwise have succeeded.
|
||||||
|
logger.warn(
|
||||||
|
`No stored DNS credentials for Cert #${certificate.id}; relying on any existing ${credentialsLocation}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const args = [
|
const args = [
|
||||||
"renew",
|
"renew",
|
||||||
"--force-renewal",
|
"--force-renewal",
|
||||||
@@ -1004,9 +1055,19 @@ const internalCertificate = {
|
|||||||
|
|
||||||
logger.info(`Command: ${certbotCommand} ${args ? args.join(" ") : ""}`);
|
logger.info(`Command: ${certbotCommand} ${args ? args.join(" ") : ""}`);
|
||||||
|
|
||||||
|
try {
|
||||||
const result = await utils.execFile(certbotCommand, args, adds.opts);
|
const result = await utils.execFile(certbotCommand, args, adds.opts);
|
||||||
logger.info(result);
|
logger.info(result);
|
||||||
return result;
|
return result;
|
||||||
|
} finally {
|
||||||
|
// Only clean up a file we put there ourselves. If `credentials` came back empty we
|
||||||
|
// wrote nothing, and an older file left on disk by the previous behaviour is the
|
||||||
|
// only thing keeping that certificate renewable - deleting it would break the next
|
||||||
|
// run for no gain.
|
||||||
|
if (credentials) {
|
||||||
|
fs.unlink(credentialsLocation, () => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -54,9 +54,7 @@ const internalDeadHost = {
|
|||||||
thisData.advanced_config = "";
|
thisData.advanced_config = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const row = await deadHostModel.query()
|
const row = await deadHostModel.query().insertAndFetch(thisData).then(utils.omitRow(omissions()));
|
||||||
.insertAndFetch(thisData)
|
|
||||||
.then(utils.omitRow(omissions()));
|
|
||||||
|
|
||||||
// Add to audit log
|
// Add to audit log
|
||||||
await internalAuditLog.add(access, {
|
await internalAuditLog.add(access, {
|
||||||
@@ -153,12 +151,8 @@ const internalDeadHost = {
|
|||||||
|
|
||||||
thisData = internalHost.cleanSslHstsData(thisData, row);
|
thisData = internalHost.cleanSslHstsData(thisData, row);
|
||||||
|
|
||||||
|
|
||||||
// do the row update
|
// do the row update
|
||||||
await deadHostModel
|
await deadHostModel.query().where({ id: data.id }).patch(data);
|
||||||
.query()
|
|
||||||
.where({id: data.id})
|
|
||||||
.patch(data);
|
|
||||||
|
|
||||||
// Add to audit log
|
// Add to audit log
|
||||||
await internalAuditLog.add(access, {
|
await internalAuditLog.add(access, {
|
||||||
@@ -168,15 +162,18 @@ const internalDeadHost = {
|
|||||||
meta: thisData,
|
meta: thisData,
|
||||||
});
|
});
|
||||||
|
|
||||||
const thisRow = await internalDeadHost
|
const thisRow = await internalDeadHost.get(access, {
|
||||||
.get(access, {
|
|
||||||
id: thisData.id,
|
id: thisData.id,
|
||||||
expand: ["owner", "certificate"],
|
expand: ["owner", "certificate"],
|
||||||
});
|
});
|
||||||
|
|
||||||
// Configure nginx
|
// Configure nginx
|
||||||
const newMeta = await internalNginx.configure(deadHostModel, "dead_host", row);
|
if (!thisRow.enabled) {
|
||||||
row.meta = newMeta;
|
// No need to add nginx config if host is disabled
|
||||||
|
return _.omit(internalHost.cleanRowCertificateMeta(thisRow), omissions());
|
||||||
|
}
|
||||||
|
const newMeta = await internalNginx.configure(deadHostModel, "dead_host", thisRow);
|
||||||
|
thisRow.meta = newMeta;
|
||||||
return _.omit(internalHost.cleanRowCertificateMeta(thisRow), omissions());
|
return _.omit(internalHost.cleanRowCertificateMeta(thisRow), omissions());
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -194,7 +191,7 @@ const internalDeadHost = {
|
|||||||
.query()
|
.query()
|
||||||
.where("is_deleted", 0)
|
.where("is_deleted", 0)
|
||||||
.andWhere("id", data.id)
|
.andWhere("id", data.id)
|
||||||
.allowGraph("[owner,certificate]")
|
.allowGraph(deadHostModel.defaultAllowGraph)
|
||||||
.first();
|
.first();
|
||||||
|
|
||||||
if (accessData.permission_visibility !== "all") {
|
if (accessData.permission_visibility !== "all") {
|
||||||
@@ -206,7 +203,7 @@ const internalDeadHost = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const row = await query.then(utils.omitRow(omissions()));
|
const row = await query.then(utils.omitRow(omissions()));
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
// Custom omissions
|
// Custom omissions
|
||||||
@@ -224,16 +221,13 @@ const internalDeadHost = {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
delete: async (access, data) => {
|
delete: async (access, data) => {
|
||||||
await access.can("dead_hosts:delete", data.id)
|
await access.can("dead_hosts:delete", data.id);
|
||||||
const row = await internalDeadHost.get(access, { id: data.id });
|
const row = await internalDeadHost.get(access, { id: data.id });
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
await deadHostModel
|
await deadHostModel.query().where("id", row.id).patch({
|
||||||
.query()
|
|
||||||
.where("id", row.id)
|
|
||||||
.patch({
|
|
||||||
is_deleted: 1,
|
is_deleted: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -259,12 +253,12 @@ const internalDeadHost = {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
enable: async (access, data) => {
|
enable: async (access, data) => {
|
||||||
await access.can("dead_hosts:update", data.id)
|
await access.can("dead_hosts:update", data.id);
|
||||||
const row = await internalDeadHost.get(access, {
|
const row = await internalDeadHost.get(access, {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
expand: ["certificate", "owner"],
|
expand: ["certificate", "owner"],
|
||||||
});
|
});
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
if (row.enabled) {
|
if (row.enabled) {
|
||||||
@@ -273,10 +267,7 @@ const internalDeadHost = {
|
|||||||
|
|
||||||
row.enabled = 1;
|
row.enabled = 1;
|
||||||
|
|
||||||
await deadHostModel
|
await deadHostModel.query().where("id", row.id).patch({
|
||||||
.query()
|
|
||||||
.where("id", row.id)
|
|
||||||
.patch({
|
|
||||||
enabled: 1,
|
enabled: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -301,9 +292,9 @@ const internalDeadHost = {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
disable: async (access, data) => {
|
disable: async (access, data) => {
|
||||||
await access.can("dead_hosts:update", data.id)
|
await access.can("dead_hosts:update", data.id);
|
||||||
const row = await internalDeadHost.get(access, { id: data.id });
|
const row = await internalDeadHost.get(access, { id: data.id });
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
if (!row.enabled) {
|
if (!row.enabled) {
|
||||||
@@ -312,10 +303,7 @@ const internalDeadHost = {
|
|||||||
|
|
||||||
row.enabled = 0;
|
row.enabled = 0;
|
||||||
|
|
||||||
await deadHostModel
|
await deadHostModel.query().where("id", row.id).patch({
|
||||||
.query()
|
|
||||||
.where("id", row.id)
|
|
||||||
.patch({
|
|
||||||
enabled: 0,
|
enabled: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -342,12 +330,12 @@ const internalDeadHost = {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
getAll: async (access, expand, searchQuery) => {
|
getAll: async (access, expand, searchQuery) => {
|
||||||
const accessData = await access.can("dead_hosts:list")
|
const accessData = await access.can("dead_hosts:list");
|
||||||
const query = deadHostModel
|
const query = deadHostModel
|
||||||
.query()
|
.query()
|
||||||
.where("is_deleted", 0)
|
.where("is_deleted", 0)
|
||||||
.groupBy("id")
|
.groupBy("id")
|
||||||
.allowGraph("[owner,certificate]")
|
.allowGraph(deadHostModel.defaultAllowGraph)
|
||||||
.orderBy(castJsonIfNeed("domain_names"), "ASC");
|
.orderBy(castJsonIfNeed("domain_names"), "ASC");
|
||||||
|
|
||||||
if (accessData.permission_visibility !== "all") {
|
if (accessData.permission_visibility !== "all") {
|
||||||
|
|||||||
@@ -0,0 +1,229 @@
|
|||||||
|
import fs from "node:fs";
|
||||||
|
import errs from "../lib/error.js";
|
||||||
|
import internalDeadHost from "./dead-host.js";
|
||||||
|
import internalProxyHost from "./proxy-host.js";
|
||||||
|
import internalRedirectionHost from "./redirection-host.js";
|
||||||
|
import internalStream from "./stream.js";
|
||||||
|
|
||||||
|
const SYSTEM_LOG_FILE = "/data/logs/backend.log";
|
||||||
|
const LETSENCRYPT_LOG_FILE = "/data/logs/letsencrypt.log";
|
||||||
|
|
||||||
|
// Matches the access_log/error_log paths written by the nginx templates
|
||||||
|
// (see backend/templates/{proxy_host,redirection_host,dead_host,stream}.conf).
|
||||||
|
// This is a fixed, server-side lookup table - a host log path is always derived
|
||||||
|
// from a validated `host_type` enum + numeric `host_id`, never from a client-supplied
|
||||||
|
// path or filename, so there is no path-traversal surface here.
|
||||||
|
const HOST_FILE_PREFIX = {
|
||||||
|
proxy: "proxy-host",
|
||||||
|
redirection: "redirection-host",
|
||||||
|
dead: "dead-host",
|
||||||
|
stream: "stream",
|
||||||
|
};
|
||||||
|
|
||||||
|
const DEFAULT_LINES = 200;
|
||||||
|
const MAX_LINES = 1000;
|
||||||
|
const CHUNK_SIZE = 64 * 1024;
|
||||||
|
// Never scan further back than this, regardless of how many lines were requested,
|
||||||
|
// so a huge or pathological log file can't turn a single request into unbounded I/O.
|
||||||
|
const MAX_SCAN_BYTES = 5 * 1024 * 1024;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads at most `maxLines` lines from the end of a file, without loading the
|
||||||
|
* whole file into memory. Reads backwards in fixed-size chunks until enough
|
||||||
|
* newlines have been seen, the start of the file is reached, or the hard
|
||||||
|
* MAX_SCAN_BYTES ceiling is hit.
|
||||||
|
*
|
||||||
|
* @param {String} filePath
|
||||||
|
* @param {Number} maxLines
|
||||||
|
* @returns {Promise<{lines: String[], size: Number, truncated: Boolean}>}
|
||||||
|
*/
|
||||||
|
const readLastLines = async (filePath, maxLines) => {
|
||||||
|
let handle;
|
||||||
|
try {
|
||||||
|
handle = await fs.promises.open(filePath, "r");
|
||||||
|
const stat = await handle.stat();
|
||||||
|
const { size } = stat;
|
||||||
|
|
||||||
|
if (size === 0) {
|
||||||
|
return { lines: [], size: 0, truncated: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
let position = size;
|
||||||
|
let scanned = 0;
|
||||||
|
let newlineCount = 0;
|
||||||
|
const chunks = [];
|
||||||
|
|
||||||
|
while (position > 0 && newlineCount <= maxLines && scanned < MAX_SCAN_BYTES) {
|
||||||
|
const readSize = Math.min(CHUNK_SIZE, position);
|
||||||
|
position -= readSize;
|
||||||
|
const buffer = Buffer.alloc(readSize);
|
||||||
|
await handle.read(buffer, 0, readSize, position);
|
||||||
|
scanned += readSize;
|
||||||
|
for (let i = buffer.length - 1; i >= 0; i--) {
|
||||||
|
if (buffer[i] === 0x0a) newlineCount++;
|
||||||
|
}
|
||||||
|
chunks.unshift(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
const truncated = position > 0 && scanned >= MAX_SCAN_BYTES;
|
||||||
|
|
||||||
|
// If we didn't start reading from byte 0, the first line in our buffer is only
|
||||||
|
// partial *unless* it happens that `position` landed exactly on a line boundary
|
||||||
|
// (the byte right before it is a newline) - check that one byte to avoid
|
||||||
|
// silently dropping a perfectly valid line.
|
||||||
|
let startsOnLineBoundary = position === 0;
|
||||||
|
if (position > 0) {
|
||||||
|
const boundaryByte = Buffer.alloc(1);
|
||||||
|
await handle.read(boundaryByte, 0, 1, position - 1);
|
||||||
|
startsOnLineBoundary = boundaryByte[0] === 0x0a;
|
||||||
|
}
|
||||||
|
|
||||||
|
const text = Buffer.concat(chunks).toString("utf8");
|
||||||
|
const allLines = text.split("\n");
|
||||||
|
|
||||||
|
if (!startsOnLineBoundary && allLines.length > 0) {
|
||||||
|
allLines.shift();
|
||||||
|
}
|
||||||
|
// Drop the trailing empty element caused by a final trailing newline.
|
||||||
|
if (allLines.length > 0 && allLines[allLines.length - 1] === "") {
|
||||||
|
allLines.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
return { lines: allLines.slice(-maxLines), size, truncated };
|
||||||
|
} finally {
|
||||||
|
if (handle) {
|
||||||
|
await handle.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves a validated {type, host_type, host_id, channel} selection to the
|
||||||
|
* fixed, absolute path of the log file on disk. Throws if the combination
|
||||||
|
* isn't a recognised source.
|
||||||
|
*
|
||||||
|
* `channel` ("access" | "error") picks which of the two log files nginx writes
|
||||||
|
* per host - it's deliberately not named "stream" to avoid confusion with the
|
||||||
|
* "stream" host_type (TCP/UDP stream hosts).
|
||||||
|
*
|
||||||
|
* @param {Object} data
|
||||||
|
* @returns {String}
|
||||||
|
*/
|
||||||
|
const resolveFilePath = (data) => {
|
||||||
|
switch (data.type) {
|
||||||
|
case "system":
|
||||||
|
return SYSTEM_LOG_FILE;
|
||||||
|
case "letsencrypt":
|
||||||
|
return LETSENCRYPT_LOG_FILE;
|
||||||
|
case "host": {
|
||||||
|
const prefix = HOST_FILE_PREFIX[data.host_type];
|
||||||
|
if (!prefix || !data.host_id || !["access", "error"].includes(data.channel)) {
|
||||||
|
throw new errs.ValidationError("Invalid host log source");
|
||||||
|
}
|
||||||
|
return `/data/logs/${prefix}-${data.host_id}_${data.channel}.log`;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
throw new errs.ItemNotFoundError(data.type);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Array} rows
|
||||||
|
* @returns {Array}
|
||||||
|
*/
|
||||||
|
const toHostOptions = (rows) =>
|
||||||
|
rows.map((row) => ({
|
||||||
|
id: row.id,
|
||||||
|
label: Array.isArray(row.domain_names) ? row.domain_names.join(", ") : `Host #${row.id}`,
|
||||||
|
}));
|
||||||
|
|
||||||
|
const internalLogViewer = {
|
||||||
|
/**
|
||||||
|
* Lists the log sources available for the log viewer: the system (backend)
|
||||||
|
* log, the Let's Encrypt (certbot) log, and one entry per host the caller
|
||||||
|
* can see, for each host type.
|
||||||
|
*
|
||||||
|
* @param {Access} access
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
listSources: async (access) => {
|
||||||
|
await access.can("logs:list");
|
||||||
|
|
||||||
|
const [proxyHosts, redirectionHosts, deadHosts, streams] = await Promise.all([
|
||||||
|
internalProxyHost.getAll(access),
|
||||||
|
internalRedirectionHost.getAll(access),
|
||||||
|
internalDeadHost.getAll(access),
|
||||||
|
internalStream.getAll(access),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return {
|
||||||
|
system: { label: "System" },
|
||||||
|
letsencrypt: { label: "Let's Encrypt" },
|
||||||
|
hosts: {
|
||||||
|
proxy: toHostOptions(proxyHosts),
|
||||||
|
redirection: toHostOptions(redirectionHosts),
|
||||||
|
dead: toHostOptions(deadHosts),
|
||||||
|
stream: streams.map((row) => ({
|
||||||
|
id: row.id,
|
||||||
|
label: `Port ${row.incoming_port} → ${row.forwarding_host}:${row.forwarding_port}`,
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the last N lines of the requested log source, optionally
|
||||||
|
* filtered by level and/or a plain-text search term.
|
||||||
|
*
|
||||||
|
* @param {Access} access
|
||||||
|
* @param {Object} data
|
||||||
|
* @param {String} data.type "system" | "letsencrypt" | "host"
|
||||||
|
* @param {String} [data.host_type] "proxy" | "redirection" | "dead" | "stream"
|
||||||
|
* @param {Number} [data.host_id]
|
||||||
|
* @param {String} [data.channel] "access" | "error"
|
||||||
|
* @param {Number} [data.lines]
|
||||||
|
* @param {String} [data.level]
|
||||||
|
* @param {String} [data.search]
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
tail: async (access, data) => {
|
||||||
|
await access.can("logs:list");
|
||||||
|
|
||||||
|
const filePath = resolveFilePath(data);
|
||||||
|
const lines = Math.min(Math.max(data.lines || DEFAULT_LINES, 1), MAX_LINES);
|
||||||
|
|
||||||
|
let result;
|
||||||
|
try {
|
||||||
|
result = await readLastLines(filePath, lines);
|
||||||
|
} catch (err) {
|
||||||
|
if (err.code === "ENOENT") {
|
||||||
|
return { lines: [], size: 0, truncated: false, exists: false };
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
let outputLines = result.lines;
|
||||||
|
|
||||||
|
// Only the system log is written in our own "LEVEL [scope]" format - level
|
||||||
|
// filtering on nginx/certbot lines would just match nothing and look like an
|
||||||
|
// empty log, so the filter is a no-op for any other source.
|
||||||
|
if (data.type === "system" && data.level) {
|
||||||
|
const needle = ` ${data.level.toUpperCase().padEnd(7)} `;
|
||||||
|
outputLines = outputLines.filter((line) => line.includes(needle));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.search) {
|
||||||
|
const needle = data.search.toLowerCase();
|
||||||
|
outputLines = outputLines.filter((line) => line.toLowerCase().includes(needle));
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
lines: outputLines,
|
||||||
|
size: result.size,
|
||||||
|
truncated: result.truncated,
|
||||||
|
exists: true,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default internalLogViewer;
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
|
import net from "node:net";
|
||||||
import { dirname } from "node:path";
|
import { dirname } from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import errs from "../lib/error.js";
|
import errs from "../lib/error.js";
|
||||||
import utils from "../lib/utils.js";
|
import utils from "../lib/utils.js";
|
||||||
import { debug, nginx as logger } from "../logger.js";
|
import { debug, nginx as logger } from "../logger.js";
|
||||||
|
import accessListModel from "../models/access_list.js";
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = dirname(__filename);
|
const __dirname = dirname(__filename);
|
||||||
@@ -34,7 +36,7 @@ const internalNginx = {
|
|||||||
// We're deleting this config regardless.
|
// We're deleting this config regardless.
|
||||||
// Don't throw errors, as the file may not exist at all
|
// Don't throw errors, as the file may not exist at all
|
||||||
// Delete the .err file too
|
// Delete the .err file too
|
||||||
return internalNginx.deleteConfig(host_type, host, false, true);
|
return internalNginx.deleteConfig(host_type, host, true);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return internalNginx.generateConfig(host_type, host);
|
return internalNginx.generateConfig(host_type, host);
|
||||||
@@ -83,10 +85,12 @@ const internalNginx = {
|
|||||||
meta: combined_meta,
|
meta: combined_meta,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
internalNginx.renameConfigAsError(host_type, host);
|
// Keep the failed config as a .err file for inspection
|
||||||
|
return internalNginx.renameConfigAsError(host_type, host);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return internalNginx.deleteConfig(host_type, host, true);
|
// The rename removed the live config already, don't touch the .err file
|
||||||
|
return internalNginx.deleteConfig(host_type, host, false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -165,6 +169,24 @@ const internalNginx = {
|
|||||||
host.locations[i],
|
host.locations[i],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// A location with its own access list overrides the host's,
|
||||||
|
// otherwise it inherits the host's access list
|
||||||
|
let locationAccessList = null;
|
||||||
|
if (locationCopy.access_list_id > 0 && locationCopy.access_list_id !== host.access_list?.id) {
|
||||||
|
locationAccessList = await accessListModel
|
||||||
|
.query()
|
||||||
|
.where("is_deleted", 0)
|
||||||
|
.andWhere("id", locationCopy.access_list_id)
|
||||||
|
.withGraphFetched("[clients,items]")
|
||||||
|
.first();
|
||||||
|
}
|
||||||
|
if (locationAccessList) {
|
||||||
|
locationCopy.access_list = locationAccessList;
|
||||||
|
} else {
|
||||||
|
locationCopy.access_list_id = host.access_list_id;
|
||||||
|
locationCopy.access_list = host.access_list;
|
||||||
|
}
|
||||||
|
|
||||||
if (locationCopy.forward_host.indexOf("/") > -1) {
|
if (locationCopy.forward_host.indexOf("/") > -1) {
|
||||||
const splitted = locationCopy.forward_host.split("/");
|
const splitted = locationCopy.forward_host.split("/");
|
||||||
|
|
||||||
@@ -176,7 +198,9 @@ const internalNginx = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
locationRendering().then(() => resolve(renderedLocations));
|
locationRendering()
|
||||||
|
.then(() => resolve(renderedLocations))
|
||||||
|
.catch(reject);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -217,10 +241,21 @@ const internalNginx = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For redirection hosts, if the scheme is not http or https, set it to $scheme
|
// For redirection hosts, if the scheme is not http or https, set it to $scheme
|
||||||
if (nice_host_type === "redirection_host" && ['http', 'https'].indexOf(host.forward_scheme.toLowerCase()) === -1) {
|
if (
|
||||||
|
nice_host_type === "redirection_host" &&
|
||||||
|
["http", "https"].indexOf(host.forward_scheme.toLowerCase()) === -1
|
||||||
|
) {
|
||||||
host.forward_scheme = "$scheme";
|
host.forward_scheme = "$scheme";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A stream forwarding to an IPv6 literal must have the address wrapped in
|
||||||
|
// square brackets before nginx appends ":<port>". Without the brackets nginx
|
||||||
|
// reads the trailing ":<port>" as part of the address and rejects the upstream
|
||||||
|
// ("invalid port in upstream"), so the stream saves but never activates (#5740).
|
||||||
|
if (nice_host_type === "stream" && net.isIPv6(host.forwarding_host)) {
|
||||||
|
host.forwarding_host = `[${host.forwarding_host}]`;
|
||||||
|
}
|
||||||
|
|
||||||
if (host.locations) {
|
if (host.locations) {
|
||||||
//logger.info ('host.locations = ' + JSON.stringify(host.locations, null, 2));
|
//logger.info ('host.locations = ' + JSON.stringify(host.locations, null, 2));
|
||||||
origLocations = [].concat(host.locations);
|
origLocations = [].concat(host.locations);
|
||||||
@@ -257,6 +292,9 @@ const internalNginx = {
|
|||||||
debug(logger, `Could not write ${filename}:`, err.message);
|
debug(logger, `Could not write ${filename}:`, err.message);
|
||||||
reject(new errs.ConfigurationError(err.message));
|
reject(new errs.ConfigurationError(err.message));
|
||||||
});
|
});
|
||||||
|
}).catch((err) => {
|
||||||
|
debug(logger, `Could not render locations for ${filename}:`, err.message);
|
||||||
|
reject(new errs.ConfigurationError(err.message));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -375,8 +413,8 @@ const internalNginx = {
|
|||||||
const config_file_err = `${config_file}.err`;
|
const config_file_err = `${config_file}.err`;
|
||||||
|
|
||||||
return new Promise((resolve /*, reject*/) => {
|
return new Promise((resolve /*, reject*/) => {
|
||||||
fs.unlink(config_file, () => {
|
fs.unlink(config_file_err, () => {
|
||||||
// ignore result, continue
|
// ignore result, a previous .err file may not exist
|
||||||
fs.rename(config_file, config_file_err, () => {
|
fs.rename(config_file, config_file_err, () => {
|
||||||
// also ignore result, as this is a debugging informative file anyway
|
// also ignore result, as this is a debugging informative file anyway
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ const internalProxyHost = {
|
|||||||
expand: ["certificate", "owner", "access_list.[clients,items]"],
|
expand: ["certificate", "owner", "access_list.[clients,items]"],
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then(async (row) => {
|
||||||
// Configure nginx
|
// Configure nginx
|
||||||
return internalNginx.configure(proxyHostModel, "proxy_host", row).then(() => {
|
return internalNginx.configure(proxyHostModel, "proxy_host", row).then(() => {
|
||||||
return row;
|
return row;
|
||||||
@@ -115,9 +115,9 @@ const internalProxyHost = {
|
|||||||
*/
|
*/
|
||||||
update: (access, data) => {
|
update: (access, data) => {
|
||||||
let thisData = data;
|
let thisData = data;
|
||||||
const create_certificate = thisData.certificate_id === "new";
|
const createCertificate = thisData.certificate_id === "new";
|
||||||
|
|
||||||
if (create_certificate) {
|
if (createCertificate) {
|
||||||
delete thisData.certificate_id;
|
delete thisData.certificate_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ const internalProxyHost = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (create_certificate) {
|
if (createCertificate) {
|
||||||
return internalCertificate
|
return internalCertificate
|
||||||
.createQuickCertificate(access, {
|
.createQuickCertificate(access, {
|
||||||
domain_names: thisData.domain_names || row.domain_names,
|
domain_names: thisData.domain_names || row.domain_names,
|
||||||
@@ -208,7 +208,7 @@ const internalProxyHost = {
|
|||||||
id: thisData.id,
|
id: thisData.id,
|
||||||
expand: ["owner", "certificate", "access_list.[clients,items]"],
|
expand: ["owner", "certificate", "access_list.[clients,items]"],
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then(async (row) => {
|
||||||
if (!row.enabled) {
|
if (!row.enabled) {
|
||||||
// No need to add nginx config if host is disabled
|
// No need to add nginx config if host is disabled
|
||||||
return row;
|
return row;
|
||||||
@@ -232,7 +232,6 @@ const internalProxyHost = {
|
|||||||
*/
|
*/
|
||||||
get: (access, data) => {
|
get: (access, data) => {
|
||||||
const thisData = data || {};
|
const thisData = data || {};
|
||||||
|
|
||||||
return access
|
return access
|
||||||
.can("proxy_hosts:get", thisData.id)
|
.can("proxy_hosts:get", thisData.id)
|
||||||
.then((access_data) => {
|
.then((access_data) => {
|
||||||
@@ -240,7 +239,7 @@ const internalProxyHost = {
|
|||||||
.query()
|
.query()
|
||||||
.where("is_deleted", 0)
|
.where("is_deleted", 0)
|
||||||
.andWhere("id", thisData.id)
|
.andWhere("id", thisData.id)
|
||||||
.allowGraph("[owner,access_list.[clients,items],certificate]")
|
.allowGraph(proxyHostModel.defaultAllowGraph)
|
||||||
.first();
|
.first();
|
||||||
|
|
||||||
if (access_data.permission_visibility !== "all") {
|
if (access_data.permission_visibility !== "all") {
|
||||||
@@ -254,7 +253,7 @@ const internalProxyHost = {
|
|||||||
return query.then(utils.omitRow(omissions()));
|
return query.then(utils.omitRow(omissions()));
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(thisData.id);
|
throw new errs.ItemNotFoundError(thisData.id);
|
||||||
}
|
}
|
||||||
const thisRow = internalHost.cleanRowCertificateMeta(row);
|
const thisRow = internalHost.cleanRowCertificateMeta(row);
|
||||||
@@ -280,7 +279,7 @@ const internalProxyHost = {
|
|||||||
return internalProxyHost.get(access, { id: data.id });
|
return internalProxyHost.get(access, { id: data.id });
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,8 +326,8 @@ const internalProxyHost = {
|
|||||||
expand: ["certificate", "owner", "access_list"],
|
expand: ["certificate", "owner", "access_list"],
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then(async (row) => {
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
if (row.enabled) {
|
if (row.enabled) {
|
||||||
@@ -337,27 +336,24 @@ const internalProxyHost = {
|
|||||||
|
|
||||||
row.enabled = 1;
|
row.enabled = 1;
|
||||||
|
|
||||||
return proxyHostModel
|
await proxyHostModel
|
||||||
.query()
|
.query()
|
||||||
.where("id", row.id)
|
.where("id", row.id)
|
||||||
.patch({
|
.patch({
|
||||||
enabled: 1,
|
enabled: 1,
|
||||||
})
|
});
|
||||||
.then(() => {
|
|
||||||
// Configure nginx
|
// Configure nginx
|
||||||
return internalNginx.configure(proxyHostModel, "proxy_host", row);
|
await internalNginx.configure(proxyHostModel, "proxy_host", row);
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
// Add to audit log
|
// Add to audit log
|
||||||
return internalAuditLog.add(access, {
|
await internalAuditLog.add(access, {
|
||||||
action: "enabled",
|
action: "enabled",
|
||||||
object_type: "proxy-host",
|
object_type: "proxy-host",
|
||||||
object_id: row.id,
|
object_id: row.id,
|
||||||
meta: _.omit(row, omissions()),
|
meta: _.omit(row, omissions()),
|
||||||
});
|
});
|
||||||
});
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -376,7 +372,7 @@ const internalProxyHost = {
|
|||||||
return internalProxyHost.get(access, { id: data.id });
|
return internalProxyHost.get(access, { id: data.id });
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
if (!row.enabled) {
|
if (!row.enabled) {
|
||||||
@@ -422,11 +418,12 @@ const internalProxyHost = {
|
|||||||
*/
|
*/
|
||||||
getAll: async (access, expand, searchQuery) => {
|
getAll: async (access, expand, searchQuery) => {
|
||||||
const accessData = await access.can("proxy_hosts:list");
|
const accessData = await access.can("proxy_hosts:list");
|
||||||
|
|
||||||
const query = proxyHostModel
|
const query = proxyHostModel
|
||||||
.query()
|
.query()
|
||||||
.where("is_deleted", 0)
|
.where("is_deleted", 0)
|
||||||
.groupBy("id")
|
.groupBy("id")
|
||||||
.allowGraph("[owner,access_list,certificate]")
|
.allowGraph(proxyHostModel.defaultAllowGraph)
|
||||||
.orderBy(castJsonIfNeed("domain_names"), "ASC");
|
.orderBy(castJsonIfNeed("domain_names"), "ASC");
|
||||||
|
|
||||||
if (accessData.permission_visibility !== "all") {
|
if (accessData.permission_visibility !== "all") {
|
||||||
|
|||||||
@@ -229,7 +229,6 @@ const internalRedirectionHost = {
|
|||||||
*/
|
*/
|
||||||
get: (access, data) => {
|
get: (access, data) => {
|
||||||
const thisData = data || {};
|
const thisData = data || {};
|
||||||
|
|
||||||
return access
|
return access
|
||||||
.can("redirection_hosts:get", thisData.id)
|
.can("redirection_hosts:get", thisData.id)
|
||||||
.then((access_data) => {
|
.then((access_data) => {
|
||||||
@@ -237,7 +236,7 @@ const internalRedirectionHost = {
|
|||||||
.query()
|
.query()
|
||||||
.where("is_deleted", 0)
|
.where("is_deleted", 0)
|
||||||
.andWhere("id", thisData.id)
|
.andWhere("id", thisData.id)
|
||||||
.allowGraph("[owner,certificate]")
|
.allowGraph(redirectionHostModel.defaultAllowGraph)
|
||||||
.first();
|
.first();
|
||||||
|
|
||||||
if (access_data.permission_visibility !== "all") {
|
if (access_data.permission_visibility !== "all") {
|
||||||
@@ -252,7 +251,7 @@ const internalRedirectionHost = {
|
|||||||
})
|
})
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
let thisRow = row;
|
let thisRow = row;
|
||||||
if (!thisRow || !thisRow.id) {
|
if (!thisRow?.id) {
|
||||||
throw new errs.ItemNotFoundError(thisData.id);
|
throw new errs.ItemNotFoundError(thisData.id);
|
||||||
}
|
}
|
||||||
thisRow = internalHost.cleanRowCertificateMeta(thisRow);
|
thisRow = internalHost.cleanRowCertificateMeta(thisRow);
|
||||||
@@ -278,7 +277,7 @@ const internalRedirectionHost = {
|
|||||||
return internalRedirectionHost.get(access, { id: data.id });
|
return internalRedirectionHost.get(access, { id: data.id });
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +325,7 @@ const internalRedirectionHost = {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
if (row.enabled) {
|
if (row.enabled) {
|
||||||
@@ -374,7 +373,7 @@ const internalRedirectionHost = {
|
|||||||
return internalRedirectionHost.get(access, { id: data.id });
|
return internalRedirectionHost.get(access, { id: data.id });
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
if (!row.enabled) {
|
if (!row.enabled) {
|
||||||
@@ -426,7 +425,7 @@ const internalRedirectionHost = {
|
|||||||
.query()
|
.query()
|
||||||
.where("is_deleted", 0)
|
.where("is_deleted", 0)
|
||||||
.groupBy("id")
|
.groupBy("id")
|
||||||
.allowGraph("[owner,certificate]")
|
.allowGraph(redirectionHostModel.defaultAllowGraph)
|
||||||
.orderBy(castJsonIfNeed("domain_names"), "ASC");
|
.orderBy(castJsonIfNeed("domain_names"), "ASC");
|
||||||
|
|
||||||
if (access_data.permission_visibility !== "all") {
|
if (access_data.permission_visibility !== "all") {
|
||||||
|
|||||||
@@ -178,7 +178,6 @@ const internalStream = {
|
|||||||
*/
|
*/
|
||||||
get: (access, data) => {
|
get: (access, data) => {
|
||||||
const thisData = data || {};
|
const thisData = data || {};
|
||||||
|
|
||||||
return access
|
return access
|
||||||
.can("streams:get", thisData.id)
|
.can("streams:get", thisData.id)
|
||||||
.then((access_data) => {
|
.then((access_data) => {
|
||||||
@@ -186,7 +185,7 @@ const internalStream = {
|
|||||||
.query()
|
.query()
|
||||||
.where("is_deleted", 0)
|
.where("is_deleted", 0)
|
||||||
.andWhere("id", thisData.id)
|
.andWhere("id", thisData.id)
|
||||||
.allowGraph("[owner,certificate]")
|
.allowGraph(streamModel.defaultAllowGraph)
|
||||||
.first();
|
.first();
|
||||||
|
|
||||||
if (access_data.permission_visibility !== "all") {
|
if (access_data.permission_visibility !== "all") {
|
||||||
@@ -201,7 +200,7 @@ const internalStream = {
|
|||||||
})
|
})
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
let thisRow = row;
|
let thisRow = row;
|
||||||
if (!thisRow || !thisRow.id) {
|
if (!thisRow?.id) {
|
||||||
throw new errs.ItemNotFoundError(thisData.id);
|
throw new errs.ItemNotFoundError(thisData.id);
|
||||||
}
|
}
|
||||||
thisRow = internalHost.cleanRowCertificateMeta(thisRow);
|
thisRow = internalHost.cleanRowCertificateMeta(thisRow);
|
||||||
@@ -227,7 +226,7 @@ const internalStream = {
|
|||||||
return internalStream.get(access, { id: data.id });
|
return internalStream.get(access, { id: data.id });
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +274,7 @@ const internalStream = {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
if (row.enabled) {
|
if (row.enabled) {
|
||||||
@@ -323,7 +322,7 @@ const internalStream = {
|
|||||||
return internalStream.get(access, { id: data.id });
|
return internalStream.get(access, { id: data.id });
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(data.id);
|
throw new errs.ItemNotFoundError(data.id);
|
||||||
}
|
}
|
||||||
if (!row.enabled) {
|
if (!row.enabled) {
|
||||||
@@ -375,7 +374,7 @@ const internalStream = {
|
|||||||
.query()
|
.query()
|
||||||
.where("is_deleted", 0)
|
.where("is_deleted", 0)
|
||||||
.groupBy("id")
|
.groupBy("id")
|
||||||
.allowGraph("[owner,certificate]")
|
.allowGraph(streamModel.defaultAllowGraph)
|
||||||
.orderBy("incoming_port", "ASC");
|
.orderBy("incoming_port", "ASC");
|
||||||
|
|
||||||
if (access_data.permission_visibility !== "all") {
|
if (access_data.permission_visibility !== "all") {
|
||||||
|
|||||||
@@ -38,11 +38,7 @@ export default {
|
|||||||
throw new errs.AuthError(ERROR_MESSAGE_INVALID_AUTH);
|
throw new errs.AuthError(ERROR_MESSAGE_INVALID_AUTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auth = await authModel
|
const auth = await authModel.query().where("user_id", "=", user.id).where("type", "=", "password").first();
|
||||||
.query()
|
|
||||||
.where("user_id", "=", user.id)
|
|
||||||
.where("type", "=", "password")
|
|
||||||
.first();
|
|
||||||
|
|
||||||
if (!auth) {
|
if (!auth) {
|
||||||
throw new errs.AuthError(ERROR_MESSAGE_INVALID_AUTH);
|
throw new errs.AuthError(ERROR_MESSAGE_INVALID_AUTH);
|
||||||
@@ -50,10 +46,7 @@ export default {
|
|||||||
|
|
||||||
const valid = await auth.verifyPassword(data.secret);
|
const valid = await auth.verifyPassword(data.secret);
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
throw new errs.AuthError(
|
throw new errs.AuthError(ERROR_MESSAGE_INVALID_AUTH, ERROR_MESSAGE_INVALID_AUTH_I18N);
|
||||||
ERROR_MESSAGE_INVALID_AUTH,
|
|
||||||
ERROR_MESSAGE_INVALID_AUTH_I18N,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.scope !== "user" && _.indexOf(user.roles, data.scope) === -1) {
|
if (data.scope !== "user" && _.indexOf(user.roles, data.scope) === -1) {
|
||||||
@@ -171,7 +164,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check scope
|
// Check scope
|
||||||
if (!tokenData.scope || tokenData.scope[0] !== "2fa-challenge") {
|
if (tokenData.scope?.[0] !== "2fa-challenge") {
|
||||||
throw new errs.AuthError("Invalid challenge token");
|
throw new errs.AuthError("Invalid challenge token");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,10 +176,7 @@ export default {
|
|||||||
// Verify 2FA code
|
// Verify 2FA code
|
||||||
const valid = await twoFactor.verifyForLogin(userId, code);
|
const valid = await twoFactor.verifyForLogin(userId, code);
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
throw new errs.AuthError(
|
throw new errs.AuthError(ERROR_MESSAGE_INVALID_2FA, ERROR_MESSAGE_INVALID_2FA_I18N);
|
||||||
ERROR_MESSAGE_INVALID_2FA,
|
|
||||||
ERROR_MESSAGE_INVALID_2FA_I18N,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create full token
|
// Create full token
|
||||||
|
|||||||
@@ -87,7 +87,13 @@ const internalUser = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return access
|
return access
|
||||||
.can("users:update", data.id)
|
.can("users:permissions", data.id)
|
||||||
|
.catch(() => {
|
||||||
|
delete data.roles;
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
return access.can("users:update", data.id);
|
||||||
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// Make sure that the user being updated doesn't change their email to another user that is already using it
|
// Make sure that the user being updated doesn't change their email to another user that is already using it
|
||||||
// 1. get user we want to update
|
// 1. get user we want to update
|
||||||
@@ -171,7 +177,7 @@ const internalUser = {
|
|||||||
return query.then(utils.omitRow(omissions()));
|
return query.then(utils.omitRow(omissions()));
|
||||||
})
|
})
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
if (!row || !row.id) {
|
if (!row?.id) {
|
||||||
throw new errs.ItemNotFoundError(thisData.id);
|
throw new errs.ItemNotFoundError(thisData.id);
|
||||||
}
|
}
|
||||||
// Custom omissions
|
// Custom omissions
|
||||||
@@ -251,9 +257,7 @@ const internalUser = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
deleteAll: async () => {
|
deleteAll: async () => {
|
||||||
await userModel
|
await userModel.query().patch({
|
||||||
.query()
|
|
||||||
.patch({
|
|
||||||
is_deleted: 1,
|
is_deleted: 1,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -384,11 +388,21 @@ const internalUser = {
|
|||||||
.andWhere("type", data.type)
|
.andWhere("type", data.type)
|
||||||
.first()
|
.first()
|
||||||
.then((existing_auth) => {
|
.then((existing_auth) => {
|
||||||
|
// Stamped here rather than read off modified_on, because it is compared against a
|
||||||
|
// token's `iat` and the two only line up when the same clock writes both. The
|
||||||
|
// database clock is a different one: with the app on one timezone and the database
|
||||||
|
// on another, its timestamps come back hours away from where Node thinks it is.
|
||||||
|
const password_changed_at = Math.floor(Date.now() / 1000);
|
||||||
|
|
||||||
if (existing_auth) {
|
if (existing_auth) {
|
||||||
// patch
|
// patch
|
||||||
|
const meta = existing_auth.meta || {};
|
||||||
|
meta.password_changed_at = password_changed_at;
|
||||||
|
|
||||||
return authModel.query().where("user_id", user.id).andWhere("type", data.type).patch({
|
return authModel.query().where("user_id", user.id).andWhere("type", data.type).patch({
|
||||||
type: data.type, // This is required for the model to encrypt on save
|
type: data.type, // This is required for the model to encrypt on save
|
||||||
secret: data.secret,
|
secret: data.secret,
|
||||||
|
meta,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// insert
|
// insert
|
||||||
@@ -396,7 +410,7 @@ const internalUser = {
|
|||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
type: data.type,
|
type: data.type,
|
||||||
secret: data.secret,
|
secret: data.secret,
|
||||||
meta: {},
|
meta: { password_changed_at },
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|||||||
+11
-11
@@ -1,19 +1,19 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
development: {
|
development: {
|
||||||
client: 'mysql2',
|
client: "mysql2",
|
||||||
migrations: {
|
migrations: {
|
||||||
tableName: 'migrations',
|
tableName: "migrations",
|
||||||
stub: 'lib/migrate_template.js',
|
stub: "lib/migrate_template.js",
|
||||||
directory: 'migrations'
|
directory: "migrations",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
production: {
|
production: {
|
||||||
client: 'mysql2',
|
client: "mysql2",
|
||||||
migrations: {
|
migrations: {
|
||||||
tableName: 'migrations',
|
tableName: "migrations",
|
||||||
stub: 'lib/migrate_template.js',
|
stub: "lib/migrate_template.js",
|
||||||
directory: 'migrations'
|
directory: "migrations",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
+24
-5
@@ -12,6 +12,7 @@ import { fileURLToPath } from "node:url";
|
|||||||
import Ajv from "ajv/dist/2020.js";
|
import Ajv from "ajv/dist/2020.js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { access as logger } from "../logger.js";
|
import { access as logger } from "../logger.js";
|
||||||
|
import authModel from "../models/auth.js";
|
||||||
import proxyHostModel from "../models/proxy_host.js";
|
import proxyHostModel from "../models/proxy_host.js";
|
||||||
import TokenModel from "../models/token.js";
|
import TokenModel from "../models/token.js";
|
||||||
import userModel from "../models/user.js";
|
import userModel from "../models/user.js";
|
||||||
@@ -80,6 +81,22 @@ export default function (tokenString) {
|
|||||||
if (!ok) {
|
if (!ok) {
|
||||||
throw new errs.AuthError("Invalid token scope for User");
|
throw new errs.AuthError("Invalid token scope for User");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A token issued before the password was last changed is no longer valid: taking an account
|
||||||
|
// back from whoever has the old password has to end the sessions that password opened.
|
||||||
|
const auth = await authModel
|
||||||
|
.query()
|
||||||
|
.where("user_id", "=", user.id)
|
||||||
|
.where("type", "=", "password")
|
||||||
|
.first();
|
||||||
|
|
||||||
|
// Both sides come from the same clock and in the same unit, whole seconds since
|
||||||
|
// the epoch: `setPassword` stamps the marker and `jsonwebtoken` stamps `iat`.
|
||||||
|
const changedAt = auth?.meta?.password_changed_at;
|
||||||
|
if (changedAt && typeof tokenData.iat === "number" && tokenData.iat < changedAt) {
|
||||||
|
throw new errs.TokenRevokedError("Token was issued before the password was changed");
|
||||||
|
}
|
||||||
|
|
||||||
initialised = true;
|
initialised = true;
|
||||||
userRoles = user.roles;
|
userRoles = user.roles;
|
||||||
permissions = user.permissions;
|
permissions = user.permissions;
|
||||||
@@ -119,10 +136,7 @@ export default function (tokenString) {
|
|||||||
|
|
||||||
// Proxy Hosts
|
// Proxy Hosts
|
||||||
case "proxy_hosts": {
|
case "proxy_hosts": {
|
||||||
const query = proxyHostModel
|
const query = proxyHostModel.query().select("id").andWhere("is_deleted", 0);
|
||||||
.query()
|
|
||||||
.select("id")
|
|
||||||
.andWhere("is_deleted", 0);
|
|
||||||
|
|
||||||
if (permissions.visibility === "user") {
|
if (permissions.visibility === "user") {
|
||||||
query.andWhere("owner_user_id", tokenUserId);
|
query.andWhere("owner_user_id", tokenUserId);
|
||||||
@@ -271,7 +285,12 @@ export default function (tokenString) {
|
|||||||
err.permission = permission;
|
err.permission = permission;
|
||||||
err.permission_data = data;
|
err.permission_data = data;
|
||||||
logger.error(permission, data, err.message);
|
logger.error(permission, data, err.message);
|
||||||
throw errs.PermissionError("Permission Denied", err);
|
// A revoked token is not a permission problem, and the client can tell: the frontend
|
||||||
|
// clears the session on a 401 and on nothing else.
|
||||||
|
if (err instanceof errs.TokenRevokedError) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
throw new errs.PermissionError("Permission Denied", err);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "roles#/definitions/admin"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
+17
-13
@@ -4,8 +4,6 @@ import { certbot as logger } from "../logger.js";
|
|||||||
import errs from "./error.js";
|
import errs from "./error.js";
|
||||||
import utils from "./utils.js";
|
import utils from "./utils.js";
|
||||||
|
|
||||||
const CERTBOT_VERSION_REPLACEMENT = "$(certbot --version | grep -Eo '[0-9](\\.[0-9]+)+')";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs a cerbot plugin given the key for the object from
|
* Installs a cerbot plugin given the key for the object from
|
||||||
* ../certbot/dns-plugins.json
|
* ../certbot/dns-plugins.json
|
||||||
@@ -15,24 +13,32 @@ const CERTBOT_VERSION_REPLACEMENT = "$(certbot --version | grep -Eo '[0-9](\\.[0
|
|||||||
*/
|
*/
|
||||||
const installPlugin = async (pluginKey) => {
|
const installPlugin = async (pluginKey) => {
|
||||||
if (typeof dnsPlugins[pluginKey] === "undefined") {
|
if (typeof dnsPlugins[pluginKey] === "undefined") {
|
||||||
// throw Error(`Certbot plugin ${pluginKey} not found`);
|
|
||||||
throw new errs.ItemNotFoundError(pluginKey);
|
throw new errs.ItemNotFoundError(pluginKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
const plugin = dnsPlugins[pluginKey];
|
const plugin = dnsPlugins[pluginKey];
|
||||||
logger.start(`Installing ${pluginKey}...`);
|
logger.start(`Installing ${pluginKey}...`);
|
||||||
|
|
||||||
plugin.version = plugin.version.replace(/{{certbot-version}}/g, CERTBOT_VERSION_REPLACEMENT);
|
plugin.version = plugin.version.replace(/{{certbot-version}}/g, process.env.CERTBOT_VERSION);
|
||||||
plugin.dependencies = plugin.dependencies.replace(/{{certbot-version}}/g, CERTBOT_VERSION_REPLACEMENT);
|
plugin.dependencies = plugin.dependencies.replace(/{{certbot-version}}/g, process.env.CERTBOT_VERSION);
|
||||||
|
|
||||||
// SETUPTOOLS_USE_DISTUTILS is required for certbot plugins to install correctly
|
// SETUPTOOLS_USE_DISTUTILS=local uses setuptools' own bundled distutils.
|
||||||
// in new versions of Python
|
// "stdlib" breaks Python 3.13+ where distutils was removed from the standard library.
|
||||||
let env = Object.assign({}, process.env, { SETUPTOOLS_USE_DISTUTILS: "stdlib" });
|
let env = Object.assign({}, process.env, { SETUPTOOLS_USE_DISTUTILS: "local" });
|
||||||
if (typeof plugin.env === "object") {
|
if (typeof plugin.env === "object") {
|
||||||
env = Object.assign(env, plugin.env);
|
env = Object.assign(env, plugin.env);
|
||||||
}
|
}
|
||||||
|
|
||||||
const cmd = `. /opt/certbot/bin/activate && pip install --no-cache-dir ${plugin.dependencies} ${plugin.package_name}${plugin.version} && deactivate`;
|
const quotedDeps = plugin.dependencies.trim()
|
||||||
|
? plugin.dependencies
|
||||||
|
.trim()
|
||||||
|
.split(/\s+/)
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((d) => `'${d}'`)
|
||||||
|
.join(" ")
|
||||||
|
: "";
|
||||||
|
|
||||||
|
const cmd = `. /opt/certbot/bin/activate && pip install --no-cache-dir ${quotedDeps} '${plugin.package_name}${plugin.version}' && deactivate`;
|
||||||
return utils
|
return utils
|
||||||
.exec(cmd, { env })
|
.exec(cmd, { env })
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
@@ -73,9 +79,7 @@ const installPlugins = async (pluginKeys) => {
|
|||||||
})
|
})
|
||||||
.end(() => {
|
.end(() => {
|
||||||
if (hasErrors) {
|
if (hasErrors) {
|
||||||
reject(
|
reject(new errs.CommandError("Some plugins failed to install. Please check the logs above", 1));
|
||||||
new errs.CommandError("Some plugins failed to install. Please check the logs above", 1),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
@@ -83,4 +87,4 @@ const installPlugins = async (pluginKeys) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export { installPlugins, installPlugin };
|
export { installPlugin, installPlugins };
|
||||||
+36
-13
@@ -2,10 +2,13 @@ import fs from "node:fs";
|
|||||||
import NodeRSA from "node-rsa";
|
import NodeRSA from "node-rsa";
|
||||||
import { global as logger } from "../logger.js";
|
import { global as logger } from "../logger.js";
|
||||||
|
|
||||||
const keysFile = '/data/keys.json';
|
const keysFile = "/data/keys.json";
|
||||||
const mysqlEngine = 'mysql2';
|
const mysqlEngine = "mysql2";
|
||||||
const postgresEngine = 'pg';
|
const postgresEngine = "pg";
|
||||||
const sqliteClientName = 'better-sqlite3';
|
const sqliteClientName = "better-sqlite3";
|
||||||
|
|
||||||
|
// Not used for new setups anymore but may exist in legacy setups
|
||||||
|
const legacySqliteClientName = "sqlite3";
|
||||||
|
|
||||||
let instance = null;
|
let instance = null;
|
||||||
|
|
||||||
@@ -37,14 +40,20 @@ const configure = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const toBool = (v) => /^(1|true|yes|on)$/i.test((v || '').trim());
|
const toBool = (v) => /^(1|true|yes|on)$/i.test((v || "").trim());
|
||||||
|
|
||||||
const envMysqlHost = process.env.DB_MYSQL_HOST || null;
|
const envMysqlHost = process.env.DB_MYSQL_HOST || null;
|
||||||
const envMysqlUser = process.env.DB_MYSQL_USER || null;
|
const envMysqlUser = process.env.DB_MYSQL_USER || null;
|
||||||
const envMysqlName = process.env.DB_MYSQL_NAME || null;
|
const envMysqlName = process.env.DB_MYSQL_NAME || null;
|
||||||
const envMysqlSSL = toBool(process.env.DB_MYSQL_SSL);
|
const envMysqlSSL = toBool(process.env.DB_MYSQL_SSL);
|
||||||
const envMysqlSSLRejectUnauthorized = process.env.DB_MYSQL_SSL_REJECT_UNAUTHORIZED === undefined ? true : toBool(process.env.DB_MYSQL_SSL_REJECT_UNAUTHORIZED);
|
const envMysqlSSLRejectUnauthorized =
|
||||||
const envMysqlSSLVerifyIdentity = process.env.DB_MYSQL_SSL_VERIFY_IDENTITY === undefined ? true : toBool(process.env.DB_MYSQL_SSL_VERIFY_IDENTITY);
|
process.env.DB_MYSQL_SSL_REJECT_UNAUTHORIZED === undefined
|
||||||
|
? true
|
||||||
|
: toBool(process.env.DB_MYSQL_SSL_REJECT_UNAUTHORIZED);
|
||||||
|
const envMysqlSSLVerifyIdentity =
|
||||||
|
process.env.DB_MYSQL_SSL_VERIFY_IDENTITY === undefined
|
||||||
|
? true
|
||||||
|
: toBool(process.env.DB_MYSQL_SSL_VERIFY_IDENTITY);
|
||||||
if (envMysqlHost && envMysqlUser && envMysqlName) {
|
if (envMysqlHost && envMysqlUser && envMysqlName) {
|
||||||
// we have enough mysql creds to go with mysql
|
// we have enough mysql creds to go with mysql
|
||||||
logger.info("Using MySQL configuration");
|
logger.info("Using MySQL configuration");
|
||||||
@@ -56,7 +65,9 @@ const configure = () => {
|
|||||||
user: envMysqlUser,
|
user: envMysqlUser,
|
||||||
password: process.env.DB_MYSQL_PASSWORD,
|
password: process.env.DB_MYSQL_PASSWORD,
|
||||||
name: envMysqlName,
|
name: envMysqlName,
|
||||||
ssl: envMysqlSSL ? { rejectUnauthorized: envMysqlSSLRejectUnauthorized, verifyIdentity: envMysqlSSLVerifyIdentity } : false,
|
ssl: envMysqlSSL
|
||||||
|
? { rejectUnauthorized: envMysqlSSLRejectUnauthorized, verifyIdentity: envMysqlSSLVerifyIdentity }
|
||||||
|
: false,
|
||||||
},
|
},
|
||||||
keys: getKeys(),
|
keys: getKeys(),
|
||||||
};
|
};
|
||||||
@@ -134,7 +145,7 @@ const generateKeys = () => {
|
|||||||
|
|
||||||
// Write keys config
|
// Write keys config
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(keysFile, JSON.stringify(keys, null, 2));
|
fs.writeFileSync(keysFile, JSON.stringify(keys, null, 2), { mode: 0o600 });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(`Could not write JWT key pair to config file: ${keysFile}: ${err.message}`);
|
logger.error(`Could not write JWT key pair to config file: ${keysFile}: ${err.message}`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
@@ -184,7 +195,7 @@ const configGet = (key) => {
|
|||||||
*/
|
*/
|
||||||
const isSqlite = () => {
|
const isSqlite = () => {
|
||||||
instance === null && configure();
|
instance === null && configure();
|
||||||
return instance.database.knex && instance.database.knex.client === sqliteClientName;
|
return instance.database.knex && [sqliteClientName, legacySqliteClientName].includes(instance.database.knex.client);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +219,7 @@ const isPostgres = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Are we running in debug mdoe?
|
* Are we running in debug mode?
|
||||||
*
|
*
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
@@ -219,7 +230,7 @@ const isDebugMode = () => !!process.env.DEBUG;
|
|||||||
*
|
*
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
const isCI = () => process.env.CI === 'true' && process.env.DEBUG === 'true';
|
const isCI = () => process.env.CI === "true" && process.env.DEBUG === "true";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a public key
|
* Returns a public key
|
||||||
@@ -256,4 +267,16 @@ const useLetsencryptServer = () => {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export { isCI, configHas, configGet, isSqlite, isMysql, isPostgres, isDebugMode, getPrivateKey, getPublicKey, useLetsencryptStaging, useLetsencryptServer };
|
export {
|
||||||
|
isCI,
|
||||||
|
configHas,
|
||||||
|
configGet,
|
||||||
|
isSqlite,
|
||||||
|
isMysql,
|
||||||
|
isPostgres,
|
||||||
|
isDebugMode,
|
||||||
|
getPrivateKey,
|
||||||
|
getPublicKey,
|
||||||
|
useLetsencryptStaging,
|
||||||
|
useLetsencryptServer,
|
||||||
|
};
|
||||||
@@ -22,6 +22,15 @@ const errs = {
|
|||||||
this.status = 404;
|
this.status = 404;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
TokenRevokedError: function (message, previous) {
|
||||||
|
Error.captureStackTrace(this, this.constructor);
|
||||||
|
this.name = this.constructor.name;
|
||||||
|
this.previous = previous;
|
||||||
|
this.message = message;
|
||||||
|
this.public = true;
|
||||||
|
this.status = 401;
|
||||||
|
},
|
||||||
|
|
||||||
AuthError: function (message, messageI18n, previous) {
|
AuthError: function (message, messageI18n, previous) {
|
||||||
Error.captureStackTrace(this, this.constructor);
|
Error.captureStackTrace(this, this.constructor);
|
||||||
this.name = this.constructor.name;
|
this.name = this.constructor.name;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ export default (req, res, next) => {
|
|||||||
res.set({
|
res.set({
|
||||||
"Access-Control-Allow-Origin": req.headers.origin,
|
"Access-Control-Allow-Origin": req.headers.origin,
|
||||||
"Access-Control-Allow-Credentials": true,
|
"Access-Control-Allow-Credentials": true,
|
||||||
"Access-Control-Allow-Methods": "OPTIONS, GET, POST",
|
"Access-Control-Allow-Methods": "OPTIONS, GET, POST, PUT, DELETE",
|
||||||
"Access-Control-Allow-Headers":
|
"Access-Control-Allow-Headers":
|
||||||
"Content-Type, Cache-Control, Pragma, Expires, Authorization, X-Dataset-Total, X-Dataset-Offset, X-Dataset-Limit",
|
"Content-Type, Cache-Control, Pragma, Expires, Authorization, X-Dataset-Total, X-Dataset-Offset, X-Dataset-Limit",
|
||||||
"Access-Control-Max-Age": 5 * 60,
|
"Access-Control-Max-Age": 5 * 60,
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import chalk from "chalk";
|
||||||
|
import { debug, express as logger } from "../../logger.js";
|
||||||
|
|
||||||
|
export default (req, _res, next) => {
|
||||||
|
debug(logger, `[${chalk.yellow(req.method.toUpperCase())}] ${chalk.green(req.path)}`);
|
||||||
|
next();
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
export default (req, res, next) => {
|
export default (req, res, next) => {
|
||||||
if (req.params.user_id === 'me' && res.locals.access) {
|
if (req.params.user_id === "me" && res.locals.access) {
|
||||||
req.params.user_id = res.locals.access.token.get('attrs').id;
|
req.params.user_id = res.locals.access.token.get("attrs").id;
|
||||||
} else {
|
} else {
|
||||||
req.params.user_id = Number.parseInt(req.params.user_id, 10);
|
req.params.user_id = Number.parseInt(req.params.user_id, 10);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,12 @@ import { dirname } from "node:path";
|
|||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { Liquid } from "liquidjs";
|
import { Liquid } from "liquidjs";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { debug, global as logger } from "../logger.js";
|
|
||||||
import errs from "./error.js";
|
import errs from "./error.js";
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = dirname(__filename);
|
const __dirname = dirname(__filename);
|
||||||
|
|
||||||
const exec = async (cmd, options = {}) => {
|
const exec = async (cmd, options = {}) => {
|
||||||
debug(logger, "CMD:", cmd);
|
|
||||||
const { stdout, stderr } = await new Promise((resolve, reject) => {
|
const { stdout, stderr } = await new Promise((resolve, reject) => {
|
||||||
const child = nodeExec(cmd, options, (isError, stdout, stderr) => {
|
const child = nodeExec(cmd, options, (isError, stdout, stderr) => {
|
||||||
if (isError) {
|
if (isError) {
|
||||||
@@ -34,7 +32,6 @@ const exec = async (cmd, options = {}) => {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
const execFile = (cmd, args, options) => {
|
const execFile = (cmd, args, options) => {
|
||||||
debug(logger, `CMD: ${cmd} ${args ? args.join(" ") : ""}`);
|
|
||||||
const opts = options || {};
|
const opts = options || {};
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import net from "node:net";
|
||||||
import Ajv from "ajv/dist/2020.js";
|
import Ajv from "ajv/dist/2020.js";
|
||||||
import errs from "../error.js";
|
import errs from "../error.js";
|
||||||
|
|
||||||
@@ -9,6 +10,8 @@ const ajv = new Ajv({
|
|||||||
coerceTypes: true,
|
coerceTypes: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ajv.addFormat("ipv6", { type: "string", validate: (value) => net.isIPv6(value) });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} schema
|
* @param {Object} schema
|
||||||
* @param {Object} payload
|
* @param {Object} payload
|
||||||
@@ -24,18 +27,14 @@ const apiValidator = async (schema, payload /*, description*/) => {
|
|||||||
throw new errs.ValidationError("Payload is undefined");
|
throw new errs.ValidationError("Payload is undefined");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const validate = ajv.compile(schema);
|
const validate = ajv.compile(schema);
|
||||||
|
|
||||||
const valid = validate(payload);
|
const valid = validate(payload);
|
||||||
|
|
||||||
|
|
||||||
if (valid && !validate.errors) {
|
if (valid && !validate.errors) {
|
||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const message = ajv.errorsText(validate.errors);
|
const message = ajv.errorsText(validate.errors);
|
||||||
const err = new errs.ValidationError(message);
|
const err = new errs.ValidationError(message);
|
||||||
err.debug = { validationErrors: validate.errors, payload };
|
err.debug = { validationErrors: validate.errors, payload };
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import Ajv from 'ajv/dist/2020.js';
|
import net from "node:net";
|
||||||
|
import Ajv from "ajv/dist/2020.js";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import commonDefinitions from "../../schema/common.json" with { type: "json" };
|
import commonDefinitions from "../../schema/common.json" with { type: "json" };
|
||||||
import errs from "../error.js";
|
import errs from "../error.js";
|
||||||
@@ -14,6 +15,8 @@ const ajv = new Ajv({
|
|||||||
schemas: [commonDefinitions],
|
schemas: [commonDefinitions],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ajv.addFormat("ipv6", { type: "string", validate: (value) => net.isIPv6(value) });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {Object} schema
|
* @param {Object} schema
|
||||||
|
|||||||
+111
-11
@@ -1,3 +1,5 @@
|
|||||||
|
import fs from "node:fs";
|
||||||
|
import path from "node:path";
|
||||||
import signale from "signale";
|
import signale from "signale";
|
||||||
import { isDebugMode } from "./lib/config.js";
|
import { isDebugMode } from "./lib/config.js";
|
||||||
|
|
||||||
@@ -5,17 +7,115 @@ const opts = {
|
|||||||
logLevel: "info",
|
logLevel: "info",
|
||||||
};
|
};
|
||||||
|
|
||||||
const global = new signale.Signale({ scope: "Global ", ...opts });
|
// Methods that are actually used across the codebase (see grep of `.info(`, `.warn(`, etc).
|
||||||
const migrate = new signale.Signale({ scope: "Migrate ", ...opts });
|
// Only these are mirrored to the log file - decorative signale methods (star, note, watch, ...)
|
||||||
const express = new signale.Signale({ scope: "Express ", ...opts });
|
// are left console-only since they carry no diagnostic value worth persisting.
|
||||||
const access = new signale.Signale({ scope: "Access ", ...opts });
|
const PERSISTED_METHODS = ["info", "warn", "error", "debug", "success", "fatal", "complete"];
|
||||||
const nginx = new signale.Signale({ scope: "Nginx ", ...opts });
|
|
||||||
const ssl = new signale.Signale({ scope: "SSL ", ...opts });
|
const LOG_FILE = "/data/logs/backend.log";
|
||||||
const certbot = new signale.Signale({ scope: "Certbot ", ...opts });
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: stripping ANSI colour codes before writing to disk
|
||||||
const importer = new signale.Signale({ scope: "Importer ", ...opts });
|
const ANSI_PATTERN = /\x1b\[[0-9;]*m/g;
|
||||||
const setup = new signale.Signale({ scope: "Setup ", ...opts });
|
|
||||||
const ipRanges = new signale.Signale({ scope: "IP Ranges", ...opts });
|
let fileStream = null;
|
||||||
const remoteVersion = new signale.Signale({ scope: "Remote Version", ...opts });
|
let lastOpenAttempt = 0;
|
||||||
|
// If the file can't be opened (eg. running outside the standard Docker image, or in
|
||||||
|
// CI without /data), don't retry on every single log call - but do retry periodically
|
||||||
|
// so a transient issue (disk full, permissions fixed later) recovers without a restart.
|
||||||
|
const REOPEN_COOLDOWN_MS = 30 * 1000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lazily opens the backend log file for appending. If the directory isn't writable,
|
||||||
|
* file logging is silently disabled and console logging continues unaffected.
|
||||||
|
*
|
||||||
|
* @returns {import('node:fs').WriteStream|null}
|
||||||
|
*/
|
||||||
|
const getFileStream = () => {
|
||||||
|
if (fileStream) {
|
||||||
|
return fileStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
const now = Date.now();
|
||||||
|
if (now - lastOpenAttempt < REOPEN_COOLDOWN_MS) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
lastOpenAttempt = now;
|
||||||
|
|
||||||
|
try {
|
||||||
|
fs.mkdirSync(path.dirname(LOG_FILE), { recursive: true });
|
||||||
|
const stream = fs.createWriteStream(LOG_FILE, { flags: "a" });
|
||||||
|
stream.on("error", () => {
|
||||||
|
fileStream = null;
|
||||||
|
});
|
||||||
|
fileStream = stream;
|
||||||
|
} catch (_err) {
|
||||||
|
fileStream = null;
|
||||||
|
}
|
||||||
|
return fileStream;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats and appends a single log line to the backend log file.
|
||||||
|
* Never throws - a failure here must never take down the application.
|
||||||
|
*
|
||||||
|
* @param {String} level
|
||||||
|
* @param {String} scope
|
||||||
|
* @param {Array} args
|
||||||
|
*/
|
||||||
|
const writeToFile = (level, scope, args) => {
|
||||||
|
const stream = getFileStream();
|
||||||
|
if (!stream) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const message = args
|
||||||
|
.map((arg) => {
|
||||||
|
if (typeof arg === "string") return arg;
|
||||||
|
if (arg instanceof Error) return arg.stack || arg.message;
|
||||||
|
try {
|
||||||
|
return JSON.stringify(arg);
|
||||||
|
} catch (_err) {
|
||||||
|
return String(arg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.join(" ")
|
||||||
|
.replace(ANSI_PATTERN, "");
|
||||||
|
|
||||||
|
const line = `${new Date().toISOString()} ${level.toUpperCase().padEnd(7)} [${scope.trim()}] ${message}\n`;
|
||||||
|
stream.write(line);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps a Signale instance so that every call to one of PERSISTED_METHODS is also
|
||||||
|
* appended to the backend log file, in addition to its normal console output.
|
||||||
|
*
|
||||||
|
* @param {Signale} instance
|
||||||
|
* @param {String} scope
|
||||||
|
* @returns {Signale}
|
||||||
|
*/
|
||||||
|
const withFileSink = (instance, scope) => {
|
||||||
|
for (const method of PERSISTED_METHODS) {
|
||||||
|
const original = instance[method].bind(instance);
|
||||||
|
instance[method] = (...args) => {
|
||||||
|
writeToFile(method, scope, args);
|
||||||
|
return original(...args);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
const createLogger = (scope) => withFileSink(new signale.Signale({ scope, ...opts }), scope);
|
||||||
|
|
||||||
|
const global = createLogger("Global ");
|
||||||
|
const migrate = createLogger("Migrate ");
|
||||||
|
const express = createLogger("Express ");
|
||||||
|
const access = createLogger("Access ");
|
||||||
|
const nginx = createLogger("Nginx ");
|
||||||
|
const ssl = createLogger("SSL ");
|
||||||
|
const certbot = createLogger("Certbot ");
|
||||||
|
const importer = createLogger("Importer ");
|
||||||
|
const setup = createLogger("Setup ");
|
||||||
|
const ipRanges = createLogger("IP Ranges");
|
||||||
|
const remoteVersion = createLogger("Remote Version");
|
||||||
|
|
||||||
const debug = (logger, ...args) => {
|
const debug = (logger, ...args) => {
|
||||||
if (isDebugMode()) {
|
if (isDebugMode()) {
|
||||||
|
|||||||
@@ -13,12 +13,13 @@ const migrateName = "settings";
|
|||||||
const up = (knex) => {
|
const up = (knex) => {
|
||||||
logger.info(`[${migrateName}] Migrating Up...`);
|
logger.info(`[${migrateName}] Migrating Up...`);
|
||||||
|
|
||||||
return knex.schema.createTable('setting', (table) => {
|
return knex.schema
|
||||||
table.string('id').notNull().primary();
|
.createTable("setting", (table) => {
|
||||||
table.string('name', 100).notNull();
|
table.string("id").notNull().primary();
|
||||||
table.string('description', 255).notNull();
|
table.string("name", 100).notNull();
|
||||||
table.string('value', 255).notNull();
|
table.string("description", 255).notNull();
|
||||||
table.json('meta').notNull();
|
table.string("value", 255).notNull();
|
||||||
|
table.json("meta").notNull();
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info(`[${migrateName}] setting Table created`);
|
logger.info(`[${migrateName}] setting Table created`);
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ const up = (knex) => {
|
|||||||
.table("redirection_host", async (table) => {
|
.table("redirection_host", async (table) => {
|
||||||
// change the column default from $scheme to auto
|
// change the column default from $scheme to auto
|
||||||
await table.string("forward_scheme").notNull().defaultTo("auto").alter();
|
await table.string("forward_scheme").notNull().defaultTo("auto").alter();
|
||||||
await knex('redirection_host')
|
await knex("redirection_host").where("forward_scheme", "$scheme").update({ forward_scheme: "auto" });
|
||||||
.where('forward_scheme', '$scheme')
|
|
||||||
.update({ forward_scheme: 'auto' });
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info(`[${migrateName}] redirection_host Table altered`);
|
logger.info(`[${migrateName}] redirection_host Table altered`);
|
||||||
@@ -38,9 +36,7 @@ const down = (knex) => {
|
|||||||
return knex.schema
|
return knex.schema
|
||||||
.table("redirection_host", async (table) => {
|
.table("redirection_host", async (table) => {
|
||||||
await table.string("forward_scheme").notNull().defaultTo("$scheme").alter();
|
await table.string("forward_scheme").notNull().defaultTo("$scheme").alter();
|
||||||
await knex('redirection_host')
|
await knex("redirection_host").where("forward_scheme", "auto").update({ forward_scheme: "$scheme" });
|
||||||
.where('forward_scheme', 'auto')
|
|
||||||
.update({ forward_scheme: '$scheme' });
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info(`[${migrateName}] redirection_host Table altered`);
|
logger.info(`[${migrateName}] redirection_host Table altered`);
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ const migrateName = "trust_forwarded_proto";
|
|||||||
* @param {Object} knex
|
* @param {Object} knex
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
const up = function (knex) {
|
const up = (knex) => {
|
||||||
logger.info(`[${migrateName}] Migrating Up...`);
|
logger.info(`[${migrateName}] Migrating Up...`);
|
||||||
|
|
||||||
return knex.schema
|
return knex.schema
|
||||||
.alterTable('proxy_host', (table) => {
|
.alterTable("proxy_host", (table) => {
|
||||||
table.tinyint('trust_forwarded_proto').notNullable().defaultTo(0);
|
table.tinyint("trust_forwarded_proto").notNullable().defaultTo(0);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info(`[${migrateName}] proxy_host Table altered`);
|
logger.info(`[${migrateName}] proxy_host Table altered`);
|
||||||
@@ -28,12 +28,12 @@ const up = function (knex) {
|
|||||||
* @param {Object} knex
|
* @param {Object} knex
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
const down = function (knex) {
|
const down = (knex) => {
|
||||||
logger.info(`[${migrateName}] Migrating Down...`);
|
logger.info(`[${migrateName}] Migrating Down...`);
|
||||||
|
|
||||||
return knex.schema
|
return knex.schema
|
||||||
.alterTable('proxy_host', (table) => {
|
.alterTable("proxy_host", (table) => {
|
||||||
table.dropColumn('trust_forwarded_proto');
|
table.dropColumn("trust_forwarded_proto");
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info(`[${migrateName}] proxy_host Table altered`);
|
logger.info(`[${migrateName}] proxy_host Table altered`);
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ class AccessList extends Model {
|
|||||||
|
|
||||||
$parseDatabaseJson(json) {
|
$parseDatabaseJson(json) {
|
||||||
const thisJson = super.$parseDatabaseJson(json);
|
const thisJson = super.$parseDatabaseJson(json);
|
||||||
|
// Postgres returns COUNT() as a string
|
||||||
|
if (typeof thisJson.proxy_host_count === "string") {
|
||||||
|
thisJson.proxy_host_count = Number.parseInt(thisJson.proxy_host_count, 10);
|
||||||
|
}
|
||||||
return convertIntFieldsToBool(thisJson, boolFields);
|
return convertIntFieldsToBool(thisJson, boolFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,16 @@ Model.knex(db());
|
|||||||
|
|
||||||
const boolFields = ["is_deleted"];
|
const boolFields = ["is_deleted"];
|
||||||
|
|
||||||
|
const cleanDomainNames = (domainNames) => {
|
||||||
|
// Sort domain_names
|
||||||
|
if (typeof domainNames !== "undefined") {
|
||||||
|
const newDomainNames = domainNames.filter((name) => name != null);
|
||||||
|
newDomainNames.sort();
|
||||||
|
return newDomainNames;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
};
|
||||||
|
|
||||||
class Certificate extends Model {
|
class Certificate extends Model {
|
||||||
$beforeInsert() {
|
$beforeInsert() {
|
||||||
this.created_on = now();
|
this.created_on = now();
|
||||||
@@ -26,7 +36,9 @@ class Certificate extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Default for domain_names
|
// Default for domain_names
|
||||||
if (typeof this.domain_names === "undefined") {
|
if (typeof this.domain_names !== "undefined") {
|
||||||
|
this.domain_names = cleanDomainNames(this.domain_names);
|
||||||
|
} else {
|
||||||
this.domain_names = [];
|
this.domain_names = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,16 +46,12 @@ class Certificate extends Model {
|
|||||||
if (typeof this.meta === "undefined") {
|
if (typeof this.meta === "undefined") {
|
||||||
this.meta = {};
|
this.meta = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.domain_names.sort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$beforeUpdate() {
|
$beforeUpdate() {
|
||||||
this.modified_on = now();
|
this.modified_on = now();
|
||||||
|
|
||||||
// Sort domain_names
|
|
||||||
if (typeof this.domain_names !== "undefined") {
|
if (typeof this.domain_names !== "undefined") {
|
||||||
this.domain_names.sort();
|
this.domain_names = cleanDomainNames(this.domain_names);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import { Model } from "objection";
|
import { Model } from "objection";
|
||||||
import db from "../db.js";
|
import db from "../db.js";
|
||||||
import { convertBoolFieldsToInt, convertIntFieldsToBool } from "../lib/helpers.js";
|
import { castJsonIfNeed, convertBoolFieldsToInt, convertIntFieldsToBool } from "../lib/helpers.js";
|
||||||
import Certificate from "./certificate.js";
|
import Certificate from "./certificate.js";
|
||||||
import now from "./now_helper.js";
|
import now from "./now_helper.js";
|
||||||
import User from "./user.js";
|
import User from "./user.js";
|
||||||
@@ -61,6 +61,18 @@ class DeadHost extends Model {
|
|||||||
return ["domain_names", "meta"];
|
return ["domain_names", "meta"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get defaultAllowGraph() {
|
||||||
|
return "[owner,certificate]";
|
||||||
|
}
|
||||||
|
|
||||||
|
static get defaultExpand() {
|
||||||
|
return ["certificate", "owner"];
|
||||||
|
}
|
||||||
|
|
||||||
|
static get defaultOrder() {
|
||||||
|
return [castJsonIfNeed("domain_names"), "ASC"];
|
||||||
|
}
|
||||||
|
|
||||||
static get relationMappings() {
|
static get relationMappings() {
|
||||||
return {
|
return {
|
||||||
owner: {
|
owner: {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import { Model } from "objection";
|
import { Model } from "objection";
|
||||||
import db from "../db.js";
|
import db from "../db.js";
|
||||||
import { convertBoolFieldsToInt, convertIntFieldsToBool } from "../lib/helpers.js";
|
import { castJsonIfNeed, convertBoolFieldsToInt, convertIntFieldsToBool } from "../lib/helpers.js";
|
||||||
import AccessList from "./access_list.js";
|
import AccessList from "./access_list.js";
|
||||||
import Certificate from "./certificate.js";
|
import Certificate from "./certificate.js";
|
||||||
import now from "./now_helper.js";
|
import now from "./now_helper.js";
|
||||||
@@ -73,6 +73,18 @@ class ProxyHost extends Model {
|
|||||||
return ["domain_names", "meta", "locations"];
|
return ["domain_names", "meta", "locations"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get defaultAllowGraph() {
|
||||||
|
return "[owner,access_list.[clients,items],certificate]";
|
||||||
|
}
|
||||||
|
|
||||||
|
static get defaultExpand() {
|
||||||
|
return ["owner", "certificate", "access_list.[clients,items]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
static get defaultOrder() {
|
||||||
|
return [castJsonIfNeed("domain_names"), "ASC"];
|
||||||
|
}
|
||||||
|
|
||||||
static get relationMappings() {
|
static get relationMappings() {
|
||||||
return {
|
return {
|
||||||
owner: {
|
owner: {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import { Model } from "objection";
|
import { Model } from "objection";
|
||||||
import db from "../db.js";
|
import db from "../db.js";
|
||||||
import { convertBoolFieldsToInt, convertIntFieldsToBool } from "../lib/helpers.js";
|
import { castJsonIfNeed, convertBoolFieldsToInt, convertIntFieldsToBool } from "../lib/helpers.js";
|
||||||
import Certificate from "./certificate.js";
|
import Certificate from "./certificate.js";
|
||||||
import now from "./now_helper.js";
|
import now from "./now_helper.js";
|
||||||
import User from "./user.js";
|
import User from "./user.js";
|
||||||
@@ -70,6 +70,18 @@ class RedirectionHost extends Model {
|
|||||||
return ["domain_names", "meta"];
|
return ["domain_names", "meta"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get defaultAllowGraph() {
|
||||||
|
return "[owner,certificate]";
|
||||||
|
}
|
||||||
|
|
||||||
|
static get defaultExpand() {
|
||||||
|
return ["certificate", "owner"];
|
||||||
|
}
|
||||||
|
|
||||||
|
static get defaultOrder() {
|
||||||
|
return [castJsonIfNeed("domain_names"), "ASC"];
|
||||||
|
}
|
||||||
|
|
||||||
static get relationMappings() {
|
static get relationMappings() {
|
||||||
return {
|
return {
|
||||||
owner: {
|
owner: {
|
||||||
|
|||||||
@@ -9,21 +9,21 @@ Model.knex(db());
|
|||||||
class Setting extends Model {
|
class Setting extends Model {
|
||||||
$beforeInsert() {
|
$beforeInsert() {
|
||||||
// Default for meta
|
// Default for meta
|
||||||
if (typeof this.meta === 'undefined') {
|
if (typeof this.meta === "undefined") {
|
||||||
this.meta = {};
|
this.meta = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static get name() {
|
static get name() {
|
||||||
return 'Setting';
|
return "Setting";
|
||||||
}
|
}
|
||||||
|
|
||||||
static get tableName() {
|
static get tableName() {
|
||||||
return 'setting';
|
return "setting";
|
||||||
}
|
}
|
||||||
|
|
||||||
static get jsonAttributes() {
|
static get jsonAttributes() {
|
||||||
return ['meta'];
|
return ["meta"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Model } from "objection";
|
import { Model } from "objection";
|
||||||
import db from "../db.js";
|
import db from "../db.js";
|
||||||
import { convertBoolFieldsToInt, convertIntFieldsToBool } from "../lib/helpers.js";
|
import { castJsonIfNeed, convertBoolFieldsToInt, convertIntFieldsToBool } from "../lib/helpers.js";
|
||||||
import Certificate from "./certificate.js";
|
import Certificate from "./certificate.js";
|
||||||
import now from "./now_helper.js";
|
import now from "./now_helper.js";
|
||||||
import User from "./user.js";
|
import User from "./user.js";
|
||||||
@@ -46,6 +46,18 @@ class Stream extends Model {
|
|||||||
return ["meta"];
|
return ["meta"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get defaultAllowGraph() {
|
||||||
|
return "[owner,certificate]";
|
||||||
|
}
|
||||||
|
|
||||||
|
static get defaultExpand() {
|
||||||
|
return ["certificate", "owner"];
|
||||||
|
}
|
||||||
|
|
||||||
|
static get defaultOrder() {
|
||||||
|
return [castJsonIfNeed("incoming_port"), "ASC"];
|
||||||
|
}
|
||||||
|
|
||||||
static get relationMappings() {
|
static get relationMappings() {
|
||||||
return {
|
return {
|
||||||
owner: {
|
owner: {
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ class UserPermission extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static get name() {
|
static get name() {
|
||||||
return 'UserPermission';
|
return "UserPermission";
|
||||||
}
|
}
|
||||||
|
|
||||||
static get tableName() {
|
static get tableName() {
|
||||||
return 'user_permission';
|
return "user_permission";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+23
-22
@@ -9,41 +9,42 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "biome lint",
|
"lint": "biome lint",
|
||||||
"prettier": "biome format --write .",
|
"prettier": "biome format --write .",
|
||||||
"validate-schema": "node validate-schema.js"
|
"validate-schema": "node validate-schema.js",
|
||||||
|
"regenerate-config": "node scripts/regenerate-config"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apidevtools/json-schema-ref-parser": "^14.1.1",
|
"@apidevtools/json-schema-ref-parser": "^16.0.2",
|
||||||
"ajv": "^8.18.0",
|
"ajv": "^8.20.0",
|
||||||
"archiver": "^7.0.1",
|
"archiver": "^8.0.0",
|
||||||
"batchflow": "^0.4.0",
|
"batchflow": "^0.4.0",
|
||||||
"bcrypt": "^6.0.0",
|
"bcrypt": "^6.0.0",
|
||||||
"better-sqlite3": "^12.6.2",
|
"better-sqlite3": "^13.0.3",
|
||||||
"body-parser": "^2.2.2",
|
"body-parser": "^2.3.0",
|
||||||
"compression": "^1.7.4",
|
"chalk": "5.6.2",
|
||||||
|
"compression": "^1.8.2",
|
||||||
"express": "^5.2.1",
|
"express": "^5.2.1",
|
||||||
"express-fileupload": "^1.5.2",
|
"express-fileupload": "^1.5.2",
|
||||||
"gravatar": "^1.8.2",
|
"gravatar": "^1.8.2",
|
||||||
"jsonwebtoken": "^9.0.3",
|
"jsonwebtoken": "^9.0.3",
|
||||||
"knex": "3.1.0",
|
"knex": "3.3.0",
|
||||||
"liquidjs": "10.24.0",
|
"liquidjs": "10.29.0",
|
||||||
"lodash": "^4.17.23",
|
"lodash": "^4.18.1",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.31.0",
|
||||||
"mysql2": "^3.17.1",
|
"mysql2": "^3.24.4",
|
||||||
"node-rsa": "^1.1.1",
|
"node-rsa": "^2.0.0",
|
||||||
"objection": "3.1.5",
|
"objection": "3.1.5",
|
||||||
"otplib": "^13.3.0",
|
"otplib": "^13.5.0",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"pg": "^8.18.0",
|
"pg": "^8.23.0",
|
||||||
"proxy-agent": "^6.5.0",
|
"proxy-agent": "^8.0.2",
|
||||||
"signale": "1.4.0",
|
"signale": "1.4.0",
|
||||||
"sqlite3": "^5.1.7",
|
"sqlite3": "^6.0.1",
|
||||||
"temp-write": "^4.0.0"
|
"temp-write": "^6.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@apidevtools/swagger-parser": "^12.1.0",
|
"@apidevtools/swagger-parser": "^13.0.0",
|
||||||
"@biomejs/biome": "^2.3.14",
|
"@biomejs/biome": "^2.5.10",
|
||||||
"chalk": "5.6.2",
|
"nodemon": "^3.1.14"
|
||||||
"nodemon": "^3.1.11"
|
|
||||||
},
|
},
|
||||||
"signale": {
|
"signale": {
|
||||||
"displayDate": true,
|
"displayDate": true,
|
||||||
|
|||||||
@@ -86,10 +86,7 @@ router
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
event_id: req.params.event_id,
|
event_id: req.params.event_id,
|
||||||
expand:
|
expand: typeof req.query.expand === "string" ? req.query.expand.split(",") : null,
|
||||||
typeof req.query.expand === "string"
|
|
||||||
? req.query.expand.split(",")
|
|
||||||
: null,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import express from "express";
|
||||||
|
import dnsPlugins from "../certbot/dns-plugins.json" with { type: "json" };
|
||||||
|
import { installPlugin } from "../lib/certbot.js";
|
||||||
|
import { debug, express as logger } from "../logger.js";
|
||||||
|
|
||||||
|
const router = express.Router({
|
||||||
|
caseSensitive: true,
|
||||||
|
strict: true,
|
||||||
|
mergeParams: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ONLY AVAILABLE IN CI ENVIRONMENT!
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* /api/ci/certbot-plugins
|
||||||
|
*/
|
||||||
|
router
|
||||||
|
.route("/certbot-plugins")
|
||||||
|
.options((_, res) => {
|
||||||
|
res.sendStatus(204);
|
||||||
|
})
|
||||||
|
|
||||||
|
// Return all certbot plugins
|
||||||
|
.get(async (_req, res, _next) => {
|
||||||
|
res.status(200).send(dnsPlugins);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* /api/ci/certbot-plugins/{plugin}
|
||||||
|
*/
|
||||||
|
router
|
||||||
|
.route("/certbot-plugins/:plugin")
|
||||||
|
.options((_, res) => {
|
||||||
|
res.sendStatus(204);
|
||||||
|
})
|
||||||
|
|
||||||
|
// Install a certbot plugin
|
||||||
|
.post(async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
const pluginName = req.params.plugin;
|
||||||
|
// check if plugin exists
|
||||||
|
if (!dnsPlugins[pluginName]) {
|
||||||
|
return res.status(404).send({
|
||||||
|
error: "Plugin not found",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await installPlugin(pluginName);
|
||||||
|
res.status(200).send(true);
|
||||||
|
} catch (err) {
|
||||||
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import express from "express";
|
||||||
|
import internalLogViewer from "../internal/log-viewer.js";
|
||||||
|
import jwtdecode from "../lib/express/jwt-decode.js";
|
||||||
|
import validator from "../lib/validator/index.js";
|
||||||
|
import { debug, express as logger } from "../logger.js";
|
||||||
|
|
||||||
|
const router = express.Router({
|
||||||
|
caseSensitive: true,
|
||||||
|
strict: true,
|
||||||
|
mergeParams: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* /api/logs/sources
|
||||||
|
*/
|
||||||
|
router
|
||||||
|
.route("/sources")
|
||||||
|
.options((_, res) => {
|
||||||
|
res.sendStatus(204);
|
||||||
|
})
|
||||||
|
.all(jwtdecode())
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /api/logs/sources
|
||||||
|
*
|
||||||
|
* Lists the log sources available for the log viewer
|
||||||
|
*/
|
||||||
|
.get(async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
const data = await internalLogViewer.listSources(res.locals.access);
|
||||||
|
res.status(200).send(data);
|
||||||
|
} catch (err) {
|
||||||
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* /api/logs/tail
|
||||||
|
*/
|
||||||
|
router
|
||||||
|
.route("/tail")
|
||||||
|
.options((_, res) => {
|
||||||
|
res.sendStatus(204);
|
||||||
|
})
|
||||||
|
.all(jwtdecode())
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /api/logs/tail
|
||||||
|
*
|
||||||
|
* Retrieve the last N lines of a log source
|
||||||
|
*/
|
||||||
|
.get(async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
const data = await validator(
|
||||||
|
{
|
||||||
|
required: ["type"],
|
||||||
|
additionalProperties: false,
|
||||||
|
properties: {
|
||||||
|
type: {
|
||||||
|
type: "string",
|
||||||
|
enum: ["system", "letsencrypt", "host"],
|
||||||
|
},
|
||||||
|
host_type: {
|
||||||
|
anyOf: [{ type: "null" }, { type: "string", enum: ["proxy", "redirection", "dead", "stream"] }],
|
||||||
|
},
|
||||||
|
host_id: {
|
||||||
|
anyOf: [{ type: "null" }, { type: "integer", minimum: 1 }],
|
||||||
|
},
|
||||||
|
channel: {
|
||||||
|
anyOf: [{ type: "null" }, { type: "string", enum: ["access", "error"] }],
|
||||||
|
},
|
||||||
|
lines: {
|
||||||
|
anyOf: [{ type: "null" }, { type: "integer", minimum: 1, maximum: 1000 }],
|
||||||
|
},
|
||||||
|
level: {
|
||||||
|
anyOf: [
|
||||||
|
{ type: "null" },
|
||||||
|
{ type: "string", enum: ["INFO", "WARN", "ERROR", "DEBUG", "SUCCESS", "FATAL", "COMPLETE"] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
search: {
|
||||||
|
anyOf: [{ type: "null" }, { type: "string", minLength: 1, maxLength: 200 }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: req.query.type,
|
||||||
|
host_type: typeof req.query.host_type === "string" ? req.query.host_type : null,
|
||||||
|
host_id: typeof req.query.host_id !== "undefined" ? req.query.host_id : null,
|
||||||
|
channel: typeof req.query.channel === "string" ? req.query.channel : null,
|
||||||
|
lines: typeof req.query.lines !== "undefined" ? req.query.lines : null,
|
||||||
|
level: typeof req.query.level === "string" ? req.query.level : null,
|
||||||
|
search: typeof req.query.search === "string" ? req.query.search : null,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const result = await internalLogViewer.tail(res.locals.access, data);
|
||||||
|
res.status(200).send(result);
|
||||||
|
} catch (err) {
|
||||||
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
|
import { isCI } from "../lib/config.js";
|
||||||
import errs from "../lib/error.js";
|
import errs from "../lib/error.js";
|
||||||
|
import logRequest from "../lib/express/log-request.js";
|
||||||
import pjson from "../package.json" with { type: "json" };
|
import pjson from "../package.json" with { type: "json" };
|
||||||
import { isSetup } from "../setup.js";
|
import { isSetup } from "../setup.js";
|
||||||
import auditLogRoutes from "./audit-log.js";
|
import auditLogRoutes from "./audit-log.js";
|
||||||
|
import ciRoutes from "./ci.js";
|
||||||
|
import logsRoutes from "./logs.js";
|
||||||
import accessListsRoutes from "./nginx/access_lists.js";
|
import accessListsRoutes from "./nginx/access_lists.js";
|
||||||
import certificatesHostsRoutes from "./nginx/certificates.js";
|
import certificatesHostsRoutes from "./nginx/certificates.js";
|
||||||
import deadHostsRoutes from "./nginx/dead_hosts.js";
|
import deadHostsRoutes from "./nginx/dead_hosts.js";
|
||||||
@@ -22,6 +26,8 @@ const router = express.Router({
|
|||||||
mergeParams: true,
|
mergeParams: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.use(logRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Health Check
|
* Health Check
|
||||||
* GET /api
|
* GET /api
|
||||||
@@ -45,6 +51,7 @@ router.use("/schema", schemaRoutes);
|
|||||||
router.use("/tokens", tokensRoutes);
|
router.use("/tokens", tokensRoutes);
|
||||||
router.use("/users", usersRoutes);
|
router.use("/users", usersRoutes);
|
||||||
router.use("/audit-log", auditLogRoutes);
|
router.use("/audit-log", auditLogRoutes);
|
||||||
|
router.use("/logs", logsRoutes);
|
||||||
router.use("/reports", reportsRoutes);
|
router.use("/reports", reportsRoutes);
|
||||||
router.use("/settings", settingsRoutes);
|
router.use("/settings", settingsRoutes);
|
||||||
router.use("/version", versionRoutes);
|
router.use("/version", versionRoutes);
|
||||||
@@ -55,6 +62,11 @@ router.use("/nginx/streams", streamsRoutes);
|
|||||||
router.use("/nginx/access-lists", accessListsRoutes);
|
router.use("/nginx/access-lists", accessListsRoutes);
|
||||||
router.use("/nginx/certificates", certificatesHostsRoutes);
|
router.use("/nginx/certificates", certificatesHostsRoutes);
|
||||||
|
|
||||||
|
// Only include CI routes if we're in a CI environment
|
||||||
|
if (isCI()) {
|
||||||
|
router.use("/ci", ciRoutes);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API 404 for all other routes
|
* API 404 for all other routes
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -44,18 +44,11 @@ router
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expand:
|
expand: typeof req.query.expand === "string" ? req.query.expand.split(",") : null,
|
||||||
typeof req.query.expand === "string"
|
|
||||||
? req.query.expand.split(",")
|
|
||||||
: null,
|
|
||||||
query: typeof req.query.query === "string" ? req.query.query : null,
|
query: typeof req.query.query === "string" ? req.query.query : null,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const rows = await internalCertificate.getAll(
|
const rows = await internalCertificate.getAll(res.locals.access, data.expand, data.query);
|
||||||
res.locals.access,
|
|
||||||
data.expand,
|
|
||||||
data.query,
|
|
||||||
);
|
|
||||||
res.status(200).send(rows);
|
res.status(200).send(rows);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
@@ -70,15 +63,9 @@ router
|
|||||||
*/
|
*/
|
||||||
.post(async (req, res, next) => {
|
.post(async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const payload = await apiValidator(
|
const payload = await apiValidator(getValidationSchema("/nginx/certificates", "post"), req.body);
|
||||||
getValidationSchema("/nginx/certificates", "post"),
|
|
||||||
req.body,
|
|
||||||
);
|
|
||||||
req.setTimeout(900000); // 15 minutes timeout
|
req.setTimeout(900000); // 15 minutes timeout
|
||||||
const result = await internalCertificate.create(
|
const result = await internalCertificate.create(res.locals.access, payload);
|
||||||
res.locals.access,
|
|
||||||
payload,
|
|
||||||
);
|
|
||||||
res.status(201).send(result);
|
res.status(201).send(result);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
@@ -139,16 +126,10 @@ router
|
|||||||
*/
|
*/
|
||||||
.post(async (req, res, next) => {
|
.post(async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const payload = await apiValidator(
|
const payload = await apiValidator(getValidationSchema("/nginx/certificates/test-http", "post"), req.body);
|
||||||
getValidationSchema("/nginx/certificates/test-http", "post"),
|
|
||||||
req.body,
|
|
||||||
);
|
|
||||||
req.setTimeout(60000); // 1 minute timeout
|
req.setTimeout(60000); // 1 minute timeout
|
||||||
|
|
||||||
const result = await internalCertificate.testHttpsChallenge(
|
const result = await internalCertificate.testHttpsChallenge(res.locals.access, payload);
|
||||||
res.locals.access,
|
|
||||||
payload,
|
|
||||||
);
|
|
||||||
res.status(200).send(result);
|
res.status(200).send(result);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
@@ -224,10 +205,7 @@ router
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
certificate_id: req.params.certificate_id,
|
certificate_id: req.params.certificate_id,
|
||||||
expand:
|
expand: typeof req.query.expand === "string" ? req.query.expand.split(",") : null,
|
||||||
typeof req.query.expand === "string"
|
|
||||||
? req.query.expand.split(",")
|
|
||||||
: null,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const row = await internalCertificate.get(res.locals.access, {
|
const row = await internalCertificate.get(res.locals.access, {
|
||||||
|
|||||||
@@ -194,9 +194,11 @@ router
|
|||||||
/**
|
/**
|
||||||
* POST /api/nginx/dead-hosts/123/disable
|
* POST /api/nginx/dead-hosts/123/disable
|
||||||
*/
|
*/
|
||||||
.post((req, res, next) => {
|
.post(async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const result = internalDeadHost.disable(res.locals.access, { id: Number.parseInt(req.params.host_id, 10) });
|
const result = await internalDeadHost.disable(res.locals.access, {
|
||||||
|
id: Number.parseInt(req.params.host_id, 10),
|
||||||
|
});
|
||||||
res.status(200).send(result);
|
res.status(200).send(result);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
|
import fs from "node:fs";
|
||||||
import internalProxyHost from "../../internal/proxy-host.js";
|
import internalProxyHost from "../../internal/proxy-host.js";
|
||||||
import jwtdecode from "../../lib/express/jwt-decode.js";
|
import jwtdecode from "../../lib/express/jwt-decode.js";
|
||||||
import apiValidator from "../../lib/validator/api.js";
|
import apiValidator from "../../lib/validator/api.js";
|
||||||
@@ -206,4 +207,70 @@ router
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proxy-host logs
|
||||||
|
*
|
||||||
|
* /api/nginx/proxy-hosts/123/logs
|
||||||
|
*/
|
||||||
|
router
|
||||||
|
.route("/:host_id/logs")
|
||||||
|
.options((_, res) => {
|
||||||
|
res.sendStatus(204);
|
||||||
|
})
|
||||||
|
.all(jwtdecode())
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /api/nginx/proxy-hosts/123/logs
|
||||||
|
*
|
||||||
|
* Retrieve logs for a specific proxy-host
|
||||||
|
*/
|
||||||
|
.get(async (req, res, next) => {
|
||||||
|
try {
|
||||||
|
const data = await validator(
|
||||||
|
{
|
||||||
|
required: ["host_id"],
|
||||||
|
additionalProperties: false,
|
||||||
|
properties: {
|
||||||
|
host_id: {
|
||||||
|
$ref: "common#/properties/id",
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: "string",
|
||||||
|
enum: ["access", "error"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
host_id: req.params.host_id,
|
||||||
|
type: req.query.type || "access",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const hostId = Number.parseInt(data.host_id, 10);
|
||||||
|
const logType = data.type === "error" ? "error" : "access";
|
||||||
|
const logFile = `/data/logs/proxy-host-${hostId}_${logType}.log`;
|
||||||
|
|
||||||
|
// Check access permission
|
||||||
|
await res.locals.access.can("proxy_hosts:get", hostId);
|
||||||
|
|
||||||
|
let logs = "";
|
||||||
|
if (fs.existsSync(logFile)) {
|
||||||
|
const content = fs.readFileSync(logFile, { encoding: "utf8" });
|
||||||
|
const lines = content.split("\n");
|
||||||
|
// Return last 1000 lines to avoid huge payloads
|
||||||
|
const maxLines = 1000;
|
||||||
|
if (lines.length > maxLines) {
|
||||||
|
logs = lines.slice(-maxLines).join("\n");
|
||||||
|
} else {
|
||||||
|
logs = content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(200).send({ logs });
|
||||||
|
} catch (err) {
|
||||||
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
@@ -18,7 +18,7 @@ router
|
|||||||
/**
|
/**
|
||||||
* GET /schema
|
* GET /schema
|
||||||
*/
|
*/
|
||||||
.get(async (req, res) => {
|
.get(async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const swaggerJSON = await getCompiledSchema();
|
const swaggerJSON = await getCompiledSchema();
|
||||||
|
|
||||||
|
|||||||
+10
-41
@@ -48,18 +48,11 @@ router
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expand:
|
expand: typeof req.query.expand === "string" ? req.query.expand.split(",") : null,
|
||||||
typeof req.query.expand === "string"
|
|
||||||
? req.query.expand.split(",")
|
|
||||||
: null,
|
|
||||||
query: typeof req.query.query === "string" ? req.query.query : null,
|
query: typeof req.query.query === "string" ? req.query.query : null,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const users = await internalUser.getAll(
|
const users = await internalUser.getAll(res.locals.access, data.expand, data.query);
|
||||||
res.locals.access,
|
|
||||||
data.expand,
|
|
||||||
data.query,
|
|
||||||
);
|
|
||||||
res.status(200).send(users);
|
res.status(200).send(users);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
@@ -95,10 +88,7 @@ router
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = await apiValidator(
|
const payload = await apiValidator(getValidationSchema("/users", "post"), body);
|
||||||
getValidationSchema("/users", "post"),
|
|
||||||
body,
|
|
||||||
);
|
|
||||||
const user = await internalUser.create(res.locals.access, payload);
|
const user = await internalUser.create(res.locals.access, payload);
|
||||||
res.status(201).send(user);
|
res.status(201).send(user);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -169,20 +159,14 @@ router
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
user_id: req.params.user_id,
|
user_id: req.params.user_id,
|
||||||
expand:
|
expand: typeof req.query.expand === "string" ? req.query.expand.split(",") : null,
|
||||||
typeof req.query.expand === "string"
|
|
||||||
? req.query.expand.split(",")
|
|
||||||
: null,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const user = await internalUser.get(res.locals.access, {
|
const user = await internalUser.get(res.locals.access, {
|
||||||
id: data.user_id,
|
id: data.user_id,
|
||||||
expand: data.expand,
|
expand: data.expand,
|
||||||
omit: internalUser.getUserOmisionsByAccess(
|
omit: internalUser.getUserOmisionsByAccess(res.locals.access, data.user_id),
|
||||||
res.locals.access,
|
|
||||||
data.user_id,
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
res.status(200).send(user);
|
res.status(200).send(user);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -198,10 +182,7 @@ router
|
|||||||
*/
|
*/
|
||||||
.put(async (req, res, next) => {
|
.put(async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const payload = await apiValidator(
|
const payload = await apiValidator(getValidationSchema("/users/{userID}", "put"), req.body);
|
||||||
getValidationSchema("/users/{userID}", "put"),
|
|
||||||
req.body,
|
|
||||||
);
|
|
||||||
payload.id = req.params.user_id;
|
payload.id = req.params.user_id;
|
||||||
const result = await internalUser.update(res.locals.access, payload);
|
const result = await internalUser.update(res.locals.access, payload);
|
||||||
res.status(200).send(result);
|
res.status(200).send(result);
|
||||||
@@ -248,10 +229,7 @@ router
|
|||||||
*/
|
*/
|
||||||
.put(async (req, res, next) => {
|
.put(async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const payload = await apiValidator(
|
const payload = await apiValidator(getValidationSchema("/users/{userID}/auth", "put"), req.body);
|
||||||
getValidationSchema("/users/{userID}/auth", "put"),
|
|
||||||
req.body,
|
|
||||||
);
|
|
||||||
payload.id = req.params.user_id;
|
payload.id = req.params.user_id;
|
||||||
const result = await internalUser.setPassword(res.locals.access, payload);
|
const result = await internalUser.setPassword(res.locals.access, payload);
|
||||||
res.status(200).send(result);
|
res.status(200).send(result);
|
||||||
@@ -281,15 +259,9 @@ router
|
|||||||
*/
|
*/
|
||||||
.put(async (req, res, next) => {
|
.put(async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const payload = await apiValidator(
|
const payload = await apiValidator(getValidationSchema("/users/{userID}/permissions", "put"), req.body);
|
||||||
getValidationSchema("/users/{userID}/permissions", "put"),
|
|
||||||
req.body,
|
|
||||||
);
|
|
||||||
payload.id = req.params.user_id;
|
payload.id = req.params.user_id;
|
||||||
const result = await internalUser.setPermissions(
|
const result = await internalUser.setPermissions(res.locals.access, payload);
|
||||||
res.locals.access,
|
|
||||||
payload,
|
|
||||||
);
|
|
||||||
res.status(200).send(result);
|
res.status(200).send(result);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
debug(logger, `${req.method.toUpperCase()} ${req.path}: ${err}`);
|
||||||
@@ -408,10 +380,7 @@ router
|
|||||||
*/
|
*/
|
||||||
.post(async (req, res, next) => {
|
.post(async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const { code } = await apiValidator(
|
const { code } = await apiValidator(getValidationSchema("/users/{userID}/2fa/enable", "post"), req.body);
|
||||||
getValidationSchema("/users/{userID}/2fa/enable", "post"),
|
|
||||||
req.body,
|
|
||||||
);
|
|
||||||
const result = await internal2FA.enable(res.locals.access, req.params.user_id, code);
|
const result = await internal2FA.enable(res.locals.access, req.params.user_id, code);
|
||||||
res.status(200).send(result);
|
res.status(200).send(result);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"description": "Available log sources for the log viewer",
|
||||||
|
"required": ["system", "letsencrypt", "hosts"],
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"system": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"label": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "System"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"letsencrypt": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"label": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Let's Encrypt"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hosts": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["proxy", "redirection", "dead", "stream"],
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"proxy": {
|
||||||
|
"$ref": "#/$defs/host-option-list"
|
||||||
|
},
|
||||||
|
"redirection": {
|
||||||
|
"$ref": "#/$defs/host-option-list"
|
||||||
|
},
|
||||||
|
"dead": {
|
||||||
|
"$ref": "#/$defs/host-option-list"
|
||||||
|
},
|
||||||
|
"stream": {
|
||||||
|
"$ref": "#/$defs/host-option-list"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"example": {
|
||||||
|
"proxy": [{ "id": 1, "label": "example.com" }],
|
||||||
|
"redirection": [],
|
||||||
|
"dead": [],
|
||||||
|
"stream": [{ "id": 1, "label": "Port 5432 → 10.0.0.5:5432" }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"$defs": {
|
||||||
|
"host-option-list": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["id", "label"],
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"$ref": "../common.json#/properties/id"
|
||||||
|
},
|
||||||
|
"label": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "example.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"description": "The last N lines of a log source",
|
||||||
|
"required": ["lines", "size", "truncated", "exists"],
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"lines": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": ["2026-01-01T00:00:00.000Z INFO [Global ] Backend PID 1 listening on port 3000 ..."]
|
||||||
|
},
|
||||||
|
"size": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Size in bytes of the underlying log file",
|
||||||
|
"example": 4096
|
||||||
|
},
|
||||||
|
"truncated": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "True when the file is larger than the maximum amount of data scanned per request",
|
||||||
|
"example": false
|
||||||
|
},
|
||||||
|
"exists": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "False when the underlying log file does not exist yet",
|
||||||
|
"example": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -124,6 +124,9 @@
|
|||||||
},
|
},
|
||||||
"advanced_config": {
|
"advanced_config": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"access_list_id": {
|
||||||
|
"$ref": "../common.json#/properties/access_list_id"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -132,7 +135,8 @@
|
|||||||
"path": "/app",
|
"path": "/app",
|
||||||
"forward_scheme": "http",
|
"forward_scheme": "http",
|
||||||
"forward_host": "example.com",
|
"forward_host": "example.com",
|
||||||
"forward_port": 80
|
"forward_port": 80,
|
||||||
|
"access_list_id": 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$"
|
"pattern": "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"operationId": "getLogSources",
|
||||||
|
"summary": "Get available log sources",
|
||||||
|
"tags": ["logs"],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"bearerAuth": ["admin"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "200 response",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"examples": {
|
||||||
|
"default": {
|
||||||
|
"value": {
|
||||||
|
"system": { "label": "System" },
|
||||||
|
"letsencrypt": { "label": "Let's Encrypt" },
|
||||||
|
"hosts": {
|
||||||
|
"proxy": [{ "id": 1, "label": "example.com" }],
|
||||||
|
"redirection": [],
|
||||||
|
"dead": [],
|
||||||
|
"stream": [{ "id": 1, "label": "Port 5432 → 10.0.0.5:5432" }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"$ref": "../../../components/log-sources-object.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
{
|
||||||
|
"operationId": "getLogTail",
|
||||||
|
"summary": "Get the last N lines of a log source",
|
||||||
|
"tags": ["logs"],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"bearerAuth": ["admin"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "type",
|
||||||
|
"required": true,
|
||||||
|
"description": "Which log source to read",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["system", "letsencrypt", "host"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "host_type",
|
||||||
|
"description": "Required when type=host",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["proxy", "redirection", "dead", "stream"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "host_id",
|
||||||
|
"description": "Required when type=host",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "channel",
|
||||||
|
"description": "Required when type=host - which log file to read (not to be confused with host_type=stream)",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["access", "error"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "lines",
|
||||||
|
"description": "Number of lines to return from the end of the file",
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1,
|
||||||
|
"maximum": 1000,
|
||||||
|
"default": 200
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "level",
|
||||||
|
"description": "Only applicable to type=system",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["INFO", "WARN", "ERROR", "DEBUG", "SUCCESS", "FATAL", "COMPLETE"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "search",
|
||||||
|
"description": "Case-insensitive plain-text search",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"maxLength": 200
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "200 response",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"examples": {
|
||||||
|
"default": {
|
||||||
|
"value": {
|
||||||
|
"lines": ["2026-01-01T00:00:00.000Z INFO [Global ] Backend PID 1 listening on port 3000 ..."],
|
||||||
|
"size": 4096,
|
||||||
|
"truncated": false,
|
||||||
|
"exists": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"$ref": "../../../components/log-tail-object.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,10 @@
|
|||||||
"name": "audit-log",
|
"name": "audit-log",
|
||||||
"description": "Endpoints related to Audit Logs"
|
"description": "Endpoints related to Audit Logs"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "logs",
|
||||||
|
"description": "Endpoints for viewing system, Let's Encrypt and per-host logs"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "access-lists",
|
"name": "access-lists",
|
||||||
"description": "Endpoints related to Access Lists"
|
"description": "Endpoints related to Access Lists"
|
||||||
@@ -81,6 +85,16 @@
|
|||||||
"$ref": "./paths/audit-log/id/get.json"
|
"$ref": "./paths/audit-log/id/get.json"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/logs/sources": {
|
||||||
|
"get": {
|
||||||
|
"$ref": "./paths/logs/sources/get.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/logs/tail": {
|
||||||
|
"get": {
|
||||||
|
"$ref": "./paths/logs/tail/get.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
"/nginx/access-lists": {
|
"/nginx/access-lists": {
|
||||||
"get": {
|
"get": {
|
||||||
"$ref": "./paths/nginx/access-lists/get.json"
|
"$ref": "./paths/nginx/access-lists/get.json"
|
||||||
|
|||||||
Executable
+76
@@ -0,0 +1,76 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
import * as process from "node:process"; // Use the node: protocol for built-ins
|
||||||
|
import internalNginx from "../internal/nginx.js";
|
||||||
|
import { global as logger } from "../logger.js";
|
||||||
|
import deadHostModel from "../models/dead_host.js";
|
||||||
|
import proxyHostModel from "../models/proxy_host.js";
|
||||||
|
import redirectionHostModel from "../models/redirection_host.js";
|
||||||
|
import streamModel from "../models/stream.js";
|
||||||
|
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
const UNATTENDED = args.includes("-y") || args.includes("--yes");
|
||||||
|
const DRY_RUN = args.includes("--dry-run");
|
||||||
|
|
||||||
|
if (args.includes("--help") || args.includes("-h")) {
|
||||||
|
console.log("\nThis will iterate over all Hosts and regnerate their Nginx configs.\n")
|
||||||
|
console.log("Usage: ./regenerate-config [-h|--help] [-y|--yes] [--dry-run]\n");
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ask for the user to confirm the action if not in unattended mode
|
||||||
|
if (!UNATTENDED && !DRY_RUN) {
|
||||||
|
const readline = await import("node:readline");
|
||||||
|
const rl = readline.createInterface({
|
||||||
|
input: process.stdin,
|
||||||
|
output: process.stdout,
|
||||||
|
});
|
||||||
|
|
||||||
|
const question = (query) =>
|
||||||
|
new Promise((resolve) => rl.question(query, resolve));
|
||||||
|
|
||||||
|
const answer = await question(
|
||||||
|
"This will iterate over all Hosts and regnerate their Nginx configs.\n\nAre you sure you want to proceed? (y/N) ",
|
||||||
|
);
|
||||||
|
rl.close();
|
||||||
|
|
||||||
|
if (answer.toLowerCase() !== "y") {
|
||||||
|
console.log("Aborting.");
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const logIt = (msg, type = "info") => logger[type](
|
||||||
|
`${DRY_RUN ? '[DRY RUN] ' : ''}${msg}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Let's do it.
|
||||||
|
|
||||||
|
const processItems = async (model, type, hostType) => {
|
||||||
|
const rows = await model
|
||||||
|
.query()
|
||||||
|
.where("is_deleted", 0)
|
||||||
|
.andWhere("enabled", 1)
|
||||||
|
.groupBy("id")
|
||||||
|
.allowGraph(model.defaultAllowGraph)
|
||||||
|
.withGraphFetched(`[${model.defaultExpand.join(", ")}]`)
|
||||||
|
.orderBy(...model.defaultOrder);
|
||||||
|
|
||||||
|
logIt(`[${type}] Found ${rows.length} rows to process...`);
|
||||||
|
for (const row of rows) {
|
||||||
|
if (!DRY_RUN) {
|
||||||
|
logIt(`[${type}] Regenerating config #${row.id}: ${row.domain_names ? row.domain_names.join(", ") : 'port ' + row.incoming_port}`);
|
||||||
|
await internalNginx.configure(model, hostType, row);
|
||||||
|
} else {
|
||||||
|
logIt(`[${type}] Skipping generation of config #${row.id}: ${row.domain_names ? row.domain_names.join(", ") : 'port ' + row.incoming_port}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
await processItems(proxyHostModel, "Proxy Host", "proxy_host");
|
||||||
|
await processItems(redirectionHostModel, "Redirection Host", "redirection_host");
|
||||||
|
await processItems(deadHostModel, "404 Host", "dead_host");
|
||||||
|
await processItems(streamModel, "Stream", "stream");
|
||||||
|
|
||||||
|
logIt("Completed", "success");
|
||||||
|
process.exit(0);
|
||||||
+18
-32
@@ -6,11 +6,12 @@ import certificateModel from "./models/certificate.js";
|
|||||||
import settingModel from "./models/setting.js";
|
import settingModel from "./models/setting.js";
|
||||||
import userModel from "./models/user.js";
|
import userModel from "./models/user.js";
|
||||||
import userPermissionModel from "./models/user_permission.js";
|
import userPermissionModel from "./models/user_permission.js";
|
||||||
|
import fs from "node:fs/promises";
|
||||||
|
|
||||||
export const isSetup = async () => {
|
export const isSetup = async () => {
|
||||||
const row = await userModel.query().select("id").where("is_deleted", 0).first();
|
const row = await userModel.query().select("id").where("is_deleted", 0).first();
|
||||||
return row?.id > 0;
|
return row?.id > 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a default admin users if one doesn't already exist in the database
|
* Creates a default admin users if one doesn't already exist in the database
|
||||||
@@ -44,13 +45,9 @@ const setupDefaultUser = async () => {
|
|||||||
roles: ["admin"],
|
roles: ["admin"],
|
||||||
};
|
};
|
||||||
|
|
||||||
const user = await userModel
|
const user = await userModel.query().insertAndFetch(data);
|
||||||
.query()
|
|
||||||
.insertAndFetch(data);
|
|
||||||
|
|
||||||
await authModel
|
await authModel.query().insert({
|
||||||
.query()
|
|
||||||
.insert({
|
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
type: "password",
|
type: "password",
|
||||||
secret: initialAdminPassword,
|
secret: initialAdminPassword,
|
||||||
@@ -77,16 +74,10 @@ const setupDefaultUser = async () => {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
const setupDefaultSettings = async () => {
|
const setupDefaultSettings = async () => {
|
||||||
const row = await settingModel
|
const row = await settingModel.query().select("id").where({ id: "default-site" }).first();
|
||||||
.query()
|
|
||||||
.select("id")
|
|
||||||
.where({ id: "default-site" })
|
|
||||||
.first();
|
|
||||||
|
|
||||||
if (!row?.id) {
|
if (!row?.id) {
|
||||||
await settingModel
|
await settingModel.query().insert({
|
||||||
.query()
|
|
||||||
.insert({
|
|
||||||
id: "default-site",
|
id: "default-site",
|
||||||
name: "Default Site",
|
name: "Default Site",
|
||||||
description: "What to show when Nginx is hit with an unknown Host",
|
description: "What to show when Nginx is hit with an unknown Host",
|
||||||
@@ -103,14 +94,10 @@ const setupDefaultSettings = async () => {
|
|||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
const setupCertbotPlugins = async () => {
|
const setupCertbotPlugins = async () => {
|
||||||
const certificates = await certificateModel
|
const certificates = await certificateModel.query().where("is_deleted", 0).andWhere("provider", "letsencrypt");
|
||||||
.query()
|
|
||||||
.where("is_deleted", 0)
|
|
||||||
.andWhere("provider", "letsencrypt");
|
|
||||||
|
|
||||||
if (certificates?.length) {
|
if (certificates?.length) {
|
||||||
const plugins = [];
|
const plugins = [];
|
||||||
const promises = [];
|
|
||||||
|
|
||||||
certificates.map((certificate) => {
|
certificates.map((certificate) => {
|
||||||
if (certificate.meta && certificate.meta.dns_challenge === true) {
|
if (certificate.meta && certificate.meta.dns_challenge === true) {
|
||||||
@@ -118,24 +105,23 @@ const setupCertbotPlugins = async () => {
|
|||||||
plugins.push(certificate.meta.dns_provider);
|
plugins.push(certificate.meta.dns_provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure credentials file exists
|
// Deliberately does NOT write the DNS credentials file here any more.
|
||||||
const credentials_loc = `/etc/letsencrypt/credentials/credentials-${certificate.id}`;
|
//
|
||||||
// Escape single quotes and backslashes
|
// It used to, so that a later `certbot renew` would find the path recorded in its
|
||||||
if (typeof certificate.meta.dns_provider_credentials === "string") {
|
// renewal config. The effect was that every backend restart rewrote a plaintext
|
||||||
const escapedCredentials = certificate.meta.dns_provider_credentials
|
// DNS provider API token for every DNS-01 certificate, and left it there.
|
||||||
.replaceAll("'", "\\'")
|
//
|
||||||
.replaceAll("\\", "\\\\");
|
// internalCertificate now writes that file immediately before it runs certbot and
|
||||||
const credentials_cmd = `[ -f '${credentials_loc}' ] || { mkdir -p /etc/letsencrypt/credentials 2> /dev/null; echo '${escapedCredentials}' > '${credentials_loc}' && chmod 600 '${credentials_loc}'; }`;
|
// removes it again afterwards, so there is exactly one writer and the credential
|
||||||
promises.push(utils.exec(credentials_cmd));
|
// is on disk only for the length of a certbot run. Recreating the files at boot
|
||||||
}
|
// would put every one of them straight back.
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
await installPlugins(plugins);
|
await installPlugins(plugins);
|
||||||
|
|
||||||
if (promises.length) {
|
if (plugins.length) {
|
||||||
await Promise.all(promises);
|
|
||||||
logger.info(`Added Certbot plugins ${plugins.join(", ")}`);
|
logger.info(`Added Certbot plugins ${plugins.join(", ")}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,13 @@
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if access_list.clients.length > 0 %}
|
||||||
# Access Rules: {{ access_list.clients | size }} total
|
# Access Rules: {{ access_list.clients | size }} total
|
||||||
{% for client in access_list.clients %}
|
{% for client in access_list.clients %}
|
||||||
{{client | nginxAccessRule}}
|
{{client | nginxAccessRule}}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
deny all;
|
deny all;
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# Access checks must...
|
# Access checks must...
|
||||||
{% if access_list.satisfy_any == 1 or access_list.satisfy_any == true %}
|
{% if access_list.satisfy_any == 1 or access_list.satisfy_any == true %}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
{% if enabled %}
|
{% if enabled %}
|
||||||
{% if tcp_forwarding == 1 or tcp_forwarding == true -%}
|
{% if tcp_forwarding == 1 or tcp_forwarding == true -%}
|
||||||
server {
|
server {
|
||||||
listen {{ incoming_port }} {%- if certificate %} ssl {%- endif %};
|
listen {{ incoming_port }} reuseport {%- if certificate %} ssl {%- endif %};
|
||||||
{% unless ipv6 -%} # {%- endunless -%} listen [::]:{{ incoming_port }} {%- if certificate %} ssl {%- endif %};
|
{% unless ipv6 -%} # {%- endunless -%} listen [::]:{{ incoming_port }} reuseport {%- if certificate %} ssl {%- endif %};
|
||||||
|
|
||||||
{%- include "_certificates_stream.conf" %}
|
{%- include "_certificates_stream.conf" %}
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@ server {
|
|||||||
|
|
||||||
{% if udp_forwarding == 1 or udp_forwarding == true -%}
|
{% if udp_forwarding == 1 or udp_forwarding == true -%}
|
||||||
server {
|
server {
|
||||||
listen {{ incoming_port }} udp;
|
listen {{ incoming_port }} udp reuseport;
|
||||||
{% unless ipv6 -%} # {%- endunless -%} listen [::]:{{ incoming_port }} udp;
|
{% unless ipv6 -%} # {%- endunless -%} listen [::]:{{ incoming_port }} udp reuseport;
|
||||||
|
|
||||||
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
|
proxy_pass {{ forwarding_host }}:{{ forwarding_port }};
|
||||||
|
|
||||||
|
|||||||
+662
-1195
File diff suppressed because it is too large.
Load diff
+8
-5
@@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
# This file assumes that the frontend has been built using ./scripts/frontend-build
|
# This file assumes that the frontend has been built using ./scripts/frontend-build
|
||||||
|
|
||||||
|
ARG BASE_IMAGE=nginxproxymanager/nginx-full:certbot-node
|
||||||
FROM nginxproxymanager/testca AS testca
|
FROM nginxproxymanager/testca AS testca
|
||||||
FROM nginxproxymanager/nginx-full:certbot-node
|
FROM $BASE_IMAGE
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
ARG BUILD_VERSION
|
ARG BUILD_VERSION
|
||||||
@@ -38,15 +39,17 @@ EXPOSE 80 81 443
|
|||||||
|
|
||||||
COPY backend /app
|
COPY backend /app
|
||||||
COPY frontend/dist /app/frontend
|
COPY frontend/dist /app/frontend
|
||||||
|
COPY docker/rootfs /
|
||||||
|
|
||||||
|
# Copy test CA cert for use in container and add to trusted certs from a self-signed CA
|
||||||
|
COPY --from=testca /home/step/certs/root_ca.crt /etc/ssl/certs/NginxProxyManager.crt
|
||||||
|
WORKDIR /etc/ssl/certs
|
||||||
|
RUN ln -s NginxProxyManager.crt 1d0e3f10.0 && update-ca-certificates
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN yarn install \
|
RUN yarn install \
|
||||||
&& yarn cache clean
|
&& yarn cache clean
|
||||||
|
|
||||||
# add late to limit cache-busting by modifications
|
|
||||||
COPY docker/rootfs /
|
|
||||||
COPY --from=testca /home/step/certs/root_ca.crt /etc/ssl/certs/NginxProxyManager.crt
|
|
||||||
|
|
||||||
# Remove frontend service not required for prod, dev nginx config as well
|
# Remove frontend service not required for prod, dev nginx config as well
|
||||||
RUN rm -rf /etc/s6-overlay/s6-rc.d/user/contents.d/frontend /etc/nginx/conf.d/dev.conf \
|
RUN rm -rf /etc/s6-overlay/s6-rc.d/user/contents.d/frontend /etc/nginx/conf.d/dev.conf \
|
||||||
&& chmod 644 /etc/logrotate.d/nginx-proxy-manager
|
&& chmod 644 /etc/logrotate.d/nginx-proxy-manager
|
||||||
|
|||||||
@@ -20,19 +20,23 @@ RUN echo "fs.file-max = 65535" > /etc/sysctl.conf \
|
|||||||
|
|
||||||
# Task
|
# Task
|
||||||
WORKDIR /usr
|
WORKDIR /usr
|
||||||
RUN curl -sL https://taskfile.dev/install.sh | sh
|
RUN curl -sL 'https://taskfile.dev/install.sh' | sh
|
||||||
WORKDIR /root
|
|
||||||
|
|
||||||
COPY rootfs /
|
COPY rootfs /
|
||||||
|
|
||||||
COPY scripts/install-s6 /tmp/install-s6
|
COPY scripts/install-s6 /tmp/install-s6
|
||||||
RUN rm -f /etc/nginx/conf.d/production.conf \
|
RUN rm -f /etc/nginx/conf.d/production.conf.template \
|
||||||
&& chmod 644 /etc/logrotate.d/nginx-proxy-manager \
|
&& chmod 644 /etc/logrotate.d/nginx-proxy-manager \
|
||||||
&& /tmp/install-s6 "${TARGETPLATFORM}" \
|
&& /tmp/install-s6 "${TARGETPLATFORM}" \
|
||||||
&& rm -f /tmp/install-s6 \
|
&& rm -f /tmp/install-s6 \
|
||||||
&& chmod 644 -R /root/.cache
|
&& chmod 644 -R /root/.cache
|
||||||
|
|
||||||
# Certs for testing purposes
|
# Copy test CA cert for use in container and add to trusted certs from a self-signed CA
|
||||||
COPY --from=testca /home/step/certs/root_ca.crt /etc/ssl/certs/NginxProxyManager.crt
|
COPY --from=testca /home/step/certs/root_ca.crt /etc/ssl/certs/NginxProxyManager.crt
|
||||||
|
WORKDIR /etc/ssl/certs
|
||||||
|
RUN ln -s NginxProxyManager.crt 1d0e3f10.0 && update-ca-certificates
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
EXPOSE 80 81 443
|
EXPOSE 80 81 443
|
||||||
ENTRYPOINT [ "/init" ]
|
ENTRYPOINT [ "/init" ]
|
||||||
@@ -28,6 +28,7 @@ acl SSL_ports port 443
|
|||||||
acl Safe_ports port 80 # http
|
acl Safe_ports port 80 # http
|
||||||
acl Safe_ports port 81
|
acl Safe_ports port 81
|
||||||
acl Safe_ports port 443 # https
|
acl Safe_ports port 443 # https
|
||||||
|
acl Safe_ports port 8000 # for CI testing with custom admin port
|
||||||
|
|
||||||
#
|
#
|
||||||
# Recommended minimum Access Permission configuration:
|
# Recommended minimum Access Permission configuration:
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# WARNING: This is a CI docker-compose file used for building and testing of the entire app, it should not be used for production.
|
||||||
|
services:
|
||||||
|
cypress:
|
||||||
|
environment:
|
||||||
|
CYPRESS_stack: "sqlite"
|
||||||
|
command: cypress run --browser chrome --config-file=cypress/config/ci.mjs --expose grepTags="@isolated"
|
||||||
|
|
||||||
|
fullstack:
|
||||||
|
environment:
|
||||||
|
DB_SQLITE_FILE: "/data/mydb.sqlite"
|
||||||
|
PUID: 1000
|
||||||
|
PGID: 1000
|
||||||
|
DISABLE_IPV6: "true"
|
||||||
@@ -3,6 +3,7 @@ services:
|
|||||||
cypress:
|
cypress:
|
||||||
environment:
|
environment:
|
||||||
CYPRESS_stack: "postgres"
|
CYPRESS_stack: "postgres"
|
||||||
|
NPM_ADMIN_PORT: 8000
|
||||||
|
|
||||||
fullstack:
|
fullstack:
|
||||||
environment:
|
environment:
|
||||||
@@ -11,11 +12,14 @@ services:
|
|||||||
DB_POSTGRES_USER: "npm"
|
DB_POSTGRES_USER: "npm"
|
||||||
DB_POSTGRES_PASSWORD: "npmpass"
|
DB_POSTGRES_PASSWORD: "npmpass"
|
||||||
DB_POSTGRES_NAME: "npm"
|
DB_POSTGRES_NAME: "npm"
|
||||||
|
NPM_ADMIN_PORT: 8000
|
||||||
depends_on:
|
depends_on:
|
||||||
- db-postgres
|
- db-postgres
|
||||||
- authentik
|
- authentik
|
||||||
- authentik-worker
|
- authentik-worker
|
||||||
- authentik-ldap
|
- authentik-ldap
|
||||||
|
expose:
|
||||||
|
- "8000/tcp"
|
||||||
|
|
||||||
db-postgres:
|
db-postgres:
|
||||||
image: postgres:17
|
image: postgres:17
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
# WARNING: This is a CI docker-compose file used for building and testing of the entire app, it should not be used for production.
|
# WARNING: This is a CI docker-compose file used for building and testing of the entire app, it should not be used for production.
|
||||||
services:
|
services:
|
||||||
|
cypress:
|
||||||
|
environment:
|
||||||
|
CYPRESS_stack: "sqlite"
|
||||||
|
|
||||||
fullstack:
|
fullstack:
|
||||||
environment:
|
environment:
|
||||||
DB_SQLITE_FILE: '/data/mydb.sqlite'
|
DB_SQLITE_FILE: "/data/mydb.sqlite"
|
||||||
PUID: 1000
|
PUID: 1000
|
||||||
PGID: 1000
|
PGID: 1000
|
||||||
DISABLE_IPV6: 'true'
|
DISABLE_IPV6: "true"
|
||||||
@@ -38,8 +38,18 @@ services:
|
|||||||
- website2.example.com
|
- website2.example.com
|
||||||
- website3.example.com
|
- website3.example.com
|
||||||
|
|
||||||
|
examplesite:
|
||||||
|
image: "${IMAGE}-examplesite:ci-${BUILD_NUMBER}"
|
||||||
|
build:
|
||||||
|
context: ../test/docker
|
||||||
|
dockerfile: Dockerfile.website
|
||||||
|
expose:
|
||||||
|
- "80/tcp"
|
||||||
|
networks:
|
||||||
|
- fulltest
|
||||||
|
|
||||||
stepca:
|
stepca:
|
||||||
image: jc21/testca
|
image: nginxproxymanager/testca
|
||||||
volumes:
|
volumes:
|
||||||
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
@@ -105,11 +115,12 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
HTTP_PROXY: "squid:3128"
|
HTTP_PROXY: "squid:3128"
|
||||||
HTTPS_PROXY: "squid:3128"
|
HTTPS_PROXY: "squid:3128"
|
||||||
|
NPM_ADMIN_PORT: 81
|
||||||
volumes:
|
volumes:
|
||||||
- "cypress_logs:/test/results"
|
- "cypress_logs:/test/results"
|
||||||
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
command: cypress run --browser chrome --config-file=cypress/config/ci.mjs
|
command: cypress run --browser chrome --config-file=cypress/config/ci.mjs --expose grepTags="-@isolated"
|
||||||
networks:
|
networks:
|
||||||
- fulltest
|
- fulltest
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ services:
|
|||||||
- pgdb.internal
|
- pgdb.internal
|
||||||
|
|
||||||
stepca:
|
stepca:
|
||||||
image: jc21/testca
|
image: nginxproxymanager/testca
|
||||||
container_name: npm2dev.stepca
|
container_name: npm2dev.stepca
|
||||||
volumes:
|
volumes:
|
||||||
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
- "./dev/resolv.conf:/etc/resolv.conf:ro"
|
||||||
|
|||||||
@@ -25,3 +25,13 @@
|
|||||||
kill -USR1 `cat /run/nginx/nginx.pid 2>/dev/null` 2>/dev/null || true
|
kill -USR1 `cat /run/nginx/nginx.pid 2>/dev/null` 2>/dev/null || true
|
||||||
endscript
|
endscript
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/data/logs/backend.log {
|
||||||
|
su npm npm
|
||||||
|
size 10M
|
||||||
|
rotate 5
|
||||||
|
missingok
|
||||||
|
notifempty
|
||||||
|
compress
|
||||||
|
copytruncate
|
||||||
|
}
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
# Admin Interface
|
# Admin Interface
|
||||||
server {
|
server {
|
||||||
listen 81 default;
|
listen {{NPM_ADMIN_PORT}} default;
|
||||||
listen [::]:81 default;
|
listen [::]:{{NPM_ADMIN_PORT}} default;
|
||||||
|
|
||||||
server_name nginxproxymanager;
|
server_name nginxproxymanager;
|
||||||
root /app/frontend;
|
root /app/frontend;
|
||||||
@@ -47,10 +47,10 @@ http {
|
|||||||
proxy_cache_path /var/lib/nginx/cache/private levels=1:2 keys_zone=private-cache:5m max_size=1024m;
|
proxy_cache_path /var/lib/nginx/cache/private levels=1:2 keys_zone=private-cache:5m max_size=1024m;
|
||||||
|
|
||||||
# Log format and fallback log file
|
# Log format and fallback log file
|
||||||
include /etc/nginx/conf.d/include/log-proxy.conf;
|
include /etc/nginx/conf.d/include/log-proxy[.]conf;
|
||||||
|
|
||||||
# Dynamically generated resolvers file
|
# Dynamically generated resolvers file
|
||||||
include /etc/nginx/conf.d/include/resolvers.conf;
|
include /etc/nginx/conf.d/include/resolvers[.]conf;
|
||||||
|
|
||||||
# Default upstream scheme
|
# Default upstream scheme
|
||||||
map $host $forward_scheme {
|
map $host $forward_scheme {
|
||||||
@@ -76,7 +76,7 @@ http {
|
|||||||
set_real_ip_from 172.16.0.0/12; # Includes Docker subnet
|
set_real_ip_from 172.16.0.0/12; # Includes Docker subnet
|
||||||
set_real_ip_from 192.168.0.0/16;
|
set_real_ip_from 192.168.0.0/16;
|
||||||
# NPM generated CDN ip ranges:
|
# NPM generated CDN ip ranges:
|
||||||
include conf.d/include/ip_ranges.conf;
|
include conf.d/include/ip_ranges[.]conf;
|
||||||
# always put the following 2 lines after ip subnets:
|
# always put the following 2 lines after ip subnets:
|
||||||
real_ip_header X-Real-IP;
|
real_ip_header X-Real-IP;
|
||||||
real_ip_recursive on;
|
real_ip_recursive on;
|
||||||
@@ -98,7 +98,7 @@ http {
|
|||||||
|
|
||||||
stream {
|
stream {
|
||||||
# Log format and fallback log file
|
# Log format and fallback log file
|
||||||
include /etc/nginx/conf.d/include/log-stream.conf;
|
include /etc/nginx/conf.d/include/log-stream[.]conf;
|
||||||
|
|
||||||
# Files generated by NPM
|
# Files generated by NPM
|
||||||
include /data/nginx/stream/*.conf;
|
include /data/nginx/stream/*.conf;
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ log_info 'Starting backend ...'
|
|||||||
|
|
||||||
if [ "${DEVELOPMENT:-}" = 'true' ]; then
|
if [ "${DEVELOPMENT:-}" = 'true' ]; then
|
||||||
s6-setuidgid "$PUID:$PGID" yarn install
|
s6-setuidgid "$PUID:$PGID" yarn install
|
||||||
exec s6-setuidgid "$PUID:$PGID" bash -c "export HOME=$NPMHOME;node --max_old_space_size=250 --abort_on_uncaught_exception node_modules/nodemon/bin/nodemon.js"
|
exec s6-setuidgid "$PUID:$PGID" bash -c "export HOME=$NPMHOME;export CERTBOT_VERSION=$CERTBOT_VERSION;node --max_old_space_size=250 --abort_on_uncaught_exception node_modules/nodemon/bin/nodemon.js"
|
||||||
else
|
else
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
s6-setuidgid "$PUID:$PGID" bash -c "export HOME=$NPMHOME;node --abort_on_uncaught_exception --max_old_space_size=250 index.js"
|
s6-setuidgid "$PUID:$PGID" bash -c "export HOME=$NPMHOME;export CERTBOT_VERSION=$CERTBOT_VERSION;node --abort_on_uncaught_exception --max_old_space_size=250 index.js"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@@ -17,6 +17,7 @@ fi
|
|||||||
. /etc/s6-overlay/s6-rc.d/prepare/20-paths.sh
|
. /etc/s6-overlay/s6-rc.d/prepare/20-paths.sh
|
||||||
. /etc/s6-overlay/s6-rc.d/prepare/30-ownership.sh
|
. /etc/s6-overlay/s6-rc.d/prepare/30-ownership.sh
|
||||||
. /etc/s6-overlay/s6-rc.d/prepare/40-dynamic.sh
|
. /etc/s6-overlay/s6-rc.d/prepare/40-dynamic.sh
|
||||||
|
. /etc/s6-overlay/s6-rc.d/prepare/45-admin-port.sh
|
||||||
. /etc/s6-overlay/s6-rc.d/prepare/50-ipv6.sh
|
. /etc/s6-overlay/s6-rc.d/prepare/50-ipv6.sh
|
||||||
. /etc/s6-overlay/s6-rc.d/prepare/60-secrets.sh
|
. /etc/s6-overlay/s6-rc.d/prepare/60-secrets.sh
|
||||||
. /etc/s6-overlay/s6-rc.d/prepare/90-banner.sh
|
. /etc/s6-overlay/s6-rc.d/prepare/90-banner.sh
|
||||||
@@ -46,6 +46,12 @@ for loc in "${locations[@]}"; do
|
|||||||
chownit "$loc"
|
chownit "$loc"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Ensure the JWT key file is owned by the runtime user, even when the /data
|
||||||
|
# directory ownership already matches PUID:PGID (chownit skips recursion then)
|
||||||
|
if [ -f /data/keys.json ]; then
|
||||||
|
chown "$PUID:$PGID" /data/keys.json
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$(is_true "${SKIP_CERTBOT_OWNERSHIP:-}")" = '1' ]; then
|
if [ "$(is_true "${SKIP_CERTBOT_OWNERSHIP:-}")" = '1' ]; then
|
||||||
log_info 'Skipping ownership change of certbot directories'
|
log_info 'Skipping ownership change of certbot directories'
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ log_info 'Dynamic resolvers ...'
|
|||||||
|
|
||||||
# Dynamically generate resolvers file, if resolver is IPv6, enclose in `[]`
|
# Dynamically generate resolvers file, if resolver is IPv6, enclose in `[]`
|
||||||
# thanks @tfmm
|
# thanks @tfmm
|
||||||
if [ "$(is_true "$DISABLE_IPV6")" = '1' ]; then
|
if [ "$(is_true "${DISABLE_RESOLVER:-}")" = '0' ]; then
|
||||||
|
if [ "$(is_true "${DISABLE_IPV6:-}")" = '1' ]; then
|
||||||
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) ipv6=off valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf
|
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) ipv6=off valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf
|
||||||
else
|
else
|
||||||
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf
|
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
# This command reads the `NPM_ADMIN_PORT` env var and will fall
|
||||||
|
# back to 81 if this is not set or is not a number.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
log_info 'Admin Port ...'
|
||||||
|
|
||||||
|
NPM_ADMIN_PORT="${NPM_ADMIN_PORT:-81}"
|
||||||
|
# ensure admin port is a number
|
||||||
|
if ! [[ "$NPM_ADMIN_PORT" =~ ^[0-9]+$ ]]; then
|
||||||
|
echo "WARNING: NPM_ADMIN_PORT must be a number. Defaulting to 81" >&2
|
||||||
|
NPM_ADMIN_PORT=81
|
||||||
|
fi
|
||||||
|
|
||||||
|
PRODFILE="/etc/nginx/conf.d/production.conf"
|
||||||
|
SED_REGEX="s/\{\{NPM_ADMIN_PORT\}\}/${NPM_ADMIN_PORT}/g"
|
||||||
|
|
||||||
|
if is_mounted "$PRODFILE"; then
|
||||||
|
echo "WARNING: skipping ${PRODFILE} — mounted file" >&2
|
||||||
|
elif [ -f "$PRODFILE.template" ]; then
|
||||||
|
if sed -E "$SED_REGEX" "$PRODFILE.template" > "$PRODFILE" && [ -s "$PRODFILE" ]; then
|
||||||
|
# success
|
||||||
|
log_info "Generated ${PRODFILE} from template"
|
||||||
|
else
|
||||||
|
log_fatal "Failed to generate ${PRODFILE} from template"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
@@ -12,7 +12,7 @@ process_folder () {
|
|||||||
FILES=$(find "$1" -type f -name "*.conf")
|
FILES=$(find "$1" -type f -name "*.conf")
|
||||||
SED_REGEX=
|
SED_REGEX=
|
||||||
|
|
||||||
if [ "$(is_true "$DISABLE_IPV6")" = '1' ]; then
|
if [ "$(is_true "${DISABLE_IPV6:-}")" = '1' ]; then
|
||||||
# IPV6 is disabled
|
# IPV6 is disabled
|
||||||
echo "Disabling IPV6 in hosts in: $1"
|
echo "Disabling IPV6 in hosts in: $1"
|
||||||
SED_REGEX='s/^([^#]*)listen \[::\]/\1#listen [::]/g'
|
SED_REGEX='s/^([^#]*)listen \[::\]/\1#listen [::]/g'
|
||||||
@@ -25,7 +25,16 @@ process_folder () {
|
|||||||
for FILE in $FILES
|
for FILE in $FILES
|
||||||
do
|
do
|
||||||
echo "- ${FILE}"
|
echo "- ${FILE}"
|
||||||
echo "$(sed -E "$SED_REGEX" "$FILE")" > $FILE
|
TMPFILE="${FILE}.tmp"
|
||||||
|
|
||||||
|
if is_mounted "${FILE}"; then
|
||||||
|
echo "WARNING: skipping ${FILE} — mounted file" >&2
|
||||||
|
elif sed -E "$SED_REGEX" "$FILE" > "$TMPFILE" && [ -s "$TMPFILE" ]; then
|
||||||
|
mv "$TMPFILE" "$FILE"
|
||||||
|
else
|
||||||
|
echo "WARNING: skipping ${FILE} — sed produced empty output" >&2
|
||||||
|
rm -f "$TMPFILE"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# ensure the files are still owned by the npm user
|
# ensure the files are still owned by the npm user
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
OK=$(curl --silent http://127.0.0.1:81/api/ | jq --raw-output '.status')
|
OK=$(curl --silent "http://127.0.0.1:${NPM_ADMIN_PORT:-81}/api/" | jq --raw-output '.status')
|
||||||
|
|
||||||
if [ "$OK" == "OK" ]; then
|
if [ "$OK" == "OK" ]; then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ NPMGROUP=npm
|
|||||||
NPMHOME=/tmp/npmuserhome
|
NPMHOME=/tmp/npmuserhome
|
||||||
export NPMUSER NPMGROUP NPMHOME
|
export NPMUSER NPMGROUP NPMHOME
|
||||||
|
|
||||||
|
# Query the certbot version just once and use it elsewhere
|
||||||
|
CERTBOT_VERSION="$(certbot --version | grep -Eo '[0-9](\.[0-9]+)+')"
|
||||||
|
export CERTBOT_VERSION
|
||||||
|
|
||||||
if [[ "$PUID" -ne '0' ]] && [ "$PGID" = '0' ]; then
|
if [[ "$PUID" -ne '0' ]] && [ "$PGID" = '0' ]; then
|
||||||
# set group id to same as user id,
|
# set group id to same as user id,
|
||||||
# the user probably forgot to specify the group id and
|
# the user probably forgot to specify the group id and
|
||||||
@@ -66,3 +70,7 @@ is_true () {
|
|||||||
echo '0'
|
echo '0'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_mounted() {
|
||||||
|
awk -v p="$1" '$5 == p { found=1 } END { exit !found }' /proc/self/mountinfo
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ BLUE='\E[1;34m'
|
|||||||
GREEN='\E[1;32m'
|
GREEN='\E[1;32m'
|
||||||
RESET='\E[0m'
|
RESET='\E[0m'
|
||||||
|
|
||||||
S6_OVERLAY_VERSION=3.2.1.0
|
S6_OVERLAY_VERSION=3.2.3.0
|
||||||
TARGETPLATFORM=${1:-linux/amd64}
|
TARGETPLATFORM=${1:-linux/amd64}
|
||||||
|
|
||||||
# Determine the correct binary file for the architecture given
|
# Determine the correct binary file for the architecture given
|
||||||
|
|||||||
+75
-30
@@ -1,4 +1,4 @@
|
|||||||
import { defineConfig, type DefaultTheme } from 'vitepress';
|
import { defineConfig } from "vitepress";
|
||||||
|
|
||||||
// https://vitepress.dev/reference/site-config
|
// https://vitepress.dev/reference/site-config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
@@ -6,56 +6,101 @@ export default defineConfig({
|
|||||||
description: "Expose your services easily and securely",
|
description: "Expose your services easily and securely",
|
||||||
head: [
|
head: [
|
||||||
["link", { rel: "icon", href: "/icon.png" }],
|
["link", { rel: "icon", href: "/icon.png" }],
|
||||||
["meta", { name: "description", content: "Docker container and built in Web Application for managing Nginx proxy hosts with a simple, powerful interface, providing free SSL support via Let's Encrypt" }],
|
[
|
||||||
|
"meta",
|
||||||
|
{
|
||||||
|
name: "description",
|
||||||
|
content:
|
||||||
|
"Docker container and built in Web Application for managing Nginx proxy hosts with a simple, powerful interface, providing free SSL support via Let's Encrypt",
|
||||||
|
},
|
||||||
|
],
|
||||||
["meta", { property: "og:title", content: "Nginx Proxy Manager" }],
|
["meta", { property: "og:title", content: "Nginx Proxy Manager" }],
|
||||||
["meta", { property: "og:description", content: "Docker container and built in Web Application for managing Nginx proxy hosts with a simple, powerful interface, providing free SSL support via Let's Encrypt"}],
|
[
|
||||||
|
"meta",
|
||||||
|
{
|
||||||
|
property: "og:description",
|
||||||
|
content:
|
||||||
|
"Docker container and built in Web Application for managing Nginx proxy hosts with a simple, powerful interface, providing free SSL support via Let's Encrypt",
|
||||||
|
},
|
||||||
|
],
|
||||||
["meta", { property: "og:type", content: "website" }],
|
["meta", { property: "og:type", content: "website" }],
|
||||||
["meta", { property: "og:url", content: "https://nginxproxymanager.com/" }],
|
["meta", { property: "og:url", content: "https://nginxproxymanager.com/" }],
|
||||||
["meta", { property: "og:image", content: "https://nginxproxymanager.com/icon.png" }],
|
[
|
||||||
|
"meta",
|
||||||
|
{
|
||||||
|
property: "og:image",
|
||||||
|
content: "https://nginxproxymanager.com/icon.png",
|
||||||
|
},
|
||||||
|
],
|
||||||
["meta", { name: "twitter:card", content: "summary" }],
|
["meta", { name: "twitter:card", content: "summary" }],
|
||||||
["meta", { name: "twitter:title", content: "Nginx Proxy Manager" }],
|
["meta", { name: "twitter:title", content: "Nginx Proxy Manager" }],
|
||||||
["meta", { name: "twitter:description", content: "Docker container and built in Web Application for managing Nginx proxy hosts with a simple, powerful interface, providing free SSL support via Let's Encrypt"}],
|
[
|
||||||
["meta", { name: "twitter:image", content: "https://nginxproxymanager.com/icon.png"}],
|
"meta",
|
||||||
|
{
|
||||||
|
name: "twitter:description",
|
||||||
|
content:
|
||||||
|
"Docker container and built in Web Application for managing Nginx proxy hosts with a simple, powerful interface, providing free SSL support via Let's Encrypt",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"meta",
|
||||||
|
{
|
||||||
|
name: "twitter:image",
|
||||||
|
content: "https://nginxproxymanager.com/icon.png",
|
||||||
|
},
|
||||||
|
],
|
||||||
["meta", { name: "twitter:alt", content: "Nginx Proxy Manager" }],
|
["meta", { name: "twitter:alt", content: "Nginx Proxy Manager" }],
|
||||||
// GA
|
// GA
|
||||||
['script', { async: 'true', src: 'https://www.googletagmanager.com/gtag/js?id=G-TXT8F5WY5B'}],
|
[
|
||||||
['script', {}, "window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', 'G-TXT8F5WY5B');"],
|
"script",
|
||||||
|
{
|
||||||
|
async: "true",
|
||||||
|
src: "https://www.googletagmanager.com/gtag/js?id=G-TXT8F5WY5B",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"script",
|
||||||
|
{},
|
||||||
|
"window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', 'G-TXT8F5WY5B');",
|
||||||
|
],
|
||||||
],
|
],
|
||||||
sitemap: {
|
sitemap: {
|
||||||
hostname: 'https://nginxproxymanager.com'
|
hostname: "https://nginxproxymanager.com",
|
||||||
},
|
},
|
||||||
metaChunk: true,
|
metaChunk: true,
|
||||||
srcDir: './src',
|
srcDir: "./src",
|
||||||
outDir: './dist',
|
outDir: "./dist",
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
// https://vitepress.dev/reference/default-theme-config
|
// https://vitepress.dev/reference/default-theme-config
|
||||||
logo: { src: '/logo.svg', width: 24, height: 24 },
|
logo: { src: "/logo.svg", width: 24, height: 24 },
|
||||||
nav: [
|
nav: [{ text: "Setup", link: "/setup/" }],
|
||||||
{ text: 'Setup', link: '/setup/' },
|
|
||||||
],
|
|
||||||
sidebar: [
|
sidebar: [
|
||||||
{
|
{
|
||||||
items: [
|
items: [
|
||||||
// { text: 'Home', link: '/' },
|
// { text: 'Home', link: '/' },
|
||||||
{ text: 'Guide', link: '/guide/' },
|
{ text: "Guide", link: "/guide/" },
|
||||||
{ text: 'Screenshots', link: '/screenshots/' },
|
{ text: "Screenshots", link: "/screenshots/" },
|
||||||
{ text: 'Setup Instructions', link: '/setup/' },
|
{ text: "Setup Instructions", link: "/setup/" },
|
||||||
{ text: 'Advanced Configuration', link: '/advanced-config/' },
|
{ text: "Advanced Configuration", link: "/advanced-config/" },
|
||||||
{ text: 'Upgrading', link: '/upgrading/' },
|
{ text: "Upgrading", link: "/upgrading/" },
|
||||||
{ text: 'Frequently Asked Questions', link: '/faq/' },
|
{ text: "Frequently Asked Questions", link: "/faq/" },
|
||||||
{ text: 'Third Party', link: '/third-party/' },
|
{ text: "Certbot", link: "/certbot/" },
|
||||||
]
|
{ text: "Third Party", link: "/third-party/" },
|
||||||
}
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
socialLinks: [
|
socialLinks: [
|
||||||
{ icon: 'github', link: 'https://github.com/NginxProxyManager/nginx-proxy-manager' }
|
{
|
||||||
|
icon: "github",
|
||||||
|
link: "https://github.com/NginxProxyManager/nginx-proxy-manager",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
search: {
|
search: {
|
||||||
provider: 'local'
|
provider: "local",
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
message: 'Released under the MIT License.',
|
message: "Released under the MIT License.",
|
||||||
copyright: 'Copyright © 2016-present jc21.com'
|
copyright: "Copyright © 2016-present jc21.com",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
+2
-1
@@ -2,7 +2,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vitepress dev --host",
|
"dev": "vitepress dev --host",
|
||||||
"build": "vitepress build",
|
"build": "vitepress build",
|
||||||
"preview": "vitepress preview"
|
"preview": "vitepress preview",
|
||||||
|
"set-version": "./scripts/set-version.sh"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vitepress": "^1.6.4"
|
"vitepress": "^1.6.4"
|
||||||
|
|||||||
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euf
|
||||||
|
|
||||||
|
# this script accepts a version number as an argument
|
||||||
|
# and replaces {{VERSION}} in src/*.md with the provided version number.
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: $0 <version>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
cd "$DIR/.." || exit 1
|
||||||
|
|
||||||
|
VERSION="$1"
|
||||||
|
# find all .md files in src/ and replace {{VERSION}} with the provided version number
|
||||||
|
find src/ -type f -name "*.md" -exec sed -i "s/{{VERSION}}/$VERSION/g" {} \;
|
||||||
@@ -14,7 +14,7 @@ on the `data` and `letsencrypt` folders at startup.
|
|||||||
```yml
|
```yml
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: 'jc21/nginx-proxy-manager:latest'
|
image: 'jc21/nginx-proxy-manager:{{VERSION}}'
|
||||||
environment:
|
environment:
|
||||||
PUID: 1000
|
PUID: 1000
|
||||||
PGID: 1000
|
PGID: 1000
|
||||||
@@ -101,7 +101,7 @@ secrets:
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: 'jc21/nginx-proxy-manager:latest'
|
image: 'jc21/nginx-proxy-manager:{{VERSION}}'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
# Public HTTP Port:
|
# Public HTTP Port:
|
||||||
@@ -130,18 +130,16 @@ services:
|
|||||||
- db
|
- db
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: jc21/mariadb-aria
|
image: 'linuxserver/mariadb'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
# MYSQL_ROOT_PASSWORD: "npm" # use secret instead
|
|
||||||
MYSQL_ROOT_PASSWORD__FILE: /run/secrets/DB_ROOT_PWD
|
MYSQL_ROOT_PASSWORD__FILE: /run/secrets/DB_ROOT_PWD
|
||||||
MYSQL_DATABASE: "npm"
|
MYSQL_DATABASE: 'npm'
|
||||||
MYSQL_USER: "npm"
|
MYSQL_USER: 'npm'
|
||||||
# MYSQL_PASSWORD: "npm" # use secret instead
|
|
||||||
MYSQL_PASSWORD__FILE: /run/secrets/MYSQL_PWD
|
MYSQL_PASSWORD__FILE: /run/secrets/MYSQL_PWD
|
||||||
MARIADB_AUTO_UPGRADE: '1'
|
TZ: 'Australia/Brisbane'
|
||||||
volumes:
|
volumes:
|
||||||
- ./mysql:/var/lib/mysql
|
- ./mariadb:/config
|
||||||
secrets:
|
secrets:
|
||||||
- DB_ROOT_PWD
|
- DB_ROOT_PWD
|
||||||
- MYSQL_PWD
|
- MYSQL_PWD
|
||||||
@@ -233,8 +231,38 @@ load_module /usr/lib/nginx/modules/ngx_stream_geoip2_module.so;
|
|||||||
|
|
||||||
Setting these environment variables will create the default user on startup, skipping the UI first user setup screen:
|
Setting these environment variables will create the default user on startup, skipping the UI first user setup screen:
|
||||||
|
|
||||||
```
|
```yml
|
||||||
environment:
|
environment:
|
||||||
INITIAL_ADMIN_EMAIL: my@example.com
|
INITIAL_ADMIN_EMAIL: my@example.com
|
||||||
INITIAL_ADMIN_PASSWORD: mypassword1
|
INITIAL_ADMIN_PASSWORD: mypassword1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Disable Nginx Resolver
|
||||||
|
|
||||||
|
On startup, we generate a resolvers directive for Nginx unless this is defined:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
environment:
|
||||||
|
DISABLE_RESOLVER: true
|
||||||
|
```
|
||||||
|
|
||||||
|
In this configuration, all DNS queries performed by Nginx will fall to the `/etc/hosts` file
|
||||||
|
and then the `/etc/resolv.conf`.
|
||||||
|
|
||||||
|
|
||||||
|
## Changing the Admin UI port from 81 to something else
|
||||||
|
|
||||||
|
First, add an env var to your docker compose file:
|
||||||
|
```yml
|
||||||
|
environment:
|
||||||
|
NPM_ADMIN_PORT: '8000'
|
||||||
|
```
|
||||||
|
|
||||||
|
And you'll probably want to expose that port as well
|
||||||
|
|
||||||
|
```yml
|
||||||
|
ports:
|
||||||
|
- '8000:8000'
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you'll be able to access admin UI at `http://localhost:8000`
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
outline: deep
|
||||||
|
---
|
||||||
|
|
||||||
|
## Certbot DNS plugins in Nginx Proxy Manager
|
||||||
|
|
||||||
|
Nginx Proxy Manager uses Certbot to issue and renew Let’s Encrypt certificates.
|
||||||
|
|
||||||
|
When you request a certificate using a DNS challenge, Nginx Proxy Manager installs
|
||||||
|
the corresponding Certbot DNS plugin for the provider you selected. The available
|
||||||
|
providers and package versions are defined in
|
||||||
|
[certbot-dns-plugins.json](https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/backend/certbot/dns-plugins.json).
|
||||||
|
|
||||||
|
## Important limitations
|
||||||
|
|
||||||
|
DNS plugins are maintained independently from Certbot and from Nginx Proxy Manager. As a result:
|
||||||
|
- Some plugins may lag behind current Certbot or dependency versions.
|
||||||
|
- A plugin may install package versions that conflict with other Certbot components.
|
||||||
|
- Support quality varies between providers, and not every plugin is regularly tested in Nginx Proxy Manager.
|
||||||
|
|
||||||
|
::: warning
|
||||||
|
Using more than one DNS provider in the same Nginx Proxy Manager instance may introduce Python
|
||||||
|
dependency conflicts between Certbot plugins.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## If a DNS plugin does not work
|
||||||
|
|
||||||
|
1. Check the Nginx Proxy Manager container logs for Certbot or Python package installation errors.
|
||||||
|
2. Identify the plugin package and version defined for your provider in
|
||||||
|
[certbot-dns-plugins.json](https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/backend/certbot/dns-plugins.json).
|
||||||
|
3. Check [PyPI](https://pypi.org/) or the plugin project for a newer compatible release.
|
||||||
|
4. If needed, update the plugin definition, including any required dependency pins.
|
||||||
|
5. Submitting a pull request and CI will build a testable docker image for you.
|
||||||
|
|
||||||
|
## File reference
|
||||||
|
|
||||||
|
Use this file when reviewing or updating provider definitions:
|
||||||
|
- [certbot-dns-plugins.json](https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/backend/certbot/dns-plugins.json)
|
||||||
@@ -64,7 +64,7 @@ I won't go in to too much detail here but here are the basics for someone new to
|
|||||||
```yml
|
```yml
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: 'jc21/nginx-proxy-manager:latest'
|
image: 'jc21/nginx-proxy-manager:{{VERSION}}'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
TZ: "Australia/Brisbane"
|
TZ: "Australia/Brisbane"
|
||||||
|
|||||||
+11
-18
@@ -11,7 +11,7 @@ Create a `docker-compose.yml` file:
|
|||||||
```yml
|
```yml
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: 'jc21/nginx-proxy-manager:latest'
|
image: 'jc21/nginx-proxy-manager:{{VERSION}}'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
@@ -45,10 +45,7 @@ docker compose up -d
|
|||||||
|
|
||||||
## Using MySQL / MariaDB Database
|
## Using MySQL / MariaDB Database
|
||||||
|
|
||||||
If you opt for the MySQL configuration you will have to provide the database server yourself. You can also use MariaDB. Here are the minimum supported versions:
|
If you opt for the MySQL configuration you will have to provide the database server yourself.
|
||||||
|
|
||||||
- MySQL v5.7.8+
|
|
||||||
- MariaDB v10.2.7+
|
|
||||||
|
|
||||||
It's easy to use another docker container for your database also and link it as part of the docker stack, so that's what the following examples
|
It's easy to use another docker container for your database also and link it as part of the docker stack, so that's what the following examples
|
||||||
are going to use.
|
are going to use.
|
||||||
@@ -58,7 +55,7 @@ Here is an example of what your `docker-compose.yml` will look like when using a
|
|||||||
```yml
|
```yml
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: 'jc21/nginx-proxy-manager:latest'
|
image: 'jc21/nginx-proxy-manager:{{VERSION}}'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
# These ports are in format <host-port>:<container-port>
|
# These ports are in format <host-port>:<container-port>
|
||||||
@@ -88,31 +85,29 @@ services:
|
|||||||
- db
|
- db
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: 'jc21/mariadb-aria:latest'
|
image: 'linuxserver/mariadb'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: 'npm'
|
MYSQL_ROOT_PASSWORD: 'npm'
|
||||||
MYSQL_DATABASE: 'npm'
|
MYSQL_DATABASE: 'npm'
|
||||||
MYSQL_USER: 'npm'
|
MYSQL_USER: 'npm'
|
||||||
MYSQL_PASSWORD: 'npm'
|
MYSQL_PASSWORD: 'npm'
|
||||||
MARIADB_AUTO_UPGRADE: '1'
|
TZ: 'Australia/Brisbane'
|
||||||
volumes:
|
volumes:
|
||||||
- ./mysql:/var/lib/mysql
|
- ./mariadb:/config
|
||||||
```
|
```
|
||||||
|
|
||||||
::: warning
|
::: warning
|
||||||
|
|
||||||
Please note, that `DB_MYSQL_*` environment variables will take precedent over `DB_SQLITE_*` variables. So if you keep the MySQL variables, you will not be able to use SQLite.
|
Please note, that `DB_MYSQL_*` environment variables will take precedent over `DB_SQLITE_*` variables. So if you keep the MySQL variables, you will not be able to use SQLite.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
### Optional: MySQL / MariaDB SSL
|
### Optional: MySQL / MariaDB SSL
|
||||||
|
|
||||||
You can enable TLS for the MySQL/MariaDB connection with these environment variables:
|
You can enable TLS for the MySQL/MariaDB connection with these environment variables:
|
||||||
|
|
||||||
- DB_MYSQL_SSL: Enable SSL when set to true. If unset or false, SSL disabled (previous default behaviour).
|
- `DB_MYSQL_SSL`: Enable SSL when set to true. If unset or false, SSL disabled (previous default behaviour).
|
||||||
- DB_MYSQL_SSL_REJECT_UNAUTHORIZED: (default: true) Validate the server certificate chain. Set to false to allow self‑signed/unknown CA.
|
- `DB_MYSQL_SSL_REJECT_UNAUTHORIZED`: (default: true) Validate the server certificate chain. Set to false to allow self‑signed/unknown CA.
|
||||||
- DB_MYSQL_SSL_VERIFY_IDENTITY: (default: true) Performs host name / identity verification.
|
- `DB_MYSQL_SSL_VERIFY_IDENTITY`: (default: true) Performs host name / identity verification.
|
||||||
|
|
||||||
Enabling SSL using a self-signed cert (not recommended for production).
|
Enabling SSL using a self-signed cert (not recommended for production).
|
||||||
|
|
||||||
@@ -123,7 +118,7 @@ Similar to the MySQL server setup:
|
|||||||
```yml
|
```yml
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: 'jc21/nginx-proxy-manager:latest'
|
image: 'jc21/nginx-proxy-manager:{{VERSION}}'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
# These ports are in format <host-port>:<container-port>
|
# These ports are in format <host-port>:<container-port>
|
||||||
@@ -155,7 +150,7 @@ services:
|
|||||||
POSTGRES_PASSWORD: 'npmpass'
|
POSTGRES_PASSWORD: 'npmpass'
|
||||||
POSTGRES_DB: 'npm'
|
POSTGRES_DB: 'npm'
|
||||||
volumes:
|
volumes:
|
||||||
- ./postgresql:/var/lib/postgresql
|
- ./postgres_data:/var/lib/postgresql/data
|
||||||
```
|
```
|
||||||
|
|
||||||
::: warning
|
::: warning
|
||||||
@@ -185,8 +180,6 @@ for a list of supported architectures and if you want one that doesn't exist,
|
|||||||
Also, if you don't know how to already, follow [this guide to install docker and docker-compose](https://manre-universe.net/how-to-run-docker-and-docker-compose-on-raspbian/)
|
Also, if you don't know how to already, follow [this guide to install docker and docker-compose](https://manre-universe.net/how-to-run-docker-and-docker-compose-on-raspbian/)
|
||||||
on Raspbian.
|
on Raspbian.
|
||||||
|
|
||||||
Please note that the `jc21/mariadb-aria:latest` image might have some problems on some ARM devices, if you want a separate database container, use the `yobasystems/alpine-mariadb:latest` image.
|
|
||||||
|
|
||||||
## Initial Run
|
## Initial Run
|
||||||
|
|
||||||
After the app is running for the first time, the following will happen:
|
After the app is running for the first time, the following will happen:
|
||||||
|
|||||||
Vendored
+2
@@ -14,6 +14,8 @@ Known integrations:
|
|||||||
- [Proxmox Scripts](https://github.com/ej52/proxmox-scripts/tree/main/apps/nginx-proxy-manager)
|
- [Proxmox Scripts](https://github.com/ej52/proxmox-scripts/tree/main/apps/nginx-proxy-manager)
|
||||||
- [Proxmox VE Helper-Scripts](https://community-scripts.github.io/ProxmoxVE/scripts?id=nginxproxymanager)
|
- [Proxmox VE Helper-Scripts](https://community-scripts.github.io/ProxmoxVE/scripts?id=nginxproxymanager)
|
||||||
- [nginxproxymanagerGraf](https://github.com/ma-karai/nginxproxymanagerGraf)
|
- [nginxproxymanagerGraf](https://github.com/ma-karai/nginxproxymanagerGraf)
|
||||||
|
- [selfhosting.sh Nginx Proxy Manager Guide](https://selfhosting.sh/apps/nginx-proxy-manager/) - Complete Docker Compose setup guide with SSL configuration, access lists, and proxy host management.
|
||||||
|
- [NPM Auth Gateway](https://github.com/Mark0025/npm-auth-gateway) — User-level access control with auto IP whitelisting via auth providers. [Details](/third-party/npm-auth-gateway)
|
||||||
|
|
||||||
|
|
||||||
If you would like your integration of NPM listed, please open a
|
If you would like your integration of NPM listed, please open a
|
||||||
|
|||||||
+83
@@ -0,0 +1,83 @@
|
|||||||
|
---
|
||||||
|
outline: deep
|
||||||
|
---
|
||||||
|
|
||||||
|
# NPM Auth Gateway
|
||||||
|
|
||||||
|
User-level access control for Nginx Proxy Manager with auto IP whitelisting.
|
||||||
|
|
||||||
|
**Repository:** [github.com/Mark0025/npm-auth-gateway](https://github.com/Mark0025/npm-auth-gateway)
|
||||||
|
|
||||||
|
## What It Does
|
||||||
|
|
||||||
|
NPM Auth Gateway is a companion app that adds user management on top of NPM's access list system. Instead of manually adding IPs to access lists, users log in through an auth provider and their IP is automatically whitelisted on the access lists they've been assigned to.
|
||||||
|
|
||||||
|
NPM remains fully in control — the gateway only reads and writes through NPM's REST API. All access enforcement stays in NPM's nginx config.
|
||||||
|
|
||||||
|
## The Problem It Solves
|
||||||
|
|
||||||
|
- **Manual IP management** — every time a user needs access, an admin manually adds their IP to an access list
|
||||||
|
- **IP changes** — mobile users, VPNs, and travel mean IPs change constantly
|
||||||
|
- **No user visibility** — access lists contain IPs, but there's no record of who each IP belongs to
|
||||||
|
- **Scaling** — managing 10+ users across multiple access lists gets tedious
|
||||||
|
|
||||||
|
## How It Works
|
||||||
|
|
||||||
|
```
|
||||||
|
Browser → NPM (SSL) → Auth Gateway → Auth Provider
|
||||||
|
↓
|
||||||
|
NPM REST API (:81)
|
||||||
|
auto-add IP to access lists
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Admin creates a user by email
|
||||||
|
2. Admin assigns access — a table of proxy hosts with checkboxes showing which hosts each access list protects
|
||||||
|
3. User logs in → IP detected → automatically added to their assigned NPM access lists
|
||||||
|
4. User's IP changes → they log in again → new IP auto-added
|
||||||
|
5. Admin revokes access → user's IPs removed from all access lists
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- **Auto IP whitelisting** on login
|
||||||
|
- **Per-host access control** with checkboxes (not abstract groups)
|
||||||
|
- **Admin/user roles** — admin sees everything, users see only their assigned hosts
|
||||||
|
- **Personalized dashboard** — users see their services as clickable cards
|
||||||
|
- **Login logging** with IP history per user
|
||||||
|
- **One-click revoke** — removes user's IPs from all access lists
|
||||||
|
- **Searchable tables** for proxy hosts and users
|
||||||
|
- **Survives gateway failure** — NPM keeps enforcing existing whitelists
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
| Responsibility | Who Handles It |
|
||||||
|
|---|---|
|
||||||
|
| SSL termination | **NPM** |
|
||||||
|
| Proxy host configuration | **NPM** |
|
||||||
|
| Access list enforcement | **NPM** |
|
||||||
|
| IP whitelisting | **NPM** |
|
||||||
|
| User identity | **Auth Provider** |
|
||||||
|
| User → access list mapping | **Gateway** |
|
||||||
|
| Auto IP whitelisting | **Gateway** |
|
||||||
|
|
||||||
|
**No database required.** NPM stores all proxy/ACL config. User metadata lives in the auth provider. Zero state duplication.
|
||||||
|
|
||||||
|
## NPM API Endpoints Used
|
||||||
|
|
||||||
|
| Endpoint | Purpose |
|
||||||
|
|---|---|
|
||||||
|
| `POST /api/tokens` | Authentication |
|
||||||
|
| `GET /api/nginx/proxy-hosts` | List proxy hosts |
|
||||||
|
| `GET /api/nginx/access-lists` | List access lists |
|
||||||
|
| `PUT /api/nginx/access-lists/:id` | Update access list IPs |
|
||||||
|
| `POST /api/nginx/access-lists` | Create access list |
|
||||||
|
| `GET /api/nginx/certificates` | List SSL certificates |
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
See the [repository README](https://github.com/Mark0025/npm-auth-gateway) for Docker deployment instructions.
|
||||||
|
|
||||||
|
## Tech Stack
|
||||||
|
|
||||||
|
Next.js / React / TypeScript / Docker
|
||||||
|
|
||||||
|
The auth provider is swappable — the proof of concept uses Clerk, but any OIDC provider works (Auth0, Keycloak, Authentik, etc.).
|
||||||
+151
-116
@@ -335,85 +335,130 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba"
|
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba"
|
||||||
integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==
|
integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==
|
||||||
|
|
||||||
"@rollup/rollup-android-arm-eabi@4.24.0":
|
"@rollup/rollup-android-arm-eabi@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.24.0.tgz#1661ff5ea9beb362795304cb916049aba7ac9c54"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz#a6742c74c7d9d6d604ef8a48f99326b4ecda3d82"
|
||||||
integrity sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==
|
integrity sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==
|
||||||
|
|
||||||
"@rollup/rollup-android-arm64@4.24.0":
|
"@rollup/rollup-android-arm64@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.24.0.tgz#2ffaa91f1b55a0082b8a722525741aadcbd3971e"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz#97247be098de4df0c11971089fd2edf80a5da8cf"
|
||||||
integrity sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA==
|
integrity sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==
|
||||||
|
|
||||||
"@rollup/rollup-darwin-arm64@4.24.0":
|
"@rollup/rollup-darwin-arm64@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.24.0.tgz#627007221b24b8cc3063703eee0b9177edf49c1f"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz#674852cf14cf11b8056e0b1a2f4e872b523576cf"
|
||||||
integrity sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA==
|
integrity sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==
|
||||||
|
|
||||||
"@rollup/rollup-darwin-x64@4.24.0":
|
"@rollup/rollup-darwin-x64@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.24.0.tgz#0605506142b9e796c370d59c5984ae95b9758724"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz#36dfd7ed0aaf4d9d89d9ef983af72632455b0246"
|
||||||
integrity sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ==
|
integrity sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==
|
||||||
|
|
||||||
"@rollup/rollup-linux-arm-gnueabihf@4.24.0":
|
"@rollup/rollup-freebsd-arm64@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.24.0.tgz#62dfd196d4b10c0c2db833897164d2d319ee0cbb"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz#2f87c2074b4220260fdb52a9996246edfc633c22"
|
||||||
integrity sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==
|
integrity sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==
|
||||||
|
|
||||||
"@rollup/rollup-linux-arm-musleabihf@4.24.0":
|
"@rollup/rollup-freebsd-x64@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.24.0.tgz#53ce72aeb982f1f34b58b380baafaf6a240fddb3"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz#9b5a26522a38a95dc06616d1939d4d9a76937803"
|
||||||
integrity sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw==
|
integrity sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==
|
||||||
|
|
||||||
"@rollup/rollup-linux-arm64-gnu@4.24.0":
|
"@rollup/rollup-linux-arm-gnueabihf@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.24.0.tgz#1632990f62a75c74f43e4b14ab3597d7ed416496"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz#86aa4859385a8734235b5e40a48e52d770758c3a"
|
||||||
integrity sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==
|
integrity sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==
|
||||||
|
|
||||||
"@rollup/rollup-linux-arm64-musl@4.24.0":
|
"@rollup/rollup-linux-arm-musleabihf@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.24.0.tgz#8c03a996efb41e257b414b2e0560b7a21f2d9065"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz#cbe70e56e6ece8dac83eb773b624fc9e5a460976"
|
||||||
integrity sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==
|
integrity sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==
|
||||||
|
|
||||||
"@rollup/rollup-linux-powerpc64le-gnu@4.24.0":
|
"@rollup/rollup-linux-arm64-gnu@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.24.0.tgz#5b98729628d5bcc8f7f37b58b04d6845f85c7b5d"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz#d14992a2e653bc3263d284bc6579b7a2890e1c45"
|
||||||
integrity sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==
|
integrity sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==
|
||||||
|
|
||||||
"@rollup/rollup-linux-riscv64-gnu@4.24.0":
|
"@rollup/rollup-linux-arm64-musl@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.24.0.tgz#48e42e41f4cabf3573cfefcb448599c512e22983"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz#2fdd1ddc434ea90aeaa0851d2044789b4d07f6da"
|
||||||
integrity sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==
|
integrity sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==
|
||||||
|
|
||||||
"@rollup/rollup-linux-s390x-gnu@4.24.0":
|
"@rollup/rollup-linux-loong64-gnu@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.24.0.tgz#e0b4f9a966872cb7d3e21b9e412a4b7efd7f0b58"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz#8a181e6f89f969f21666a743cd411416c80099e7"
|
||||||
integrity sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==
|
integrity sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==
|
||||||
|
|
||||||
"@rollup/rollup-linux-x64-gnu@4.24.0":
|
"@rollup/rollup-linux-loong64-musl@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.24.0.tgz#78144741993100f47bd3da72fce215e077ae036b"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz#904125af2babc395f8061daa27b5af1f4e3f2f78"
|
||||||
integrity sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==
|
integrity sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==
|
||||||
|
|
||||||
"@rollup/rollup-linux-x64-musl@4.24.0":
|
"@rollup/rollup-linux-ppc64-gnu@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.24.0.tgz#d9fe32971883cd1bd858336bd33a1c3ca6146127"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz#a57970ac6864c9a3447411a658224bdcf948be22"
|
||||||
integrity sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==
|
integrity sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==
|
||||||
|
|
||||||
"@rollup/rollup-win32-arm64-msvc@4.24.0":
|
"@rollup/rollup-linux-ppc64-musl@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.24.0.tgz#71fa3ea369316db703a909c790743972e98afae5"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz#bb84de5b26870567a4267666e08891e80bb56a63"
|
||||||
integrity sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==
|
integrity sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==
|
||||||
|
|
||||||
"@rollup/rollup-win32-ia32-msvc@4.24.0":
|
"@rollup/rollup-linux-riscv64-gnu@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.24.0.tgz#653f5989a60658e17d7576a3996deb3902e342e2"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz#72d00d2c7fb375ce3564e759db33f17a35bffab9"
|
||||||
integrity sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ==
|
integrity sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==
|
||||||
|
|
||||||
"@rollup/rollup-win32-x64-msvc@4.24.0":
|
"@rollup/rollup-linux-riscv64-musl@4.59.0":
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.24.0.tgz#0574d7e87b44ee8511d08cc7f914bcb802b70818"
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz#4c166ef58e718f9245bd31873384ba15a5c1a883"
|
||||||
integrity sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw==
|
integrity sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-s390x-gnu@4.59.0":
|
||||||
|
version "4.59.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz#bb5025cde9a61db478c2ca7215808ad3bce73a09"
|
||||||
|
integrity sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-x64-gnu@4.59.0":
|
||||||
|
version "4.59.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz#9b66b1f9cd95c6624c788f021c756269ffed1552"
|
||||||
|
integrity sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-x64-musl@4.59.0":
|
||||||
|
version "4.59.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz#b007ca255dc7166017d57d7d2451963f0bd23fd9"
|
||||||
|
integrity sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==
|
||||||
|
|
||||||
|
"@rollup/rollup-openbsd-x64@4.59.0":
|
||||||
|
version "4.59.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz#e8b357b2d1aa2c8d76a98f5f0d889eabe93f4ef9"
|
||||||
|
integrity sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==
|
||||||
|
|
||||||
|
"@rollup/rollup-openharmony-arm64@4.59.0":
|
||||||
|
version "4.59.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz#96c2e3f4aacd3d921981329831ff8dde492204dc"
|
||||||
|
integrity sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==
|
||||||
|
|
||||||
|
"@rollup/rollup-win32-arm64-msvc@4.59.0":
|
||||||
|
version "4.59.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz#2d865149d706d938df8b4b8f117e69a77646d581"
|
||||||
|
integrity sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==
|
||||||
|
|
||||||
|
"@rollup/rollup-win32-ia32-msvc@4.59.0":
|
||||||
|
version "4.59.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz#abe1593be0fa92325e9971c8da429c5e05b92c36"
|
||||||
|
integrity sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==
|
||||||
|
|
||||||
|
"@rollup/rollup-win32-x64-gnu@4.59.0":
|
||||||
|
version "4.59.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz#c4af3e9518c9a5cd4b1c163dc81d0ad4d82e7eab"
|
||||||
|
integrity sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==
|
||||||
|
|
||||||
|
"@rollup/rollup-win32-x64-msvc@4.59.0":
|
||||||
|
version "4.59.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz#4584a8a87b29188a4c1fe987a9fcf701e256d86c"
|
||||||
|
integrity sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==
|
||||||
|
|
||||||
"@shikijs/core@2.5.0", "@shikijs/core@^2.1.0":
|
"@shikijs/core@2.5.0", "@shikijs/core@^2.1.0":
|
||||||
version "2.5.0"
|
version "2.5.0"
|
||||||
@@ -479,10 +524,10 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz#a90ab31d0cc1dfb54c66a69e515bf624fa7b2224"
|
resolved "https://registry.yarnpkg.com/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz#a90ab31d0cc1dfb54c66a69e515bf624fa7b2224"
|
||||||
integrity sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==
|
integrity sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==
|
||||||
|
|
||||||
"@types/estree@1.0.6":
|
"@types/estree@1.0.8":
|
||||||
version "1.0.6"
|
version "1.0.8"
|
||||||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50"
|
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e"
|
||||||
integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==
|
integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==
|
||||||
|
|
||||||
"@types/hast@^3.0.0", "@types/hast@^3.0.4":
|
"@types/hast@^3.0.0", "@types/hast@^3.0.4":
|
||||||
version "3.0.4"
|
version "3.0.4"
|
||||||
@@ -907,15 +952,10 @@ mitt@^3.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/mitt/-/mitt-3.0.1.tgz#ea36cf0cc30403601ae074c8f77b7092cdab36d1"
|
resolved "https://registry.yarnpkg.com/mitt/-/mitt-3.0.1.tgz#ea36cf0cc30403601ae074c8f77b7092cdab36d1"
|
||||||
integrity sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==
|
integrity sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==
|
||||||
|
|
||||||
nanoid@^3.3.11:
|
nanoid@^3.3.16:
|
||||||
version "3.3.11"
|
version "3.3.16"
|
||||||
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.11.tgz#4f4f112cefbe303202f2199838128936266d185b"
|
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.16.tgz#a04d8ec4b1f10009d2d533947aefe4293737816c"
|
||||||
integrity sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==
|
integrity sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==
|
||||||
|
|
||||||
nanoid@^3.3.7:
|
|
||||||
version "3.3.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.8.tgz#b1be3030bee36aaff18bacb375e5cce521684baf"
|
|
||||||
integrity sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==
|
|
||||||
|
|
||||||
oniguruma-to-es@^3.1.0:
|
oniguruma-to-es@^3.1.0:
|
||||||
version "3.1.1"
|
version "3.1.1"
|
||||||
@@ -931,31 +971,17 @@ perfect-debounce@^1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/perfect-debounce/-/perfect-debounce-1.0.0.tgz#9c2e8bc30b169cc984a58b7d5b28049839591d2a"
|
resolved "https://registry.yarnpkg.com/perfect-debounce/-/perfect-debounce-1.0.0.tgz#9c2e8bc30b169cc984a58b7d5b28049839591d2a"
|
||||||
integrity sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==
|
integrity sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==
|
||||||
|
|
||||||
picocolors@^1.1.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.0.tgz#5358b76a78cde483ba5cef6a9dc9671440b27d59"
|
|
||||||
integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==
|
|
||||||
|
|
||||||
picocolors@^1.1.1:
|
picocolors@^1.1.1:
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
|
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
|
||||||
integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
|
integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
|
||||||
|
|
||||||
postcss@^8.4.43:
|
postcss@^8.4.43, postcss@^8.5.6:
|
||||||
version "8.4.47"
|
version "8.5.25"
|
||||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.47.tgz#5bf6c9a010f3e724c503bf03ef7947dcb0fea365"
|
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.25.tgz#5012a598eaaa897f21bbe8553be3cb7bd2bd78cb"
|
||||||
integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==
|
integrity sha512-DTPx3RWSSnWyzLxQnlH0rJP+EW5ekl16ZU4/psbIhA0e53kJfdgaN5vKM+xP7yJtXVu+nfdVFmlgFDEKAe4Pyw==
|
||||||
dependencies:
|
dependencies:
|
||||||
nanoid "^3.3.7"
|
nanoid "^3.3.16"
|
||||||
picocolors "^1.1.0"
|
|
||||||
source-map-js "^1.2.1"
|
|
||||||
|
|
||||||
postcss@^8.5.6:
|
|
||||||
version "8.5.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.6.tgz#2825006615a619b4f62a9e7426cc120b349a8f3c"
|
|
||||||
integrity sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==
|
|
||||||
dependencies:
|
|
||||||
nanoid "^3.3.11"
|
|
||||||
picocolors "^1.1.1"
|
picocolors "^1.1.1"
|
||||||
source-map-js "^1.2.1"
|
source-map-js "^1.2.1"
|
||||||
|
|
||||||
@@ -994,28 +1020,37 @@ rfdc@^1.4.1:
|
|||||||
integrity sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==
|
integrity sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==
|
||||||
|
|
||||||
rollup@^4.20.0:
|
rollup@^4.20.0:
|
||||||
version "4.24.0"
|
version "4.59.0"
|
||||||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.24.0.tgz#c14a3576f20622ea6a5c9cad7caca5e6e9555d05"
|
resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.59.0.tgz#cf74edac17c1486f562d728a4d923a694abdf06f"
|
||||||
integrity sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg==
|
integrity sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/estree" "1.0.6"
|
"@types/estree" "1.0.8"
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
"@rollup/rollup-android-arm-eabi" "4.24.0"
|
"@rollup/rollup-android-arm-eabi" "4.59.0"
|
||||||
"@rollup/rollup-android-arm64" "4.24.0"
|
"@rollup/rollup-android-arm64" "4.59.0"
|
||||||
"@rollup/rollup-darwin-arm64" "4.24.0"
|
"@rollup/rollup-darwin-arm64" "4.59.0"
|
||||||
"@rollup/rollup-darwin-x64" "4.24.0"
|
"@rollup/rollup-darwin-x64" "4.59.0"
|
||||||
"@rollup/rollup-linux-arm-gnueabihf" "4.24.0"
|
"@rollup/rollup-freebsd-arm64" "4.59.0"
|
||||||
"@rollup/rollup-linux-arm-musleabihf" "4.24.0"
|
"@rollup/rollup-freebsd-x64" "4.59.0"
|
||||||
"@rollup/rollup-linux-arm64-gnu" "4.24.0"
|
"@rollup/rollup-linux-arm-gnueabihf" "4.59.0"
|
||||||
"@rollup/rollup-linux-arm64-musl" "4.24.0"
|
"@rollup/rollup-linux-arm-musleabihf" "4.59.0"
|
||||||
"@rollup/rollup-linux-powerpc64le-gnu" "4.24.0"
|
"@rollup/rollup-linux-arm64-gnu" "4.59.0"
|
||||||
"@rollup/rollup-linux-riscv64-gnu" "4.24.0"
|
"@rollup/rollup-linux-arm64-musl" "4.59.0"
|
||||||
"@rollup/rollup-linux-s390x-gnu" "4.24.0"
|
"@rollup/rollup-linux-loong64-gnu" "4.59.0"
|
||||||
"@rollup/rollup-linux-x64-gnu" "4.24.0"
|
"@rollup/rollup-linux-loong64-musl" "4.59.0"
|
||||||
"@rollup/rollup-linux-x64-musl" "4.24.0"
|
"@rollup/rollup-linux-ppc64-gnu" "4.59.0"
|
||||||
"@rollup/rollup-win32-arm64-msvc" "4.24.0"
|
"@rollup/rollup-linux-ppc64-musl" "4.59.0"
|
||||||
"@rollup/rollup-win32-ia32-msvc" "4.24.0"
|
"@rollup/rollup-linux-riscv64-gnu" "4.59.0"
|
||||||
"@rollup/rollup-win32-x64-msvc" "4.24.0"
|
"@rollup/rollup-linux-riscv64-musl" "4.59.0"
|
||||||
|
"@rollup/rollup-linux-s390x-gnu" "4.59.0"
|
||||||
|
"@rollup/rollup-linux-x64-gnu" "4.59.0"
|
||||||
|
"@rollup/rollup-linux-x64-musl" "4.59.0"
|
||||||
|
"@rollup/rollup-openbsd-x64" "4.59.0"
|
||||||
|
"@rollup/rollup-openharmony-arm64" "4.59.0"
|
||||||
|
"@rollup/rollup-win32-arm64-msvc" "4.59.0"
|
||||||
|
"@rollup/rollup-win32-ia32-msvc" "4.59.0"
|
||||||
|
"@rollup/rollup-win32-x64-gnu" "4.59.0"
|
||||||
|
"@rollup/rollup-win32-x64-msvc" "4.59.0"
|
||||||
fsevents "~2.3.2"
|
fsevents "~2.3.2"
|
||||||
|
|
||||||
shiki@^2.1.0:
|
shiki@^2.1.0:
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
src/locale/lang
|
src/locale/lang
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
/logs/
|
||||||
*.log
|
*.log
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
|
|||||||
+7
-24
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/2.3.14/schema.json",
|
"$schema": "https://biomejs.dev/schemas/2.5.10/schema.json",
|
||||||
"vcs": {
|
"vcs": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"clientKind": "git",
|
"clientKind": "git",
|
||||||
@@ -7,13 +7,7 @@
|
|||||||
},
|
},
|
||||||
"files": {
|
"files": {
|
||||||
"ignoreUnknown": false,
|
"ignoreUnknown": false,
|
||||||
"includes": [
|
"includes": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "!**/dist/**/*"]
|
||||||
"**/*.ts",
|
|
||||||
"**/*.tsx",
|
|
||||||
"**/*.js",
|
|
||||||
"**/*.jsx",
|
|
||||||
"!**/dist/**/*"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"formatter": {
|
"formatter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
@@ -31,24 +25,13 @@
|
|||||||
"groups": [
|
"groups": [
|
||||||
":BUN:",
|
":BUN:",
|
||||||
":NODE:",
|
":NODE:",
|
||||||
[
|
["npm:*", "npm:*/**"],
|
||||||
"npm:*",
|
|
||||||
"npm:*/**"
|
|
||||||
],
|
|
||||||
":PACKAGE_WITH_PROTOCOL:",
|
":PACKAGE_WITH_PROTOCOL:",
|
||||||
":URL:",
|
":URL:",
|
||||||
":PACKAGE:",
|
":PACKAGE:",
|
||||||
[
|
["/src/*", "/src/**"],
|
||||||
"/src/*",
|
["/**"],
|
||||||
"/src/**"
|
["#*", "#*/**"],
|
||||||
],
|
|
||||||
[
|
|
||||||
"/**"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"#*",
|
|
||||||
"#*/**"
|
|
||||||
],
|
|
||||||
":PATH:"
|
":PATH:"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -59,7 +42,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"rules": {
|
"rules": {
|
||||||
"recommended": true,
|
"preset": "recommended",
|
||||||
"correctness": {
|
"correctness": {
|
||||||
"useUniqueElementIds": "off"
|
"useUniqueElementIds": "off"
|
||||||
},
|
},
|
||||||
|
|||||||
Loaded 100 of 243 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user