forge
Explore
Log in

Don't you dare go Hollow

📝 deploy: ferron.conf example, trusted proxies, share tokens out of access logs, tighter systemd unit

Browse files at this commit

b5e7290524de29bc396b39ae2d4c18b3dd5eef54Ahmet Kaan GümüşParent: f70fcdd
README.mdmodified+4 -3
@@ -45,7 +45,7 @@ user can read:
45 | `database`, `data_dir` | Database file and data directory (blobs, staging, `in.key`, `in.lock`). The data directory is created with mode 0700. |45 | `database`, `data_dir` | Database file and data directory (blobs, staging, `in.key`, `in.lock`). The data directory is created with mode 0700. |
46 | `listen` | Address to bind. Keep it on loopback and put the reverse proxy in front. |46 | `listen` | Address to bind. Keep it on loopback and put the reverse proxy in front. |
47 | `base_url` | Public origin with no trailing slash. An `https` origin turns on `Secure` cookies and HSTS. |47 | `base_url` | Public origin with no trailing slash. An `https` origin turns on `Secure` cookies and HSTS. |
48-| `trusted_proxies` | Proxies whose `X-Forwarded-For` is believed. |48+| `trusted_proxies` | Proxies whose `X-Forwarded-For` is believed. Behind Ferron on the same host, `["127.0.0.1/32"]`; left empty there, every visitor counts as the proxy. |
49 | `[oidc]` | `issuer` (the `im` origin), `client_id` (the id `im` printed for this client), `client_secret_file`. |49 | `[oidc]` | `issuer` (the `im` origin), `client_id` (the id `im` printed for this client), `client_secret_file`. |
50 | `[storage]` | `backend = "local"` (default) or `"s3"` with `[storage.s3]`. |50 | `[storage]` | `backend = "local"` (default) or `"s3"` with `[storage.s3]`. |
51 | `[backup]` | Optional. `dir`, `interval_hours`, `keep`, `healthcheck_url`. See *Backups*. |51 | `[backup]` | Optional. `dir`, `interval_hours`, `keep`, `healthcheck_url`. See *Backups*. |
@@ -79,9 +79,10 @@ is the built-in default. A blank field on that page removes the page's value aga
79 The scopes must include `directory.read`, which `in` uses to read the people directory; `im` does not grant79 The scopes must include `directory.read`, which `in` uses to read the people directory; `im` does not grant
80 it unless it is listed.80 it unless it is listed.
81 81
82-3. Put the reverse proxy in front (see `deploy/ferron.kdl`, an example for Ferron that proxies82+3. Put the reverse proxy in front (see `deploy/ferron.conf`, an example for Ferron that proxies
83 `https://in.example.com` to `127.0.0.1:7655`). Ferron must not buffer responses: the live update stream83 `https://in.example.com` to `127.0.0.1:7655`). Ferron must not buffer responses: the live update stream
84- depends on it.84+ depends on it. Set `trusted_proxies = ["127.0.0.1/32"]`, so the share-password throttle sees each visitor's
85+ address, and keep `/s/` paths out of the access log: a share link's token is in its path.
85 86
86 4. Start the service:87 4. Start the service:
87 88
config/in.example.tomlmodified+1 -0
@@ -11,6 +11,7 @@ listen = "127.0.0.1:7655"
11 # Public URL of this instance, with no trailing slash. An https URL turns on Secure cookies and HSTS.11 # Public URL of this instance, with no trailing slash. An https URL turns on Secure cookies and HSTS.
12 base_url = "http://127.0.0.1:7655"12 base_url = "http://127.0.0.1:7655"
13 # Proxies whose X-Forwarded-For header is believed for client addresses. CIDR ranges or bare addresses.13 # Proxies whose X-Forwarded-For header is believed for client addresses. CIDR ranges or bare addresses.
14+# Behind Ferron on the same host, set ["127.0.0.1/32"]; left empty there, every visitor counts as 127.0.0.1.
14 trusted_proxies = []15 trusted_proxies = []
15 16
16 # Sign-in through im (OpenID Connect). Point issuer at the im instance you run (its origin, no17 # Sign-in through im (OpenID Connect). Point issuer at the im instance you run (its origin, no
deploy/ferron.confadded+20 -0
@@ -0,0 +1,20 @@
1+# Ferron reverse proxy for in. Same format as the forge and iz examples (ferron.conf, not KDL).
2+# Replace in.example.com with the public host name (base_url in /etc/in/in.toml must match it).
3+# A bare host block gets automatic TLS.
4+#
5+# The proxy sends X-Forwarded-For for the client. in reads that header only from peers listed in
6+# trusted_proxies; with Ferron on the same machine the peer is 127.0.0.1, so set
7+# trusted_proxies = ["127.0.0.1/32"] in in.toml. Left empty, every visitor counts as 127.0.0.1 and one
8+# visitor's failures throttle everyone.
9+#
10+# Buffering is off because the live update streams (server-sent events) must reach the browser
11+# as they are written.
12+#
13+# Keep /s/ (public share links) out of the access log: those paths carry tokens that grant access.
14+in.example.com {
15+ buffer_request 0
16+ buffer_response 0
17+ proxy {
18+ upstream http://127.0.0.1:7655
19+ }
20+}
deploy/ferron.kdldeleted+0 -6
@@ -1,6 +0,0 @@
1-// Example Ferron site for `in`. Ferron terminates TLS and forwards to the loopback listener of `in`.
2-// Check the directive names against the Ferron version you run; this file shows the shape, it has not been
3-// run against a live Ferron here.
4-in.example.com {
5- proxy http://127.0.0.1:7655
6-}
deploy/in.servicemodified+9 -0
@@ -12,6 +12,8 @@ Group=in
12 Environment=IN_CONFIG=/etc/in/in.toml12 Environment=IN_CONFIG=/etc/in/in.toml
13 ExecStart=/usr/local/bin/in serve13 ExecStart=/usr/local/bin/in serve
14 WorkingDirectory=/var/lib/in14 WorkingDirectory=/var/lib/in
15+StateDirectory=in
16+StateDirectoryMode=0700
15 Restart=on-failure17 Restart=on-failure
16 RestartSec=218 RestartSec=2
17 LimitNOFILE=6553619 LimitNOFILE=65536
@@ -39,6 +41,13 @@ LockPersonality=yes
39 MemoryDenyWriteExecute=yes41 MemoryDenyWriteExecute=yes
40 SystemCallArchitectures=native42 SystemCallArchitectures=native
41 SystemCallFilter=@system-service43 SystemCallFilter=@system-service
44+SystemCallFilter=~@privileged
45+ProtectProc=invisible
46+ProcSubset=pid
47+RemoveIPC=yes
48+PrivateMounts=yes
49+KeyringMode=private
50+MemoryMax=2G
42 CapabilityBoundingSet=51 CapabilityBoundingSet=
43 AmbientCapabilities=52 AmbientCapabilities=
44 UMask=007753 UMask=0077