Skip to content

Commit 2d9410b

Browse files
committed
Docs for LISTEN_PORT & ALLOW_PRIVATE_ADDRESS
1 parent 06da44d commit 2d9410b

File tree

6 files changed

+74
-5
lines changed

6 files changed

+74
-5
lines changed

.env.sample

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SECRET_KEY=secret_key # generate a secret key with `openssl rand -base64 32`
55
LOG_LEVEL=info
66
LOG_QUERY=false
77
BEHIND_PROXY=false
8-
LISTEN_PORT=3000 # if BEHIND_PROXY=true used as port for the server
8+
LISTEN_PORT=3000
99
# Setting ALLOW_PRIVATE_ADDRESS to true disables SSRF (Server-Side Request Forgery) protection
1010
# Set to true to test in local network
1111
# Will be replaced by list of allowed IPs once https://github.com/dahlia/fedify/issues/157

docs/src/content/docs/install/env.mdx

+17
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Hollo is configured using environment variables. You can set them in an *.env*
99
file in the root directory of the project, or you can set them using Docker's
1010
`-e`/`--env` option or Railway's environment variables.
1111

12+
### `LISTEN_PORT` <Badge text="Optional" /> <Badge text="Unused in Railway" variant="tip" />
13+
14+
The port number to listen on. 3000 by default.
15+
1216
### `DATABASE_URL` <Badge text="Unused in Railway" variant="tip" />
1317

1418
The URL of the PostgreSQL database, e.g.,
@@ -67,6 +71,19 @@ Turned off by default.
6771
security reasons.
6872
</Aside>
6973

74+
### `ALLOW_PRIVATE_ADDRESS` <Badge text="Optional" />
75+
76+
Setting this to `true` disables SSRF (Server-Side Request Forgery) protection.
77+
78+
Turn on to test in local network.
79+
80+
Turned off by default.
81+
82+
<Aside>
83+
Turning on this option is dangerous security-wise. Only use this option in
84+
a trusted environment and never in production.
85+
</Aside>
86+
7087
### `S3_REGION` <Badge text="Optional" />
7188

7289
The region of the S3-compatible object storage, e.g., `us-east-1`. On some

docs/src/content/docs/ja/install/env.mdx

+17
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Holloは環境変数を使って設定を行います。
1010
Dockerの`-e`/`--env`オプションを使うか、
1111
Railwayのenvironment variablesメニューから設定できます。
1212

13+
### `LISTEN_PORT` <Badge text="オプション" /> <Badge text="Railwayでは使われない" variant="tip" />
14+
15+
サーバーが受信するポート番号。デフォルトは3000です。
16+
1317
### `DATABASE_URL` <Badge text="Railwayでは使われない" variant="tip" />
1418

