Skip to content

Commit 451d854

Browse files
committed
docs(node): align firewall defaults with single-node 5432 overrides
1 parent 2159c9f commit 451d854

File tree

10 files changed

+115
-93
lines changed

10 files changed

+115
-93
lines changed

content/docs/about/release.md

Lines changed: 88 additions & 63 deletions
Large diffs are not rendered by default.

content/docs/conf/yaml/demo/debian.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ all:
412412
# NODE_SEC
413413
#-----------------------------------------------------------------
414414
node_selinux_mode: permissive # set selinux mode: enforcing,permissive,disabled
415-
node_firewall_mode: zone # firewall mode: none (skip), off (disable), zone (enable & config)
415+
node_firewall_mode: zone # firewall mode: zone (default), off (disable), none (skip & self-managed)
416416
node_firewall_intranet: # which intranet cidr considered as internal network
417417
- 10.0.0.0/8
418418
- 192.168.0.0/16
@@ -421,7 +421,6 @@ all:
421421
- 22 # enable ssh access
422422
- 80 # enable http access
423423
- 443 # enable https access
424-
- 5432 # enable postgresql access (think twice before exposing it!)
425424

426425
#-----------------------------------------------------------------
427426
# NODE_TUNE

content/docs/conf/yaml/demo/el.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ all:
419419
# NODE_SEC
420420
#-----------------------------------------------------------------
421421
node_selinux_mode: permissive # set selinux mode: enforcing,permissive,disabled
422-
node_firewall_mode: zone # firewall mode: none (skip), off (disable), zone (enable & config)
422+
node_firewall_mode: zone # firewall mode: zone (default), off (disable), none (skip & self-managed)
423423
node_firewall_intranet: # which intranet cidr considered as internal network
424424
- 10.0.0.0/8
425425
- 192.168.0.0/16
@@ -428,7 +428,6 @@ all:
428428
- 22 # enable ssh access
429429
- 80 # enable http access
430430
- 443 # enable https access
431-
- 5432 # enable postgresql access (think twice before exposing it!)
432431

433432
#-----------------------------------------------------------------
434433
# NODE_TUNE

content/docs/conf/yaml/ha/safe.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ all:
165165
repo_remove: true # remove existing repo on admin node during repo bootstrap
166166
node_repo_remove: true # remove existing node repo for node managed by pigsty
167167
#node_selinux_mode: enforcing # set selinux mode: enforcing,permissive,disabled
168-
node_firewall_mode: zone # firewall mode: none (skip), off (disable), zone (enable & config)
168+
node_firewall_mode: zone # firewall mode: zone (default), off (disable), none (skip & self-managed)
169169

170170
repo_extra_packages: [ pg18-main ] #,pg18-core ,pg18-time ,pg18-gis ,pg18-rag ,pg18-fts ,pg18-olap ,pg18-feat ,pg18-lang ,pg18-type ,pg18-util ,pg18-func ,pg18-admin ,pg18-stat ,pg18-sec ,pg18-fdw ,pg18-sim ,pg18-etl]
171171
pg_version: 18 # default postgres version

content/docs/conf/yaml/ha/simu.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ all:
299299
#==========================================================#
300300
node_id_from_pg: true # use nodename rather than pg identity as hostname
301301
node_tune: tiny # use small node template
302+
node_firewall_mode: zone # default: trust intranet, expose selected public ports
302303
node_timezone: Asia/Hong_Kong # use Asia/Hong_Kong Timezone
303304
node_dns_servers: # DNS servers in /etc/resolv.conf
304305
- 10.10.10.10

content/docs/conf/yaml/meta.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ all:
148148
#node_repo_modules: local # use this if you want to build & user local repo
149149
node_repo_remove: true # remove existing node repo for node managed by pigsty
150150
#node_packages: [openssh-server] # packages to be installed current nodes with the latest version
151+
node_firewall_public_port: [22, 80, 443, 5432] # expose 5432 for demo convenience, remove in production!
151152

152153
#----------------------------------------------#
153154
# PGSQL : https://pigsty.io/docs/pgsql/param
@@ -217,4 +218,4 @@ all:
217218
haproxy_admin_password: pigsty
218219
minio_secret_key: S3User.MinIO
219220
etcd_root_password: Etcd.Root
220-
...
221+
...

