Firewall — filtering connections that come in first
What it is
A firewall is like the lock on a front door: you go out and come back as you like, but someone knocking from outside gets in only through a door you gave them a key to. The NanumOS firewall filters incoming connections only. What this computer starts (browsing, fetching mail, updates) and the answers to it always pass.
To do now: leave it on. Add a rule only for a door you opened on purpose (for example port 80 of a web server). See and change it in Security › Firewall.
How to use it
- Security › Firewall: on/off, the rules with how often each let something in, "Add a Rule…", the services you turned on, what was dropped. Turning it off or removing a rule asks once more.
- In the terminal one word,
fw, does the same.
| To | Command |
|---|---|
| see the state and the rules | fw (or fw status) |
| open a web server (port 80) | fw allow 80/tcp |
| several ports at once | fw allow 6000:6007/udp |
| remove a rule | fw delete 2 or fw delete allow 80/tcp |
| turn off · on | fw off · fw on |
- A change works at once (no restart). Connections already open stay; new ones follow the new rules.
- Rules are read from the top and the first that matches wins. If none matches, the connection is dropped.
- A service you turned on (remote terminal
sshd, screen sharing, file sharing, Send Nearby, From other devices (the Zeus door), the phone exchange, the messenger link, Wire, a VM port forward) is allowed while it runs.fw statuslists it under "Services turned on" with its count. To block one anyway, add adenyrule (rules come first). - A program you start yourself in the terminal (like
u httpd 8080) is reachable from outside only after you add a rule.
How it works
- For every packet that arrives on the network card the kernel first asks: is it part of something we know? A TCP connection this computer opened, the answer to a UDP datagram it sent (within 3 minutes), getting an address (DHCP) and finding neighbours (mDNS) pass as they are.
- A connection it has not seen is matched against
/etc/fw/rulesfrom the top. An allow rule lets it in; a deny rule drops it. - With no rule, it checks whether a service you turned on listens there. If not, it is dropped without a word: no reset (RST) is sent, so whoever knocked waits for an answer that never comes.
- Drops are counted per rule and per service; the log gets one summary line a minute at most (never a line per packet).
Technical details
- The rules file:
/etc/fw/rules(owned by root, 0644). It is saved data, so it stays when the OS is updated to a new version. One per line:state on|off,allow|deny [PORT[:PORT]|any][/tcp|/udp] [from A.B.C.D[/N]],#for a note. 64 at most. - Only an administrator (root or a user in
/etc/sudoers) changes it; an administrator logged in over SSH can. - With no file: on real hardware and in the Mac app it is on; inside a QEMU VM it is off (QEMU's user network is a NAT that only the ports the host opened reach, so the host decides). A host can start it on with
-fw_cfg name=opt/zeusos/fw,string=on. The server editions (server, web) write their own rules withfw initat the first boot. - The state now:
cat /proc/fw(state,source,rule N … hits H,service tcp 22 sshd hits H,dropped N tcp A udp B,last …). - IPv4 only (NanumOS's network has no IPv6 yet). An IPv6 source in a rule is refused.
- Tests:
tests/test_fw_core.py(the grammar, matching, order, the UDP answer window),tests/firewall.py(in a VM an allowed port answers and a dropped one stays silent with no RST, changes work at once, the rules survive a reboot, the throughput comparison--bench).
NanumOS 0.1.8349 · 2026-11-16