1519
PostgreSQLのデータベースのURL。例:`postgresql://hollo:password@localhost/hollo`
@@ -67,6 +71,19 @@ HolloがL7ロードバランサーの後ろにある場合(通常はそうす
6771
この動作はセキュリティ上注意が必要です。
6872
</Aside>
6973

74+
### `ALLOW_PRIVATE_ADDRESS` <Badge text="オプション" />
75+
76+
このオプションを`true`に設定すると、サーバーサイドリクエストフォージェリ(SSRF)攻撃の防止を解除します。
77+
78+
ローカルネットワークでテストする場合は、このオプションをオンにする必要がある場合があります。
79+
80+
デフォルトではオフになっています。
81+
82+
<Aside>
83+
このオプションをオンにすることはセキュリティ上危険です。
84+
信頼できる環境でのみ使用し、本番環境では使用しないでください。
85+
</Aside>
86+
7087
### `S3_REGION` <Badge text="オプション" />
7188

7289
S3互換オブジェクトストレージのリージョン。例:`us-east-1`

docs/src/content/docs/ko/install/env.mdx

+17
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Hollo는 환경 변수를 통해 여러 가지 설정을 할 수 있습니다.
1010
Docker의 `-e`/`--env` 옵션을 쓰거나,
1111
Railway의 environment variables 메뉴에서 설정할 수 있습니다.
1212

13+
### `LISTEN_PORT` <Badge text="선택" /> <Badge text="Railway에서는 안 쓰임" variant="tip" />
14+
15+
서버가 수신할 포트 번호. 기본값은 3000입니다.
16+
1317
### `DATABASE_URL` <Badge text="Railway에서는 안 쓰임" variant="tip" />
1418

1519
PostgreSQL 데이터베이스의 URL. 예: `postgresql://hollo:password@localhost/hollo`.
@@ -66,6 +70,19 @@ Hollo가 L7 로드 밸런서 뒤에 위치할 경우 (일반적으로 그래야
6670
이 동작은 보안상 주의를 기울여야 합니다.
6771
</Aside>
6872

73+
### `ALLOW_PRIVATE_ADDRESS` <Badge text="선택" />
74+
75+
이 옵션을 `true`로 설정하면 서버 측 요청 위조(SSRF) 공격 방지를 풉니다.
76+
77+
로컬 네트워크에서 테스트할 때 이 옵션을 켜야 할 수 있습니다.
78+
79+
기본적으로는 꺼져 있습니다.
80+
81+
<Aside>
82+
이 옵션을 켜는 것은 보안상 위험할 수 있습니다. 신뢰할 수 있는 환경에서만 사용하고,
83+
프로덕션 환경에서는 사용하지 마세요.
84+
</Aside>
85+
6986
### `S3_REGION` <Badge text="선택" />
7087

7188
S3 호환 오브젝트 스토리지의 지역. 예: `us-east-1`.

docs/src/content/docs/zh-cn/install/env.mdx

+17
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import { Aside, Badge } from '@astrojs/starlight/components';
77

88
Hollo是通过环境变量进行配置的。你可以在项目根目录的 *.env* 文件中设置它们,或者使用Docker的`-e`/`--env`选项或Railway的环境变量进行设置。
99

10+
### `LISTEN_PORT` <Badge text="可选" /> <Badge text="Railway中未使用" variant="tip" />
11+
12+
服务器监听的端口号。默认为3000。
13+
1014
### `DATABASE_URL` <Badge text="Railway中未使用" variant="tip" />
1115

1216
PostgreSQL数据库的URL,例如:`postgresql://hollo:password@localhost/hollo`
@@ -57,6 +61,19 @@ openssl rand -hex 32
5761
启用此选项后,Hollo将信任来自反向代理的`X-Forwarded-For``X-Forwarded-Proto``X-Forwarded-Host`头。这对于安全来说非常重要。
5862
</Aside>
5963

64+
### `ALLOW_PRIVATE_ADDRESS` <Badge text="可选" />
65+
66+
将此选项设置为`true`将禁用 SSRF(服务器端请求伪造)保护。
67+
68+
打开此选项可在本地网络中进行测试。
69+
70+
默认情况下关闭。
71+
72+
<Aside>
73+
启用此选项存在严重的安全隐患。
74+
仅在受信任的环境下使用此选项,切勿在生产环境中使用。
75+
</Aside>
76+
6077
### `S3_REGION` <Badge text="可选" />
6178

6279
S3兼容对象存储的区域,例如:`us-east-1`。在某些非S3服务中,可以省略此项。默认为`auto`

src/index.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ app.get("/nodeinfo/2.0", (c) => c.redirect("/nodeinfo/2.1"));
2121
// biome-ignore lint/complexity/useLiteralKeys: tsc complains about this (TS4111)
2222
const BEHIND_PROXY = process.env["BEHIND_PROXY"] === "true";
2323
// biome-ignore lint/complexity/useLiteralKeys: tsc complains about this (TS4111)
24-
const HOLLO_PORT = Number.parseInt(process.env["LISTEN_PORT"] ?? "3000", 10);
24+
const LISTEN_PORT = Number.parseInt(process.env["LISTEN_PORT"] ?? "3000", 10);
2525

26-
export default BEHIND_PROXY
27-
? { fetch: behindProxy(app.fetch.bind(app)), port: HOLLO_PORT }
28-
: app;
26+
export default {
27+
fetch: BEHIND_PROXY ? behindProxy(app.fetch.bind(app)) : app.fetch.bind(app),
28+
port: LISTEN_PORT,
29+
};

0 commit comments

Comments
 (0)