content/docs/conf/yaml/vibe.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ all:
5858
node_repo_modules: node,infra,pgsql # add these repos directly to the singleton node
5959
node_packages: [ openssh-server, juicefs, restic, rclone, uv, opencode, golang, asciinema, tmux ]
6060
docker_enabled: true # enable docker service
61-
node_firewall_mode: none # change to 'zone' to enable firewall
62-
node_firewall_public_port: [22, 80, 443, 5432] # add custom public ports
61+
node_firewall_mode: zone # default: trust intranet, expose selected public ports
62+
node_firewall_public_port: [22, 80, 443, 5432] # expose 5432 for remote access, remove in production!
6363
#docker_registry_mirrors: ["https://docker.1panel.live","https://docker.1ms.run","https://docker.xuanyuan.me","https://registry-1.docker.io"]
6464

6565
#----------------------------------------------#

content/docs/node/admin.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,17 @@ After changing the password, use the following to reload config (hot reload, no
164164
Pigsty uses [`node_firewall_mode`](/docs/node/param#node_firewall_mode) to control firewall behavior.
165165
Uses **firewalld** on RHEL/Rocky and **ufw** on Debian/Ubuntu.
166166

167-
By default, this is `none` - existing firewall config is untouched and left to the user.
168-
Set to `zone` to enable the system firewall.
167+
By default, this is `zone`: Pigsty enables the system firewall consistently across distros with an "intranet trusted, public minimized" policy.
169168
In zone mode, intranet traffic is unrestricted, but external access is limited to specific ports.
169+
Set `node_firewall_mode: none` only when you want to fully self-manage firewall state and rules.
170170
This is especially important when deploying on cloud servers exposed to the internet.
171171

172172
We recommend opening only necessary ports: 22 (SSH), 80/443 (HTTP/HTTPS) are essential. Be cautious about exposing port 5432 (PostgreSQL).
173173

174174

175-
### Enable Firewall
175+
### Apply Firewall Rules
176176

177-
Set `node_firewall_mode` to `zone` to enable firewall with trusted zone config:
177+
`zone` is already the default. If you previously set `none/off`, set it back to `zone` and apply:
178178

179179
```yaml
180180
node_firewall_mode: zone # enable firewall with zone rules
@@ -288,4 +288,3 @@ sudo ufw disable
288288
```
289289
{{% /tab %}}
290290
{{< /tabpane >}}
291-

content/docs/node/param.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ The [NODE](/docs/node) module tunes target nodes into the desired state and inte
8080
| Parameter | Type | Level | Description |
8181
|:----------------------------------------------------------------|:-----------:|:-------:|:-----------------------------------------------------|
8282
| [`node_selinux_mode`](#node_selinux_mode) | `enum` | `C` | SELinux mode: disabled, permissive, enforcing |
83-
| [`node_firewall_mode`](#node_firewall_mode) | `enum` | `C` | firewall mode: none, off, zone |
83+
| [`node_firewall_mode`](#node_firewall_mode) | `enum` | `C` | firewall mode: zone (default), off, none (self-managed) |
8484
| [`node_firewall_intranet`](#node_firewall_intranet) | `cidr[]` | `C` | intranet CIDR list for firewall rules |
85-
| [`node_firewall_public_port`](#node_firewall_public_port) | `port[]` | `C` | public exposed port list, default [22, 80, 443, 5432]|
85+
| [`node_firewall_public_port`](#node_firewall_public_port) | `port[]` | `C` | public exposed port list, default [22, 80, 443] |
8686

8787
[`NODE_ADMIN`](#node_admin) section configures admin user, data directory, and shell aliases.
8888

@@ -687,7 +687,7 @@ Node security related parameters, including SELinux and firewall configuration.
687687

688688
```yaml
689689
node_selinux_mode: permissive # selinux mode: disabled, permissive, enforcing
690-
node_firewall_mode: none # firewall mode: none (skip), off (disable), zone (enable & config)
690+
node_firewall_mode: zone # firewall mode: zone (default), off (disable), none (skip & self-managed)
691691
node_firewall_intranet: # which intranet cidr considered as internal network
692692
- 10.0.0.0/8
693693
- 192.168.0.0/16
@@ -696,7 +696,6 @@ node_firewall_public_port: # expose these ports to public network in (zon
696696
- 22 # enable ssh access
697697
- 80 # enable http access
698698
- 443 # enable https access
699-
- 5432 # enable postgresql access (think twice before exposing it!)
700699
```
701700

702701

@@ -727,17 +726,17 @@ Also, SELinux mode changes may require a system reboot to fully take effect.
727726

728727
name: `node_firewall_mode`, type: `enum`, level: `C`
729728

730-
Firewall running mode. Default is `none`.
729+
Firewall running mode. Default is `zone`.
731730

732731
Options:
733732

734-
* `none`: Do nothing, maintain existing firewall rules unchanged (default)
733+
* `zone`: Enable firewall and configure rules: trust intranet, only open specified ports to public (default)
735734
* `off`: Turn off and disable firewall (equivalent to old version's `node_disable_firewall: true`)
736-
* `zone`: Enable firewall and configure rules: trust intranet, only open specified ports to public
735+
* `none`: Do not manage firewall state/rules; fully self-managed by user
737736

738-
Uses `firewalld` service on EL systems, `ufw` service on Debian/Ubuntu systems.
737+
Uses `firewalld` service on EL systems, `ufw` service on Debian/Ubuntu systems. To align behavior across distros, Pigsty now defaults to `zone`: firewall enabled by default, intranet trusted, and public access limited to [`node_firewall_public_port`](#node_firewall_public_port).
739738

740-
If you're deploying in a completely trusted intranet environment, or using cloud provider security groups for access control, you can use the default `none` mode to keep existing firewall configuration, or set to `off` to explicitly disable the firewall.
739+
If you need full manual firewall control (for example, relying only on cloud security groups or enterprise firewall policies), set `node_firewall_mode` to `none`. Use `off` only when you explicitly want to disable the system firewall.
741740

742741
Production environments with public network exposure should use `zone` mode with [`node_firewall_intranet`](#node_firewall_intranet) and [`node_firewall_public_port`](#node_firewall_public_port) for fine-grained access control. The `zone` mode will enable the firewall if not already running.
743742

@@ -769,26 +768,25 @@ Hosts within these CIDR ranges will be treated as trusted intranet hosts with mo
769768

770769
name: `node_firewall_public_port`, type: `port[]`, level: `C`
771770

772-
Public exposed port list. Default is `[22, 80, 443, 5432]`.
771+
Public exposed port list. Default is `[22, 80, 443]`.
773772

774773
This parameter defines ports exposed to public network (non-intranet CIDR). Default exposed ports include:
775774

776775
* `22`: SSH service port
777776
* `80`: HTTP service port
778777
* `443`: HTTPS service port
779-
* `5432`: PostgreSQL database port
780778

781-
You can adjust this list according to actual needs. For example, if you don't need to expose the database port externally, remove `5432`:
779+
You can adjust this list according to actual needs. For example, if you need to expose PostgreSQL to public network, explicitly add `5432`:
782780

783781
```yaml
784-
node_firewall_public_port: [22, 80, 443]
782+
node_firewall_public_port: [22, 80, 443, 5432]
785783
```
786784

787785
PostgreSQL default security policy in Pigsty only allows administrators to access the database port from public networks.
788786
If you want other users to access the database from public networks, make sure to correctly configure corresponding access permissions in PG/PGB HBA rules.
789787

790-
If you want to expose other service ports to public networks, you can also add them to this list.
791-
If you want to tighten firewall rules, you can remove the 5432 database port to ensure only truly needed service ports are exposed.
788+
If you want to expose other service ports to public networks, you can add them to this list.
789+
Always keep the minimum-exposure principle and open only ports you really need.
792790

793791
Note that this parameter only takes effect when [`node_firewall_mode`](#node_firewall_mode) is set to `zone`.
794792

content/docs/ref/port.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ Avoid exposing internal component ports directly to the public internet: `etcd`
6464

6565
```yaml
6666
node_firewall_mode: zone
67-
node_firewall_public_port: [22, 80, 443, 5432]
67+
node_firewall_public_port: [22, 80, 443]
68+
# node_firewall_public_port: [22, 80, 443, 5432] # only if public DB access is required
6869
```
69-

0 commit comments

Comments
 (0)