Firewall
Appearance
Firewall is currently being implemented in pmbootstrap!2042 and pmaports!2060. This wiki page explains how it will be once both MRs are merged. |
New and existing postmarketOS installations have nftables configured if the device's kernel has support for it.
Default rules
The following rules are enabled by default:
- Allow incoming SSH on USB networking and WiFi interfaces
- Allow incoming DHCP requests on USB networking interface
- Without this, USB networking requires assigning a static IP address manually on the host, so this is included for convenience.
- Deny all incoming connections on wwan (cell data network)
- The assumption is no incoming connection on this network, which is owned/managed by cell carriers, should be trusted. Users aren't able to connect to their devices on this interface over the cell network.
- Allow all outgoing connections on all interfaces
Check if it is running
Firewall service status can be viewed by querying openrc:
$ sudo rc-service nftables status
* status: started
If the status is not started
, the kernel may not have support for nftables (see #Flash Mode).
The currently loaded set of rules can be viewed with:
$ sudo nft list ruleset
table inet filter {
chain input {
type filter hook input priority filter; policy drop;
.....
Usage
(explain how to enable / disable it, explain -openusb)
Configuring the kernel to support nftables
- Run
pmbootstrap kconfig check --nftables kernel-name
to get a list of kernel config options that need to be changed - Fix them up with
pmbootstrap kconfig edit
- Add
pmb:kconfigcheck-nftables
tooptions=
in your kernel's APKBUILD - Create a test install with
pmbootstrap install
- Boot it and verify that the firewall works
- Create a merge request to pmaports.git with your changes
See also
- pmbootstrap!2042: add support for firewall
- pmaports!2060: postmarketos-firewall: add package for installing/configuring default fw
- build.postmarketos.org#100: build all main and community devices with firewall enabled